mirror of
https://github.com/davidhalter/parso.git
synced 2026-05-19 15:00:08 +08:00
A small improvement in checks
This commit is contained in:
@@ -59,10 +59,6 @@ def group(*choices, **kwargs):
|
|||||||
return start + '|'.join(choices) + ')'
|
return start + '|'.join(choices) + ')'
|
||||||
|
|
||||||
|
|
||||||
def any(*choices):
|
|
||||||
return group(*choices) + '*'
|
|
||||||
|
|
||||||
|
|
||||||
def maybe(*choices):
|
def maybe(*choices):
|
||||||
return group(*choices) + '?'
|
return group(*choices) + '?'
|
||||||
|
|
||||||
@@ -357,9 +353,7 @@ def tokenize_lines(lines, version_info, start_pos=(1, 0)):
|
|||||||
contstr = line[start:]
|
contstr = line[start:]
|
||||||
contline = line
|
contline = line
|
||||||
break
|
break
|
||||||
elif initial in single_quoted or \
|
elif any(token.startswith(s) for s in single_quoted):
|
||||||
token[:2] in single_quoted or \
|
|
||||||
token[:3] in single_quoted:
|
|
||||||
if token[-1] == '\n': # continued string
|
if token[-1] == '\n': # continued string
|
||||||
contstr_start = lnum, start
|
contstr_start = lnum, start
|
||||||
endprog = (endpats.get(initial) or endpats.get(token[1])
|
endprog = (endpats.get(initial) or endpats.get(token[1])
|
||||||
|
|||||||
Reference in New Issue
Block a user