root = xml.etree.ElementTree.parse(sys.stdin).getroot()
def replace_in_action(i):
- if i.tag == 'PLex_Section2_Rule_Action' and len(i):
- assert i[0].tag == 'PLex_Text'
+ if i.tag == 'AST_Section2_Rule_Action' and len(i):
+ assert i[0].tag == 'AST_Text'
text = element.get_text(i[0], 0)
# see tests/parse.y
- text = text.replace('CHAR', 'y_tab.LR1.CHAR')
- text = text.replace('NUMBER', 'y_tab.LR1.NUMBER')
- text = text.replace('SECTEND', 'y_tab.LR1.SECTEND')
- text = text.replace('SCDECL', 'y_tab.LR1.SCDECL')
- text = text.replace('Xy_tab.LR1.SCDECL', 'y_tab.LR1.XSCDECL')
- text = text.replace('NAME', 'y_tab.LR1.NAME')
- text = text.replace('PREVCCL', 'y_tab.LR1.PREVCCL')
- text = text.replace('EOF_OP', 'y_tab.LR1.EOF_OP')
- text = text.replace('TOK_OPTION', 'y_tab.LR1.TOK_OPTION')
- text = text.replace('TOK_OUTFILE', 'y_tab.LR1.TOK_OUTFILE')
- text = text.replace('TOK_PREFIX', 'y_tab.LR1.TOK_PREFIX')
- text = text.replace('TOK_YYCLASS', 'y_tab.LR1.TOK_YYCLASS')
- text = text.replace('TOK_HEADER_FILE', 'y_tab.LR1.TOK_HEADER_FILE')
- text = text.replace('TOK_EXTRA_TYPE', 'y_tab.LR1.TOK_EXTRA_TYPE')
- text = text.replace('TOK_TABLES_FILE', 'y_tab.LR1.TOK_TABLES_FILE')
-
- text = text.replace('CCE_ALNUM', 'y_tab.LR1.CCE_ALNUM')
- text = text.replace('CCE_ALPHA', 'y_tab.LR1.CCE_ALPHA')
- text = text.replace('CCE_BLANK', 'y_tab.LR1.CCE_BLANK')
- text = text.replace('CCE_CNTRL', 'y_tab.LR1.CCE_CNTRL')
- text = text.replace('CCE_DIGIT', 'y_tab.LR1.CCE_DIGIT')
- text = text.replace('CCE_GRAPH', 'y_tab.LR1.CCE_GRAPH')
- text = text.replace('CCE_LOWER', 'y_tab.LR1.CCE_LOWER')
- text = text.replace('CCE_PRINT', 'y_tab.LR1.CCE_PRINT')
- text = text.replace('CCE_PUNCT', 'y_tab.LR1.CCE_PUNCT')
- text = text.replace('CCE_SPACE', 'y_tab.LR1.CCE_SPACE')
- text = text.replace('CCE_UPPER', 'y_tab.LR1.CCE_UPPER')
- text = text.replace('CCE_XDIGIT', 'y_tab.LR1.CCE_XDIGIT')
-
- text = text.replace('CCE_NEG_ALNUM', 'y_tab.LR1.CCE_NEG_ALNUM')
- text = text.replace('CCE_NEG_ALPHA', 'y_tab.LR1.CCE_NEG_ALPHA')
- text = text.replace('CCE_NEG_BLANK', 'y_tab.LR1.CCE_NEG_BLANK')
- text = text.replace('CCE_NEG_CNTRL', 'y_tab.LR1.CCE_NEG_CNTRL')
- text = text.replace('CCE_NEG_DIGIT', 'y_tab.LR1.CCE_NEG_DIGIT')
- text = text.replace('CCE_NEG_GRAPH', 'y_tab.LR1.CCE_NEG_GRAPH')
- text = text.replace('CCE_NEG_LOWER', 'y_tab.LR1.CCE_NEG_LOWER')
- text = text.replace('CCE_NEG_PRINT', 'y_tab.LR1.CCE_NEG_PRINT')
- text = text.replace('CCE_NEG_PUNCT', 'y_tab.LR1.CCE_NEG_PUNCT')
- text = text.replace('CCE_NEG_SPACE', 'y_tab.LR1.CCE_NEG_SPACE')
- text = text.replace('CCE_NEG_UPPER', 'y_tab.LR1.CCE_NEG_UPPER')
- text = text.replace('CCE_NEG_XDIGIT', 'y_tab.LR1.CCE_NEG_XDIGIT')
-
- text = text.replace('CCL_OP_DIFF', 'y_tab.LR1.CCL_OP_DIFF')
- text = text.replace('CCL_OP_UNION', 'y_tab.LR1.CCL_OP_UNION')
-
- text = text.replace('BEGIN_REPEAT_POSIX', 'y_tab.LR1.BEGIN_REPEAT_POSIX')
- text = text.replace('END_REPEAT_POSIX', 'y_tab.LR1.END_REPEAT_POSIX')
- text = text.replace('BEGIN_REPEAT_FLEX', 'y_tab.LR1.BEGIN_REPEAT_FLEX')
- text = text.replace('END_REPEAT_FLEX', 'y_tab.LR1.END_REPEAT_FLEX')
+ text = text.replace('CHAR', 'y_tab.CHAR')
+ text = text.replace('NUMBER', 'y_tab.NUMBER')
+ text = text.replace('SECTEND', 'y_tab.SECTEND')
+ text = text.replace('SCDECL', 'y_tab.SCDECL')
+ text = text.replace('Xy_tab.SCDECL', 'y_tab.XSCDECL')
+ text = text.replace('NAME', 'y_tab.NAME')
+ text = text.replace('PREVCCL', 'y_tab.PREVCCL')
+ text = text.replace('EOF_OP', 'y_tab.EOF_OP')
+ text = text.replace('TOK_OPTION', 'y_tab.TOK_OPTION')
+ text = text.replace('TOK_OUTFILE', 'y_tab.TOK_OUTFILE')
+ text = text.replace('TOK_PREFIX', 'y_tab.TOK_PREFIX')
+ text = text.replace('TOK_YYCLASS', 'y_tab.TOK_YYCLASS')
+ text = text.replace('TOK_HEADER_FILE', 'y_tab.TOK_HEADER_FILE')
+ text = text.replace('TOK_EXTRA_TYPE', 'y_tab.TOK_EXTRA_TYPE')
+ text = text.replace('TOK_TABLES_FILE', 'y_tab.TOK_TABLES_FILE')
+
+ text = text.replace('CCE_ALNUM', 'y_tab.CCE_ALNUM')
+ text = text.replace('CCE_ALPHA', 'y_tab.CCE_ALPHA')
+ text = text.replace('CCE_BLANK', 'y_tab.CCE_BLANK')
+ text = text.replace('CCE_CNTRL', 'y_tab.CCE_CNTRL')
+ text = text.replace('CCE_DIGIT', 'y_tab.CCE_DIGIT')
+ text = text.replace('CCE_GRAPH', 'y_tab.CCE_GRAPH')
+ text = text.replace('CCE_LOWER', 'y_tab.CCE_LOWER')
+ text = text.replace('CCE_PRINT', 'y_tab.CCE_PRINT')
+ text = text.replace('CCE_PUNCT', 'y_tab.CCE_PUNCT')
+ text = text.replace('CCE_SPACE', 'y_tab.CCE_SPACE')
+ text = text.replace('CCE_UPPER', 'y_tab.CCE_UPPER')
+ text = text.replace('CCE_XDIGIT', 'y_tab.CCE_XDIGIT')
+
+ text = text.replace('CCE_NEG_ALNUM', 'y_tab.CCE_NEG_ALNUM')
+ text = text.replace('CCE_NEG_ALPHA', 'y_tab.CCE_NEG_ALPHA')
+ text = text.replace('CCE_NEG_BLANK', 'y_tab.CCE_NEG_BLANK')
+ text = text.replace('CCE_NEG_CNTRL', 'y_tab.CCE_NEG_CNTRL')
+ text = text.replace('CCE_NEG_DIGIT', 'y_tab.CCE_NEG_DIGIT')
+ text = text.replace('CCE_NEG_GRAPH', 'y_tab.CCE_NEG_GRAPH')
+ text = text.replace('CCE_NEG_LOWER', 'y_tab.CCE_NEG_LOWER')
+ text = text.replace('CCE_NEG_PRINT', 'y_tab.CCE_NEG_PRINT')
+ text = text.replace('CCE_NEG_PUNCT', 'y_tab.CCE_NEG_PUNCT')
+ text = text.replace('CCE_NEG_SPACE', 'y_tab.CCE_NEG_SPACE')
+ text = text.replace('CCE_NEG_UPPER', 'y_tab.CCE_NEG_UPPER')
+ text = text.replace('CCE_NEG_XDIGIT', 'y_tab.CCE_NEG_XDIGIT')
+
+ text = text.replace('CCL_OP_DIFF', 'y_tab.CCL_OP_DIFF')
+ text = text.replace('CCL_OP_UNION', 'y_tab.CCL_OP_UNION')
+
+ text = text.replace('BEGIN_REPEAT_POSIX', 'y_tab.BEGIN_REPEAT_POSIX')
+ text = text.replace('END_REPEAT_POSIX', 'y_tab.END_REPEAT_POSIX')
+ text = text.replace('BEGIN_REPEAT_FLEX', 'y_tab.BEGIN_REPEAT_FLEX')
+ text = text.replace('END_REPEAT_FLEX', 'y_tab.END_REPEAT_FLEX')
element.set_text(i[0], 0, text)
else: