Commit 4a1d681 1 parent cba703b commit 4a1d681 Copy full SHA for 4a1d681
File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -142,14 +142,19 @@ function _all_string_prefixes() {
142
142
// StringPrefix can be the empty string (making it optional).
143
143
var StringPrefix = group . apply ( null , _all_string_prefixes ( ) )
144
144
145
+ // these regexes differ from python because .exec doesn't do the
146
+ // same thing as .match in python. It's more like .search.
147
+ // .match matches from the start of the string.
148
+ // to get the same behaviour we can add a ^ to the start of the
149
+ // regex
145
150
// Tail end of ' string.
146
- var Single = "[^'\\\\]*(?:\\\\.[^'\\\\]*)*'" ;
151
+ var Single = "^ [^'\\\\]*(?:\\\\.[^'\\\\]*)*'" ;
147
152
// Tail end of " string.
148
- var Double = '[^"\\\\]*(?:\\\\.[^"\\\\]*)*"' ;
153
+ var Double = '^ [^"\\\\]*(?:\\\\.[^"\\\\]*)*"' ;
149
154
// Tail end of ''' string.
150
- var Single3 = "[^'\\\\]*(?:(?:\\\\.|'(?!''))[^'\\\\]*)*'''" ;
155
+ var Single3 = "^ [^'\\\\]*(?:(?:\\\\.|'(?!''))[^'\\\\]*)*'''" ;
151
156
// Tail end of """ string.
152
- var Double3 = '[^"\\\\]*(?:(?:\\\\.|"(?!""))[^"\\\\]*)*"""' ;
157
+ var Double3 = '^ [^"\\\\]*(?:(?:\\\\.|"(?!""))[^"\\\\]*)*"""' ;
153
158
var Triple = group ( StringPrefix + "'''" , StringPrefix + '"""' ) ;
154
159
// Single-line ' or " string.
155
160
var String_ = group ( StringPrefix + "'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*'" ,
You can’t perform that action at this time.
0 commit comments