(False, [], True, 0, last_action)
)
)
- assert isinstance(self[0], AST.Text) # temporary
for i in self[0]:
if isinstance(i, AST.Text.StackLocation):
i.offset = -len(symbols)
symbols,
tag_names
):
+ for i in self[0]:
+ if isinstance(i, AST.Text.StackLocation):
+ i.offset = -production.n_symbols
+ elif isinstance(i, AST.Text.StackReference):
+ if (
+ len(i.tag_name) == 0 and
+ i.index >= 1 and
+ i.index <= len(tag_names)
+ ):
+ i.tag_name = tag_names[i.index - 1]
+ i.offset = -production.n_symbols
for i in self[1:]:
last_action = i.add_to_symbols(
_ast,
then
mkdir out
../../bootstrap_bison.git/src/bison -o /dev/null ../tests/cal.y 2>out/cal.y.xml.ok
+ ../../bootstrap_bison.git/src/bison -o /dev/null ../tests_ast/cal_py.y 2>out/cal_py.y.xml.ok
../../bootstrap_bison.git/src/bison -o /dev/null ../../bootstrap_flex.git/src/parse.y 2>out/parse.y.xml.ok
../../bootstrap_bison.git/src/bison ../../bootstrap_bison.git/src/parse-gram.y 2>out/parse-gram.y.xml.ok
rm parse-gram.output parse-gram.tab.c parse-gram.tab.h
fi
./markup.py <../tests/cal.y >out/cal.y.xml
diff --unified out/cal.y.xml.ok out/cal.y.xml
+./markup.py <../tests_ast/cal_py.y >out/cal_py.y.xml
+diff --unified out/cal_py.y.xml.ok out/cal_py.y.xml
./markup.py <../../bootstrap_flex.git/src/parse.y >out/parse.y.xml
diff --unified out/parse.y.xml.ok out/parse.y.xml
./markup.py <../../bootstrap_bison.git/src/parse-gram.y >out/parse-gram.y.xml
#current_type = None
gram_piece2 = 0
gram_piece3 = 0
- nested_rhs = 0
+ #nested_rhs = 0
}
/* Nick %define api.prefix {gram_} */
}
| rhs "{...}" named_ref.opt
{
- lex_yy_code.trap = True
lex_yy_code.code_piece_append('<AST_Text>')
#grammar_current_rule_action_append($2, @2, $3, False)
lex_yy_code.yyin = None
insert_before(1, '<AST_Production_Merge>')
}
/* Nick extra rules for element groups */
-| rhs '('
- {
+ | rhs '('
+ /*{
#nested_rhs += 1
- }
+ }*/
rhs ')'
{
+ lex_yy_code.code_piece_append('(?E{<AST_Text>')
+ lex_yy_code.yyin = None
+ lex_yy_code.yy_buffer_stack = [lex_yy_code.YYBufferState()]
+ lex_yy_code.yytext = '' # fool unput()
+ lex_yy_code.unput($2[4:-1])
+ lex_yy_code.sc_context = lex_yy_code.SC_RULE_ACTION # CODE_PROPS_RULE_ACTION
+ lex_yy_code.yylex()
+ lex_yy_code.code_piece_append('</AST_Text>}')
+ lex_yy_code.code_piece_pack()
+ lex_yy.gram_piece[gram_piece2 + 2] = lex_yy_code.code_piece[lex_yy_code.code_piece0 - 1]
insert_after(3, '</AST_Production_GroupElement>')
insert_before(1, '<AST_Production_GroupElement>')
}
/* Nick added %space */
-| rhs "%space"
+ | rhs "%space"
{
insert_after(1, '</AST_Production_Space>')
insert_before(1, '<AST_Production_Space>')
{2:s}{3:s}{4:s}{5:s}'''.format(
i,
(
- 'yytoken, yylval, yylloc, '
+ 'yychar, yylval, yylloc, '
if actions[i][0] else # take_space_right
''
),
(
- ''' if yytoken == -1:
+ ''' if yychar == -1:
yylval = None
yylloc = None
- yytoken = yylex()
+ yychar = lex_yy.yylex()
yy_element_stack.append(lex_yy.yy_element_space)
lex_yy.yy_element_space = element.Element('root')
'''