Actually pass the tests again with removed remove_last_newline.

This commit is contained in:
Dave Halter
2017-06-01 18:26:40 +02:00
parent 814b16cc6c
commit b1b165c21e
6 changed files with 59 additions and 15 deletions

View File

@@ -133,7 +133,13 @@ class Parser(BaseParser):
symbol = pgen_grammar.number2symbol[type_]
yield symbol, nodes
if typ == ENDMARKER:
tos_nodes = stack.get_tos_nodes()
if tos_nodes:
last_leaf = tos_nodes[-1].get_last_leaf()
else:
last_leaf = None
if typ == ENDMARKER or typ == DEDENT and '\n' not in last_leaf.value:
def reduce_stack(states, newstate):
# reduce
state = newstate