import sys
from ndcode.piyacc import t_def
from ndcode.piyacc import element
-from ndcode.piyacc import generate_bison
-from ndcode.piyacc import generate_py
+from ndcode.piyacc.generate_bison import generate_bison
+from ndcode.piyacc.generate_py import generate_py
EXIT_SUCCESS = 0
EXIT_FAILURE = 1
_ast.post_process()
#element.serialize(_ast, 'b.xml', 'utf-8')
#_ast = element.deserialize('b.xml', t_def.factory, 'utf-8')
- (generate_py.generate_py if python else generate_bison.generate_bison)(
+ (generate_py if python else generate_bison)(
_ast,
_element,
home_dir,
%token BRACKETED_ID "[identifier]"
%token CHAR "char"
%token EPILOGUE "epilogue"
-%token EQUAL "="
%token ID "identifier"
%token ID_COLON "identifier:"
%token PERCENT_PERCENT "%%"
-%token PIPE "|"
%token PROLOGUE "%{...%}"
-%token SEMICOLON ";"
%token TAG "<tag>"
%token TAG_ANY "<*>"
%token TAG_NONE "<>"
| %space (?E{t_def.AST.Section1.TokenTable}"%token-table")
| %space (?E{t_def.AST.Section1.Verbose}"%verbose")
| %space (?E{t_def.AST.Section1.YACC}"%yacc")
- | /*FIXME: Err? What is this horror doing here? */ ";"
+ | /*FIXME: Err? What is this horror doing here? */ ';'
;
params
body of the grammar. */
rules_or_grammar_declaration
: rules
- | grammar_declaration ";"
- | error ";"
+ | grammar_declaration ';'
+ | error ';'
{
#yyerrok
}
rhses.1
: %space (?E{t_def.AST.Production}rhs)
- | rhses.1 "|" %space (?E{t_def.AST.Production}rhs)
- | rhses.1 ";"
+ | rhses.1 '|' %space (?E{t_def.AST.Production}rhs)
+ | rhses.1 ';'
;
%token PERCENT_EMPTY "%empty";
"%"{id} state.complain(y_tab.yylloc, state.complaint, 'invalid directive: {0:s}'.format(state.quote(yytext)))
- "=" return y_tab.EQUAL
- "|" return y_tab.PIPE
- ";" return y_tab.SEMICOLON
+ [=|;] return ord(yytext[0])
(?E{t_def.AST.ID}{id}) {
global id_loc, bracketed_id_str