boundary_set (&@$.end, current_file, 1, 1);
}
-/* Only NUMBERS have a value. */
%union
{
symbol *symbol;
symbol_list *list;
int integer;
- char *chars;
+ char const *chars;
+ char *code;
assoc assoc;
uniqstr uniqstr;
unsigned char character;
%token PERCENT_TYPE "%type"
%token PERCENT_DESTRUCTOR "%destructor"
%token PERCENT_PRINTER "%printer"
-%token PERCENT_SYMBOL_DEFAULT
- "%symbol-default"
%token PERCENT_LEFT "%left"
%token PERCENT_RIGHT "%right"
`----------------------*/
%token
- PERCENT_AFTER_HEADER "%after-header"
- PERCENT_BEFORE_HEADER "%before-header"
+ PERCENT_CODE "%code"
+ PERCENT_CODE_TOP "%code-top"
PERCENT_DEBUG "%debug"
PERCENT_DEFAULT_PREC "%default-prec"
PERCENT_DEFINE "%define"
PERCENT_DEFINES "%defines"
- PERCENT_END_HEADER "%end-header"
PERCENT_ERROR_VERBOSE "%error-verbose"
PERCENT_EXPECT "%expect"
PERCENT_EXPECT_RR "%expect-rr"
"%nondeterministic-parser"
PERCENT_OUTPUT "%output"
PERCENT_PARSE_PARAM "%parse-param"
+ PERCENT_PROVIDES "%provides"
PERCENT_PURE_PARSER "%pure-parser"
+ PERCENT_PUSH_PARSER "%push-parser"
PERCENT_REQUIRE "%require"
+ PERCENT_REQUIRES "%requires"
PERCENT_SKELETON "%skeleton"
PERCENT_START "%start"
- PERCENT_START_HEADER "%start-header"
PERCENT_TOKEN_TABLE "%token-table"
PERCENT_VERBOSE "%verbose"
PERCENT_YACC "%yacc"
%token PROLOGUE "%{...%}"
%token SEMICOLON ";"
%token TYPE "type"
+%token TYPE_TAG_ANY "<*>"
+%token TYPE_TAG_NONE "<>"
%type <character> CHAR
%printer { fputs (char_name ($$), stderr); } CHAR
/* braceless is not to be used for rule or symbol actions, as it
calls translate_code. */
-%type <chars> STRING "{...}" "%{...%}" EPILOGUE braceless content content.opt
+%type <chars> STRING "%{...%}" EPILOGUE braceless content content.opt
+%type <code> "{...}"
%printer { fputs (quotearg_style (c_quoting_style, $$), stderr); }
- STRING
+ STRING
%printer { fprintf (stderr, "{\n%s\n}", $$); }
- braceless content content.opt "{...}" "%{...%}" EPILOGUE
+ braceless content content.opt "{...}" "%{...%}" EPILOGUE
%type <uniqstr> TYPE ID ID_COLON
%printer { fprintf (stderr, "<%s>", $$); } TYPE
prologue_declaration:
grammar_declaration
| "%{...%}" { prologue_augment (translate_code ($1, @1), @1, union_seen); }
-| "%after-header" braceless { prologue_augment ($2, @2, true); }
-| "%before-header" braceless { prologue_augment ($2, @2, false); }
| "%debug" { debug_flag = true; }
| "%define" STRING content.opt { muscle_insert ($2, $3); }
| "%defines" { defines_flag = true; }
-| "%end-header" braceless { muscle_code_grow ("end_header", $2, @2); }
+| "%defines" STRING
+ {
+ defines_flag = true;
+ spec_defines_file = xstrdup ($2);
+ }
| "%error-verbose" { error_verbose = true; }
| "%expect" INT { expected_sr_conflicts = $2; }
| "%expect-rr" INT { expected_rr_conflicts = $2; }
-| "%file-prefix" "=" STRING { spec_file_prefix = $3; }
+| "%file-prefix" STRING { spec_file_prefix = $2; }
+| "%file-prefix" "=" STRING { spec_file_prefix = $3; } /* deprecated */
| "%glr-parser"
{
nondeterministic_parser = true;
}
| "%lex-param" "{...}" { add_param ("lex_param", $2, @2); }
| "%locations" { locations_flag = true; }
-| "%name-prefix" "=" STRING { spec_name_prefix = $3; }
+| "%name-prefix" STRING { spec_name_prefix = $2; }
+| "%name-prefix" "=" STRING { spec_name_prefix = $3; } /* deprecated */
| "%no-lines" { no_lines_flag = true; }
| "%nondeterministic-parser" { nondeterministic_parser = true; }
-| "%output" "=" STRING { spec_outfile = $3; }
+| "%output" STRING { spec_outfile = $2; }
+| "%output" "=" STRING { spec_outfile = $3; } /* deprecated */
| "%parse-param" "{...}" { add_param ("parse_param", $2, @2); }
| "%pure-parser" { pure_parser = true; }
+| "%push-parser" { push_parser = true; }
| "%require" STRING { version_check (&@2, $2); }
| "%skeleton" STRING { skeleton = $2; }
-| "%start-header" braceless { muscle_code_grow ("start_header", $2, @2); }
| "%token-table" { token_table_flag = true; }
| "%verbose" { report_flag = report_states; }
| "%yacc" { yacc_flag = true; }
symbol_list *list;
const char *action = translate_symbol_action ($2, @2);
for (list = $3; list; list = list->next)
- symbol_list_destructor_set (list, action, @2);
+ symbol_list_destructor_set (list, action, @2);
symbol_list_free ($3);
}
| "%printer" "{...}" generic_symlist
symbol_list *list;
const char *action = translate_symbol_action ($2, @2);
for (list = $3; list; list = list->next)
- symbol_list_printer_set (list, action, @2);
+ symbol_list_printer_set (list, action, @2);
symbol_list_free ($3);
}
| "%default-prec"
{
default_prec = false;
}
+| "%code" braceless { prologue_augment ($2, @2, true); }
+| "%code-top" braceless { prologue_augment ($2, @2, false); }
+| "%provides" braceless { muscle_code_grow ("provides", $2, @2); }
+| "%requires" braceless { muscle_code_grow ("requires", $2, @2); }
;
}
| "%type" TYPE symbols.1
{
- tag_seen = true;
symbol_list *list;
+ tag_seen = true;
for (list = $3; list; list = list->next)
symbol_type_set (list->content.sym, $2, @2);
symbol_list_free ($3);
generic_symlist_item:
symbol { $$ = symbol_list_sym_new ($1, @1); }
| TYPE { $$ = symbol_list_type_new ($1, @1); }
-| "%symbol-default" { $$ = symbol_list_default_new (@1); }
+| "<*>" { $$ = symbol_list_default_tagged_new (@1); }
+| "<>" { $$ = symbol_list_default_tagless_new (@1); }
;
/* One token definition. */