str(pos1) if pos1 else '',
ast_text_to_python(factory_text, ' ')
)
- for pos0, pos1, factory_text in actions[i][1]
+ for pos0, pos1, factory_text in actions[i][1] # groups
]
),
(
''
)
)
- if actions[i][2] else # take_space_left
+ # note that null productions always have take_space_left ==
+ # True, so that the action generates a dummy space and then
+ # the skeleton generates a dummy AST, ignore if not element
+ if _element and actions[i][2] else # take_space_left
''
),
(
# GENERATE TOKENS
yystack = None
-yytoken = None
+yychar = None
+YYEMPTY = -1
yyval = None
yyloc = None
# GENERATE SECTION2
def yyparse():
- global yystack, yytoken, yyval, yyloc, yylval, yylloc
+ global yystack, yychar, yyval, yyloc, yylval, yylloc
# GENERATE INITIALACTION
state = 0
yystack = []
yylval = None
- yytoken = -1
+ yychar = -1
while True:
#print('state', state, 'yystack', yystack)
reduce = yy_lr1dfa_states[state][4]
if reduce == -1:
- if yytoken == -1:
+ if yychar == -1:
yylval = None
yylloc = None
- yytoken = yylex()
- #print('yytoken', yytoken, 'yylval', yylval, 'yylloc', yylloc)
+ yychar = yylex()
+ print('yychar', yychar, 'yylval', yylval, 'yylloc', yylloc)
action = yy_lr1dfa_states[state][1][
- bisect.bisect_right(yy_lr1dfa_states[state][0], yytoken)
+ bisect.bisect_right(yy_lr1dfa_states[state][0], yychar)
]
if action == -1:
raise Exception('syntax error')
yystack.append((state, yylval, yylloc))
state = action >> 1
#print('shift', state)
- yytoken = -1
+ yychar = -1
continue
reduce = action >> 1
#print('reduce', reduce)
# GENERATE TOKENS
yystack = None
-yytoken = None
+yychar = None
+YYEMPTY = -1
yyval = None
yyloc = None
# GENERATE SECTION2
def yyparse(factory, *args, **kwargs):
- global yystack, yytoken, yyval, yyloc, yylval, yylloc, yy_element_stack
+ global yystack, yychar, yyval, yyloc, yylval, yylloc, yy_element_stack
# GENERATE INITIALACTION
state = 0
yystack = []
yylval = None
- yytoken = -1
+ yychar = -1
yy_element_stack = []
while True:
#print('state', state, 'yystack', yystack)
assert len(yy_element_stack) == len(yystack) * 2
reduce = yy_lr1dfa_states[state][4]
if reduce == -1:
- if yytoken == -1:
+ if yychar == -1:
yylval = None
yylloc = None
- yytoken = lex_yy.yylex()
- #print('yytoken', yytoken, 'yylval', yylval, 'yylloc', yylloc)
+ yychar = lex_yy.yylex()
+ #print('yychar', yychar, 'yylval', yylval, 'yylloc', yylloc)
#print('lex_yy.yy_element_space')
#xml.etree.ElementTree.dump(lex_yy.yy_element_space)
#print('lex_yy.yy_element_token')
#xml.etree.ElementTree.dump(lex_yy.yy_element_token)
action = yy_lr1dfa_states[state][1][
- bisect.bisect_right(yy_lr1dfa_states[state][0], yytoken)
+ bisect.bisect_right(yy_lr1dfa_states[state][0], yychar)
]
if action == -1:
raise Exception('syntax error')
state = action >> 1
#print('shift', state)
- yytoken = -1
+ yychar = -1
continue
reduce = action >> 1
#print('reduce', reduce)