From e9690142325711b320ef444768fdd40a087d02f7 Mon Sep 17 00:00:00 2001 From: "Joel E. Denny" Date: Sun, 24 Jul 2011 17:50:37 -0400 Subject: [PATCH] global: remove unnecessary horizontal tabs. This change was made by applying emacs' untabify function to nearly all files in Bison's repository. Required tabs in make files, ChangeLog, regexps, and test code were manually skipped. Other notable exceptions and changes are listed below. * bootstrap: Skip because we sync this with gnulib. * data/m4sugar/foreach.m4 * data/m4sugar/m4sugar.m4: Skip because we sync these with Autoconf. * djgpp: Skip because I don't know how to test djgpp properly, and this code appears to be unmaintained anyway. * README-hacking (Hacking): Specify that tabs should be avoided where not required. --- ChangeLog | 16 + NEWS | 22 +- README-hacking | 7 + REFERENCES | 4 +- TODO | 46 +- build-aux/cross-options.pl | 74 +- build-aux/local.mk | 8 +- configure.ac | 8 +- data/bison.m4 | 20 +- data/c++.m4 | 12 +- data/c.m4 | 26 +- data/glr.c | 1372 ++++++++++++------------ data/glr.cc | 54 +- data/lalr1.cc | 42 +- data/local.mk | 44 +- data/location.cc | 4 +- data/stack.hh | 2 +- data/xslt/xml2dot.xsl | 20 +- data/xslt/xml2text.xsl | 38 +- data/xslt/xml2xhtml.xsl | 136 +-- data/yacc.c | 334 +++--- doc/Doxyfile.in | 12 +- doc/local.mk | 20 +- etc/bench.pl.in | 22 +- etc/prefix-gnulib-mk | 2 +- examples/calc++/Makefile.am | 6 +- examples/extexi | 18 +- lib/abitset.c | 232 ++--- lib/bbitset.h | 28 +- lib/bitset.c | 10 +- lib/bitset.h | 58 +- lib/bitset_stats.c | 100 +- lib/bitsetv-print.c | 2 +- lib/bitsetv.c | 6 +- lib/ebitset.c | 654 ++++++------ lib/lbitset.c | 754 +++++++------- lib/timevar.c | 40 +- lib/vbitset.c | 312 +++--- m4/c-working.m4 | 2 +- m4/cxx.m4 | 32 +- src/LR0.c | 70 +- src/closure.c | 38 +- src/complain.c | 16 +- src/complain.h | 4 +- src/conflicts.c | 258 ++--- src/derives.c | 16 +- src/files.c | 62 +- src/flex-scanner.h | 8 +- src/getargs.c | 212 ++-- src/getargs.h | 12 +- src/gram.c | 72 +- src/gram.h | 6 +- src/graphviz.c | 2 +- src/graphviz.h | 2 +- src/lalr.c | 176 ++-- src/local.mk | 162 +-- src/location.c | 20 +- src/location.h | 6 +- src/muscle-tab.c | 6 +- src/muscle-tab.h | 70 +- src/nullable.c | 84 +- src/output.c | 172 +-- src/parse-gram.c | 362 +++---- src/parse-gram.y | 54 +- src/print-xml.c | 190 ++-- src/print.c | 258 ++--- src/print_graph.c | 76 +- src/reader.c | 102 +- src/reader.h | 6 +- src/reduce.c | 120 +-- src/relation.c | 36 +- src/scan-code.l | 248 ++--- src/scan-gram.l | 226 ++-- src/scan-skel.l | 4 +- src/state.c | 54 +- src/state.h | 16 +- src/symlist.c | 4 +- src/symtab.c | 98 +- src/symtab.h | 6 +- src/system.h | 56 +- src/tables.c | 312 +++--- src/uniqstr.c | 10 +- tests/actions.at | 58 +- tests/atlocal.in | 2 +- tests/c++.at | 2 +- tests/calc.at | 6 +- tests/cxx-type.at | 166 +-- tests/existing.at | 1962 +++++++++++++++++------------------ tests/glr-regression.at | 92 +- tests/java.at | 86 +- tests/local.at | 24 +- tests/local.mk | 42 +- tests/named-refs.at | 4 +- tests/output.at | 68 +- tests/regression.at | 8 +- tests/sets.at | 20 +- tests/testsuite.at | 2 +- tests/torture.at | 18 +- 98 files changed, 5447 insertions(+), 5424 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9c6d813..abea813f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2011-07-24 Joel E. Denny + + global: remove unnecessary horizontal tabs. + This change was made by applying emacs' untabify function to + nearly all files in Bison's repository. Required tabs in make + files, ChangeLog, regexps, and test code were manually skipped. + Other notable exceptions and changes are listed below. + * bootstrap: Skip because we sync this with gnulib. + * data/m4sugar/foreach.m4 + * data/m4sugar/m4sugar.m4: Skip because we sync these with + Autoconf. + * djgpp: Skip because I don't know how to test djgpp properly, and + this code appears to be unmaintained anyway. + * README-hacking (Hacking): Specify that tabs should be avoided + where not required. + 2011-07-10 Joel E. Denny build: avoid YACC typo inherited from Autoconf. diff --git a/NEWS b/NEWS index ff3f19fe..c3f73190 100644 --- a/NEWS +++ b/NEWS @@ -894,26 +894,26 @@ Bison News if the symbols have destructors. For instance: exp: exp "?" exp ":" exp { $1 ? $1 : $3; } - | exp "+" exp - ; + | exp "+" exp + ; will trigger a warning about $$ and $5 in the first rule, and $3 in the second ($1 is copied to $$ by the default rule). This example most likely contains three errors, and could be rewritten as: exp: exp "?" exp ":" exp - { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); } - | exp "+" exp - { $$ = $1 ? $1 : $3; if ($1) free ($3); } - ; + { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); } + | exp "+" exp + { $$ = $1 ? $1 : $3; if ($1) free ($3); } + ; However, if the original actions were really intended, memory leaks and all, the warnings can be suppressed by letting Bison believe the values are used, e.g.: exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); } - | exp "+" exp { $$ = $1; (void) $3; } - ; + | exp "+" exp { $$ = $1; (void) $3; } + ; If there are mid-rule actions, the warning is issued if no action uses it. The following triggers no warning: $1 and $3 are used. @@ -1157,16 +1157,16 @@ Bison News In agreement with POSIX and with other Yaccs, leaving a default action is valid when $$ is untyped, and $1 typed: - untyped: ... typed; + untyped: ... typed; but the converse remains an error: - typed: ... untyped; + typed: ... untyped; ** Values of mid-rule actions The following code: - foo: { ... } { $$ = $1; } ... + foo: { ... } { $$ = $1; } ... was incorrectly rejected: $1 is defined in the second mid-rule action, and is equal to the $$ of the first mid-rule action. diff --git a/README-hacking b/README-hacking index 6a240624..7cb79286 100644 --- a/README-hacking +++ b/README-hacking @@ -46,6 +46,13 @@ of the .output file etc. This excludes impossible error messages (comparable to assert/abort), and all the --trace output which is meant for the maintainers only. +** Horizontal tabs +Do not add horizontal tab characters to any file in Bison's repository +except where required. For example, do not use tabs to format C code. +However, make files, ChangeLog, and some regular expressions require +tabs. Also, test cases might need to contain tabs to check that Bison +properly processes tabs in its input. + * Working from the repository diff --git a/REFERENCES b/REFERENCES index 23084822..d55cdae8 100644 --- a/REFERENCES +++ b/REFERENCES @@ -25,8 +25,8 @@ LALR(1) Look-Ahead Sets", ACM Transactions on Programming Languages and Systems (TOPLAS) 4, 4 (October 1982), 615-649. Their technique is the standard one now.) - paul rubin - free software foundation + paul rubin + free software foundation [DeRemer-Pennello reference corrected by Paul Eggert , diff --git a/TODO b/TODO index f3bcf19d..814e0dfe 100644 --- a/TODO +++ b/TODO @@ -166,11 +166,11 @@ what it should look like. For instance what follows crashes. The code in yyerrlab reads: if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } There are only two yychar that can be <= YYEOF: YYEMPTY and YYEOF. But I can't produce the situation where yychar is YYEMPTY here, is it @@ -280,7 +280,7 @@ Note that there remains the problem of locations: `@r'? We should find a means to provide an access to values deep in the stack. For instance, instead of - baz: qux { $$ = $-1 + $0 + $1; } + baz: qux { $$ = $-1 + $0 + $1; } we should be able to have: @@ -313,13 +313,13 @@ XML output for GNU Bison * Unit rules Maybe we could expand unit rules, i.e., transform - exp: arith | bool; - arith: exp '+' exp; - bool: exp '&' exp; + exp: arith | bool; + arith: exp '+' exp; + bool: exp '&' exp; into - exp: exp '+' exp | exp '&' exp; + exp: exp '+' exp | exp '&' exp; when there are no actions. This can significantly speed up some grammars. I can't find the papers. In particular the book `LR @@ -344,19 +344,19 @@ Wow, %printer is not documented. Clearly mark YYPRINT as obsolete. * Coding system independence Paul notes: - Currently Bison assumes 8-bit bytes (i.e. that UCHAR_MAX is - 255). It also assumes that the 8-bit character encoding is - the same for the invocation of 'bison' as it is for the - invocation of 'cc', but this is not necessarily true when - people run bison on an ASCII host and then use cc on an EBCDIC - host. I don't think these topics are worth our time - addressing (unless we find a gung-ho volunteer for EBCDIC or - PDP-10 ports :-) but they should probably be documented - somewhere. - - More importantly, Bison does not currently allow NUL bytes in - tokens, either via escapes (e.g., "x\0y") or via a NUL byte in - the source code. This should get fixed. + Currently Bison assumes 8-bit bytes (i.e. that UCHAR_MAX is + 255). It also assumes that the 8-bit character encoding is + the same for the invocation of 'bison' as it is for the + invocation of 'cc', but this is not necessarily true when + people run bison on an ASCII host and then use cc on an EBCDIC + host. I don't think these topics are worth our time + addressing (unless we find a gung-ho volunteer for EBCDIC or + PDP-10 ports :-) but they should probably be documented + somewhere. + + More importantly, Bison does not currently allow NUL bytes in + tokens, either via escapes (e.g., "x\0y") or via a NUL byte in + the source code. This should get fixed. * --graph Show reductions. diff --git a/build-aux/cross-options.pl b/build-aux/cross-options.pl index 7762e276..0f5009ce 100755 --- a/build-aux/cross-options.pl +++ b/build-aux/cross-options.pl @@ -18,50 +18,50 @@ while () \s # Spaces. /x) { - my ($short, $long, $opt, $arg) = ($1, $2, $3, $4); - $short = '' if ! defined $short; - $short = '-d' if $long eq '--defines' && ! $short; - my $dir = '%' . substr($long, 2); - if (index ($scanner, "\"$dir\"") < 0) - { - if ($long eq '--force-define') { $dir = '%define'; } - else { $dir = ''; } - } - if ($arg) - { + my ($short, $long, $opt, $arg) = ($1, $2, $3, $4); + $short = '' if ! defined $short; + $short = '-d' if $long eq '--defines' && ! $short; + my $dir = '%' . substr($long, 2); + if (index ($scanner, "\"$dir\"") < 0) + { + if ($long eq '--force-define') { $dir = '%define'; } + else { $dir = ''; } + } + if ($arg) + { # if $opt, $arg contains the closing ]. substr ($arg, -1) = '' if $opt eq '['; - $arg =~ s/^=//; + $arg =~ s/^=//; $arg = lc ($arg); - my $dir_arg = $arg; + my $dir_arg = $arg; # If the argument is compite (e.g., for --define[=NAME[=VALUE]]), # put each word in @var, to build @var{name}[=@var{value}], not # @var{name[=value]}]. - $arg =~ s/(\w+)/\@var{$1}/g; - my $long_arg = "=$arg"; - if ($opt eq '[') { - $long_arg = "[$long_arg]"; - $arg = "[$arg]"; - } - # For arguments of directives: this only works if all arguments - # are strings and have the same syntax as on the command line. - if ($dir_arg eq 'name[=value]') - { - $dir_arg = '@var{name} ["@var{value}"]'; - } - else - { - $dir_arg =~ s/(\w+)/\@var{"$1"}/g; - $dir_arg = '[' . $dir_arg . ']' - if $opt eq '['; - } - $long = "$long$long_arg"; - $short = "$short $arg" if $short && $short ne '-d'; - $dir = "$dir $dir_arg" if $dir; - } - $option{$long} = $short; - $directive{$long} = $dir; + $arg =~ s/(\w+)/\@var{$1}/g; + my $long_arg = "=$arg"; + if ($opt eq '[') { + $long_arg = "[$long_arg]"; + $arg = "[$arg]"; + } + # For arguments of directives: this only works if all arguments + # are strings and have the same syntax as on the command line. + if ($dir_arg eq 'name[=value]') + { + $dir_arg = '@var{name} ["@var{value}"]'; + } + else + { + $dir_arg =~ s/(\w+)/\@var{"$1"}/g; + $dir_arg = '[' . $dir_arg . ']' + if $opt eq '['; + } + $long = "$long$long_arg"; + $short = "$short $arg" if $short && $short ne '-d'; + $dir = "$dir $dir_arg" if $dir; + } + $option{$long} = $short; + $directive{$long} = $dir; } } diff --git a/build-aux/local.mk b/build-aux/local.mk index 141081e7..29c907a4 100644 --- a/build-aux/local.mk +++ b/build-aux/local.mk @@ -1,5 +1,5 @@ -EXTRA_DIST += \ - build-aux/cross-options.pl \ - build-aux/move-if-change \ - build-aux/prev-version.txt \ +EXTRA_DIST += \ + build-aux/cross-options.pl \ + build-aux/move-if-change \ + build-aux/prev-version.txt \ build-aux/update-b4-copyright diff --git a/configure.ac b/configure.ac index d75924e4..258e6bb1 100644 --- a/configure.ac +++ b/configure.ac @@ -61,7 +61,7 @@ AC_ARG_ENABLE(gcc-warnings, yes|no) ;; *) AC_MSG_ERROR([bad value ${enableval} for gcc-warnings option]) ;; esac], - [enableval=no]) + [enableval=no]) if test "${enableval}" = yes; then gl_WARN_ADD([-Werror], [WERROR_CFLAGS]) AC_SUBST([WERROR_CFLAGS]) @@ -175,7 +175,7 @@ do eval "test x\$$ac_var = x || $ac_var=lib/\$$ac_var" done AC_CONFIG_FILES([Makefile - po/Makefile.in - examples/calc++/Makefile - doc/yacc.1]) + po/Makefile.in + examples/calc++/Makefile + doc/yacc.1]) AC_OUTPUT diff --git a/data/bison.m4 b/data/bison.m4 index bbf90aae..c97cd6c0 100644 --- a/data/bison.m4 +++ b/data/bison.m4 @@ -304,8 +304,8 @@ m4_define([b4_parser_tables_define], m4_define([b4_flag_if], [m4_case(b4_$1_flag, [0], [$3], - [1], [$2], - [m4_fatal([invalid $1 value: ]$1)])]) + [1], [$2], + [m4_fatal([invalid $1 value: ]$1)])]) # b4_define_flag_if(FLAG) @@ -330,10 +330,10 @@ m4_define([b4_$3_if], # b4_FLAG_if(IF-TRUE, IF-FALSE) # ----------------------------- # Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise. -b4_define_flag_if([defines]) # Whether headers are requested. -b4_define_flag_if([glr]) # Whether a GLR parser is requested. -b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled. -b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated. +b4_define_flag_if([defines]) # Whether headers are requested. +b4_define_flag_if([glr]) # Whether a GLR parser is requested. +b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled. +b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated. ## --------- ## @@ -435,7 +435,7 @@ m4_define([b4_type_action_], b4_dollar_dollar([b4_symbol([$1], [number])], [b4_symbol([$1], [tag])], [b4_symbol([$1], [type])]); - break; + break; ])]) @@ -629,8 +629,8 @@ m4_define([b4_percent_define_get_syncline], # b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]]) m4_define([b4_percent_define_ifdef], [m4_ifdef([b4_percent_define(]$1[)], - [b4_percent_define_use([$1])$2], - [$3])]) + [b4_percent_define_use([$1])$2], + [$3])]) ## --------- ## @@ -765,7 +765,7 @@ m4_popdef([b4_macro_name])]) m4_define([b4_percent_code_ifdef], [m4_ifdef([b4_percent_code(]$1[)], [m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])$2], - [$3])]) + [$3])]) ## ------------------ ## diff --git a/data/c++.m4 b/data/c++.m4 index 45b4322c..43e065ca 100644 --- a/data/c++.m4 +++ b/data/c++.m4 @@ -405,24 +405,24 @@ m4_define([b4_parse_param_decl_1], # Extra initialisations of the constructor. m4_define([b4_parse_param_cons], [m4_ifset([b4_parse_param], - [ + [ b4_cc_constructor_calls(b4_parse_param)])]) m4_define([b4_cc_constructor_calls], - [m4_map_sep([b4_cc_constructor_call], [, + [m4_map_sep([b4_cc_constructor_call], [, ], [$@])]) m4_define([b4_cc_constructor_call], - [$2 ($2_yyarg)]) + [$2 ($2_yyarg)]) # b4_parse_param_vars # ------------------- # Extra instance variables. m4_define([b4_parse_param_vars], [m4_ifset([b4_parse_param], - [ + [ /* User arguments. */ b4_cc_var_decls(b4_parse_param)])]) m4_define([b4_cc_var_decls], - [m4_map_sep([b4_cc_var_decl], [ + [m4_map_sep([b4_cc_var_decl], [ ], [$@])]) m4_define([b4_cc_var_decl], - [ $1;]) + [ $1;]) diff --git a/data/c.m4 b/data/c.m4 index 7a718a1d..8a7a6885 100644 --- a/data/c.m4 +++ b/data/c.m4 @@ -146,7 +146,7 @@ m4_define([b4_int_type], m4_eval([0 <= $1]), [1], [unsigned int], - [int])]) + [int])]) # b4_int_type_for(NAME) @@ -235,7 +235,7 @@ m4_define([b4_token_enums], enum yytokentype { m4_map_sep([ b4_token_enum], [, ], - [$@]) + [$@]) }; #endif ])]) @@ -314,7 +314,7 @@ $1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl m4_define([b4_c_ansi_formals], [m4_if([$#], [0], [void], [$#$1], [1], [void], - [m4_map_sep([b4_c_ansi_formal], [, ], [$@])])]) + [m4_map_sep([b4_c_ansi_formal], [, ], [$@])])]) m4_define([b4_c_ansi_formal], [$1]) @@ -335,9 +335,9 @@ m4_define([b4_c_knr_formal_name], # Output the K&R argument declarations. m4_define([b4_c_knr_formal_decls], [m4_map_sep([b4_c_knr_formal_decl], - [ + [ ], - [$@])]) + [$@])]) m4_define([b4_c_knr_formal_decl], [ $1;]) @@ -457,7 +457,7 @@ b4_parse_param_use[]dnl { ]b4_symbol_foreach([b4_symbol_destructor])dnl [ default: - break; + break; } }]dnl ]) @@ -477,9 +477,9 @@ m4_define_default([b4_yy_symbol_print_generate], /*ARGSUSED*/ ]$1([yy_symbol_value_print], [static void], - [[FILE *yyoutput], [yyoutput]], - [[int yytype], [yytype]], - [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl + [[FILE *yyoutput], [yyoutput]], + [[int yytype], [yytype]], + [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl m4_ifset([b4_parse_param], [, b4_parse_param]))[ { @@ -498,7 +498,7 @@ b4_parse_param_use[]dnl { ]b4_symbol_foreach([b4_symbol_printer])dnl [ default: - break; + break; } } @@ -509,9 +509,9 @@ b4_parse_param_use[]dnl ]$1([yy_symbol_print], [static void], - [[FILE *yyoutput], [yyoutput]], - [[int yytype], [yytype]], - [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl + [[FILE *yyoutput], [yyoutput]], + [[int yytype], [yytype]], + [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl m4_ifset([b4_parse_param], [, b4_parse_param]))[ { diff --git a/data/glr.c b/data/glr.c index f22a8f10..f1394d80 100644 --- a/data/glr.c +++ b/data/glr.c @@ -220,7 +220,7 @@ typedef struct YYLTYPE ]) b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]], - [b4_shared_declarations])[ + [b4_shared_declarations])[ /* Enabling traces. */ #ifndef YYDEBUG @@ -358,7 +358,7 @@ b4_percent_code_get[]dnl #define YYUNDEFTOK ]b4_undef_token_number[ #define YYMAXUTOK ]b4_user_token_number_max[ -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ @@ -440,32 +440,32 @@ dnl We probably ought to introduce a type for confl. ]b4_locations_if([[ #define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ while (YYID (0)) /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) #endif ]],[ #ifndef YYLLOC_DEFAULT @@ -521,10 +521,10 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG; # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ - do { \ +# define YYDPRINTF(Args) \ + do { \ if (yydebug) \ - YYFPRINTF Args; \ + YYFPRINTF Args; \ } while (YYID (0)) ]b4_yy_symbol_print_generate([b4_c_ansi_function_def])[ @@ -552,7 +552,7 @@ int yydebug; #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH ]b4_stack_depth_init[ #endif @@ -579,16 +579,16 @@ int yydebug; #endif #if YYSTACKEXPANDABLE -# define YY_RESERVE_GLRSTACK(Yystack) \ - do { \ - if (Yystack->yyspaceLeft < YYHEADROOM) \ - yyexpandGLRStack (Yystack); \ +# define YY_RESERVE_GLRSTACK(Yystack) \ + do { \ + if (Yystack->yyspaceLeft < YYHEADROOM) \ + yyexpandGLRStack (Yystack); \ } while (YYID (0)) #else -# define YY_RESERVE_GLRSTACK(Yystack) \ - do { \ - if (Yystack->yyspaceLeft < YYHEADROOM) \ - yyMemoryExhausted (Yystack); \ +# define YY_RESERVE_GLRSTACK(Yystack) \ + do { \ + if (Yystack->yyspaceLeft < YYHEADROOM) \ + yyMemoryExhausted (Yystack); \ } while (YYID (0)) #endif @@ -632,27 +632,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -811,11 +811,11 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1) #endif yyvsp[i].yystate.yyresolved = s->yyresolved; if (s->yyresolved) - yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval; + yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval; else - /* The effect of using yysval or yyloc (in an immediate rule) is + /* The effect of using yysval or yyloc (in an immediate rule) is * undefined. */ - yyvsp[i].yystate.yysemantics.yyfirstVal = NULL; + yyvsp[i].yystate.yysemantics.yyfirstVal = NULL; yyvsp[i].yystate.yyloc = s->yyloc; s = yyvsp[i].yystate.yypred = s->yypred; } @@ -844,10 +844,10 @@ yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal) * yyerr for YYERROR, yyabort for YYABORT. */ /*ARGSUSED*/ static YYRESULTTAG yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp, - YYSTYPE* yyvalp, - YYLTYPE* YYOPTIONAL_LOC (yylocp), - yyGLRStack* yystackp - ]b4_user_formals[) + YYSTYPE* yyvalp, + YYLTYPE* YYOPTIONAL_LOC (yylocp), + yyGLRStack* yystackp + ]b4_user_formals[) { yybool yynormal __attribute__ ((__unused__)) = (yystackp->yysplitPoint == NULL); @@ -868,9 +868,9 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp, # undef YYFILL # define YYFILL(N) yyfill (yyvsp, &yylow, N, yynormal) # undef YYBACKUP -# define YYBACKUP(Token, Value) \ +# define YYBACKUP(Token, Value) \ return yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")), \ - yyerrok, yyerr + yyerrok, yyerr yylow = 1; if (yyrhslen == 0) @@ -910,7 +910,7 @@ yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1) } } - /* Bison grammar-table manipulation. */ + /* Bison grammar-table manipulation. */ ]b4_yydestruct_generate([b4_c_ansi_function_def])[ @@ -926,32 +926,32 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[) { if (yys->yyresolved) yydestruct (yymsg, yystos[yys->yylrState], - &yys->yysemantics.yysval]b4_locations_if([, &yys->yyloc])[]b4_user_args[); + &yys->yysemantics.yysval]b4_locations_if([, &yys->yyloc])[]b4_user_args[); else { #if YYDEBUG if (yydebug) - { - if (yys->yysemantics.yyfirstVal) - YYFPRINTF (stderr, "%s unresolved ", yymsg); - else - YYFPRINTF (stderr, "%s incomplete ", yymsg); - yy_symbol_print (stderr, yystos[yys->yylrState], - NULL]b4_locations_if([, &yys->yyloc])[]b4_user_args[); - YYFPRINTF (stderr, "\n"); - } + { + if (yys->yysemantics.yyfirstVal) + YYFPRINTF (stderr, "%s unresolved ", yymsg); + else + YYFPRINTF (stderr, "%s incomplete ", yymsg); + yy_symbol_print (stderr, yystos[yys->yylrState], + NULL]b4_locations_if([, &yys->yyloc])[]b4_user_args[); + YYFPRINTF (stderr, "\n"); + } #endif if (yys->yysemantics.yyfirstVal) - { - yySemanticOption *yyoption = yys->yysemantics.yyfirstVal; - yyGLRState *yyrh; - int yyn; - for (yyrh = yyoption->yystate, yyn = yyrhsLength (yyoption->yyrule); - yyn > 0; - yyrh = yyrh->yypred, yyn -= 1) - yydestroyGLRState (yymsg, yyrh]b4_user_args[); - } + { + yySemanticOption *yyoption = yys->yysemantics.yyfirstVal; + yyGLRState *yyrh; + int yyn; + for (yyrh = yyoption->yystate, yyn = yyrhsLength (yyoption->yyrule); + yyn > 0; + yyrh = yyrh->yypred, yyn -= 1) + yydestroyGLRState (yymsg, yyrh]b4_user_args[); + } } } @@ -993,7 +993,7 @@ yydefaultAction (yyStateNum yystate) */ static inline void yygetLRActions (yyStateNum yystate, int yytoken, - int* yyaction, const short int** yyconflicts) + int* yyaction, const short int** yyconflicts) { int yyindex = yypact[yystate] + yytoken; if (yypact_value_is_default (yypact[yystate]) @@ -1036,7 +1036,7 @@ yyisErrorAction (int yyaction) return yyaction == 0; } - /* GLRStates */ + /* GLRStates */ /** Return a fresh GLRStackItem in YYSTACKP. The item is an LR state * if YYISSTATE, and otherwise a semantic option. Callers should call @@ -1059,7 +1059,7 @@ yynewGLRStackItem (yyGLRStack* yystackp, yybool yyisState) * stack #YYK of *YYSTACKP. */ static void yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate, - yyGLRState* yyrhs, yyRuleNum yyrule) + yyGLRState* yyrhs, yyRuleNum yyrule) { yySemanticOption* yynewOption = &yynewGLRStackItem (yystackp, yyfalse)->yyoption; @@ -1079,7 +1079,7 @@ yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate, YY_RESERVE_GLRSTACK (yystackp); } - /* GLRStacks */ + /* GLRStacks */ /** Initialize YYSET to a singleton set containing an empty stack. */ static yybool @@ -1157,35 +1157,35 @@ yyexpandGLRStack (yyGLRStack* yystackp) { *yyp1 = *yyp0; if (*(yybool *) yyp0) - { - yyGLRState* yys0 = &yyp0->yystate; - yyGLRState* yys1 = &yyp1->yystate; - if (yys0->yypred != NULL) - yys1->yypred = - YYRELOC (yyp0, yyp1, yys0->yypred, yystate); - if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != NULL) - yys1->yysemantics.yyfirstVal = - YYRELOC(yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption); - } + { + yyGLRState* yys0 = &yyp0->yystate; + yyGLRState* yys1 = &yyp1->yystate; + if (yys0->yypred != NULL) + yys1->yypred = + YYRELOC (yyp0, yyp1, yys0->yypred, yystate); + if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != NULL) + yys1->yysemantics.yyfirstVal = + YYRELOC(yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption); + } else - { - yySemanticOption* yyv0 = &yyp0->yyoption; - yySemanticOption* yyv1 = &yyp1->yyoption; - if (yyv0->yystate != NULL) - yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate); - if (yyv0->yynext != NULL) - yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption); - } + { + yySemanticOption* yyv0 = &yyp0->yyoption; + yySemanticOption* yyv1 = &yyp1->yyoption; + if (yyv0->yystate != NULL) + yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate); + if (yyv0->yynext != NULL) + yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption); + } } if (yystackp->yysplitPoint != NULL) yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems, - yystackp->yysplitPoint, yystate); + yystackp->yysplitPoint, yystate); for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1) if (yystackp->yytops.yystates[yyn] != NULL) yystackp->yytops.yystates[yyn] = - YYRELOC (yystackp->yyitems, yynewItems, - yystackp->yytops.yystates[yyn], yystate); + YYRELOC (yystackp->yyitems, yynewItems, + yystackp->yytops.yystates[yyn], yystate); YYFREE (yystackp->yyitems); yystackp->yyitems = yynewItems; yystackp->yynextFree = yynewItems + yysize; @@ -1241,30 +1241,30 @@ yyremoveDeletes (yyGLRStack* yystackp) while (yyj < yystackp->yytops.yysize) { if (yystackp->yytops.yystates[yyi] == NULL) - { - if (yyi == yyj) - { - YYDPRINTF ((stderr, "Removing dead stacks.\n")); - } - yystackp->yytops.yysize -= 1; - } + { + if (yyi == yyj) + { + YYDPRINTF ((stderr, "Removing dead stacks.\n")); + } + yystackp->yytops.yysize -= 1; + } else - { - yystackp->yytops.yystates[yyj] = yystackp->yytops.yystates[yyi]; - /* In the current implementation, it's unnecessary to copy - yystackp->yytops.yylookaheadNeeds[yyi] since, after - yyremoveDeletes returns, the parser immediately either enters - deterministic operation or shifts a token. However, it doesn't - hurt, and the code might evolve to need it. */ - yystackp->yytops.yylookaheadNeeds[yyj] = - yystackp->yytops.yylookaheadNeeds[yyi]; - if (yyj != yyi) - { - YYDPRINTF ((stderr, "Rename stack %lu -> %lu.\n", - (unsigned long int) yyi, (unsigned long int) yyj)); - } - yyj += 1; - } + { + yystackp->yytops.yystates[yyj] = yystackp->yytops.yystates[yyi]; + /* In the current implementation, it's unnecessary to copy + yystackp->yytops.yylookaheadNeeds[yyi] since, after + yyremoveDeletes returns, the parser immediately either enters + deterministic operation or shifts a token. However, it doesn't + hurt, and the code might evolve to need it. */ + yystackp->yytops.yylookaheadNeeds[yyj] = + yystackp->yytops.yylookaheadNeeds[yyi]; + if (yyj != yyi) + { + YYDPRINTF ((stderr, "Rename stack %lu -> %lu.\n", + (unsigned long int) yyi, (unsigned long int) yyj)); + } + yyj += 1; + } yyi += 1; } } @@ -1274,8 +1274,8 @@ yyremoveDeletes (yyGLRStack* yystackp) * value *YYVALP and source location *YYLOCP. */ static inline void yyglrShift (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState, - size_t yyposn, - YYSTYPE* yyvalp, YYLTYPE* yylocp) + size_t yyposn, + YYSTYPE* yyvalp, YYLTYPE* yylocp) { yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate; @@ -1295,7 +1295,7 @@ yyglrShift (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState, * semantic value of YYRHS under the action for YYRULE. */ static inline void yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState, - size_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule) + size_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule) { yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate; @@ -1313,10 +1313,10 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState, #if !YYDEBUG # define YY_REDUCE_PRINT(Args) #else -# define YY_REDUCE_PRINT(Args) \ -do { \ - if (yydebug) \ - yy_reduce_print Args; \ +# define YY_REDUCE_PRINT(Args) \ +do { \ + if (yydebug) \ + yy_reduce_print Args; \ } while (YYID (0)) /*----------------------------------------------------------------------. @@ -1331,8 +1331,8 @@ yy_reduce_print (int yynormal, yyGLRStackItem* yyvsp, size_t yyk, yyRuleNum yyru int yyi; ]b4_parse_param_use[]dnl [ YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n", - (unsigned long int) yyk, yyrule - 1, - (unsigned long int) yyrline[yyrule]); + (unsigned long int) yyk, yyrule - 1, + (unsigned long int) yyrline[yyrule]); if (! yynormal) yyfillin (yyvsp, 1, -yynrhs); /* The symbols being reduced. */ @@ -1340,10 +1340,10 @@ yy_reduce_print (int yynormal, yyGLRStackItem* yyvsp, size_t yyk, yyRuleNum yyru { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, - yystos[yyvsp[yyi - yynrhs + 1].yystate.yylrState], - &yyvsp[yyi - yynrhs + 1].yystate.yysemantics.yysval - ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl - b4_user_args[); + yystos[yyvsp[yyi - yynrhs + 1].yystate.yylrState], + &yyvsp[yyi - yynrhs + 1].yystate.yysemantics.yysval + ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl + b4_user_args[); if (!yyvsp[yyi - yynrhs + 1].yystate.yyresolved) YYFPRINTF (stderr, " (unresolved)"); YYFPRINTF (stderr, "\n"); @@ -1359,7 +1359,7 @@ yy_reduce_print (int yynormal, yyGLRStackItem* yyvsp, size_t yyk, yyRuleNum yyru * for userAction. */ static inline YYRESULTTAG yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, - YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[) + YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[) { int yynrhs = yyrhsLength (yyrule); @@ -1373,7 +1373,7 @@ yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate; YY_REDUCE_PRINT ((1, yyrhs, yyk, yyrule]b4_user_args[)); return yyuserAction (yyrule, yynrhs, yyrhs, - yyvalp, yylocp, yystackp]b4_user_args[); + yyvalp, yylocp, yystackp]b4_user_args[); } else { @@ -1381,20 +1381,20 @@ yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, yyGLRState* yys; yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1]; yys = yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred - = yystackp->yytops.yystates[yyk];]b4_locations_if([[ + = yystackp->yytops.yystates[yyk];]b4_locations_if([[ if (yynrhs == 0) - /* Set default location. */ - yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yys->yyloc;]])[ + /* Set default location. */ + yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yys->yyloc;]])[ for (yyi = 0; yyi < yynrhs; yyi += 1) - { - yys = yys->yypred; - YYASSERT (yys); - } + { + yys = yys->yypred; + YYASSERT (yys); + } yyupdateSplit (yystackp, yys); yystackp->yytops.yystates[yyk] = yys; YY_REDUCE_PRINT ((0, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, yyk, yyrule]b4_user_args[)); return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, - yyvalp, yylocp, yystackp]b4_user_args[); + yyvalp, yylocp, yystackp]b4_user_args[); } } @@ -1411,7 +1411,7 @@ yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, */ static inline YYRESULTTAG yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, - yybool yyforceEval]b4_user_formals[) + yybool yyforceEval]b4_user_formals[) { size_t yyposn = yystackp->yytops.yystates[yyk]->yyposn; @@ -1422,19 +1422,19 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, YYLTYPE yyloc; yyflag = yydoAction (yystackp, yyk, yyrule, &yysval, - &yyloc]b4_user_args[); + &yyloc]b4_user_args[); if (yyflag == yyerr && yystackp->yysplitPoint != NULL) { - YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n", - (unsigned long int) yyk, yyrule - 1)); + YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n", + (unsigned long int) yyk, yyrule - 1)); } if (yyflag != yyok) return yyflag; YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyrule], &yysval, &yyloc); yyglrShift (yystackp, yyk, - yyLRgotoState (yystackp->yytops.yystates[yyk]->yylrState, - yylhsNonterm (yyrule)), - yyposn, &yysval, &yyloc); + yyLRgotoState (yystackp->yytops.yystates[yyk]->yylrState, + yylhsNonterm (yyrule)), + yyposn, &yysval, &yyloc); } else { @@ -1444,35 +1444,35 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule, yyStateNum yynewLRState; for (yys = yystackp->yytops.yystates[yyk], yyn = yyrhsLength (yyrule); - 0 < yyn; yyn -= 1) - { - yys = yys->yypred; - YYASSERT (yys); - } + 0 < yyn; yyn -= 1) + { + yys = yys->yypred; + YYASSERT (yys); + } yyupdateSplit (yystackp, yys); yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm (yyrule)); YYDPRINTF ((stderr, - "Reduced stack %lu by rule #%d; action deferred. Now in state %d.\n", - (unsigned long int) yyk, yyrule - 1, yynewLRState)); + "Reduced stack %lu by rule #%d; action deferred. Now in state %d.\n", + (unsigned long int) yyk, yyrule - 1, yynewLRState)); for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) - if (yyi != yyk && yystackp->yytops.yystates[yyi] != NULL) - { - yyGLRState* yyp, *yysplit = yystackp->yysplitPoint; - yyp = yystackp->yytops.yystates[yyi]; - while (yyp != yys && yyp != yysplit && yyp->yyposn >= yyposn) - { - if (yyp->yylrState == yynewLRState && yyp->yypred == yys) - { - yyaddDeferredAction (yystackp, yyk, yyp, yys0, yyrule); - yymarkStackDeleted (yystackp, yyk); - YYDPRINTF ((stderr, "Merging stack %lu into stack %lu.\n", - (unsigned long int) yyk, - (unsigned long int) yyi)); - return yyok; - } - yyp = yyp->yypred; - } - } + if (yyi != yyk && yystackp->yytops.yystates[yyi] != NULL) + { + yyGLRState* yyp, *yysplit = yystackp->yysplitPoint; + yyp = yystackp->yytops.yystates[yyi]; + while (yyp != yys && yyp != yysplit && yyp->yyposn >= yyposn) + { + if (yyp->yylrState == yynewLRState && yyp->yypred == yys) + { + yyaddDeferredAction (yystackp, yyk, yyp, yys0, yyrule); + yymarkStackDeleted (yystackp, yyk); + YYDPRINTF ((stderr, "Merging stack %lu into stack %lu.\n", + (unsigned long int) yyk, + (unsigned long int) yyi)); + return yyok; + } + yyp = yyp->yypred; + } + } yystackp->yytops.yystates[yyk] = yys; yyglrShiftDefer (yystackp, yyk, yynewLRState, yyposn, yys0, yyrule); } @@ -1495,24 +1495,24 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk) yynewStates = NULL; if (yystackp->yytops.yycapacity - > (YYSIZEMAX / (2 * sizeof yynewStates[0]))) - yyMemoryExhausted (yystackp); + > (YYSIZEMAX / (2 * sizeof yynewStates[0]))) + yyMemoryExhausted (yystackp); yystackp->yytops.yycapacity *= 2; yynewStates = - (yyGLRState**) YYREALLOC (yystackp->yytops.yystates, - (yystackp->yytops.yycapacity - * sizeof yynewStates[0])); + (yyGLRState**) YYREALLOC (yystackp->yytops.yystates, + (yystackp->yytops.yycapacity + * sizeof yynewStates[0])); if (yynewStates == NULL) - yyMemoryExhausted (yystackp); + yyMemoryExhausted (yystackp); yystackp->yytops.yystates = yynewStates; yynewLookaheadNeeds = - (yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds, - (yystackp->yytops.yycapacity - * sizeof yynewLookaheadNeeds[0])); + (yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds, + (yystackp->yytops.yycapacity + * sizeof yynewLookaheadNeeds[0])); if (yynewLookaheadNeeds == NULL) - yyMemoryExhausted (yystackp); + yyMemoryExhausted (yystackp); yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds; } yystackp->yytops.yystates[yystackp->yytops.yysize] @@ -1534,11 +1534,11 @@ yyidenticalOptions (yySemanticOption* yyy0, yySemanticOption* yyy1) yyGLRState *yys0, *yys1; int yyn; for (yys0 = yyy0->yystate, yys1 = yyy1->yystate, - yyn = yyrhsLength (yyy0->yyrule); - yyn > 0; - yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1) - if (yys0->yyposn != yys1->yyposn) - return yyfalse; + yyn = yyrhsLength (yyy0->yyrule); + yyn > 0; + yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1) + if (yys0->yyposn != yys1->yyposn) + return yyfalse; return yytrue; } else @@ -1558,43 +1558,43 @@ yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1) yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1) { if (yys0 == yys1) - break; + break; else if (yys0->yyresolved) - { - yys1->yyresolved = yytrue; - yys1->yysemantics.yysval = yys0->yysemantics.yysval; - } + { + yys1->yyresolved = yytrue; + yys1->yysemantics.yysval = yys0->yysemantics.yysval; + } else if (yys1->yyresolved) - { - yys0->yyresolved = yytrue; - yys0->yysemantics.yysval = yys1->yysemantics.yysval; - } + { + yys0->yyresolved = yytrue; + yys0->yysemantics.yysval = yys1->yysemantics.yysval; + } else - { - yySemanticOption** yyz0p; - yySemanticOption* yyz1; - yyz0p = &yys0->yysemantics.yyfirstVal; - yyz1 = yys1->yysemantics.yyfirstVal; - while (YYID (yytrue)) - { - if (yyz1 == *yyz0p || yyz1 == NULL) - break; - else if (*yyz0p == NULL) - { - *yyz0p = yyz1; - break; - } - else if (*yyz0p < yyz1) - { - yySemanticOption* yyz = *yyz0p; - *yyz0p = yyz1; - yyz1 = yyz1->yynext; - (*yyz0p)->yynext = yyz; - } - yyz0p = &(*yyz0p)->yynext; - } - yys1->yysemantics.yyfirstVal = yys0->yysemantics.yyfirstVal; - } + { + yySemanticOption** yyz0p; + yySemanticOption* yyz1; + yyz0p = &yys0->yysemantics.yyfirstVal; + yyz1 = yys1->yysemantics.yyfirstVal; + while (YYID (yytrue)) + { + if (yyz1 == *yyz0p || yyz1 == NULL) + break; + else if (*yyz0p == NULL) + { + *yyz0p = yyz1; + break; + } + else if (*yyz0p < yyz1) + { + yySemanticOption* yyz = *yyz0p; + *yyz0p = yyz1; + yyz1 = yyz1->yynext; + (*yyz0p)->yynext = yyz; + } + yyz0p = &(*yyz0p)->yynext; + } + yys1->yysemantics.yyfirstVal = yys0->yysemantics.yyfirstVal; + } } } @@ -1610,9 +1610,9 @@ yypreference (yySemanticOption* y0, yySemanticOption* y1) if (p0 == p1) { if (yymerger[r0] == 0 || yymerger[r0] != yymerger[r1]) - return 0; + return 0; else - return 1; + return 1; } if (p0 == 0 || p1 == 0) return 0; @@ -1624,7 +1624,7 @@ yypreference (yySemanticOption* y0, yySemanticOption* y1) } static YYRESULTTAG yyresolveValue (yyGLRState* yys, - yyGLRStack* yystackp]b4_user_formals[); + yyGLRStack* yystackp]b4_user_formals[); /** Resolve the previous YYN states starting at and including state YYS @@ -1634,14 +1634,14 @@ static YYRESULTTAG yyresolveValue (yyGLRState* yys, * data so that yydestroyGLRState can be invoked if necessary. */ static YYRESULTTAG yyresolveStates (yyGLRState* yys, int yyn, - yyGLRStack* yystackp]b4_user_formals[) + yyGLRStack* yystackp]b4_user_formals[) { if (0 < yyn) { YYASSERT (yys->yypred); YYCHK (yyresolveStates (yys->yypred, yyn-1, yystackp]b4_user_args[)); if (! yys->yyresolved) - YYCHK (yyresolveValue (yys, yystackp]b4_user_args[)); + YYCHK (yyresolveValue (yys, yystackp]b4_user_args[)); } return yyok; } @@ -1653,7 +1653,7 @@ yyresolveStates (yyGLRState* yys, int yyn, * semantic values if invoked). */ static YYRESULTTAG yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp, - YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[) + YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[) { yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1]; int yynrhs; @@ -1668,7 +1668,7 @@ yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp, { yyGLRState *yys; for (yys = yyopt->yystate; yynrhs > 0; yys = yys->yypred, yynrhs -= 1) - yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[); + yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[); return yyflag; } @@ -1683,8 +1683,8 @@ yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp, yylval = yyopt->yyval; yylloc = yyopt->yyloc; yyflag = yyuserAction (yyopt->yyrule, yynrhs, - yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, - yyvalp, yylocp, yystackp]b4_user_args[); + yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, + yyvalp, yylocp, yystackp]b4_user_args[); yychar = yychar_current; yylval = yylval_current; yylloc = yylloc_current; @@ -1713,35 +1713,35 @@ yyreportTree (yySemanticOption* yyx, int yyindent) if (yyx->yystate->yyposn < yys->yyposn + 1) YYFPRINTF (stderr, "%*s%s -> \n", - yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)), - yyx->yyrule - 1); + yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)), + yyx->yyrule - 1); else YYFPRINTF (stderr, "%*s%s -> \n", - yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)), - yyx->yyrule - 1, (unsigned long int) (yys->yyposn + 1), - (unsigned long int) yyx->yystate->yyposn); + yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)), + yyx->yyrule - 1, (unsigned long int) (yys->yyposn + 1), + (unsigned long int) yyx->yystate->yyposn); for (yyi = 1; yyi <= yynrhs; yyi += 1) { if (yystates[yyi]->yyresolved) - { - if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn) - YYFPRINTF (stderr, "%*s%s \n", yyindent+2, "", - yytokenName (yystos[yystates[yyi-1]->yylrState])); - else - YYFPRINTF (stderr, "%*s%s \n", yyindent+2, "", - yytokenName (yystos[yystates[yyi-1]->yylrState]), - (unsigned long int) (yystates[yyi-1]->yyposn + 1), - (unsigned long int) yystates[yyi]->yyposn); - } + { + if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn) + YYFPRINTF (stderr, "%*s%s \n", yyindent+2, "", + yytokenName (yystos[yystates[yyi-1]->yylrState])); + else + YYFPRINTF (stderr, "%*s%s \n", yyindent+2, "", + yytokenName (yystos[yystates[yyi-1]->yylrState]), + (unsigned long int) (yystates[yyi-1]->yyposn + 1), + (unsigned long int) yystates[yyi]->yyposn); + } else - yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2); + yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2); } } #endif /*ARGSUSED*/ static YYRESULTTAG yyreportAmbiguity (yySemanticOption* yyx0, - yySemanticOption* yyx1]b4_pure_formals[) + yySemanticOption* yyx1]b4_pure_formals[) { YYUSE (yyx0); YYUSE (yyx1); @@ -1764,56 +1764,56 @@ yyreportAmbiguity (yySemanticOption* yyx0, * The first semantic option of a state is always chosen. */ static void yyresolveLocations (yyGLRState* yys1, int yyn1, - yyGLRStack *yystackp]b4_user_formals[) + yyGLRStack *yystackp]b4_user_formals[) { if (0 < yyn1) { yyresolveLocations (yys1->yypred, yyn1 - 1, yystackp]b4_user_args[); if (!yys1->yyresolved) - { - yySemanticOption *yyoption; - yyGLRStackItem yyrhsloc[1 + YYMAXRHS]; - int yynrhs; - int yychar_current; - YYSTYPE yylval_current; - YYLTYPE yylloc_current; - yyoption = yys1->yysemantics.yyfirstVal; - YYASSERT (yyoption != NULL); - yynrhs = yyrhsLength (yyoption->yyrule); - if (yynrhs > 0) - { - yyGLRState *yys; - int yyn; - yyresolveLocations (yyoption->yystate, yynrhs, - yystackp]b4_user_args[); - for (yys = yyoption->yystate, yyn = yynrhs; - yyn > 0; - yys = yys->yypred, yyn -= 1) - yyrhsloc[yyn].yystate.yyloc = yys->yyloc; - } - else - { - /* Both yyresolveAction and yyresolveLocations traverse the GSS - in reverse rightmost order. It is only necessary to invoke - yyresolveLocations on a subforest for which yyresolveAction - would have been invoked next had an ambiguity not been - detected. Thus the location of the previous state (but not - necessarily the previous state itself) is guaranteed to be - resolved already. */ - yyGLRState *yyprevious = yyoption->yystate; - yyrhsloc[0].yystate.yyloc = yyprevious->yyloc; - } - yychar_current = yychar; - yylval_current = yylval; - yylloc_current = yylloc; - yychar = yyoption->yyrawchar; - yylval = yyoption->yyval; - yylloc = yyoption->yyloc; - YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs); - yychar = yychar_current; - yylval = yylval_current; - yylloc = yylloc_current; - } + { + yySemanticOption *yyoption; + yyGLRStackItem yyrhsloc[1 + YYMAXRHS]; + int yynrhs; + int yychar_current; + YYSTYPE yylval_current; + YYLTYPE yylloc_current; + yyoption = yys1->yysemantics.yyfirstVal; + YYASSERT (yyoption != NULL); + yynrhs = yyrhsLength (yyoption->yyrule); + if (yynrhs > 0) + { + yyGLRState *yys; + int yyn; + yyresolveLocations (yyoption->yystate, yynrhs, + yystackp]b4_user_args[); + for (yys = yyoption->yystate, yyn = yynrhs; + yyn > 0; + yys = yys->yypred, yyn -= 1) + yyrhsloc[yyn].yystate.yyloc = yys->yyloc; + } + else + { + /* Both yyresolveAction and yyresolveLocations traverse the GSS + in reverse rightmost order. It is only necessary to invoke + yyresolveLocations on a subforest for which yyresolveAction + would have been invoked next had an ambiguity not been + detected. Thus the location of the previous state (but not + necessarily the previous state itself) is guaranteed to be + resolved already. */ + yyGLRState *yyprevious = yyoption->yystate; + yyrhsloc[0].yystate.yyloc = yyprevious->yyloc; + } + yychar_current = yychar; + yylval_current = yylval; + yylloc_current = yylloc; + yychar = yyoption->yyrawchar; + yylval = yyoption->yyval; + yylloc = yyoption->yyloc; + YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs); + yychar = yychar_current; + yylval = yylval_current; + yylloc = yylloc_current; + } } }]])[ @@ -1842,35 +1842,35 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[) yySemanticOption* yyp = *yypp; if (yyidenticalOptions (yybest, yyp)) - { - yymergeOptionSets (yybest, yyp); - *yypp = yyp->yynext; - } + { + yymergeOptionSets (yybest, yyp); + *yypp = yyp->yynext; + } else - { - switch (yypreference (yybest, yyp)) - { - case 0:]b4_locations_if([[ - yyresolveLocations (yys, 1, yystackp]b4_user_args[);]])[ - return yyreportAmbiguity (yybest, yyp]b4_pure_args[); - break; - case 1: - yymerge = yytrue; - break; - case 2: - break; - case 3: - yybest = yyp; - yymerge = yyfalse; - break; - default: - /* This cannot happen so it is not worth a YYASSERT (yyfalse), - but some compilers complain if the default case is - omitted. */ - break; - } - yypp = &yyp->yynext; - } + { + switch (yypreference (yybest, yyp)) + { + case 0:]b4_locations_if([[ + yyresolveLocations (yys, 1, yystackp]b4_user_args[);]])[ + return yyreportAmbiguity (yybest, yyp]b4_pure_args[); + break; + case 1: + yymerge = yytrue; + break; + case 2: + break; + case 3: + yybest = yyp; + yymerge = yyfalse; + break; + default: + /* This cannot happen so it is not worth a YYASSERT (yyfalse), + but some compilers complain if the default case is + omitted. */ + break; + } + yypp = &yyp->yynext; + } } if (yymerge) @@ -1878,26 +1878,26 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[) yySemanticOption* yyp; int yyprec = yydprec[yybest->yyrule]; yyflag = yyresolveAction (yybest, yystackp, &yysval, - yylocp]b4_user_args[); + yylocp]b4_user_args[); if (yyflag == yyok) - for (yyp = yybest->yynext; yyp != NULL; yyp = yyp->yynext) - { - if (yyprec == yydprec[yyp->yyrule]) - { - YYSTYPE yysval_other; - YYLTYPE yydummy; - yyflag = yyresolveAction (yyp, yystackp, &yysval_other, - &yydummy]b4_user_args[); - if (yyflag != yyok) - { - yydestruct ("Cleanup: discarding incompletely merged value for", - yystos[yys->yylrState], - &yysval]b4_locations_if([, yylocp])[]b4_user_args[); - break; - } - yyuserMerge (yymerger[yyp->yyrule], &yysval, &yysval_other); - } - } + for (yyp = yybest->yynext; yyp != NULL; yyp = yyp->yynext) + { + if (yyprec == yydprec[yyp->yyrule]) + { + YYSTYPE yysval_other; + YYLTYPE yydummy; + yyflag = yyresolveAction (yyp, yystackp, &yysval_other, + &yydummy]b4_user_args[); + if (yyflag != yyok) + { + yydestruct ("Cleanup: discarding incompletely merged value for", + yystos[yys->yylrState], + &yysval]b4_locations_if([, yylocp])[]b4_user_args[); + break; + } + yyuserMerge (yymerger[yyp->yyrule], &yysval, &yysval_other); + } + } } else yyflag = yyresolveAction (yybest, yystackp, &yysval, yylocp]b4_user_args[); @@ -1921,11 +1921,11 @@ yyresolveStack (yyGLRStack* yystackp]b4_user_formals[) int yyn; for (yyn = 0, yys = yystackp->yytops.yystates[0]; - yys != yystackp->yysplitPoint; - yys = yys->yypred, yyn += 1) - continue; + yys != yystackp->yysplitPoint; + yys = yys->yypred, yyn += 1) + continue; YYCHK (yyresolveStates (yystackp->yytops.yystates[0], yyn, yystackp - ]b4_user_args[)); + ]b4_user_args[)); } return yyok; } @@ -1962,112 +1962,112 @@ yycompressStack (yyGLRStack* yystackp) static YYRESULTTAG yyprocessOneStack (yyGLRStack* yystackp, size_t yyk, - size_t yyposn]b4_pure_formals[) + size_t yyposn]b4_pure_formals[) { while (yystackp->yytops.yystates[yyk] != NULL) { yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState; YYDPRINTF ((stderr, "Stack %lu Entering state %d\n", - (unsigned long int) yyk, yystate)); + (unsigned long int) yyk, yystate)); YYASSERT (yystate != YYFINAL); if (yyisDefaultedState (yystate)) - { + { YYRESULTTAG yyflag; yyRuleNum yyrule = yydefaultAction (yystate); - if (yyrule == 0) - { - YYDPRINTF ((stderr, "Stack %lu dies.\n", - (unsigned long int) yyk)); - yymarkStackDeleted (yystackp, yyk); - return yyok; - } - yyflag = yyglrReduce (yystackp, yyk, yyrule, yyimmediate[yyrule]]b4_user_args[); + if (yyrule == 0) + { + YYDPRINTF ((stderr, "Stack %lu dies.\n", + (unsigned long int) yyk)); + yymarkStackDeleted (yystackp, yyk); + return yyok; + } + yyflag = yyglrReduce (yystackp, yyk, yyrule, yyimmediate[yyrule]]b4_user_args[); if (yyflag == yyerr) { - YYDPRINTF ((stderr, "Stack %lu dies (predicate failure or explicit user error).\n", - (unsigned long int) yyk)); - yymarkStackDeleted (yystackp, yyk); - return yyok; - } - if (yyflag != yyok) + YYDPRINTF ((stderr, "Stack %lu dies (predicate failure or explicit user error).\n", + (unsigned long int) yyk)); + yymarkStackDeleted (yystackp, yyk); + return yyok; + } + if (yyflag != yyok) return yyflag; - } + } else - { - yySymbol yytoken; + { + yySymbol yytoken; int yyaction; const short int* yyconflicts; - yystackp->yytops.yylookaheadNeeds[yyk] = yytrue; - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts); - - while (*yyconflicts != 0) - { - YYRESULTTAG yyflag; - size_t yynewStack = yysplitStack (yystackp, yyk); - YYDPRINTF ((stderr, "Splitting off stack %lu from %lu.\n", - (unsigned long int) yynewStack, - (unsigned long int) yyk)); - yyflag = yyglrReduce (yystackp, yynewStack, - *yyconflicts, - yyimmediate[*yyconflicts]]b4_user_args[); + yystackp->yytops.yylookaheadNeeds[yyk] = yytrue; + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts); + + while (*yyconflicts != 0) + { + YYRESULTTAG yyflag; + size_t yynewStack = yysplitStack (yystackp, yyk); + YYDPRINTF ((stderr, "Splitting off stack %lu from %lu.\n", + (unsigned long int) yynewStack, + (unsigned long int) yyk)); + yyflag = yyglrReduce (yystackp, yynewStack, + *yyconflicts, + yyimmediate[*yyconflicts]]b4_user_args[); if (yyflag == yyok) - YYCHK (yyprocessOneStack (yystackp, yynewStack, - yyposn]b4_pure_args[)); - else if (yyflag == yyerr) - { - YYDPRINTF ((stderr, "Stack %lu dies.\n", - (unsigned long int) yynewStack)); - yymarkStackDeleted (yystackp, yynewStack); - } - else - return yyflag; - yyconflicts += 1; - } - - if (yyisShiftAction (yyaction)) - break; - else if (yyisErrorAction (yyaction)) - { - YYDPRINTF ((stderr, "Stack %lu dies.\n", - (unsigned long int) yyk)); - yymarkStackDeleted (yystackp, yyk); - break; - } - else + YYCHK (yyprocessOneStack (yystackp, yynewStack, + yyposn]b4_pure_args[)); + else if (yyflag == yyerr) + { + YYDPRINTF ((stderr, "Stack %lu dies.\n", + (unsigned long int) yynewStack)); + yymarkStackDeleted (yystackp, yynewStack); + } + else + return yyflag; + yyconflicts += 1; + } + + if (yyisShiftAction (yyaction)) + break; + else if (yyisErrorAction (yyaction)) { - YYRESULTTAG yyflag = yyglrReduce (yystackp, yyk, -yyaction, + YYDPRINTF ((stderr, "Stack %lu dies.\n", + (unsigned long int) yyk)); + yymarkStackDeleted (yystackp, yyk); + break; + } + else + { + YYRESULTTAG yyflag = yyglrReduce (yystackp, yyk, -yyaction, yyimmediate[-yyaction]]b4_user_args[); - if (yyflag == yyerr) + if (yyflag == yyerr) { - YYDPRINTF ((stderr, "Stack %lu dies (predicate failure or explicit user error).\n", - (unsigned long int) yyk)); - yymarkStackDeleted (yystackp, yyk); + YYDPRINTF ((stderr, "Stack %lu dies (predicate failure or explicit user error).\n", + (unsigned long int) yyk)); + yymarkStackDeleted (yystackp, yyk); break; - } - else if (yyflag != yyok) + } + else if (yyflag != yyok) return yyflag; } - } + } } return yyok; } @@ -2215,45 +2215,45 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[) reductions. Skip tokens until we can proceed. */ while (YYID (yytrue)) { - yySymbol yytoken; - if (yychar == YYEOF) - yyFail (yystackp][]b4_lpure_args[, NULL); - if (yychar != YYEMPTY) - {]b4_locations_if([[ - /* We throw away the lookahead, but the error range - of the shifted error token must take it into account. */ - yyGLRState *yys = yystackp->yytops.yystates[0]; - yyGLRStackItem yyerror_range[3]; - yyerror_range[1].yystate.yyloc = yys->yyloc; - yyerror_range[2].yystate.yyloc = yylloc; - YYLLOC_DEFAULT ((yys->yyloc), yyerror_range, 2);]])[ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Error: discarding", - yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[); - } - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - yyj = yypact[yystackp->yytops.yystates[0]->yylrState]; - if (yypact_value_is_default (yyj)) - return; - yyj += yytoken; - if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken) - { - if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0) - return; - } - else if (! yytable_value_is_error (yytable[yyj])) - return; + yySymbol yytoken; + if (yychar == YYEOF) + yyFail (yystackp][]b4_lpure_args[, NULL); + if (yychar != YYEMPTY) + {]b4_locations_if([[ + /* We throw away the lookahead, but the error range + of the shifted error token must take it into account. */ + yyGLRState *yys = yystackp->yytops.yystates[0]; + yyGLRStackItem yyerror_range[3]; + yyerror_range[1].yystate.yyloc = yys->yyloc; + yyerror_range[2].yystate.yyloc = yylloc; + YYLLOC_DEFAULT ((yys->yyloc), yyerror_range, 2);]])[ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Error: discarding", + yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[); + } + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + yyj = yypact[yystackp->yytops.yystates[0]->yylrState]; + if (yypact_value_is_default (yyj)) + return; + yyj += yytoken; + if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken) + { + if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0) + return; + } + else if (! yytable_value_is_error (yytable[yyj])) + return; } /* Reduce to one stack. */ @@ -2274,26 +2274,26 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[) yyGLRState *yys = yystackp->yytops.yystates[0]; yyj = yypact[yys->yylrState]; if (! yypact_value_is_default (yyj)) - { - yyj += YYTERROR; - if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR - && yyisShiftAction (yytable[yyj])) - { - /* Shift the error token having adjusted its location. */ - YYLTYPE yyerrloc;]b4_locations_if([[ - yystackp->yyerror_range[2].yystate.yyloc = yylloc; - YYLLOC_DEFAULT (yyerrloc, (yystackp->yyerror_range), 2);]])[ - YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]], - &yylval, &yyerrloc); - yyglrShift (yystackp, 0, yytable[yyj], - yys->yyposn, &yylval, &yyerrloc); - yys = yystackp->yytops.yystates[0]; - break; - } - } + { + yyj += YYTERROR; + if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR + && yyisShiftAction (yytable[yyj])) + { + /* Shift the error token having adjusted its location. */ + YYLTYPE yyerrloc;]b4_locations_if([[ + yystackp->yyerror_range[2].yystate.yyloc = yylloc; + YYLLOC_DEFAULT (yyerrloc, (yystackp->yyerror_range), 2);]])[ + YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]], + &yylval, &yyerrloc); + yyglrShift (yystackp, 0, yytable[yyj], + yys->yyposn, &yylval, &yyerrloc); + yys = yystackp->yytops.yystates[0]; + break; + } + } ]b4_locations_if([[ yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[ if (yys->yypred != NULL) - yydestroyGLRState ("Error: popping", yys]b4_user_args[); + yydestroyGLRState ("Error: popping", yys]b4_user_args[); yystackp->yytops.yystates[0] = yys->yypred; yystackp->yynextFree -= 1; yystackp->yyspaceLeft += 1; @@ -2302,20 +2302,20 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[) yyFail (yystackp][]b4_lpure_args[, NULL); } -#define YYCHK1(YYE) \ - do { \ - switch (YYE) { \ - case yyok: \ - break; \ - case yyabort: \ - goto yyabortlab; \ - case yyaccept: \ - goto yyacceptlab; \ - case yyerr: \ - goto yyuser_error; \ - default: \ - goto yybuglab; \ - } \ +#define YYCHK1(YYE) \ + do { \ + switch (YYE) { \ + case yyok: \ + break; \ + case yyabort: \ + goto yyabortlab; \ + case yyaccept: \ + goto yyacceptlab; \ + case yyerr: \ + goto yyuser_error; \ + default: \ + goto yybuglab; \ + } \ } while (YYID (0)) /*----------. @@ -2362,148 +2362,148 @@ m4_popdef([b4_at_dollar])])dnl while (YYID (yytrue)) { /* For efficiency, we have two loops, the first of which is - specialized to deterministic operation (single stack, no - potential ambiguity). */ + specialized to deterministic operation (single stack, no + potential ambiguity). */ /* Standard mode */ while (YYID (yytrue)) - { - yyRuleNum yyrule; - int yyaction; - const short int* yyconflicts; - - yyStateNum yystate = yystack.yytops.yystates[0]->yylrState; - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - if (yystate == YYFINAL) - goto yyacceptlab; - if (yyisDefaultedState (yystate)) - { - yyrule = yydefaultAction (yystate); - if (yyrule == 0) - { -]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ - yyreportSyntaxError (&yystack]b4_user_args[); - goto yyuser_error; - } - YYCHK1 (yyglrReduce (&yystack, 0, yyrule, yytrue]b4_user_args[)); - } - else - { - yySymbol yytoken; - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts); - if (*yyconflicts != 0) - break; - if (yyisShiftAction (yyaction)) - { - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - yychar = YYEMPTY; - yyposn += 1; - yyglrShift (&yystack, 0, yyaction, yyposn, &yylval, &yylloc); - if (0 < yystack.yyerrState) - yystack.yyerrState -= 1; - } - else if (yyisErrorAction (yyaction)) - { -]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ - yyreportSyntaxError (&yystack]b4_user_args[); - goto yyuser_error; - } - else - YYCHK1 (yyglrReduce (&yystack, 0, -yyaction, yytrue]b4_user_args[)); - } - } + { + yyRuleNum yyrule; + int yyaction; + const short int* yyconflicts; + + yyStateNum yystate = yystack.yytops.yystates[0]->yylrState; + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + goto yyacceptlab; + if (yyisDefaultedState (yystate)) + { + yyrule = yydefaultAction (yystate); + if (yyrule == 0) + { +]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ + yyreportSyntaxError (&yystack]b4_user_args[); + goto yyuser_error; + } + YYCHK1 (yyglrReduce (&yystack, 0, yyrule, yytrue]b4_user_args[)); + } + else + { + yySymbol yytoken; + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts); + if (*yyconflicts != 0) + break; + if (yyisShiftAction (yyaction)) + { + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + yychar = YYEMPTY; + yyposn += 1; + yyglrShift (&yystack, 0, yyaction, yyposn, &yylval, &yylloc); + if (0 < yystack.yyerrState) + yystack.yyerrState -= 1; + } + else if (yyisErrorAction (yyaction)) + { +]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ + yyreportSyntaxError (&yystack]b4_user_args[); + goto yyuser_error; + } + else + YYCHK1 (yyglrReduce (&yystack, 0, -yyaction, yytrue]b4_user_args[)); + } + } while (YYID (yytrue)) - { - yySymbol yytoken_to_shift; - size_t yys; - - for (yys = 0; yys < yystack.yytops.yysize; yys += 1) - yystackp->yytops.yylookaheadNeeds[yys] = yychar != YYEMPTY; - - /* yyprocessOneStack returns one of three things: - - - An error flag. If the caller is yyprocessOneStack, it - immediately returns as well. When the caller is finally - yyparse, it jumps to an error label via YYCHK1. - - - yyok, but yyprocessOneStack has invoked yymarkStackDeleted - (&yystack, yys), which sets the top state of yys to NULL. Thus, - yyparse's following invocation of yyremoveDeletes will remove - the stack. - - - yyok, when ready to shift a token. - - Except in the first case, yyparse will invoke yyremoveDeletes and - then shift the next token onto all remaining stacks. This - synchronization of the shift (that is, after all preceding - reductions on all stacks) helps prevent double destructor calls - on yylval in the event of memory exhaustion. */ - - for (yys = 0; yys < yystack.yytops.yysize; yys += 1) - YYCHK1 (yyprocessOneStack (&yystack, yys, yyposn]b4_lpure_args[)); - yyremoveDeletes (&yystack); - if (yystack.yytops.yysize == 0) - { - yyundeleteLastStack (&yystack); - if (yystack.yytops.yysize == 0) - yyFail (&yystack][]b4_lpure_args[, YY_("syntax error")); - YYCHK1 (yyresolveStack (&yystack]b4_user_args[)); - YYDPRINTF ((stderr, "Returning to deterministic operation.\n")); -]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ - yyreportSyntaxError (&yystack]b4_user_args[); - goto yyuser_error; - } - - /* If any yyglrShift call fails, it will fail after shifting. Thus, - a copy of yylval will already be on stack 0 in the event of a - failure in the following loop. Thus, yychar is set to YYEMPTY - before the loop to make sure the user destructor for yylval isn't - called twice. */ - yytoken_to_shift = YYTRANSLATE (yychar); - yychar = YYEMPTY; - yyposn += 1; - for (yys = 0; yys < yystack.yytops.yysize; yys += 1) - { - int yyaction; - const short int* yyconflicts; - yyStateNum yystate = yystack.yytops.yystates[yys]->yylrState; - yygetLRActions (yystate, yytoken_to_shift, &yyaction, - &yyconflicts); - /* Note that yyconflicts were handled by yyprocessOneStack. */ - YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long int) yys)); - YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc); - yyglrShift (&yystack, yys, yyaction, yyposn, - &yylval, &yylloc); - YYDPRINTF ((stderr, "Stack %lu now in state #%d\n", - (unsigned long int) yys, - yystack.yytops.yystates[yys]->yylrState)); - } - - if (yystack.yytops.yysize == 1) - { - YYCHK1 (yyresolveStack (&yystack]b4_user_args[)); - YYDPRINTF ((stderr, "Returning to deterministic operation.\n")); - yycompressStack (&yystack); - break; - } - } + { + yySymbol yytoken_to_shift; + size_t yys; + + for (yys = 0; yys < yystack.yytops.yysize; yys += 1) + yystackp->yytops.yylookaheadNeeds[yys] = yychar != YYEMPTY; + + /* yyprocessOneStack returns one of three things: + + - An error flag. If the caller is yyprocessOneStack, it + immediately returns as well. When the caller is finally + yyparse, it jumps to an error label via YYCHK1. + + - yyok, but yyprocessOneStack has invoked yymarkStackDeleted + (&yystack, yys), which sets the top state of yys to NULL. Thus, + yyparse's following invocation of yyremoveDeletes will remove + the stack. + + - yyok, when ready to shift a token. + + Except in the first case, yyparse will invoke yyremoveDeletes and + then shift the next token onto all remaining stacks. This + synchronization of the shift (that is, after all preceding + reductions on all stacks) helps prevent double destructor calls + on yylval in the event of memory exhaustion. */ + + for (yys = 0; yys < yystack.yytops.yysize; yys += 1) + YYCHK1 (yyprocessOneStack (&yystack, yys, yyposn]b4_lpure_args[)); + yyremoveDeletes (&yystack); + if (yystack.yytops.yysize == 0) + { + yyundeleteLastStack (&yystack); + if (yystack.yytops.yysize == 0) + yyFail (&yystack][]b4_lpure_args[, YY_("syntax error")); + YYCHK1 (yyresolveStack (&yystack]b4_user_args[)); + YYDPRINTF ((stderr, "Returning to deterministic operation.\n")); +]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ + yyreportSyntaxError (&yystack]b4_user_args[); + goto yyuser_error; + } + + /* If any yyglrShift call fails, it will fail after shifting. Thus, + a copy of yylval will already be on stack 0 in the event of a + failure in the following loop. Thus, yychar is set to YYEMPTY + before the loop to make sure the user destructor for yylval isn't + called twice. */ + yytoken_to_shift = YYTRANSLATE (yychar); + yychar = YYEMPTY; + yyposn += 1; + for (yys = 0; yys < yystack.yytops.yysize; yys += 1) + { + int yyaction; + const short int* yyconflicts; + yyStateNum yystate = yystack.yytops.yystates[yys]->yylrState; + yygetLRActions (yystate, yytoken_to_shift, &yyaction, + &yyconflicts); + /* Note that yyconflicts were handled by yyprocessOneStack. */ + YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long int) yys)); + YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc); + yyglrShift (&yystack, yys, yyaction, yyposn, + &yylval, &yylloc); + YYDPRINTF ((stderr, "Stack %lu now in state #%d\n", + (unsigned long int) yys, + yystack.yytops.yystates[yys]->yylrState)); + } + + if (yystack.yytops.yysize == 1) + { + YYCHK1 (yyresolveStack (&yystack]b4_user_args[)); + YYDPRINTF ((stderr, "Returning to deterministic operation.\n")); + yycompressStack (&yystack); + break; + } + } continue; yyuser_error: yyrecoverSyntaxError (&yystack]b4_user_args[); @@ -2530,8 +2530,8 @@ m4_popdef([b4_at_dollar])])dnl yyreturn: if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", - YYTRANSLATE (yychar), - &yylval]b4_locations_if([, &yylloc])[]b4_user_args[); + YYTRANSLATE (yychar), + &yylval]b4_locations_if([, &yylloc])[]b4_user_args[); /* If the stack is well-formed, pop the stack until it is empty, destroying its entries as we go. But free the stack regardless @@ -2540,25 +2540,25 @@ m4_popdef([b4_at_dollar])])dnl { yyGLRState** yystates = yystack.yytops.yystates; if (yystates) - { - size_t yysize = yystack.yytops.yysize; - size_t yyk; - for (yyk = 0; yyk < yysize; yyk += 1) - if (yystates[yyk]) - { - while (yystates[yyk]) - { - yyGLRState *yys = yystates[yyk]; -]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]] -)[ if (yys->yypred != NULL) - yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[); - yystates[yyk] = yys->yypred; - yystack.yynextFree -= 1; - yystack.yyspaceLeft += 1; - } - break; - } - } + { + size_t yysize = yystack.yytops.yysize; + size_t yyk; + for (yyk = 0; yyk < yysize; yyk += 1) + if (yystates[yyk]) + { + while (yystates[yyk]) + { + yyGLRState *yys = yystates[yyk]; +]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]] +)[ if (yys->yypred != NULL) + yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[); + yystates[yyk] = yys->yypred; + yystack.yynextFree -= 1; + yystack.yyspaceLeft += 1; + } + break; + } + } yyfreeGLRStack (&yystack); } @@ -2600,7 +2600,7 @@ yypstack (yyGLRStack* yystackp, size_t yyk) yypstates (yystackp->yytops.yystates[yyk]); } -#define YYINDEX(YYX) \ +#define YYINDEX(YYX) \ ((YYX) == NULL ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems) @@ -2614,29 +2614,29 @@ yypdumpstack (yyGLRStack* yystackp) YYFPRINTF (stderr, "%3lu. ", (unsigned long int) (yyp - yystackp->yyitems)); if (*(yybool *) yyp) - { - YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld", - yyp->yystate.yyresolved, yyp->yystate.yylrState, - (unsigned long int) yyp->yystate.yyposn, - (long int) YYINDEX (yyp->yystate.yypred)); - if (! yyp->yystate.yyresolved) - YYFPRINTF (stderr, ", firstVal: %ld", - (long int) YYINDEX (yyp->yystate + { + YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld", + yyp->yystate.yyresolved, yyp->yystate.yylrState, + (unsigned long int) yyp->yystate.yyposn, + (long int) YYINDEX (yyp->yystate.yypred)); + if (! yyp->yystate.yyresolved) + YYFPRINTF (stderr, ", firstVal: %ld", + (long int) YYINDEX (yyp->yystate .yysemantics.yyfirstVal)); - } + } else - { - YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld", - yyp->yyoption.yyrule - 1, - (long int) YYINDEX (yyp->yyoption.yystate), - (long int) YYINDEX (yyp->yyoption.yynext)); - } + { + YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld", + yyp->yyoption.yyrule - 1, + (long int) YYINDEX (yyp->yyoption.yystate), + (long int) YYINDEX (yyp->yyoption.yynext)); + } YYFPRINTF (stderr, "\n"); } YYFPRINTF (stderr, "Tops:"); for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) YYFPRINTF (stderr, "%lu: %ld; ", (unsigned long int) yyi, - (long int) YYINDEX (yystackp->yytops.yystates[yyi])); + (long int) YYINDEX (yystackp->yytops.yystates[yyi])); YYFPRINTF (stderr, "\n"); } #endif diff --git a/data/glr.cc b/data/glr.cc index e8f495bb..d373eb6f 100644 --- a/data/glr.cc +++ b/data/glr.cc @@ -77,9 +77,9 @@ m4_define([b4_yy_symbol_print_generate], [[FILE *], []], [[int yytype], [yytype]], [[const b4_namespace_ref::b4_parser_class_name::semantic_type *yyvaluep], - [yyvaluep]], + [yyvaluep]], [[const b4_namespace_ref::b4_parser_class_name::location_type *yylocationp], - [yylocationp]], + [yylocationp]], b4_parse_param)[ { ]b4_parse_param_use[]dnl @@ -146,7 +146,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl inline void ]b4_parser_class_name[::yy_symbol_value_print_ (int yytype, - const semantic_type* yyvaluep, const location_type* yylocationp) + const semantic_type* yyvaluep, const location_type* yylocationp) { /* Pacify ``unused variable'' warnings. */ YYUSE (yyvaluep); @@ -155,18 +155,18 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl { ]b4_symbol_foreach([b4_symbol_printer])dnl [ default: - break; + break; } } void ]b4_parser_class_name[::yy_symbol_print_ (int yytype, - const semantic_type* yyvaluep, const location_type* yylocationp) + const semantic_type* yyvaluep, const location_type* yylocationp) { *yycdebug_ << (yytype < YYNTOKENS ? "token" : "nterm") - << ' ' << yytname[yytype] << " (" - << *yylocationp << ": "; + << ' ' << yytname[yytype] << " (" + << *yylocationp << ": "; yy_symbol_value_print_ (yytype, yyvaluep, yylocationp); *yycdebug_ << ')'; } @@ -205,10 +205,10 @@ b4_namespace_close[ # Let glr.c believe that the user arguments include the parser itself. m4_ifset([b4_parse_param], [m4_pushdef([b4_parse_param], - m4_dquote([[[b4_namespace_ref::b4_parser_class_name& yyparser], [[yyparser]]],] + m4_dquote([[[b4_namespace_ref::b4_parser_class_name& yyparser], [[yyparser]]],] m4_defn([b4_parse_param])))], [m4_pushdef([b4_parse_param], - [[[[b4_namespace_ref::b4_parser_class_name& yyparser], [[yyparser]]]]]) + [[[[b4_namespace_ref::b4_parser_class_name& yyparser], [[yyparser]]]]]) ]) m4_include(b4_pkgdatadir/[glr.c]) m4_popdef([b4_parse_param]) @@ -244,17 +244,17 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++], the previous symbol: RHS[0] (always defined). */ #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (N) \ - { \ - (Current).begin = YYRHSLOC (Rhs, 1).begin; \ - (Current).end = YYRHSLOC (Rhs, N).end; \ - } \ - else \ - { \ - (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \ - } \ +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).begin = YYRHSLOC (Rhs, 1).begin; \ + (Current).end = YYRHSLOC (Rhs, N).end; \ + } \ + else \ + { \ + (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \ + } \ while (/*CONSTCOND*/ 0) #endif @@ -298,15 +298,15 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++], /// \param yyvaluep Its semantic value. /// \param yylocationp Its location. virtual void yy_symbol_value_print_ (int yytype, - const semantic_type* yyvaluep, - const location_type* yylocationp); + const semantic_type* yyvaluep, + const location_type* yylocationp); /// \brief Report a symbol on the debug stream. /// \param yytype The token type. /// \param yyvaluep Its semantic value. /// \param yylocationp Its location. virtual void yy_symbol_print_ (int yytype, - const semantic_type* yyvaluep, - const location_type* yylocationp); + const semantic_type* yyvaluep, + const location_type* yylocationp); private: /* Debugging. */ std::ostream* yycdebug_; @@ -318,9 +318,9 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++], /// \param yyvaluep Its semantic value. /// \param yylocationp Its location. inline void yydestruct_ (const char* yymsg, - int yytype, - semantic_type* yyvaluep, - location_type* yylocationp); + int yytype, + semantic_type* yyvaluep, + location_type* yylocationp); ]b4_parse_param_vars[ }; diff --git a/data/lalr1.cc b/data/lalr1.cc index dab5ab9b..37b91ed4 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -426,14 +426,14 @@ b4_percent_code_get[]dnl } \ } while (false) -# define YY_REDUCE_PRINT(Rule) \ - do { \ +# define YY_REDUCE_PRINT(Rule) \ + do { \ if (yydebug_) \ - yy_reduce_print_ (Rule); \ + yy_reduce_print_ (Rule); \ } while (false) -# define YY_STACK_PRINT() \ - do { \ +# define YY_STACK_PRINT() \ + do { \ if (yydebug_) \ yystack_print_ (); \ } while (false) @@ -575,7 +575,7 @@ b4_percent_code_get[]dnl { ]b4_symbol_foreach([b4_symbol_printer])dnl [ default: - break; + break; } yyo << ')'; } @@ -739,7 +739,7 @@ m4_popdef([b4_at_dollar])])dnl [ yyla = b4_c_function_call([yylex], [symbol_type], m4_ifdef([b4_lex_param], b4_lex_param));], [ yyla.type = yytranslate_ (b4_c_function_call([yylex], [int], - [[YYSTYPE*], [&yyla.value]][]dnl + [[YYSTYPE*], [&yyla.value]][]dnl b4_locations_if([, [[location*], [&yyla.location]]])dnl m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[ yyempty = false; @@ -756,10 +756,10 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[ yyn = yytable_[yyn]; if (yyn <= 0) { - if (yy_table_value_is_error_ (yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; + if (yy_table_value_is_error_ (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; } /* Discard the token being shifted. */ @@ -818,7 +818,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[ switch (yyn) { ]b4_user_actions[ - default: + default: break; } } @@ -859,8 +859,8 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[ /* If not already recovering from an error, report this error. */ if (!yyerrstatus_) { - ++yynerrs_; - error (]b4_args(b4_locations_if([yyla.location]), + ++yynerrs_; + error (]b4_args(b4_locations_if([yyla.location]), [[yysyntax_error_ (yystack_[0].state, yyempty ? yyempty_ : yyla.type)]])[); } @@ -869,7 +869,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[ yyerror_range[1].location = yyla.location;]])[ if (yyerrstatus_ == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ /* Return failure if at end of input. */ @@ -879,7 +879,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[ { yy_destroy_ ("Error: discarding", yyla); yyempty = true; - } + } } /* Else will try to reuse lookahead token after shifting the error @@ -910,7 +910,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[ | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus_ = 3; /* Each real token shifted decrements this. */ + yyerrstatus_ = 3; /* Each real token shifted decrements this. */ { stack_symbol_type error_token; for (;;) @@ -965,8 +965,8 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[ yypop_ (yylen); while (yystack_.size () != 1) { - yy_destroy_ ("Cleanup: popping", yystack_[0]); - yypop_ (); + yy_destroy_ ("Cleanup: popping", yystack_[0]); + yypop_ (); } return yyresult; @@ -1098,7 +1098,7 @@ b4_error_verbose_if([state_type yystate, int yytoken], for (stack_type::const_iterator i = yystack_.begin (), i_end = yystack_.end (); - i != i_end; ++i) + i != i_end; ++i) *yycdebug_ << ' ' << i->state; *yycdebug_ << std::endl; } @@ -1111,7 +1111,7 @@ b4_error_verbose_if([state_type yystate, int yytoken], int yynrhs = yyr2_[yyrule]; /* Print the symbols being reduced, and their result. */ *yycdebug_ << "Reducing stack by rule " << yyrule - 1 - << " (line " << yylno << "):" << std::endl; + << " (line " << yylno << "):" << std::endl; /* The symbols being reduced. */ for (int yyi = 0; yyi < yynrhs; yyi++) YY_SYMBOL_PRINT (" $" << yyi + 1 << " =", diff --git a/data/local.mk b/data/local.mk index 578323ae..038ba1d3 100644 --- a/data/local.mk +++ b/data/local.mk @@ -13,32 +13,32 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . -dist_pkgdata_DATA = \ - data/README \ - data/bison.m4 \ - data/c++-skel.m4 \ - data/c++.m4 \ - data/c-skel.m4 \ - data/c.m4 \ - data/glr.c \ - data/glr.cc \ - data/java-skel.m4 \ - data/java.m4 \ - data/lalr1.cc \ - data/lalr1.java \ - data/location.cc \ - data/stack.hh \ - data/variant.hh \ +dist_pkgdata_DATA = \ + data/README \ + data/bison.m4 \ + data/c++-skel.m4 \ + data/c++.m4 \ + data/c-skel.m4 \ + data/c.m4 \ + data/glr.c \ + data/glr.cc \ + data/java-skel.m4 \ + data/java.m4 \ + data/lalr1.cc \ + data/lalr1.java \ + data/location.cc \ + data/stack.hh \ + data/variant.hh \ data/yacc.c m4sugardir = $(pkgdatadir)/m4sugar -dist_m4sugar_DATA = \ - data/m4sugar/foreach.m4 \ +dist_m4sugar_DATA = \ + data/m4sugar/foreach.m4 \ data/m4sugar/m4sugar.m4 xsltdir = $(pkgdatadir)/xslt -dist_xslt_DATA = \ - data/xslt/bison.xsl \ - data/xslt/xml2dot.xsl \ - data/xslt/xml2text.xsl \ +dist_xslt_DATA = \ + data/xslt/bison.xsl \ + data/xslt/xml2dot.xsl \ + data/xslt/xml2text.xsl \ data/xslt/xml2xhtml.xsl diff --git a/data/location.cc b/data/location.cc index 731c8ae8..d3d3f0a1 100644 --- a/data/location.cc +++ b/data/location.cc @@ -279,8 +279,8 @@ b4_copyright([Locations for Bison parsers in C++])[ position last = loc.end - 1; ostr << loc.begin; if (last.filename - && (!loc.begin.filename - || *loc.begin.filename != *last.filename)) + && (!loc.begin.filename + || *loc.begin.filename != *last.filename)) ostr << '-' << last; else if (loc.begin.line != last.line) ostr << '-' << last.line << '.' << last.column; diff --git a/data/stack.hh b/data/stack.hh index 1801a739..d4f6ef05 100644 --- a/data/stack.hh +++ b/data/stack.hh @@ -74,7 +74,7 @@ b4_copyright([Stack handling for Bison parsers in C++])[ pop (unsigned int n = 1) { for (; n; --n) - seq_.pop_front (); + seq_.pop_front (); } inline diff --git a/data/xslt/xml2dot.xsl b/data/xslt/xml2dot.xsl index 100553b7..b1ddef4a 100644 --- a/data/xslt/xml2dot.xsl +++ b/data/xslt/xml2dot.xsl @@ -124,20 +124,20 @@ - - dotted - - - solid - - - dashed - + + dotted + + + solid + + + dashed + - + diff --git a/data/xslt/xml2text.xsl b/data/xslt/xml2text.xsl index a91b4a71..4bd119fc 100644 --- a/data/xslt/xml2text.xsl +++ b/data/xslt/xml2text.xsl @@ -253,9 +253,9 @@ - - - + + + @@ -266,9 +266,9 @@ - - - + + + @@ -279,9 +279,9 @@ - - - + + + @@ -290,7 +290,7 @@ + select="preceding-sibling::item[1]/@rule-number"/> @@ -329,14 +329,14 @@ - - + + - - + + @@ -442,7 +442,7 @@ ( + select="key('bison:ruleByNumber', current()/@rule)/lhs[text()]"/> ) @@ -479,9 +479,9 @@ + order="descending"/> - + @@ -498,7 +498,7 @@ - + @@ -516,7 +516,7 @@ - + diff --git a/data/xslt/xml2xhtml.xsl b/data/xslt/xml2xhtml.xsl index 2ffc964a..edac9bcc 100644 --- a/data/xslt/xml2xhtml.xsl +++ b/data/xslt/xml2xhtml.xsl @@ -31,32 +31,32 @@ + doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" + doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" + indent="yes"/> - <xsl:value-of select="bison-xml-report/filename"/> - <xsl:text> - GNU Bison XML Automaton Report</xsl:text> + <xsl:value-of select="bison-xml-report/filename"/> + <xsl:text> - GNU Bison XML Automaton Report</xsl:text>