import y_tab
import sys
+lex_yy.piece_append('<root><AST ref=\"0\"><AST_Section1>')
y_tab.yyparse()
while lex_yy.flexscan():
pass
+lex_yy.piece_append('</AST></root>\n')
sys.stdout.write(''.join(lex_yy.piece))
#$$ = scon_stk_ptr
if yychar == YYEMPTY:
yychar = lex_yy.flexscan()
- print('xxx yychar', yychar, 'yylval', yylval, 'yylloc', yylloc, 'lex_yy.yytext', yytext)
+ #print('xxx yychar', yychar, 'yylval', yylval, 'yylloc', yylloc, 'lex_yy.yytext', yytext)
temp = lex_yy.piece[piece2 + 1]
lex_yy.piece[piece2 + 1] = lex_yy.piece[piece2]
lex_yy.piece[piece2] = lex_yy.piece[piece2 - 1]
*/
"{"{NAME}"}"[[:space:]]? {
end_ch = yytext[-1]
- end_is_ws = end_ch != ord('}')
+ end_is_ws = end_ch != '}'
state.nmstr = yytext[1:-1 - int(end_is_ws)]
nmdef = state.ndlookup(state.nmstr)
if nmdef is None:
# GENERATE SECTION2
def yyparse():
- global yystack, yychar, yyval, yyloc, yylval, yylloc
+ global yystack, yychar, yyval, yyloc, yylval, yylloc, piece2, piece3
# GENERATE INITIALACTION
yylval = None
yylloc = None
yychar = lex_yy.flexscan()
- print('yychar', yychar, 'yylval', yylval, 'yylloc', yylloc, 'lex_yy.yytext', lex_yy.yytext)
+ #print('yychar', yychar, 'yylval', yylval, 'yylloc', yylloc, 'lex_yy.yytext', lex_yy.yytext)
action = yy_lr1dfa_states[state][1][
bisect.bisect_right(yy_lr1dfa_states[state][0], yychar)
]
piece2 = n + 1
piece3 = n + len_symbols * 2
if len_symbols == 0:
- lex_yy.piece[base:base] = ['', '']
+ lex_yy.piece[n:n] = ['', '']
piece3 = n + 2
lex_yy.piece0 += 2
ref_data()
+import sys
+
# miscellaneous state accessed by scan.l and parse.y
in_rule = False
infilename = '<stdin>'
def synerr(str):
sys.stderr.write(
- '{0:s}:{1:d}: {1:s}\n'.format(infilename, linenum, str)
+ '{0:s}:{1:d}: {2:s}\n'.format(infilename, linenum, str)
)
esc = {
'v': ord('\v')
}
def myesc(str):
- print('myesc @@@{0:s}@@@'.format(str))
assert str[0] == '\\'
result = esc.get(str[1])
if result is None: