mirror of
https://github.com/davidhalter/parso.git
synced 2026-05-19 15:00:08 +08:00
Some last fstring fixes.
This commit is contained in:
+1
-1
@@ -176,7 +176,7 @@ class Grammar(object):
|
|||||||
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
labels = self._pgen_grammar.symbol2number.values()
|
labels = self._pgen_grammar.number2symbol.values()
|
||||||
txt = ' '.join(list(labels)[:3]) + ' ...'
|
txt = ' '.join(list(labels)[:3]) + ' ...'
|
||||||
return '<%s:%s>' % (self.__class__.__name__, txt)
|
return '<%s:%s>' % (self.__class__.__name__, txt)
|
||||||
|
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ class DiffParser(object):
|
|||||||
is_first_token = True
|
is_first_token = True
|
||||||
omitted_first_indent = False
|
omitted_first_indent = False
|
||||||
indents = []
|
indents = []
|
||||||
tokens = self._tokenizer(lines)
|
tokens = self._tokenizer(lines, (1, 0))
|
||||||
stack = self._active_parser.pgen_parser.stack
|
stack = self._active_parser.pgen_parser.stack
|
||||||
for typ, string, start_pos, prefix in tokens:
|
for typ, string, start_pos, prefix in tokens:
|
||||||
start_pos = start_pos[0] + line_offset, start_pos[1]
|
start_pos = start_pos[0] + line_offset, start_pos[1]
|
||||||
|
|||||||
@@ -11,9 +11,6 @@
|
|||||||
single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE
|
single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE
|
||||||
file_input: (NEWLINE | stmt)* ENDMARKER
|
file_input: (NEWLINE | stmt)* ENDMARKER
|
||||||
eval_input: testlist NEWLINE* ENDMARKER
|
eval_input: testlist NEWLINE* ENDMARKER
|
||||||
# Dave: A modification to parse f-strings.
|
|
||||||
testlist_comp_with_endmarker: testlist NEWLINE* ENDMARKER
|
|
||||||
|
|
||||||
decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE
|
decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE
|
||||||
decorators: decorator+
|
decorators: decorator+
|
||||||
decorated: decorators (classdef | funcdef | async_funcdef)
|
decorated: decorators (classdef | funcdef | async_funcdef)
|
||||||
|
|||||||
@@ -255,11 +255,13 @@ def tokenize_lines(lines, version_info, start_pos=(1, 0)):
|
|||||||
lnum = start_pos[0] - 1
|
lnum = start_pos[0] - 1
|
||||||
for line in lines: # loop over lines in stream
|
for line in lines: # loop over lines in stream
|
||||||
lnum += 1
|
lnum += 1
|
||||||
pos, max = 0, len(line)
|
pos = 0
|
||||||
|
max = len(line)
|
||||||
if first:
|
if first:
|
||||||
if line.startswith(BOM_UTF8_STRING):
|
if line.startswith(BOM_UTF8_STRING):
|
||||||
additional_prefix = BOM_UTF8_STRING
|
additional_prefix = BOM_UTF8_STRING
|
||||||
line = line[1:]
|
line = line[1:]
|
||||||
|
max = len(line)
|
||||||
|
|
||||||
# Fake that the part before was already parsed.
|
# Fake that the part before was already parsed.
|
||||||
line = '^' * start_pos[1] + line
|
line = '^' * start_pos[1] + line
|
||||||
|
|||||||
Reference in New Issue
Block a user