Compare commits

..
11 Commits
Author SHA1 Message Date
Akim Demaille 7f921d18dd version 3.5.2
* NEWS: Record release date.
2020-02-13 18:25:21 +01:00
Akim Demaille cc3760ef51 news: 3.5.2
* NEWS: Update.
2020-02-13 18:25:11 +01:00
Akim Demaille 2f23ca6f65 gnulib: update 2020-02-13 08:18:12 +01:00
Akim Demaille 468b68c5cd doc: update Doxygen template
* Doxyfile.in: Run doxygen -u on it.
2020-02-13 08:18:12 +01:00
Akim Demaille 9ed802a026 java: avoid trailing white spaces
* data/skeletons/java.m4 (b4_maybe_throws): Issue a space before when needed.
* data/skeletons/lalr1.java: Avoid trailing spaces.
2020-02-13 08:18:12 +01:00
Akim Demaille fb554c2804 m4: fix b4_token_format
We used to emit:

    /** Token number,to be returned by the scanner.  */
    static final int NUM = 258;
    /** Token number,to be returned by the scanner.  */
    static final int NEG = 259;

with no space after the comma.  Fix that.

* data/skeletons/bison.m4 (b4_token_format): Quote where appropriate.
2020-02-13 08:18:11 +01:00
Akim Demaille 47850d4f58 doc: clearly state that %yacc only makes sense with yacc.c
* doc/bison.texi: here.
2020-02-13 08:18:11 +01:00
Akim Demaille 57b035a242 doc: spell check
* doc/bison.texi: here.
2020-02-13 08:18:11 +01:00
Akim Demaille 1587a5ea9b examples: be more robust to spaces in paths
Reported by Nikki Valen.
https://lists.gnu.org/r/bug-bison/2020-01/msg00032.html

* examples/test ($prog): Remove, replaced by...
(prog): This new function, which pays attention to quoting shell
variables.
2020-01-21 07:01:34 +01:00
Adrian VogelsgesangandAkim Demaille 4ab2cf7450 larlr1.cc: Reject unsupported values for parse.lac
Just as the yacc.c skeleton, the lalr1.cc skeleton should reject
invalid values for parse.lac.

