forked from VimPlug/jedi
Adding a token in pgen should have the same signature that the tokenizer uses.
This commit is contained in:
@@ -336,7 +336,7 @@ class ParserWithRecovery(Parser):
|
|||||||
|
|
||||||
# print('err', token.tok_name[typ], repr(value), start_pos, len(stack), index)
|
# print('err', token.tok_name[typ], repr(value), start_pos, len(stack), index)
|
||||||
if self._stack_removal(grammar, stack, arcs, index + 1, value, start_pos):
|
if self._stack_removal(grammar, stack, arcs, index + 1, value, start_pos):
|
||||||
add_token_callback(typ, value, prefix, start_pos)
|
add_token_callback(typ, value, start_pos, prefix)
|
||||||
else:
|
else:
|
||||||
if typ == INDENT:
|
if typ == INDENT:
|
||||||
# For every deleted INDENT we have to delete a DEDENT as well.
|
# For every deleted INDENT we have to delete a DEDENT as well.
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class PgenParser(object):
|
|||||||
|
|
||||||
def parse(self, tokenizer):
|
def parse(self, tokenizer):
|
||||||
for type_, value, start_pos, prefix in tokenizer:
|
for type_, value, start_pos, prefix in tokenizer:
|
||||||
if self.addtoken(type_, value, prefix, start_pos):
|
if self.addtoken(type_, value, start_pos, prefix):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# We never broke out -- EOF is too soon -- Unfinished statement.
|
# We never broke out -- EOF is too soon -- Unfinished statement.
|
||||||
@@ -130,7 +130,7 @@ class PgenParser(object):
|
|||||||
raise InternalParseError("incomplete input", type_, value, start_pos)
|
raise InternalParseError("incomplete input", type_, value, start_pos)
|
||||||
return self.rootnode
|
return self.rootnode
|
||||||
|
|
||||||
def addtoken(self, type_, value, prefix, start_pos):
|
def addtoken(self, type_, value, start_pos, prefix):
|
||||||
"""Add a token; return True if this is the end of the program."""
|
"""Add a token; return True if this is the end of the program."""
|
||||||
ilabel = token_to_ilabel(self.grammar, type_, value)
|
ilabel = token_to_ilabel(self.grammar, type_, value)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user