then
mkdir out
../../bootstrap_flex.git/src/flex -o /dev/null ../tests/cal.l 2>out/cal.l.xml.ok
+ ../../bootstrap_flex.git/src/flex -o /dev/null ../tests_ast/cal_py.l 2>out/cal_py.l.xml.ok
../../bootstrap_flex.git/src/flex -o /dev/null ../../bootstrap_flex.git/src/scan.l 2>out/scan.l.xml.ok
../../bootstrap_flex.git/src/flex ../../bootstrap_bison.git/src/scan-code.l 2>out/scan-code.l.xml.ok
rm lex.yy.c
fi
./markup.py <../tests/cal.l >out/cal.l.xml
diff -q out/cal.l.xml.ok out/cal.l.xml
+./markup.py <../tests_ast/cal_py.l >out/cal_py.l.xml
+diff -q out/cal_py.l.xml.ok out/cal_py.l.xml
./markup.py <../../bootstrap_flex.git/src/scan.l >out/scan.l.xml
diff -q out/scan.l.xml.ok out/scan.l.xml
./markup.py <../../bootstrap_bison.git/src/scan-code.l >out/scan-code.l.xml
<CODEBLOCK,ACTION>{
"reject" {
#add_action(yytext)
- if all_upper(yytext):
+ if yytext.isupper():
reject = True
}
"yymore" {
#add_action(yytext)
- if all_lower(yytext):
+ if yytext.islower():
yymore_used = True
}
}
then
mkdir out
bootstrap/markup.py <tests/cal.l |./reserialize.py >out/cal.l.xml.ok
+ bootstrap/markup.py <tests_ast/cal_py.l |./reserialize.py >out/cal_py.l.xml.ok
bootstrap/markup.py <../bootstrap_flex.git/src/scan.l |./reserialize.py >out/scan.l.xml.ok
bootstrap/markup.py <../bootstrap_bison.git/src/scan-code.l |./reserialize.py >out/scan-code.l.xml.ok
bootstrap/markup.py <../bootstrap_bison.git/src/scan-gram.l |./reserialize.py >out/scan-gram.l.xml.ok
fi
./markup.py <tests/cal.l >out/cal.l.xml
diff -q out/cal.l.xml.ok out/cal.l.xml
+./markup.py <tests_ast/cal_py.l >out/cal_py.l.xml
+diff -q out/cal_py.l.xml.ok out/cal_py.l.xml
./markup.py <../bootstrap_flex.git/src/scan.l >out/scan.l.xml
diff -q out/scan.l.xml.ok out/scan.l.xml
./markup.py <../bootstrap_bison.git/src/scan-code.l >out/scan-code.l.xml
in_file = args[0]
with open(in_file) as fin:
- _ast = element.deserialize(fin, ast.factory)
+ if in_file[-4:] == '.xml':
+ _ast = element.deserialize(fin, ast.factory)
+ else:
+ import lex_yy
+ import state
+ import y_tab
+ state.infilename = in_file
+ lex_yy.yyin = fin
+ _ast = y_tab.yyparse(ast.AST)
#element.serialize(_ast, 'a.xml', 'utf-8')
#_ast = element.deserialize('a.xml', ast.factory, 'utf-8')
_ast.post_process()
BEGIN(SECT2)
yy_push_state(ELEMENT_GROUP)
bracelevel = 1
+ markup_flush(len(yytext))
markup_push() # RegexGroupElement.Text
}
":" {
<CODEBLOCK,ACTION>{
"reject" {
#add_action(yytext)
- if all_upper(yytext):
+ if yytext.isupper():
reject = True
}
"yymore" {
#add_action(yytext)
- if all_lower(yytext):
+ if yytext.islower():
yymore_used = True
}
}