%{/* Bison Grammar Parser -*- C -*-
- Copyright (C) 2002-2012 Free Software Foundation, Inc.
+ Copyright (C) 2002-2013 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
static YYLTYPE lloc_default (YYLTYPE const *, int);
#define YY_LOCATION_PRINT(File, Loc) \
- location_print (File, Loc)
+ location_print (Loc, File)
static void version_check (location const *loc, char const *version);
-/* Request detailed syntax error messages, and pass them to GRAM_ERROR.
- FIXME: depends on the undocumented availability of YYLLOC. */
-#undef yyerror
-#define yyerror(Msg) \
- gram_error (&yylloc, Msg)
static void gram_error (location const *, char const *);
+/// A string that describes a char (e.g., 'a' -> "'a'").
static char const *char_name (char);
%}
*/
static
void
- current_lhs(symbol *sym, location loc, named_ref *ref)
+ current_lhs (symbol *sym, location loc, named_ref *ref)
{
current_lhs_symbol = sym;
current_lhs_location = loc;
#define YYTYPE_UINT8 uint_fast8_t
}
-%verbose
-%defines
+%define api.prefix "gram_"
+%define api.pure full
%define locations
-%define api.pure
%define parse.error verbose
%define parse.lac full
%define parse.trace
-%name-prefix "gram_"
+%defines
%expect 0
+%verbose
%initial-action
{
{
#define CASE(In, Out) \
case param_ ## In: fputs ("%" #Out, stderr); break
- CASE(lex, lex-param);
- CASE(parse, parse-param);
- CASE(both, param);
+ CASE (lex, lex-param);
+ CASE (parse, parse-param);
+ CASE (both, param);
#undef CASE
case param_none: aver (false); break;
}
| "%expect" INT { expected_sr_conflicts = $2; }
| "%expect-rr" INT { expected_rr_conflicts = $2; }
| "%file-prefix" STRING { spec_file_prefix = $2; }
-| "%file-prefix" "=" STRING { spec_file_prefix = $3; } /* deprecated */
| "%glr-parser"
{
nondeterministic_parser = true;
}
| "%language" STRING { language_argmatch ($2, grammar_prio, @1); }
| "%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 = $2; }
-| "%output" "=" STRING { spec_outfile = $3; } /* deprecated */
| "%param" { current_param = $1; } params { current_param = param_none; }
| "%require" STRING { version_check (&@2, $2); }
| "%skeleton" STRING
"%union" union_name braceless
{
union_seen = true;
- muscle_code_grow ("stype", $3, @3);
+ muscle_code_grow ("union_members", $3, @3);
code_scanner_last_string_free ();
}
;
symbol.prec
{ $$ = symbol_list_sym_new ($1, @1); }
| symbols.prec symbol.prec
- { $$ = symbol_list_prepend ($1, symbol_list_sym_new ($2, @2)); }
+ { $$ = symbol_list_append ($1, symbol_list_sym_new ($2, @2)); }
;
symbol.prec:
symbol
{ $$ = symbol_list_sym_new ($1, @1); }
| symbols.1 symbol
- { $$ = symbol_list_prepend ($1, symbol_list_sym_new ($2, @2)); }
+ { $$ = symbol_list_append ($1, symbol_list_sym_new ($2, @2)); }
;
generic_symlist:
generic_symlist_item { $$ = $1; }
-| generic_symlist generic_symlist_item { $$ = symbol_list_prepend ($1, $2); }
+| generic_symlist generic_symlist_item { $$ = symbol_list_append ($1, $2); }
;
generic_symlist_item:
/* One token definition. */
symbol_def:
TAG
- {
- current_type = $1;
- tag_seen = true;
- }
+ {
+ current_type = $1;
+ tag_seen = true;
+ }
| id
- {
- symbol_class_set ($1, current_class, @1, true);
- symbol_type_set ($1, current_type, @1);
- }
+ {
+ symbol_class_set ($1, current_class, @1, true);
+ symbol_type_set ($1, current_type, @1);
+ }
| id INT
{
symbol_class_set ($1, current_class, @1, true);
named_ref.opt:
/* Nothing. */ { $$ = 0; }
|
- BRACKETED_ID { $$ = named_ref_new($1, @1); }
+ BRACKETED_ID { $$ = named_ref_new ($1, @1); }
;
/*---------------------------.
%%
-
/* Return the location of the left-hand side of a rule whose
right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
the right-hand side, and return an empty location equal to the end