--- orig/bison-2.0/src/parse-gram.y Sat Oct 9 19:50:26 2004 +++ bison-2.0/src/parse-gram.y Wed May 18 00:45:41 2005 @@ -57,6 +57,8 @@ symbol *current_lhs; location current_lhs_location; assoc current_assoc; int current_prec = 0; +extern bool include_braces; +extern bool other_id; %} %debug @@ -100,6 +102,7 @@ int current_prec = 0; %token PERCENT_PRINTER "%printer {...}" %token PERCENT_UNION "%union {...}" +%token PERCENT_TYPED "%typed" %token PERCENT_LEFT "%left" %token PERCENT_RIGHT "%right" @@ -118,6 +121,7 @@ int current_prec = 0; PERCENT_DEBUG "%debug" PERCENT_DEFAULT_PREC "%default-prec" PERCENT_DEFINE "%define" + PERCENT_CODE "%code" PERCENT_DEFINES "%defines" PERCENT_ERROR_VERBOSE "%error-verbose" PERCENT_EXPECT "%expect" @@ -148,6 +152,7 @@ int current_prec = 0; %token PIPE "|" %token ID "identifier" %token ID_COLON "identifier:" +%token OTHER_ID "non-grammar identifier" %token PERCENT_PERCENT "%%" %token PROLOGUE "%{...%}" %token EPILOGUE "epilogue" @@ -161,9 +166,9 @@ int current_prec = 0; "%parse-param {...}" "%printer {...}" "%union {...}" - BRACED_CODE action + BRACED_CODE OTHER_ID action PROLOGUE EPILOGUE -%type TYPE +%type TYPE "%typed" %type INT %type ID ID_COLON symbol string_as_id %type precedence_declarator @@ -189,6 +194,8 @@ declaration: | PROLOGUE { prologue_augment ($1, @1); } | "%debug" { debug_flag = true; } | "%define" string_content string_content { muscle_insert ($2, $3); } +| "%code" { include_braces = false; other_id = true; } + OTHER_ID BRACED_CODE { muscle_insert ($3, $4); include_braces = true; other_id = false; } | "%defines" { defines_flag = true; } | "%error-verbose" { error_verbose = true; } | "%expect" INT { expected_sr_conflicts = $2; } @@ -230,6 +237,10 @@ grammar_declaration: typed = true; MUSCLE_INSERT_INT ("stype_line", @1.start.line); muscle_insert ("stype", $1); + } +| "%typed" + { + typed = true; } | "%destructor {...}" symbols.1 {