* data/skeletons/lalr1.cc: check validity of parse.lac
* tests/input.at: new test cases
2020-01-21 06:57:21 +01:00
Akim Demaille 7e3a513d88 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2020-01-19 14:35:50 +01:00
16 changed files with 503 additions and 278 deletions
+1 -1
View File
@@ -1 +1 @@
3.5 3.5.1
+9
View File
@@ -1,5 +1,14 @@
GNU Bison NEWS GNU Bison NEWS
* Noteworthy changes in release 3.5.2 (2020-02-13) [stable]
** Bug fixes
Portability issues and minor cosmetic issues.
The lalr1.cc skeleton properly rejects unsupported values for parse.lac
(as yacc.c does).
* Noteworthy changes in release 3.5.1 (2020-01-19) [stable] * Noteworthy changes in release 3.5.1 (2020-01-19) [stable]
** Bug fixes ** Bug fixes
+1
View File
@@ -130,6 +130,7 @@ Nick Bowler [email protected]
Nicolas Bedon [email protected] Nicolas Bedon [email protected]
Nicolas Burrus [email protected] Nicolas Burrus [email protected]
Nicolas Tisserand [email protected] Nicolas Tisserand [email protected]
Nikki Valen [email protected]
Noah Friedman [email protected] Noah Friedman [email protected]
Odd Arild Olsen [email protected] Odd Arild Olsen [email protected]
Oleg Smolsky [email protected] Oleg Smolsky [email protected]
+3 -3
View File
@@ -532,9 +532,9 @@ m4_define([b4_any_token_visible_if],
# ---------------------------- # ----------------------------
m4_define([b4_token_format], m4_define([b4_token_format],
[b4_token_visible_if([$2], [b4_token_visible_if([$2],
[m4_quote(m4_format([$1], [m4_format([[$1]],
[b4_symbol([$2], [id])], m4_quote(b4_symbol([$2], [id])),
[b4_symbol([$2], b4_api_token_raw_if([[number]], [[user_number]]))]))])]) m4_quote(b4_symbol([$2], b4_api_token_raw_if([[number]], [[user_number]]))))])])
## ------- ## ## ------- ##
+7 -5
View File
@@ -147,18 +147,20 @@ b4_symbol_foreach([b4_token_enum])])])
# b4-case(ID, CODE) # b4-case(ID, CODE)
# ----------------- # -----------------
# We need to fool Java's stupid unreachable code detection. # We need to fool Java's stupid unreachable code detection.
m4_define([b4_case], [ case $1: m4_define([b4_case],
[ case $1:
if (yyn == $1) if (yyn == $1)
$2; $2;
break; break;
]) ])
# b4_predicate_case(LABEL, CONDITIONS) # b4_predicate_case(LABEL, CONDITIONS)
# ------------------------------------ # ------------------------------------
m4_define([b4_predicate_case], [ case $1: m4_define([b4_predicate_case],
[ case $1:
if (! ($2)) YYERROR; if (! ($2)) YYERROR;
break; break;
]) ])
## -------- ## ## -------- ##
@@ -361,4 +363,4 @@ m4_define([b4_var_decl],
# ----------------------- # -----------------------
# Expand to either an empty string or "throws THROWS". # Expand to either an empty string or "throws THROWS".
m4_define([b4_maybe_throws], m4_define([b4_maybe_throws],
[m4_ifval($1, [throws $1])]) [m4_ifval($1, [ throws $1])])
+1
View File
@@ -23,6 +23,7 @@ m4_define([b4_value_type_setup_variant])
# Check the value of %define parse.lac, where LAC stands for lookahead # Check the value of %define parse.lac, where LAC stands for lookahead
# correction. # correction.
b4_percent_define_default([[parse.lac]], [[none]]) b4_percent_define_default([[parse.lac]], [[none]])
b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]])
b4_define_flag_if([lac]) b4_define_flag_if([lac])
m4_define([b4_lac_flag], m4_define([b4_lac_flag],
[m4_if(b4_percent_define_get([[parse.lac]]), [m4_if(b4_percent_define_get([[parse.lac]]),
+50 -49
View File
@@ -65,8 +65,8 @@ m4_define([b4_define_state],[[
int label = YYNEWSTATE; int label = YYNEWSTATE;
/* Error handling. */ /* Error handling. */
int yynerrs_ = 0; int yynerrs_ = 0;]b4_locations_if([[
]b4_locations_if([[/* The location where the error started. */ /* The location where the error started. */
]b4_location_type[ yyerrloc = null; ]b4_location_type[ yyerrloc = null;
/* Location. */ /* Location. */
@@ -182,7 +182,7 @@ b4_locations_if([[
]b4_token_enums[ ]b4_token_enums[
]b4_locations_if([[/** ]b4_locations_if([[/**
* Method to retrieve the beginning position of the last scanned token. * Method to retrieve the beginning position of the last scanned token.
* @@return the position at which the last scanned token starts. * @@return the position at which the last scanned token starts.
*/ */
@@ -206,13 +206,13 @@ b4_locations_if([[
* ]b4_locations_if([and beginning/ending positions ])[of the token. * ]b4_locations_if([and beginning/ending positions ])[of the token.
* @@return the token identifier corresponding to the next token. * @@return the token identifier corresponding to the next token.
*/ */
int yylex () ]b4_maybe_throws([b4_lex_throws])[; int yylex ()]b4_maybe_throws([b4_lex_throws])[;
/** /**
* Entry point for error reporting. Emits an error * Entry point for error reporting. Emits an error
* ]b4_locations_if([referring to the given location ])[in a user-defined way. * ]b4_locations_if([referring to the given location ])[in a user-defined way.
* *
* ]b4_locations_if([[@@param loc The location of the element to which the *]b4_locations_if([[ @@param loc The location of the element to which the
* error message is related]])[ * error message is related]])[
* @@param msg The string for the error message. * @@param msg The string for the error message.
*/ */
@@ -224,22 +224,23 @@ b4_locations_if([[
]b4_percent_code_get([[lexer]])[ ]b4_percent_code_get([[lexer]])[
} }
]])[/** ]])[
/**
* The object doing lexical analysis for us. * The object doing lexical analysis for us.
*/ */
private Lexer yylexer; private Lexer yylexer;
]b4_parse_param_vars[ ]b4_parse_param_vars[
]b4_lexer_if([[ ]b4_lexer_if([[
/** /**
* Instantiates the Bison-generated parser. * Instantiates the Bison-generated parser.
*/ */
public ]b4_parser_class (b4_parse_param_decl([b4_lex_param_decl])[) ]b4_maybe_throws([b4_init_throws])[ public ]b4_parser_class (b4_parse_param_decl([b4_lex_param_decl])[)]b4_maybe_throws([b4_init_throws])[
{ {
]b4_percent_code_get([[init]])[ ]b4_percent_code_get([[init]])[
this.yylexer = new YYLexer(]b4_lex_param_call[); this.yylexer = new YYLexer(]b4_lex_param_call[);
]b4_parse_param_cons[ ]b4_parse_param_cons[
} }
]])[ ]])[
@@ -247,11 +248,11 @@ b4_locations_if([[
* Instantiates the Bison-generated parser. * Instantiates the Bison-generated parser.
* @@param yylexer The scanner that will supply tokens to the parser. * @@param yylexer The scanner that will supply tokens to the parser.
*/ */
]b4_lexer_if([[protected]], [[public]]) b4_parser_class[ (]b4_parse_param_decl([[Lexer yylexer]])[) ]b4_maybe_throws([b4_init_throws])[ ]b4_lexer_if([[protected]], [[public]]) b4_parser_class[ (]b4_parse_param_decl([[Lexer yylexer]])[)]b4_maybe_throws([b4_init_throws])[
{ {
]b4_percent_code_get([[init]])[ ]b4_percent_code_get([[init]])[
this.yylexer = yylexer; this.yylexer = yylexer;
]b4_parse_param_cons[ ]b4_parse_param_cons[
} }
]b4_parse_trace_if([[ ]b4_parse_trace_if([[
@@ -320,8 +321,8 @@ b4_locations_if([[
}]])[ }]])[
private final class YYStack { private final class YYStack {
private int[] stateStack = new int[16]; private int[] stateStack = new int[16];]b4_locations_if([[
]b4_locations_if([[private ]b4_location_type[[] locStack = new ]b4_location_type[[16];]])[ private ]b4_location_type[[] locStack = new ]b4_location_type[[16];]])[
private ]b4_yystype[[] valueStack = new ]b4_yystype[[16]; private ]b4_yystype[[] valueStack = new ]b4_yystype[[16];
public int size = 16; public int size = 16;
@@ -334,8 +335,7 @@ b4_locations_if([[
{ {
int[] newStateStack = new int[size * 2]; int[] newStateStack = new int[size * 2];
System.arraycopy (stateStack, 0, newStateStack, 0, height); System.arraycopy (stateStack, 0, newStateStack, 0, height);
stateStack = newStateStack; stateStack = newStateStack;]b4_locations_if([[
]b4_locations_if([[
]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2]; ]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2];
System.arraycopy (locStack, 0, newLocStack, 0, height); System.arraycopy (locStack, 0, newLocStack, 0, height);
locStack = newLocStack;]]) locStack = newLocStack;]])
@@ -347,8 +347,8 @@ b4_locations_if([[
size *= 2; size *= 2;
} }
stateStack[height] = state; stateStack[height] = state;]b4_locations_if([[
]b4_locations_if([[locStack[height] = loc;]])[ locStack[height] = loc;]])[
valueStack[height] = value; valueStack[height] = value;
} }
@@ -359,8 +359,8 @@ b4_locations_if([[
public final void pop (int num) { public final void pop (int num) {
// Avoid memory leaks... garbage collection is a white lie! // Avoid memory leaks... garbage collection is a white lie!
if (0 < num) { if (0 < num) {
java.util.Arrays.fill (valueStack, height - num + 1, height + 1, null); java.util.Arrays.fill (valueStack, height - num + 1, height + 1, null);]b4_locations_if([[
]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height + 1, null);]])[ java.util.Arrays.fill (locStack, height - num + 1, height + 1, null);]])[
} }
height -= num; height -= num;
} }
@@ -368,8 +368,9 @@ b4_locations_if([[
public final int stateAt (int i) { public final int stateAt (int i) {
return stateStack[height - i]; return stateStack[height - i];
} }
]b4_locations_if([[
]b4_locations_if([[public final ]b4_location_type[ locationAt (int i) { public final ]b4_location_type[ locationAt (int i) {
return locStack[height - i]; return locStack[height - i];
} }
@@ -452,7 +453,7 @@ b4_locations_if([[
return yydefgoto_[yysym - yyntokens_]; return yydefgoto_[yysym - yyntokens_];
} }
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[ private int yyaction (int yyn, YYStack yystack, int yylen)]b4_maybe_throws([b4_throws])[
{ {
/* If YYLEN is nonzero, implement the default value of the action: /* If YYLEN is nonzero, implement the default value of the action:
'$$ = $1'. Otherwise, use the top of the stack. '$$ = $1'. Otherwise, use the top of the stack.
@@ -460,8 +461,8 @@ b4_locations_if([[
Otherwise, the following line sets YYVAL to garbage. Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison This behavior is undocumented and Bison
users should not rely upon it. */ users should not rely upon it. */
]b4_yystype[ yyval = (0 < yylen) ? yystack.valueAt (yylen - 1) : yystack.valueAt (0); ]b4_yystype[ yyval = (0 < yylen) ? yystack.valueAt (yylen - 1) : yystack.valueAt (0);]b4_locations_if([[
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[]b4_parse_trace_if([[ ]b4_location_type[ yyloc = yylloc (yystack, yylen);]])[]b4_parse_trace_if([[
yyReducePrint (yyn, yystack);]])[ yyReducePrint (yyn, yystack);]])[
@@ -541,29 +542,28 @@ b4_locations_if([[
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not * @@return <tt>true</tt> if the parsing succeeds. Note that this does not
* imply that there were no syntax errors. * imply that there were no syntax errors.
*/ */
public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[]])[ public boolean parse ()]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[]])[
]b4_push_if([ ]b4_push_if([
/** /**
* Push Parse input from external lexer * Push Parse input from external lexer
* *
* @@param yylextoken current token * @@param yylextoken current token
* @@param yylexval current lval * @@param yylexval current lval]b4_locations_if([[
]b4_locations_if([ * @@param yylexloc current position])[ * @@param yylexloc current position]])[
* *
* @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt> * @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
*/ */
public int push_parse (int yylextoken, b4_yystype yylexval[]b4_locations_if([, b4_location_type yylexloc])) public int push_parse (int yylextoken, b4_yystype yylexval[]b4_locations_if([, b4_location_type yylexloc]))b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])])[
b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])])[ {]b4_locations_if([[
{ /* @@$. */
]b4_locations_if([/* @@$. */ ]b4_location_type[ yyloc;]])[
b4_location_type yyloc;])[
]b4_push_if([],[[ ]b4_push_if([],[[
]b4_define_state[]b4_parse_trace_if([[ ]b4_define_state[]b4_parse_trace_if([[
yycdebug ("Starting parse\n");]])[ yycdebug ("Starting parse\n");]])[
yyerrstatus_ = 0; yyerrstatus_ = 0;
/* Initialize the stack. */ /* Initialize the stack. */
yystack.push (yystate, yylval ]b4_locations_if([, yylloc])[); yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
]m4_ifdef([b4_initial_action], [ ]m4_ifdef([b4_initial_action], [
b4_dollar_pushdef([yylval], [], [], [yylloc])dnl b4_dollar_pushdef([yylval], [], [], [yylloc])dnl
b4_user_initial_action b4_user_initial_action
@@ -706,7 +706,8 @@ b4_dollar_popdef[]dnl
yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken)); yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
} }
]b4_locations_if([yyerrloc = yylloc;])[ ]b4_locations_if([[
yyerrloc = yylloc;]])[
if (yyerrstatus_ == 3) 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
@@ -730,8 +731,8 @@ b4_dollar_popdef[]dnl
/*-------------------------------------------------. /*-------------------------------------------------.
| errorlab -- error raised explicitly by YYERROR. | | errorlab -- error raised explicitly by YYERROR. |
`-------------------------------------------------*/ `-------------------------------------------------*/
case YYERROR: case YYERROR:]b4_locations_if([[
]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[ yyerrloc = yystack.locationAt (yylen - 1);]])[
/* Do not reclaim the symbols of the rule which action triggered /* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */ this YYERROR. */
yystack.pop (yylen); yystack.pop (yylen);
@@ -765,7 +766,8 @@ b4_dollar_popdef[]dnl
if (yystack.height == 0) if (yystack.height == 0)
]b4_push_if([{label = YYABORT; break;}],[return false;])[ ]b4_push_if([{label = YYABORT; break;}],[return false;])[
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[ ]b4_locations_if([[
yyerrloc = yystack.locationAt (0);]])[
yystack.pop (); yystack.pop ();
yystate = yystack.stateAt (0);]b4_parse_trace_if([[ yystate = yystack.stateAt (0);]b4_parse_trace_if([[
if (0 < yydebug) if (0 < yydebug)
@@ -776,12 +778,12 @@ b4_dollar_popdef[]dnl
/* Leave the switch. */ /* Leave the switch. */
break; break;
]b4_locations_if([ ]b4_locations_if([[
/* Muck with the stack to setup for yylloc. */ /* Muck with the stack to setup for yylloc. */
yystack.push (0, null, yylloc); yystack.push (0, null, yylloc);
yystack.push (0, null, yyerrloc); yystack.push (0, null, yyerrloc);
yyloc = yylloc (yystack, 2); yyloc = yylloc (yystack, 2);
yystack.pop (2);])[ yystack.pop (2);]])[
/* Shift the error token. */]b4_parse_trace_if([[ /* Shift the error token. */]b4_parse_trace_if([[
yySymbolPrint ("Shifting", yystos_[yyn], yySymbolPrint ("Shifting", yystos_[yyn],
@@ -823,10 +825,10 @@ b4_dollar_popdef[]dnl
this.label = YYNEWSTATE; this.label = YYNEWSTATE;
/* Error handling. */ /* Error handling. */
this.yynerrs_ = 0; this.yynerrs_ = 0;]b4_locations_if([[
]b4_locations_if([/* The location where the error started. */ /* The location where the error started. */
this.yyerrloc = null; this.yyerrloc = null;
this.yylloc = new b4_location_type (null, null);])[ this.yylloc = new ]b4_location_type[ (null, null);]])[
/* Semantic value of the lookahead. */ /* Semantic value of the lookahead. */
this.yylval = null; this.yylval = null;
@@ -846,8 +848,7 @@ b4_dollar_popdef[]dnl
* *
* @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt> * @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
*/ */
public int push_parse (int yylextoken, b4_yystype yylexval, b4_position_type yylexpos) public int push_parse (int yylextoken, b4_yystype yylexval, b4_position_type yylexpos)b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])
b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])
{ {
return push_parse (yylextoken, yylexval, new b4_location_type (yylexpos)); return push_parse (yylextoken, yylexval, new b4_location_type (yylexpos));
} }
@@ -862,7 +863,7 @@ b4_dollar_popdef[]dnl
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not * @@return <tt>true</tt> if the parsing succeeds. Note that this does not
* imply that there were no syntax errors. * imply that there were no syntax errors.
*/ */
public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[ public boolean parse ()]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[
{ {
if (yylexer == null) if (yylexer == null)
throw new NullPointerException("Null Lexer"); throw new NullPointerException("Null Lexer");
@@ -872,9 +873,9 @@ b4_dollar_popdef[]dnl
]b4_yystype[ lval = yylexer.getLVal(); ]b4_yystype[ lval = yylexer.getLVal();
]b4_locations_if([dnl ]b4_locations_if([dnl
b4_location_type yyloc = new b4_location_type (yylexer.getStartPos (), b4_location_type yyloc = new b4_location_type (yylexer.getStartPos (),
yylexer.getEndPos ());])[ yylexer.getEndPos ());])[]b4_locations_if([[
]b4_locations_if([status = push_parse(token,lval,yyloc);],[ status = push_parse(token,lval,yyloc);]], [[
status = push_parse(token,lval);])[ status = push_parse(token,lval);]])[
} while (status == YYPUSH_MORE); } while (status == YYPUSH_MORE);
return (status == YYACCEPT); return (status == YYACCEPT);
} }
+368 -186
View File
File diff suppressed because it is too large Load Diff
+18 -14
View File
@@ -5841,7 +5841,10 @@ states and what is done for each type of lookahead token in that state.
@deffn {Directive} %yacc @deffn {Directive} %yacc
Pretend the option @option{--yacc} was given, i.e., imitate Yacc, including Pretend the option @option{--yacc} was given, i.e., imitate Yacc, including
its naming conventions. @xref{Tuning the Parser}, for more. its naming conventions. Only makes sense with the @file{yacc.c}
skeleton. @xref{Tuning the Parser}, for more.
Of course @code{%yacc} is a Bison extension@dots{}
@end deffn @end deffn
@@ -9972,7 +9975,7 @@ When a Bison grammar compiles properly but parses ``incorrectly'', the
@node Enabling Traces @node Enabling Traces
@subsection Enabling Traces @subsection Enabling Traces
There are several means to enable compilation of trace facilities, in There are several means to enable compilation of trace facilities, in
decresing order of preference: decreasing order of preference:
@table @asis @table @asis
@item the variable @samp{parse.trace} @item the variable @samp{parse.trace}
@@ -10228,7 +10231,7 @@ Cleanup: popping nterm input ()
@subsection The @code{YYPRINT} Macro @subsection The @code{YYPRINT} Macro
@findex YYPRINT @findex YYPRINT
The @code{%printer} directive was introduced in Bison 1.50 (Novembre 2002). The @code{%printer} directive was introduced in Bison 1.50 (November 2002).
Before then, @code{YYPRINT} provided a similar feature, but only for Before then, @code{YYPRINT} provided a similar feature, but only for
terminal symbols and only with the @file{yacc.c} skeleton. terminal symbols and only with the @file{yacc.c} skeleton.
@@ -10857,11 +10860,10 @@ different diagnostics to be generated (it implies @option{-Wyacc}), and may
change behavior in other minor ways. Most importantly, imitate Yacc's change behavior in other minor ways. Most importantly, imitate Yacc's
output file name conventions, so that the parser implementation file is output file name conventions, so that the parser implementation file is
called @file{y.tab.c}, and the other outputs are called @file{y.output} and called @file{y.tab.c}, and the other outputs are called @file{y.output} and
@file{y.tab.h}. Also, if generating a deterministic parser in C, generate @file{y.tab.h}. Also, generate @code{#define} statements in addition to an
@code{#define} statements in addition to an @code{enum} to associate token @code{enum} to associate token numbers with token names. Thus, the
numbers with token names. Thus, the following shell script can substitute following shell script can substitute for Yacc, and the Bison distribution
for Yacc, and the Bison distribution contains such a script for contains such a script for compatibility with POSIX:
compatibility with POSIX:
@example @example
#! /bin/sh #! /bin/sh
@@ -10869,9 +10871,9 @@ bison -y "$@@"
@end example @end example
The @option{-y}/@option{--yacc} option is intended for use with traditional The @option{-y}/@option{--yacc} option is intended for use with traditional
Yacc grammars. If your grammar uses Bison extensions like Yacc grammars. This option only makes sense for the default C skeleton,
@samp{%glr-parser}, Bison might not be Yacc-compatible even if this option @file{yacc.c}. If your grammar uses Bison extensions Bison cannot be
is specified. Yacc-compatible, even if this option is specified.
@end table @end table
@node Output Files @node Output Files
@@ -14604,7 +14606,7 @@ London, Department of Computer Science, TR-00-12 (December 2000).
@c LocalWords: strncmp intval tindex lvalp locp llocp typealt YYBACKUP subrange @c LocalWords: strncmp intval tindex lvalp locp llocp typealt YYBACKUP subrange
@c LocalWords: YYEMPTY YYEOF YYRECOVERING yyclearin GE def UMINUS maybeword loc @c LocalWords: YYEMPTY YYEOF YYRECOVERING yyclearin GE def UMINUS maybeword loc
@c LocalWords: Johnstone Shamsa Sadaf Hussain Tomita TR uref YYMAXDEPTH inline @c LocalWords: Johnstone Shamsa Sadaf Hussain Tomita TR uref YYMAXDEPTH inline
@c LocalWords: YYINITDEPTH stmts ref initdcl maybeasm notype Lookahead @c LocalWords: YYINITDEPTH stmts ref initdcl maybeasm notype Lookahead ctx
@c LocalWords: hexflag STR exdent itemset asis DYYDEBUG YYFPRINTF args Autoconf @c LocalWords: hexflag STR exdent itemset asis DYYDEBUG YYFPRINTF args Autoconf
@c LocalWords: ypp yxx itemx tex leaderfill Troubleshouting sqrt Graphviz @c LocalWords: ypp yxx itemx tex leaderfill Troubleshouting sqrt Graphviz
@c LocalWords: hbox hss hfill tt ly yyin fopen fclose ofirst gcc ll lookahead @c LocalWords: hbox hss hfill tt ly yyin fopen fclose ofirst gcc ll lookahead
@@ -14648,10 +14650,12 @@ London, Department of Computer Science, TR-00-12 (December 2000).
@c LocalWords: Relocatability exprs fixit Wyacc parseable fixits ffixit svg @c LocalWords: Relocatability exprs fixit Wyacc parseable fixits ffixit svg
@c LocalWords: DNDEBUG cstring Wzero workalike POPL workalikes byacc UCB @c LocalWords: DNDEBUG cstring Wzero workalike POPL workalikes byacc UCB
@c LocalWords: Penello's Penello Byson Byson's Corbett's CSD TOPLAS PDP @c LocalWords: Penello's Penello Byson Byson's Corbett's CSD TOPLAS PDP
@c LocalWords: Beazley's goyacc ocamlyacc SIGACT SIGPLAN colorWarning @c LocalWords: Beazley's goyacc ocamlyacc SIGACT SIGPLAN colorWarning exVal
@c LocalWords: setcolor rgbError colorError rgbNotice colorNotice derror @c LocalWords: setcolor rgbError colorError rgbNotice colorNotice derror
@c LocalWords: colorOff maincolor inlineraw darkviolet darkcyan dwarning @c LocalWords: colorOff maincolor inlineraw darkviolet darkcyan dwarning
@c LocalWords: dnotice copyable stdint ptrdiff bufsize @c LocalWords: dnotice copyable stdint ptrdiff bufsize yyreport invariants
@c LocalWords: xrefautomaticsectiontitle yysyntax yysymbol ARGMAX cond
@c LocalWords: Wdangling
@c Local Variables: @c Local Variables:
@c ispell-dictionary: "american" @c ispell-dictionary: "american"
+14 -14
View File
@@ -31,18 +31,18 @@ exit=true
cwd=$(pwd) cwd=$(pwd)
# The exercised program. # The exercised program.
for p in "$cwd/examples/$medir/$me" abs_medir=$cwd/examples/$medir
do if test -x "$abs_medir/$me"; then
if test -x "$p"; then prog ()
prog=$p {
break "$abs_medir/$me" "$@"
elif test -f "$p.class"; then }
pwd elif test -f "$abs_medir/$me.class"; then
prog="$SHELL $cwd/javaexec.sh -cp $(dirname $p) $(basename $p)" prog ()
break {
fi "$SHELL" "$cwd/javaexec.sh" -cp "$abs_medir" "$me" "$@"
done }
if test x"$prog" = x; then else
echo "$me: ERROR: cannot find program to exercise in:" echo "$me: ERROR: cannot find program to exercise in:"
echo "$me: ERROR: $cwd/examples/$medir/$me" echo "$me: ERROR: $cwd/examples/$medir/$me"
exit 1 exit 1
@@ -55,7 +55,7 @@ cleanup ()
{ {
status=$? status=$?
if test -z "$DEBUG"; then if test -z "$DEBUG"; then
cd $cwd cd "$cwd"
rm -rf $$.dir rm -rf $$.dir
fi fi
exit $status exit $status
@@ -82,7 +82,7 @@ run ()
shift shift
# Effective exit status. # Effective exit status.
sta_eff=0 sta_eff=0
$prog "$@" - <input >out_eff 2>err_eff || sta_eff=$? prog "$@" - <input >out_eff 2>err_eff || sta_eff=$?
# Combine effective output and error streams. # Combine effective output and error streams.
out_eff=$(cat out_eff && $noerr || sed -e 's/^/err: /g' err_eff) out_eff=$(cat out_eff && $noerr || sed -e 's/^/err: /g' err_eff)
if test $sta_eff -eq $sta_exp; then if test $sta_eff -eq $sta_exp; then
+1 -1
Submodule gnulib updated: f5eb8cea72...4fcedca004
+3
View File
@@ -138,6 +138,8 @@
/isnanl-nolibm.h /isnanl-nolibm.h
/isnanl.c /isnanl.c
/iswblank.c /iswblank.c
/iswdigit.c
/iswxdigit.c
/itold.c /itold.c
/lc-charset-dispatch.c /lc-charset-dispatch.c
/lc-charset-dispatch.h /lc-charset-dispatch.h
@@ -147,6 +149,7 @@
/limits.in.h /limits.in.h
/localcharset.c /localcharset.c
/localcharset.h /localcharset.h
/locale.h
/locale.in.h /locale.in.h
/localtime-buffer.c /localtime-buffer.c
/localtime-buffer.h /localtime-buffer.h
+3
View File
@@ -69,6 +69,8 @@
/isnanf.m4 /isnanf.m4
/isnanl.m4 /isnanl.m4
/iswblank.m4 /iswblank.m4
/iswdigit.m4
/iswxdigit.m4
/javacomp.m4 /javacomp.m4
/javaexec.m4 /javaexec.m4
/jm-winsz1.m4 /jm-winsz1.m4
@@ -210,3 +212,4 @@
/xalloc.m4 /xalloc.m4
/xsize.m4 /xsize.m4
/xstrndup.m4 /xstrndup.m4
/zzgnulib.m4
+2 -2
View File
@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.5.22-948cd-dirty. */ /* A Bison parser, made by GNU Bison 3.5.2. */
/* Bison implementation for Yacc-like parsers in C /* Bison implementation for Yacc-like parsers in C
@@ -48,7 +48,7 @@
#define YYBISON 1 #define YYBISON 1
/* Bison version. */ /* Bison version. */
#define YYBISON_VERSION "3.5.22-948cd-dirty" #define YYBISON_VERSION "3.5.2"
/* Skeleton name. */ /* Skeleton name. */
#define YYSKELETON_NAME "yacc.c" #define YYSKELETON_NAME "yacc.c"
+1 -1
View File
@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.5.22-948cd-dirty. */ /* A Bison parser, made by GNU Bison 3.5.2. */
/* Bison interface for Yacc-like parsers in C /* Bison interface for Yacc-like parsers in C
+21 -2
View File
@@ -2367,6 +2367,25 @@ AT_DATA([[input.y]],
start: %empty; start: %empty;
]]) ]])
# Only "full" and "none" are accepted for parse.lac
# Unknown values (such as "unsupported") are rejected
AT_BISON_CHECK([[-Dparse.lac=none input.y]])
AT_BISON_CHECK([[-Dparse.lac=none -L c++ input.y]])
AT_BISON_CHECK([[-Dparse.lac=full input.y]])
AT_BISON_CHECK([[-Dparse.lac=full -L c++ input.y]])
AT_BISON_CHECK([[-Dparse.lac=unsupported input.y]],
[[1]], [],
[[<command line>:3: error: invalid value for %define variable 'parse.lac': 'unsupported'
<command line>:3: accepted value: 'full'
<command line>:3: accepted value: 'none'
]])
AT_BISON_CHECK([[-Dparse.lac=unsupported -L c++ input.y]],
[[1]], [],
[[<command line>:3: error: invalid value for %define variable 'parse.lac': 'unsupported'
<command line>:3: accepted value: 'full'
<command line>:3: accepted value: 'none'
]])
# parse.lac.* options are useless if LAC isn't actually activated. # parse.lac.* options are useless if LAC isn't actually activated.
AT_BISON_CHECK([[-Dparse.lac.es-capacity-initial=1 input.y]], AT_BISON_CHECK([[-Dparse.lac.es-capacity-initial=1 input.y]],
[[1]], [], [[1]], [],
@@ -2378,11 +2397,11 @@ AT_BISON_CHECK([[-Dparse.lac.memory-trace=full input.y]],
]]) ]])
# parse.lac.* options are useless in C++ even if LAC isn't actually activated. # parse.lac.* options are useless in C++ even if LAC isn't actually activated.
AT_BISON_CHECK([[-Dparse.lac.es-capacity-initial=1 -L C++ -Dparse.lac input.y]], AT_BISON_CHECK([[-Dparse.lac.es-capacity-initial=1 -L C++ -Dparse.lac=full input.y]],
[[1]], [], [[1]], [],
[[<command line>:3: error: %define variable 'parse.lac.es-capacity-initial' is not used [[<command line>:3: error: %define variable 'parse.lac.es-capacity-initial' is not used
]]) ]])
AT_BISON_CHECK([[-Dparse.lac.memory-trace=full -L C++ -Dparse.lac input.y]], AT_BISON_CHECK([[-Dparse.lac.memory-trace=full -L C++ -Dparse.lac=full input.y]],
[[1]], [], [[1]], [],
[[<command line>:3: error: %define variable 'parse.lac.memory-trace' is not used [[<command line>:3: error: %define variable 'parse.lac.memory-trace' is not used
]]) ]])