1
0
forked from VimPlug/jedi

Trying to move the indent/dedent logic back into the tokenizer.

This commit is contained in:
Dave Halter
2014-11-28 02:04:04 +01:00
parent 97516eb26b
commit e1d6511f2f
4 changed files with 14 additions and 18 deletions
+2 -2
View File
@@ -208,13 +208,13 @@ class Parser(object):
"""
# For now just discard everything that is not a suite or
# file_input, if we detect an error.
for i, (dfa, state, (_type, _)) in reversed(list(enumerate(stack))):
for index, (dfa, state, (_type, _)) in reversed(list(enumerate(stack))):
# `suite` can sometimes be only simple_stmt, not stmt.
symbol = grammar.number2symbol[_type]
if symbol in ('file_input', 'suite'):
index = i
break
# No success finding a transition
print('err', tokenize.tok_name[typ], repr(value), start_pos, len(stack), index)
self._stack_removal(grammar, stack, index + 1, value, start_pos)
def _stack_removal(self, grammar, stack, start_index, value, start_pos):