mirror of
https://github.com/davidhalter/parso.git
synced 2026-01-21 10:32:25 +08:00
Some last fstring fixes.
This commit is contained in:
@@ -176,7 +176,7 @@ class Grammar(object):
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
labels = self._pgen_grammar.symbol2number.values()
|
||||
labels = self._pgen_grammar.number2symbol.values()
|
||||
txt = ' '.join(list(labels)[:3]) + ' ...'
|
||||
return '<%s:%s>' % (self.__class__.__name__, txt)
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ class DiffParser(object):
|
||||
is_first_token = True
|
||||
omitted_first_indent = False
|
||||
indents = []
|
||||
tokens = self._tokenizer(lines)
|
||||
tokens = self._tokenizer(lines, (1, 0))
|
||||
stack = self._active_parser.pgen_parser.stack
|
||||
for typ, string, start_pos, prefix in tokens:
|
||||
start_pos = start_pos[0] + line_offset, start_pos[1]
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE
|
||||
file_input: (NEWLINE | stmt)* 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
|
||||
decorators: decorator+
|
||||
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
|
||||
for line in lines: # loop over lines in stream
|
||||
lnum += 1
|
||||
pos, max = 0, len(line)
|
||||
pos = 0
|
||||
max = len(line)
|
||||
if first:
|
||||
if line.startswith(BOM_UTF8_STRING):
|
||||
additional_prefix = BOM_UTF8_STRING
|
||||
line = line[1:]
|
||||
max = len(line)
|
||||
|
||||
# Fake that the part before was already parsed.
|
||||
line = '^' * start_pos[1] + line
|
||||
|
||||
Reference in New Issue
Block a user