Use strings as a non-terminal symbol in all grammars

This makes it easier to write the same logic for all Python versions
This commit is contained in:
Dave Halter
2018-04-05 09:55:19 +02:00
parent 7c7f4f4e54
commit a3e280c2b9
7 changed files with 22 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
from parso.python import tree
from parso.python.token import (DEDENT, INDENT, ENDMARKER, NEWLINE, NUMBER,
STRING, tok_name, NAME)
STRING, tok_name, NAME, FSTRING_STRING)
from parso.parser import BaseParser
from parso.pgen2.parse import token_to_ilabel
@@ -129,6 +129,8 @@ class Parser(BaseParser):
return tree.Newline(value, start_pos, prefix)
elif type == ENDMARKER:
return tree.EndMarker(value, start_pos, prefix)
elif type == FSTRING_STRING:
return tree.FStringString(value, start_pos, prefix)
else:
return tree.Operator(value, start_pos, prefix)