We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d12a372 commit b58765dCopy full SHA for b58765d
sly/lex.py
@@ -36,6 +36,10 @@
36
import re
37
import copy
38
39
+
40
+_strings_pattern_re = re.compile('(?P<QUOTE_STRING>(\'(?:\\\\.|[^\'])*(?:\'\'(?:\\\\.|[^\'])*)*\'))|(?P<DQUOTE_STRING>("(?:\\\\.|[^"])*"))')
41
42
43
class LexError(Exception):
44
'''
45
Exception raised if an invalid character is encountered and no default
@@ -406,7 +410,11 @@ def _reject():
406
410
tok = Token()
407
411
tok.lineno = lineno
408
412
tok.index = index
409
- m = _master_re.match(text, index)
413
414
+ m = _master_re.match(text, index, index + 50)
415
+ if m is None:
416
+ m = _strings_pattern_re.match(text, index)
417
418
if m:
419
tok.end = index = m.end()
420
tok.value = m.group()
0 commit comments