# if strverscmp(version, '3.0.5') > 0:
# complain(loc, complaint, 'require bison %s, but have %s', version, '3.0.5')
# exit(63)
-#
-#def gram_error(loc, msg):
-# complain(loc, complaint, '%s', msg)
-#
+
+# was gram_error(), due to use of %define api.prefix
+def yyerror(loc, msg):
+ state.complain(loc, state.complaint, msg)
+
#def token_name(type):
# return yytname[YYTRANSLATE(type)]
#
bisect.bisect_right(yy_lr1dfa_states[state][0], yychar)
]
if action == -1:
- raise Exception('syntax error')
+ yyerror(yylloc, 'syntax error')
+ assert False # error recovery is not implemented yet
if (action & 1) == 0:
yystack.append((action >> 1, yylval, yylloc.copy()))
#print('shift', yystack[-1][0])
bisect.bisect_right(yy_lr1dfa_states[state][0], yychar)
]
if action == -1:
- raise Exception('syntax error')
+ yyerror(yylloc, 'syntax error')
+ assert False # error recovery is not implemented yet
if (action & 1) == 0:
# push space then AST element contiguously onto yy_element_stack
# even numbered elements are spaces, odd numbered elements are AST
bisect.bisect_right(yy_lr1dfa_states[state][0], yychar)
]
if action == -1:
- raise Exception('syntax error')
+ yyerror(yylloc, 'syntax error')
+ assert False # error recovery is not implemented yet
if (action & 1) == 0:
yystack.append((state, yylval, yylloc.copy()))