-/* Bison Grammar Parser -*- C -*-
+%{/* Bison Grammar Parser -*- C -*-
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
02111-1307 USA
*/
-
-%debug
-%defines
-%locations
-%pure-parser
-%error-verbose
-%defines
-%name-prefix="gram_"
-
-%{
#include "system.h"
#include "complain.h"
int current_prec = 0;
%}
+%debug
+%defines
+%locations
+%pure-parser
+%error-verbose
+%defines
+%name-prefix="gram_"
+
%initial-action
{
/* Bison's grammar can initial empty locations, hence a default
%token
PERCENT_DEBUG "%debug"
+ PERCENT_DEFAULT_PREC "%default-prec"
PERCENT_DEFINE "%define"
PERCENT_DEFINES "%defines"
PERCENT_ERROR_VERBOSE "%error-verbose"
PERCENT_EXPECT "%expect"
+ PERCENT_EXPECT_RR "%expect-rr"
PERCENT_FILE_PREFIX "%file-prefix"
PERCENT_GLR_PARSER "%glr-parser"
PERCENT_INITIAL_ACTION "%initial-action {...}"
PERCENT_LEX_PARAM "%lex-param {...}"
PERCENT_LOCATIONS "%locations"
PERCENT_NAME_PREFIX "%name-prefix"
+ PERCENT_NO_DEFAULT_PREC "%no-default-prec"
PERCENT_NO_LINES "%no-lines"
PERCENT_NONDETERMINISTIC_PARSER
"%nondeterministic-parser"
| "%define" string_content string_content { muscle_insert ($2, $3); }
| "%defines" { defines_flag = true; }
| "%error-verbose" { error_verbose = true; }
-| "%expect" INT { expected_conflicts = $2; }
+| "%expect" INT { expected_sr_conflicts = $2; }
+| "%expect-rr" INT { expected_rr_conflicts = $2; }
| "%file-prefix" "=" string_content { spec_file_prefix = $3; }
| "%glr-parser"
{
symbol_printer_set (list->sym, $1, list->location);
symbol_list_free ($2);
}
+| "%default-prec"
+ {
+ default_prec = true;
+ }
+| "%no-default-prec"
+ {
+ default_prec = false;
+ }
;
symbol_declaration:
{
int i;
YYLTYPE loc;
- loc.start = loc.end = rhs[n].end;
+
+ /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
+ The bug is fixed in 7.4.2m, but play it safe for now. */
+ loc.start = rhs[n].end;
+ loc.end = rhs[n].end;
/* Ignore empty nonterminals the start of the the right-hand side.
Do not bother to ignore them at the end of the right-hand side,