From e3e21cc0d86c395b7043b80063bc8871173438d9 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Thu, 2 Apr 2020 06:59:35 +0200 Subject: [PATCH 01/15] examples: reccalc: compile cleanly in C99 See https://trac.macports.org/ticket/59927. * examples/c/reccalc/parse.y: C99 does not allow multiple typedefs. --- examples/c/reccalc/parse.y | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/c/reccalc/parse.y b/examples/c/reccalc/parse.y index 6d645294..3de58afc 100644 --- a/examples/c/reccalc/parse.y +++ b/examples/c/reccalc/parse.y @@ -133,6 +133,9 @@ exp: %% // Epilogue (C code). +// We already defined yyscan_t, don't let scan.h define it again. +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; #include "scan.h" result From 6e89bc0fd27ee8bf1095544504c6970530e9527c Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Thu, 2 Apr 2020 07:09:27 +0200 Subject: [PATCH 02/15] build: fix compatibility with old compilers GCC 4.2 dies with src/InadequacyList.c: In function 'InadequacyList__new_conflict': src/InadequacyList.c:37: error: #pragma GCC diagnostic not allowed inside functions src/InadequacyList.c:37: error: #pragma GCC diagnostic not allowed inside functions src/InadequacyList.c:40: error: #pragma GCC diagnostic not allowed inside functions Reported by Evan Lavelle. See https://lists.gnu.org/r/bug-bison/2020-03/msg00021.html and https://trac.macports.org/ticket/59927. * src/system.h (GCC_VERSION): New. Use it to control IGNORE_TYPE_LIMITS_BEGIN and IGNORE_TYPE_LIMITS_END. --- THANKS | 1 + src/system.h | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/THANKS b/THANKS index d8ef2c0c..9a06506b 100644 --- a/THANKS +++ b/THANKS @@ -61,6 +61,7 @@ Enrico Scholz enrico.scholz@informatik.tu-chemnitz.de Eric Blake ebb9@byu.net Eric S. Raymond esr@thyrsus.com Étienne Renault renault@lrde.epita.fr +Evan Lavelle eml-bison@cyconix.com Evan Nemerson evan@nemerson.com Evgeny Stambulchik fnevgeny@plasma-gate.weizmann.ac.il Fabrice Bauzac noon@cote-dazur.com diff --git a/src/system.h b/src/system.h index 0210f6c6..6073048f 100644 --- a/src/system.h +++ b/src/system.h @@ -73,9 +73,14 @@ typedef size_t uintptr_t; # include # include +// Clang and ICC like to pretend they are GCC. +#if defined __GNUC__ && !defined __clang__ && !defined __ICC +# define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) +#endif -/* See https://lists.gnu.org/archive/html/bug-bison/2019-10/msg00061.html. */ -# if defined __GNUC__ && ! defined __clang__ && ! defined __ICC && __GNUC__ < 5 +// See https://lists.gnu.org/archive/html/bug-bison/2019-10/msg00061.html +// and https://trac.macports.org/ticket/59927. +#if defined GCC_VERSION && 405 <= GCC_VERSION # define IGNORE_TYPE_LIMITS_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wtype-limits\"") From ef88dfba812b9179341d5fb7dd21e1adfa30fc0a Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 21 Mar 2020 08:29:13 +0100 Subject: [PATCH 03/15] doc: c++: promote api.token.raw * doc/bison.texi (Calc++ Parser): Here. --- doc/bison.texi | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/bison.texi b/doc/bison.texi index 7cf45189..2edf942b 100644 --- a/doc/bison.texi +++ b/doc/bison.texi @@ -12105,13 +12105,24 @@ designed the grammar for. %defines @end example +@noindent +@findex %define api.token.raw +Because our scanner returns only genuine tokens and never simple characters +(i.e., it returns @samp{PLUS}, not @samp{'+'}), we can avoid conversions. + +@comment file: calc++/parser.yy +@example +%define api.token.raw +@end example + @noindent @findex %define api.token.constructor @findex %define api.value.type variant -This example will use genuine C++ objects as semantic values, therefore, we -require the variant-based interface. To make sure we properly use it, we -enable assertions. To fully benefit from type-safety and more natural -definition of ``symbol'', we enable @code{api.token.constructor}. +This example uses genuine C++ objects as semantic values, therefore, we +require the variant-based storage of semantic values. To make sure we +properly use it, we enable assertions. To fully benefit from type-safety +and more natural definition of ``symbol'', we enable +@code{api.token.constructor}. @comment file: calc++/parser.yy @example From 6c23b012b9d3be56eb46337a009815136a9cc87d Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 29 Mar 2020 10:30:40 +0200 Subject: [PATCH 04/15] tests: recheck: work properly when the test suite was interrupted * tests/local.mk (recheck): Look at the per-test logs, not the overall log, which, when interrupted, contains only information about... the tests that passed. --- tests/local.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/local.mk b/tests/local.mk index 6bdf0516..b7e7cc59 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -96,10 +96,10 @@ clean-local-tests: .PHONY: recheck recheck: $(RUN_TESTSUITE_deps) - $(RUN_TESTSUITE) \ - $$(perl -n \ - -e 'if (/Summary of the failures/../Detailed failed tests/)' \ - -e '{ /^ *[0-9]+:/ && s/:.*//s && print }' %D%/testsuite.log) + $(RUN_TESTSUITE) \ + $$(perl -n \ + -e 'eof && /^(\d+).*: FAILED/ && print "$$1 "' \ + %D%/testsuite.dir/*/testsuite.log) check-local: $(RUN_TESTSUITE_deps) $(RUN_TESTSUITE) From cb40f5c6244050bc25152bd9949c7b4744dc4523 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 4 Apr 2020 07:31:06 +0200 Subject: [PATCH 05/15] build: fix syntax-check issues * src/system.h, tests/local.mk: Fix indentation. --- src/system.h | 8 ++++---- tests/local.mk | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/system.h b/src/system.h index 6073048f..606d3c46 100644 --- a/src/system.h +++ b/src/system.h @@ -74,13 +74,13 @@ typedef size_t uintptr_t; # include // Clang and ICC like to pretend they are GCC. -#if defined __GNUC__ && !defined __clang__ && !defined __ICC -# define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) -#endif +# if defined __GNUC__ && !defined __clang__ && !defined __ICC +# define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) +# endif // See https://lists.gnu.org/archive/html/bug-bison/2019-10/msg00061.html // and https://trac.macports.org/ticket/59927. -#if defined GCC_VERSION && 405 <= GCC_VERSION +# if defined GCC_VERSION && 405 <= GCC_VERSION # define IGNORE_TYPE_LIMITS_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wtype-limits\"") diff --git a/tests/local.mk b/tests/local.mk index b7e7cc59..fac8426f 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -99,7 +99,7 @@ recheck: $(RUN_TESTSUITE_deps) $(RUN_TESTSUITE) \ $$(perl -n \ -e 'eof && /^(\d+).*: FAILED/ && print "$$1 "' \ - %D%/testsuite.dir/*/testsuite.log) + %D%/testsuite.dir/*/testsuite.log) check-local: $(RUN_TESTSUITE_deps) $(RUN_TESTSUITE) From cca8c734310fa32a8fe8ca0615b743797f6aad36 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 4 Apr 2020 08:03:17 +0200 Subject: [PATCH 06/15] java: style: prefer 'int[] foo' to 'int foo[]' * data/skeletons/java.m4 (b4_typed_parser_table_define): Here. --- data/skeletons/java.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/skeletons/java.m4 b/data/skeletons/java.m4 index 83e2ec6c..cb9c407e 100644 --- a/data/skeletons/java.m4 +++ b/data/skeletons/java.m4 @@ -109,7 +109,7 @@ m4_define([b4_null], [null]) m4_define([b4_typed_parser_table_define], [m4_ifval([$4], [b4_comment([$4]) ])dnl -[private static final ]$1[ yy$2_[] = yy$2_init(); +[private static final ]$1[[] yy$2_ = yy$2_init(); private static final ]$1[[] yy$2_init() { return new ]$1[[] From 72f04ca80fc8cd90da86529a55d45dc415eb5674 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Thu, 2 Apr 2020 09:26:14 +0200 Subject: [PATCH 07/15] java: check and fix support for api.token.raw * tests/local.at (AT_LANG_MATCH, AT_YYERROR_DECLARE(java)) (AT_YYERROR_DECLARE_EXTERN(java), AT_PARSER_CLASS): New. (AT_MAIN_DEFINE(java)): Use AT_PARSER_CLASS. * tests/scanner.at: Add a test for Java. * data/skeletons/lalr1.java (yytranslate_): Cast the result. --- data/skeletons/lalr1.java | 2 +- tests/local.at | 21 +++++++- tests/scanner.at | 110 +++++++++++++++++++++++++++++++++++--- 3 files changed, 122 insertions(+), 11 deletions(-) diff --git a/data/skeletons/lalr1.java b/data/skeletons/lalr1.java index 7b0dc7e9..6eb34ecd 100644 --- a/data/skeletons/lalr1.java +++ b/data/skeletons/lalr1.java @@ -1012,7 +1012,7 @@ b4_dollar_popdef[]dnl private static final ]b4_int_type_for([b4_translate])[ yytranslate_ (int t) ]b4_api_token_raw_if(dnl [[ { - return t; + return (]b4_int_type_for([b4_translate])[) t; } ]], [[ { diff --git a/tests/local.at b/tests/local.at index f49f4733..1adb698a 100644 --- a/tests/local.at +++ b/tests/local.at @@ -233,6 +233,11 @@ m4_pushdef([AT_PARSE_PARAMS]) m4_bpatsubst([$3], [%parse-param { *\([^{}]*[^{} ]\) *}], [m4_append([AT_PARSE_PARAMS], [\1, ])]) +m4_pushdef([AT_PARSER_CLASS], +[m4_bmatch([$3], [%define *api\.parser\.class {\([^\}]*\)}], + [m4_bregexp([$3], [%define *api\.parser\.class {\([^\}]*\)}], [\1])], + [AT_API_PREFIX[]Parser])]) + m4_pushdef([AT_PURE_IF], [m4_bmatch([$3], [%define *api\.pure\|%pure-parser], [m4_bmatch([$3], [%define *api\.pure *false], [$2], [$1])], @@ -382,6 +387,7 @@ m4_popdef([AT_LOCATION_IF]) m4_popdef([AT_PARSE_PARAMS]) m4_popdef([AT_PUSH_IF]) m4_popdef([AT_PURE_IF]) +m4_popdef([AT_PARSER_CLASS]) m4_popdef([AT_PARAM_IF]) m4_popdef([AT_LEXPARAM_IF]) m4_popdef([AT_YACC_IF]) @@ -409,6 +415,12 @@ m4_define([AT_LANG_CASE], [m4_case(AT_LANG, $@)]) +# AT_LANG_MATCH(LANG1, IF-LANG1, LANG2, IF-LANG2, ..., DEFAULT) +# ------------------------------------------------------------ +m4_define([AT_LANG_MATCH], +[m4_bmatch(AT_LANG, $@)]) + + # _AT_LANG_DISPATCH(LANG, MACRO, ARGS) # ------------------------------------ # Call the specialization of MACRO for LANG with ARGS. Complain if @@ -747,6 +759,9 @@ m4_define([AT_MAIN_DEFINE(d)], # ------------------------------ m4_copy([AT_DATA], [AT_DATA_GRAMMAR(java)]) +# No need to declare, it's part of the class interface. +m4_define([AT_YYERROR_DECLARE(java)], []) +m4_define([AT_YYERROR_DECLARE_EXTERN(java)], []) # AT_JAVA_POSITION_DEFINE # ----------------------- @@ -829,10 +844,12 @@ m4_define([AT_YYLEX_DEFINE(java)], m4_define([AT_MAIN_DEFINE(java)], [[class input { - public static void main (String args[]) throws IOException + public static void main (String[] args) throws IOException { ]AT_API_prefix[Parser p = new ]AT_API_prefix[Parser (); - System.exit (p.parse () ? 0 : 1); + boolean success = p.parse (); + if (!success) + System.exit (1); } }]]) diff --git a/tests/scanner.at b/tests/scanner.at index 43484cfe..bc05538a 100644 --- a/tests/scanner.at +++ b/tests/scanner.at @@ -158,6 +158,78 @@ m4_pushdef([AT_MAIN_DEFINE(d)], }]]) +m4_pushdef([AT_MAIN_DEFINE(java)], +[[class input +{ + public static void main (String[] args) throws IOException + {]AT_LEXPARAM_IF([[ + ]AT_PARSER_CLASS[ p = new ]AT_PARSER_CLASS[ (System.in);]], [[ + ]AT_API_prefix[Lexer l = new ]AT_API_prefix[Lexer (System.in); + ]AT_PARSER_CLASS[ p = new ]AT_PARSER_CLASS[ (l);]])AT_DEBUG_IF([[ + //p.setDebugLevel (1);]])[ + boolean success = p.parse (); + if (!success) + System.exit (1); + } +}]]) + +m4_define([AT_RAW_YYLEX(java)], +[[class CalcLexer implements Calc.Lexer { + + StreamTokenizer st; + + public CalcLexer (InputStream is) + { + st = new StreamTokenizer (new StringReader ("0-(1+2)*3/9")); + st.resetSyntax (); + st.eolIsSignificant (true); + st.whitespaceChars ('\t', '\t'); + st.whitespaceChars (' ', ' '); + st.wordChars ('0', '9'); + } + + public void yyerror (String s) + { + System.err.println (s); + } + + Integer yylval; + + public Object getLVal () { + return yylval; + } + + public int yylex () throws IOException { + int ttype = st.nextToken (); + switch (ttype) + { + case StreamTokenizer.TT_EOF: + return EOF; + case StreamTokenizer.TT_EOL: + return (int) '\n'; + case StreamTokenizer.TT_WORD: + yylval = new Integer (st.sval); + return NUM; + case '+': + return PLUS; + case '-': + return MINUS; + case '*': + return STAR; + case '/': + return SLASH; + case '(': + return LPAR; + case ')': + return RPAR; + default: + throw new AssertionError ("invalid character: " + ttype); + } + } +} +]]) + + ## ------------------- ## ## Raw token numbers. ## ## ------------------- ## @@ -166,19 +238,31 @@ m4_pushdef([AT_TEST], [ AT_SETUP([Token numbers: $1]) -AT_BISON_OPTION_PUSHDEFS([%debug $1]) +AT_BISON_OPTION_PUSHDEFS([%debug ]m4_bmatch([$1], [java], [[%define api.prefix {Calc} %define api.parser.class {Calc}]])[ $1]) AT_DATA_GRAMMAR([[input.y]], [[$1 %debug -]AT_D_IF([], [[ +]AT_LANG_MATCH([[c\|c++]], [[ %code { #include ]AT_YYERROR_DECLARE[ ]AT_YYLEX_DECLARE[ -}]])[ +}]], + [java], [[ +%define api.prefix {Calc} +%define api.parser.class {Calc} +%code imports { + import java.io.IOException; + import java.io.InputStream; + import java.io.StringReader; + import java.io.Reader; + import java.io.StreamTokenizer; +} +]])[ -]AT_VARIANT_IF([[ +]AT_LANG_MATCH([c\|c++\|d], +[AT_VARIANT_IF([[ %token NUM "number" %nterm exp ]], [[ @@ -187,6 +271,10 @@ AT_DATA_GRAMMAR([[input.y]], } %token NUM "number" %nterm exp +]])], + [java], +[[%token NUM "number" +%type exp ]])[ %token @@ -204,7 +292,7 @@ AT_DATA_GRAMMAR([[input.y]], %% input -: exp { printf ("%d\n", $][1); } +: exp { ]AT_JAVA_IF([[System.out.println ($][1)]], [[printf ("%d\n", $][1)]])[; } ; exp @@ -217,21 +305,26 @@ exp ; %% -]AT_YYERROR_DEFINE[ +]AT_LANG_MATCH([c\|c++\|d], + [AT_YYERROR_DEFINE])[ ]AT_RAW_YYLEX[ ]AT_MAIN_DEFINE[ ]]) AT_FULL_COMPILE([input]) +# When api.token.raw, the yytranslate table should not be included. +# # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). -AT_CHECK([[$EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =' input.]AT_LANG_EXT], +# lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). +AT_CHECK([[$EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.]AT_LANG_EXT], [ignore], [AT_TOKEN_RAW_IF([0], [1])[ ]]) + AT_PARSER_CHECK([input], 0, [[-1 ]]) @@ -240,11 +333,12 @@ AT_BISON_OPTION_POPDEFS AT_CLEANUP ]) -m4_foreach([b4_skel], [[yacc.c], [glr.c], [lalr1.cc], [glr.cc], [lalr1.d]], +m4_foreach([b4_skel], [[yacc.c], [glr.c], [lalr1.cc], [glr.cc], [lalr1.java], [lalr1.d]], [AT_TEST([%skeleton "]b4_skel["]) AT_TEST([%skeleton "]b4_skel[" %define api.token.raw])]) AT_TEST([%skeleton "lalr1.cc" %define api.token.raw %define api.value.type variant %define api.token.constructor])]) +m4_popdef([AT_MAIN_DEFINE(java)]) m4_popdef([AT_MAIN_DEFINE(d)]) m4_popdef([AT_TEST]) From 4a55a5ea9a77d3803df7508793bf0058e700b83d Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 4 Apr 2020 10:42:21 +0200 Subject: [PATCH 08/15] package: improve the readme * README: Describe what Bison is. --- README | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/README b/README index f8d79755..f5748c3c 100644 --- a/README +++ b/README @@ -1,4 +1,19 @@ -This package contains the GNU Bison parser generator. +GNU Bison is a general-purpose parser generator that converts an annotated +context-free grammar into a deterministic LR or generalized LR (GLR) parser +employing LALR(1) parser tables. Bison can also generate IELR(1) or +canonical LR(1) parser tables. Once you are proficient with Bison, you can +use it to develop a wide range of language parsers, from those used in +simple desk calculators to complex programming languages. + +Bison is upward compatible with Yacc: all properly-written Yacc grammars +work with Bison with no change. Anyone familiar with Yacc should be able to +use Bison with little trouble. You need to be fluent in C, C++ or Java +programming in order to use Bison. + +Bison and the parsers it generates are portable, they do not require any +specific compilers. + +GNU Bison's home page is https://gnu.org/software/bison/. # Installation ## Build from git @@ -103,7 +118,8 @@ fill-column: 76 ispell-dictionary: "american" End: -LocalWords: parsers ngettext Texinfo pdf html YYYY ZZZZ ispell american -LocalWords: MERCHANTABILITY +LocalWords: parsers ngettext Texinfo pdf html YYYY ZZZZ ispell american md +LocalWords: MERCHANTABILITY GLR LALR IELR submodule init README src bw +LocalWords: Relocatability symlinks symlink --> From 1c273826d45715aa562c0c1b13accb8c1151658a Mon Sep 17 00:00:00 2001 From: Adrian Vogelsgesang Date: Thu, 27 Feb 2020 09:52:03 +0100 Subject: [PATCH 09/15] typo: succesful -> successful * tests/calc.at: Here. --- tests/calc.at | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/calc.at b/tests/calc.at index 0cd6db82..bac7e87c 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -720,7 +720,7 @@ _AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (1 2) = 1], [113], calc: error: 2222 != 1]) # Check that yyerrok works properly: second error is not reported, -# third and fourth are. Parse status is succesful. +# third and fourth are. Parse status is successful. _AT_CHECK_CALC_ERROR([$1], [0], [(* *) + (*) + (*)], [113], [1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!' 1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!' From 1376a7c6e2391b252cb5b6f03c1306d19b02e3bf Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 4 Apr 2020 10:46:56 +0200 Subject: [PATCH 10/15] style: fix spellos * src/complain.c, src/print.c, src/print-xml.c, src/symtab.h: here. --- src/complain.c | 6 +++--- src/print-xml.c | 2 +- src/print.c | 2 +- src/scan-code.l | 2 +- src/symtab.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/complain.c b/src/complain.c index 04e22708..f15c6b8b 100644 --- a/src/complain.c +++ b/src/complain.c @@ -41,9 +41,9 @@ bool warnings_are_errors = false; /** Whether -Werror/-Wno-error was applied to a warning. */ typedef enum { - errority_unset = 0, /** No explict status. */ - errority_disabled = 1, /** Explictly disabled with -Wno-error=foo. */ - errority_enabled = 2 /** Explictly enabled with -Werror=foo. */ + errority_unset = 0, /** No explicit status. */ + errority_disabled = 1, /** Explicitly disabled with -Wno-error=foo. */ + errority_enabled = 2 /** Explicitly enabled with -Werror=foo. */ } errority; /** For each warning type, its errority. */ diff --git a/src/print-xml.c b/src/print-xml.c index a7d165dc..61fb93b4 100644 --- a/src/print-xml.c +++ b/src/print-xml.c @@ -329,7 +329,7 @@ print_reductions (FILE *out, int level, state *s) /*--------------------------------------------------------------. | Report on OUT all the actions (shifts, gotos, reductions, and | -| explicit erros from %nonassoc) of S. | +| explicit errors from %nonassoc) of S. | `--------------------------------------------------------------*/ static void diff --git a/src/print.c b/src/print.c index b0c89319..259c16b3 100644 --- a/src/print.c +++ b/src/print.c @@ -319,7 +319,7 @@ print_reductions (FILE *out, state *s) /*--------------------------------------------------------------. | Report on OUT all the actions (shifts, gotos, reductions, and | -| explicit erros from %nonassoc) of S. | +| explicit errors from %nonassoc) of S. | `--------------------------------------------------------------*/ static void diff --git a/src/scan-code.l b/src/scan-code.l index ef667146..39cb4539 100644 --- a/src/scan-code.l +++ b/src/scan-code.l @@ -617,7 +617,7 @@ handle_action_dollar (symbol_list *rule, char *text, const location *dollar_loc) char *cp = fetch_type_name (text + 1, &type_name, dollar_loc); int n = parse_ref (cp, effective_rule, effective_rule_length, rule->midrule_parent_rhs_index, text, dollar_loc, '$'); - /* End type_name. Don't do it ealier: parse_ref depends on TEXT. */ + /* End type_name. Don't do it earlier: parse_ref depends on TEXT. */ if (type_name) cp[-1] = '\0'; diff --git a/src/symtab.h b/src/symtab.h index d6de8023..f3421774 100644 --- a/src/symtab.h +++ b/src/symtab.h @@ -130,7 +130,7 @@ struct sym_content /** Its \c \%type's location. */ location type_loc; - /** Any \c \%destructor (resp. \%printer) declared specificially for this + /** Any \c \%destructor (resp. \%printer) declared specifically for this symbol. Access this field only through symbol's interface functions. For From cc6e5cf85417f26e4fe64c26d469bba86b92ea85 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 4 Apr 2020 07:35:11 +0200 Subject: [PATCH 11/15] news: update for 3.5.4 --- NEWS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NEWS b/NEWS index b727f6d4..2de5799e 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,11 @@ GNU Bison NEWS * Noteworthy changes in release ?.? (????-??-??) [?] +** Bug fixes + + Fix portability issues of the package itself on old compilers. + + Fix api.token.raw support in Java. * Noteworthy changes in release 3.5.3 (2020-03-08) [stable] From 961ea2ac8548f8f5e8b48b89e680931ba6c7b15e Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 4 Apr 2020 14:52:58 +0200 Subject: [PATCH 12/15] news: announce that Bison 3.6 drops YYERROR_VERBOSE * NEWS: here. --- NEWS | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NEWS b/NEWS index 2de5799e..d5d1d019 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,18 @@ GNU Bison NEWS * Noteworthy changes in release ?.? (????-??-??) [?] +** WARNING: Future backward-incompatibilities! + + TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose". + + Bison 3.6 will no longer support the YYERROR_VERBOSE macro; the parsers + that still depend on it will produce Yacc-like error messages (just + "syntax error"). It was superseded by the "%error-verbose" directive in + Bison 1.875 (2003-01-01). Bison 2.6 (2012-07-19) clearly announced that + support for YYERROR_VERBOSE would be removed. Note that since Bison 3.0 + (2013-07-25), "%error-verbose" is deprecated in favor of "%define + parse.error verbose". + ** Bug fixes Fix portability issues of the package itself on old compilers. From 678853da7e43e4b89098d69d276ee12ec07ede95 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 5 Apr 2020 08:34:40 +0200 Subject: [PATCH 13/15] examples: reccalc: really compile cleanly in C99 The previous fix does not suffice, and actually managed to make things worse by defining yyscan_t twice in parse.y... Reported by kencu. https://trac.macports.org/ticket/59927#comment:29 * examples/c/reccalc/parse.y (yyscan_t): Define it with the same guards as used by Flex. --- examples/c/reccalc/parse.y | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/c/reccalc/parse.y b/examples/c/reccalc/parse.y index 3de58afc..ae80942c 100644 --- a/examples/c/reccalc/parse.y +++ b/examples/c/reccalc/parse.y @@ -4,7 +4,11 @@ // Emitted in the header file, before the definition of YYSTYPE. %code requires { + #ifndef YY_TYPEDEF_YY_SCANNER_T + # define YY_TYPEDEF_YY_SCANNER_T typedef void* yyscan_t; + #endif + typedef struct { // Whether to print the intermediate results. @@ -132,10 +136,6 @@ exp: %% // Epilogue (C code). - -// We already defined yyscan_t, don't let scan.h define it again. -#define YY_TYPEDEF_YY_SCANNER_T -typedef void* yyscan_t; #include "scan.h" result From 5604903f7a670c287c630cdb9686e5f02481ede0 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 5 Apr 2020 09:08:30 +0200 Subject: [PATCH 14/15] version 3.5.4 * NEWS: Record release date. --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index d5d1d019..75c8abdc 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ GNU Bison NEWS -* Noteworthy changes in release ?.? (????-??-??) [?] +* Noteworthy changes in release 3.5.4 (2020-04-05) [stable] ** WARNING: Future backward-incompatibilities! From 6c44f2dce31f5d19d09dfae7f58921e767842e29 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 5 Apr 2020 09:27:36 +0200 Subject: [PATCH 15/15] maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update. --- .prev-version | 2 +- NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.prev-version b/.prev-version index 444877d4..65afb3b8 100644 --- a/.prev-version +++ b/.prev-version @@ -1 +1 @@ -3.5.3 +3.5.4 diff --git a/NEWS b/NEWS index 75c8abdc..e0bc4b09 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ GNU Bison NEWS +* Noteworthy changes in release ?.? (????-??-??) [?] + + * Noteworthy changes in release 3.5.4 (2020-04-05) [stable] ** WARNING: Future backward-incompatibilities!