%{/* 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 api.prefix "gram_"
-%define api.pure
+%define api.pure full
%define locations
%define parse.error verbose
%define parse.lac full
{
#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;
}
"%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); }
;
/*---------------------------.