mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-08 21:54:54 +08:00
Use token.OP and use reserved words
This change breaks the tokenizer backwards compatibility a bit. Details of operators is now part of the parser and not the tokenizer anymore. The parser does this anyway, so we don't need the complexity in the tokenizer.
This commit is contained in:
@@ -127,7 +127,7 @@ class Parser(BaseParser):
|
||||
def convert_leaf(self, pgen_grammar, type, value, prefix, start_pos):
|
||||
# print('leaf', repr(value), token.tok_name[type])
|
||||
if type == NAME:
|
||||
if value in pgen_grammar.keywords:
|
||||
if value in pgen_grammar.reserved_syntax_strings:
|
||||
return tree.Keyword(value, start_pos, prefix)
|
||||
else:
|
||||
return tree.Name(value, start_pos, prefix)
|
||||
|
||||
Reference in New Issue
Block a user