From: Akim Demaille Date: Fri, 4 May 2012 12:38:53 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/maint' X-Git-Tag: v2.7.90~451 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/72cd9a913f6d282c5e24990505c2c820bda2bf1b Merge remote-tracking branch 'origin/maint' * origin/maint: (22 commits) tests: ignore code coverage/profiling failure messages doc: fix some invalid @ref. build: fix previous commit. install-pdf: fix. NEWS: Update. %printer: support both yyo and yyoutput. doc: mfcalc: demonstrate %printer. tests: style changes. build: require Flex. build: flex.m4: check for Flex. build: flex.m4: quote properly. build: flex.m4. build: autoconf: update. glr: eliminate last bits of unwanted locations. NEWS: 2.6 will drop K&R. TODO: remove dead items. TODO: import from master. gnulib: update. maint: update NEWS. doc: fix index. doc: fix documentation of YYERROR. c++: more YY_NULL Conflicts: TODO bootstrap data/c.m4 data/glr.c data/lalr1.cc doc/bison.texinfo --- 72cd9a913f6d282c5e24990505c2c820bda2bf1b diff --cc NEWS index bb96c36e,f6cc360a..8f77271b --- a/NEWS +++ b/NEWS @@@ -1,98 -1,27 +1,95 @@@ Bison News ---------- +* Changes in version ?.? (????-??-??): + +** Additional yylex/yyparse arguments + + The new directive %param declare additional argument to both yylex + and yyparse. The %lex-param, %parse-param, and %param directives + support one or more arguments. Instead of + + %lex-param {arg1_type *arg1} + %lex-param {arg2_type *arg2} + %parse-param {arg1_type *arg1} + %parse-param {arg2_type *arg2} + + one may now declare + + %param {arg1_type *arg1} {arg2_type *arg2} + +** Java skeleton improvements + + The constants for token names were moved to the Lexer interface. + Also, it is possible to add code to the parser's constructors using + "%code init" and "%define init_throws". + +** C++ skeleton improvements + + The C++ parser features a syntax_error exception, which can be + thrown from the scanner or from user rules to raise syntax errors. + This facilitates reporting errors caught in sub-functions (e.g., + rejecting too large integral literals from a conversion function + used by the scanner, or rejecting invalid combinations from a + factory invoked by the user actions). + +** Variable api.tokens.prefix + + The variable api.tokens.prefix changes the way tokens are identified in + the generated files. This is especially useful to avoid collisions + with identifiers in the target language. For instance + + %token FILE for ERROR + %define api.tokens.prefix "TOK_" + %% + start: FILE for ERROR; + + will generate the definition of the symbols TOK_FILE, TOK_for, and + TOK_ERROR in the generated sources. In particular, the scanner must + use these prefixed token names, although the grammar itself still + uses the short names (as in the sample rule given above). + +** Variable api.namespace + + The "namespace" variable is renamed "api.namespace". Backward + compatibility is ensured, but upgrading is recommended. + +** Variable parse.error + + The variable error controls the verbosity of error messages. The + use of the %error-verbose directive is deprecated in favor of + %define parse.error "verbose". + +** Semantic predicates + + The new, experimental, semantic-predicate feature allows actions of + the form %?{ BOOLEAN-EXPRESSION }, which cause syntax errors (as for + YYERROR) if the expression evaluates to 0, and are evaluated immediately + in GLR parsers, rather than being deferred. The result is that they + allow the programmer to prune possible parses based on the values of + runtime expressions. + * Changes in version 2.5.1 (????-??-??): - ** Several portability problems in the test suite have been fixed: + ** Future changes: - This includes warnings with some compilers, unexpected behavior of - tools such as diff, warning messages from the test suite itself, - etc. + The next major release will drop support for K&R C. - __attribute__ is not longer disabled when __STRICT_ANSI__ is defined - (i.e., when -std is passed to GCC). + ** yacc.c: YYBACKUP works as expected. - ** Warnings during the build procedure have been eliminated. + ** glr.c improvements: - ** Many minor improvements have been made to the manual: + *** Location support is eliminated when not requested: - The layout for grammar has changed to a more compact scheme. Named - references are motivated. The description of the automaton - description file is updated. + GLR parsers used to include location-related code even when + locations were not requested, and therefore not even usable. - ** YYBACKUP works as expected. + *** __attribute__ is preserved: - ** liby is no longer asking for "rpl_fprintf" on some platforms. + __attribute__ is no longer disabled when __STRICT_ANSI__ is defined + (i.e., when -std is passed to GCC). - ** Several Java fixes: + ** lalr1.java: several fixes: The Java parser no longer throws ArrayIndexOutOfBoundsException if the first token leads to a syntax error. Some minor clean ups. diff --cc data/glr.c index dcf2c007,0e62c6ac..509ee123 --- a/data/glr.c +++ b/data/glr.c @@@ -820,17 -873,10 +815,17 @@@ yyfillin (yyGLRStackItem *yyvsp, int yy s = yyvsp[yylow0].yystate.yypred; for (i = yylow0-1; i >= yylow1; i -= 1) { - YYASSERT (s->yyresolved); - yyvsp[i].yystate.yyresolved = yytrue; - yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval;]b4_locations_if([[ +#if YYDEBUG + yyvsp[i].yystate.yylrState = s->yylrState; +#endif + yyvsp[i].yystate.yyresolved = s->yyresolved; + if (s->yyresolved) + yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval; + else + /* The effect of using yysval or yyloc (in an immediate rule) is + * undefined. */ - yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULL; - yyvsp[i].yystate.yyloc = s->yyloc; ++ yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULL;]b4_locations_if([[ + yyvsp[i].yystate.yyloc = s->yyloc;]])[ s = yyvsp[i].yystate.yypred = s->yypred; } } diff --cc doc/bison.texinfo index 434b6e67,b9b7f775..4aac8d3d --- a/doc/bison.texinfo +++ b/doc/bison.texinfo @@@ -6002,11 -5758,11 +6002,11 @@@ The value returned by @code{yypull_pars More user feedback will help to stabilize it.) You call the function @code{yypstate_new} to create a new parser instance. -This function is available if either the @code{%define api.push-pull push} or -@code{%define api.push-pull both} declaration is used. +This function is available if either the @samp{%define api.push-pull push} or +@samp{%define api.push-pull both} declaration is used. @xref{Push Decl, ,A Push Parser}. - @deftypefun yypstate *yypstate_new (void) + @deftypefun {yypstate*} yypstate_new (void) The function will return a valid parser instance if there was memory available or 0 if no memory was available. In impure mode, it will also return 0 if a parser instance is currently