mirror of
https://github.com/davidhalter/parso.git
synced 2026-02-20 00:28:52 +08:00
Some minor changes
This commit is contained in:
@@ -56,6 +56,8 @@ class Stack(list):
|
|||||||
|
|
||||||
def token_to_ilabel(grammar, type_, value):
|
def token_to_ilabel(grammar, type_, value):
|
||||||
# Map from token to label
|
# Map from token to label
|
||||||
|
# TODO this is not good, shouldn't use tokenize.NAME, but somehow use the
|
||||||
|
# grammar.
|
||||||
if type_ == tokenize.NAME:
|
if type_ == tokenize.NAME:
|
||||||
# Check for reserved words (keywords)
|
# Check for reserved words (keywords)
|
||||||
try:
|
try:
|
||||||
@@ -186,8 +188,8 @@ class PgenParser(object):
|
|||||||
elif t >= 256:
|
elif t >= 256:
|
||||||
# See if it's a nonterminal and if we're in its first set
|
# See if it's a nonterminal and if we're in its first set
|
||||||
itsdfa = _gram.dfas[t]
|
itsdfa = _gram.dfas[t]
|
||||||
itsstates, itsfirst = itsdfa
|
itsstates, first_terminals = itsdfa
|
||||||
if ilabel in itsfirst:
|
if ilabel in first_terminals:
|
||||||
# Push a nonterminal
|
# Push a nonterminal
|
||||||
_push(t, itsdfa, newstate)
|
_push(t, itsdfa, newstate)
|
||||||
break # To continue the outer while loop
|
break # To continue the outer while loop
|
||||||
|
|||||||
Reference in New Issue
Block a user