Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd3197be

Browse files
committed
fix for#163 (SQL scanner), declare 1.1.1
1 parente93aae8 commitd3197be

File tree

3 files changed

+21
-25
lines changed

3 files changed

+21
-25
lines changed

‎Changes.textile‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ h1=. CodeRay Version History
22

33
p=. _This files lists all changes in the CodeRay library since the 0.9.8 release._
44

5+
h2. Changes in 1.1.1
6+
7+
* SQL scanner: fix open strings [#163, thanks to Adam]
8+
59
h2. Changes in 1.1
610

711
New scanners:

‎lib/coderay/scanners/sql.rb‎

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ class SQL < Scanner
5757

5858
STRING_PREFIXES=/[xnb]|_\w+/i
5959

60+
STRING_CONTENT_PATTERN={
61+
'"'=>/ (?: [^\\"] | "" )+ /x,
62+
"'"=>/ (?: [^\\'] | '' )+ /x,
63+
'`'=>/ (?: [^\\`] | `` )+ /x,
64+
}
65+
6066
defscan_tokensencoder,options
6167

6268
state=:initial
@@ -115,40 +121,26 @@ def scan_tokens encoder, options
115121
end
116122

117123
elsifstate ==:string
118-
ifmatch=scan(/[^\\"'`]+/)
119-
string_content <<match
120-
next
124+
ifmatch=scan(STRING_CONTENT_PATTERN[string_type])
125+
encoder.text_tokenmatch,:content
121126
elsifmatch=scan(/["'`]/)
122127
ifstring_type ==match
123128
ifpeek(1) ==string_type# doubling means escape
124-
string_content <<string_type <<getch
125-
next
126-
end
127-
unlessstring_content.empty?
128-
encoder.text_tokenstring_content,:content
129-
string_content=''
129+
encoder.text_tokenmatch +getch,:content
130+
else
131+
encoder.text_tokenmatch,:delimiter
132+
encoder.end_group:string
133+
state=:initial
134+
string_type=nil
130135
end
131-
encoder.text_tokenmatch,:delimiter
132-
encoder.end_group:string
133-
state=:initial
134-
string_type=nil
135136
else
136-
string_content <<match
137+
encoder.text_tokenmatch,:content
137138
end
138139
elsifmatch=scan(/\\ (?:#{ESCAPE} |#{UNICODE_ESCAPE} ) /mox)
139-
unlessstring_content.empty?
140-
encoder.text_tokenstring_content,:content
141-
string_content=''
142-
end
143140
encoder.text_tokenmatch,:char
144141
elsifmatch=scan(/\\ . /mox)
145-
string_content <<match
146-
next
142+
encoder.text_tokenmatch,:content
147143
elsifmatch=scan(/\\ | $ /x)
148-
unlessstring_content.empty?
149-
encoder.text_tokenstring_content,:content
150-
string_content=''
151-
end
152144
encoder.text_tokenmatch,:errorunlessmatch.empty?
153145
encoder.end_group:string
154146
state=:initial

‎lib/coderay/version.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
moduleCodeRay
2-
VERSION='1.1.0'
2+
VERSION='1.1.1'
33
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp