| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Run "make update-copyright".
|
|
|
|
| |
* configure.ac (warn_cxx): here.
|
|
|
|
|
|
|
|
|
| |
For some reason this test fails on Solaris/x86. But multistart is not
part of 3.8, so we can postpone the debugging of this issue.
Reported by Dagobert Michelsen.
<https://lists.gnu.org/r/bug-bison/2021-08/msg00027.html>
* tests/report.at (Multistart reports): Comment out.
|
| |
|
|
|
|
|
|
|
|
|
| |
Besides, for mysterious reasons, this fails on some environment.
Reported by Dagobert Michelsen.
<https://lists.gnu.org/archive/html/bug-bison/2021-08/msg00008.html>
* examples/c/lexcalc/lexcalc.test, examples/c/lexcalc/parse.y,
* examples/c/lexcalc/scan.l: Revert to a single-start example.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reported by Dagobert Michelsen.
https://lists.gnu.org/r/bug-bison/2021-08/msg00006.html
* m4/bison-cxx-std.m4 (_BISON_CXXSTD_98_snippet): We don't need
vector::data, it was only for glr2.cc, which is C++11 anyway.
(_BISON_CXXSTD_11_snippet): We need vector::data and std::swap on
arrays.
* m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): We don't need
vector::data.
* tests/local.at (AT_COMPILE_CXX): Skip when glr2.cc and no support
for C++11.
|
|
|
|
|
|
|
| |
Reported by Tom Shields <thomas.evans.shields@icloud.com>.
* data/skeletons/glr.c (yypcontext_location): Fix return type.
* tests/calc.at: Check the case pure, location, custom error messages.
|
|
|
|
|
|
|
|
|
| |
In some extreme situations, with lots of useless tokens, Bison was
numbering them incorrectly, which resulted in a broken grammar.
<https://lists.gnu.org/r/bison-patches/2021-03/msg00001.html>
commit a774839ca873d1082f79ba3c4eecc1e242a28ce1.
* tests/regression.at (Useless Tokens): New.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In POSIX Yacc mode, declare yyerror and yylex unless already #defined,
or if YYERROR_IS_DECLARED/YYLEX_IS_DECLARED are defined (for
consistency with Bison's YYSTYPE_IS_DECLARED/YYLTYPE_IS_DECLARED).
See <https://austingroupbugs.net/view.php?id=1388#c5220>.
* data/skeletons/c.m4 (b4_function_declare): Resurect.
(b4_lex_formals): Since we will possibly expose this prototype
in the header, take the prefix into account.
* data/skeletons/yacc.c (b4_declare_yyerror_and_yylex): New.
(b4_shared_declarations): Use it.
* tests/local.at (AT_YACC_IF): New.
When in Yacc mode, set the `yacc` Autotest keyword.
(AT_YYERROR_DECLARE(c)): Don't declare in Yacc mode,
to avoid clashes (since this signature is static).
(AT_YYERROR_DEFINE(c)): Don't define as static in Yacc mode.
* tests/regression.at (Early token definitions with --yacc): Specify
that we are in Yacc mode.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Check in m4's output if there are sequences such as m4_foo or b4_foo,
which are probably resulting from incorrect m4 processing.
It actually already is useful:
- it caught a leaking b4_lac_if leaking from glr.c, where LAC is not
supported, hence b4_lac_if is not defined.
- it also caught references to location.hh in position.hh when
location.hh does not exist.
- while making "Code injection" robust to these new warnings (it is
its very purpose to let b4_canary pass unevaluated), I saw that it
did not check lalr1.d, and when adding lalr1.d, it revealed it did
underquote ocurrences of token value types.
* src/scan-skel.l (macro): New abbreviation.
Use it.
* data/skeletons/glr.c: Don't use b4_lac_if, we don't have it.
* data/skeletons/location.cc: Don't generate position.hh when we don't
generate location.hh.
* data/skeletons/d.m4 (b4_basic_symbol_constructor_define): Fix
underquotation.
* data/skeletons/bison.m4 (b4_canary): New.
* tests/input.at (Code injection): Use it, and check lalr1.d too.
|
|
|
|
| |
* src/scan-code.l: Fix indentation.
|
|
|
|
| |
* doc/bison.texi (Enabling Traces): here.
|
| |
|
|
|
|
|
|
|
| |
See <https://lists.gnu.org/r/help-bison/2020-12/msg00016.html>.
* doc/bison.texi (Merging GLR Parses): document typed mergers.
And avoid #define YYSTYPE.
|
| |
|
|
|
|
|
|
| |
Document YYLOCATION_PRINT.
* doc/bison.texi (Printing Locations): New node.
|
|
|
|
|
|
|
|
|
| |
Its removal was annonced several times in NEWS (for Bison 3.5, 3.6, 3.7).
* data/skeletons/c.m4, data/skeletons/yacc.c: Remove support for YYPRINT.
* NEWS: Fix the mess introduced by the merge.
Document the removal of YYPRINT.
* doc/bison.texi (The YYPRINT Macro): Remove.
|
|
|
|
|
|
|
|
| |
We have been accepting this for years, but it is deprecated: people
are expecting to define api.value.type instead.
* doc/bison.texi: Make it clear that YYSTYPE and YYLTYPE are for C
only.
|
|
|
|
| |
Also, fix a few http: URLs that were no longer working.
|
|
|
|
|
| |
* TODO, cfg.mk: Update.
* src/parse-gram.c, src/parse-gram.h: Regen.
|
|
|
|
| |
Run 'make update-copyright'.
|
|
|
|
|
|
|
| |
* data/skeletons/glr2.cc: Add support for api.token.constructor.
* examples/c++/glr/c++-types.yy: Use it.
* examples/c++/glr/c++-types.test: Adjust expectations for error
messages.
|
|
|
|
|
|
|
|
|
| |
* examples/c/glr/c++-types.y (node_print): New.
Use YY_LOCATION_PRINT instead of duplicating it.
And actually use it in the action instead of badly duplicating it.
(main): Add proper option support.
* examples/c/glr/c++-types.test: Adjust expectations on locations.
* examples/c++/glr/c++-types.yy: Fix bad iteration.
|
|
|
|
|
|
|
|
|
|
|
| |
Reported by Jot Dot.
https://lists.gnu.org/r/help-bison/2020-12/msg00014.html
* data/skeletons/glr.c, data/skeletons/glr2.cc (b4_call_merger): Use
the symbol's slot, not its type.
* examples/c/glr/c++-types.y: Use explicit per-symbol typing together
with api.value.type=union.
(yylex): Use yytoken_kind_t.
|
|
|
|
|
| |
* data/skeletons/glr.c, data/skeletons/glr2.cc: Use yyval, as in
the other skeletons.
|
|
|
|
|
|
|
|
| |
* data/skeletons/README-D.txt: Remove, now useless and obsolete.
* data/skeletons/glr2.cc, examples/d/calc/calc.y,
* tests/calc.at, tests/d.at, tests/scanner.at (semanticVal): Replace
with...
(value): this.
|
|
|
|
|
| |
* data/skeletons/glr2.cc (YY_DEBUG_STREAM): Rename as...
(YYCDEBUG): this, as in lalr1.cc.
|
|
|
|
|
|
| |
* data/skeletons/glr2.cc: Define value_type and location_type where
needed, and use them only.
(yyuserMerge): Make it a member function of the glr_state class.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently we are using pointers. The whole point of
glr2.cc (vs. glr.cc) is precisely to allow genuine C++ objects to be
semantic values. Let's make that work.
* data/skeletons/glr2.cc (glr_state::glr_state): Be sure to initialize
yysval.
(glr_state): Add copy-ctor, assignment and dtor.
(glr_state::copyFrom): Be sure to initialize the destination if it was
not.
(glr_state::~glr_state): Destroy the semantic value.
* examples/c++/glr/ast.hh: Rewrite so that we use genuine objects,
rather than a traditional OOP hierarchy that requires to deal with
pointers.
With help from Bruno Belanyi <bruno.belanyi@epita.fr>.
* examples/c++/glr/c++-types.yy: Remove memory management.
Use true objects.
(main): Don't reach yydebug directly.
* examples/c++/glr/local.mk: We need C++11.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A glr_state keeps tracks of its predecessor using an offset relative
to itself (i.e., pointer subtraction). Unfortunately we sometimes
have to compute offsets for pointers that live in different
containers, in particular in yyfillin. In that case there is no
reason for the distance between the two objects to be a multiple of
the object size (0x40 on my machine), and the resulting ptrdiff_t may
be "wrong", i.e., it does allow to recover one from the other. We
cannot use "typed" pointer arithmetics here, the Euclidean division
has it wrong. So use "plain" char* pointers.
Fixes 718 (Duplicate representation of merged trees: glr2.cc) and
examples/c++/glr/c++-types.
Still XFAIL:
712: Improper handling of embedded actions and dollar(-N) in GLR parsers: glr2.cc
730: Incorrectly initialized location for empty right-hand side in GLR: glr2.cc
748: Incorrect lookahead during nondeterministic GLR: glr2.cc
* data/skeletons/glr2.cc (glr_state::as_pointer_): New.
(glr_state::pred): Use it.
* examples/c++/glr/c++-types.test: The test passes.
* tests/glr-regression.at (Duplicate representation of merged trees:
glr2.cc): Passes.
|
|
|
|
|
| |
* data/skeletons/glr2.cc: Fake support of parse.assert, so that the
tests can use it without failing.
|
|
|
|
|
| |
* data/skeletons/glr2.cc: Prefer references to pointers.
Add a few more const.
|
|
|
|
|
| |
* data/skeletons/glr.c (yyglrReduce): Fix line numbers.
* tests/glr-regression.at: Fix expectations.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
* src/gram.h (rule_is_initial): New.
* src/graphviz.c, src/print-xml.c, src/print.c, src/lalr.c: Use it.
Some of these occurrences were incorrect (checking whether this is
rule 0), and not behaving properly in the case of multistart.
|
|
|
|
|
|
| |
* tests/local.at (AT_YYLEX_DEFINE(java)): Fix overquoting issue.
Style changes.
* tests/regression.at (LAC: Exploratory stack): Run for lalr1.java too.
|
|
|
|
|
|
| |
* tests/calc.at (CALC_EOF): Rename as...
(EOF): this.
Since there is no risk of a clash with #define EOF here...
|
|
|
|
| |
* data/skeletons/yacc.c: here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For each start symbol, generate a parsing function with a richer
return value than the usual of yyparse. Reserve a place for the
returned semantic value, in order to avoid having to pass a pointer as
argument to "return" that value. This also makes the call to the
parsing function independent of whether a given start-symbol is typed.
For instance, if the grammar file contains:
%type <int> expression
%start input expression
(so "input" is valueless) we get
typedef struct
{
int yystatus;
} yyparse_input_t;
yyparse_input_t yyparse_input (void);
typedef struct
{
int yyvalue;
int yystatus;
} yyparse_expression_t;
yyparse_expression_t yyparse_expression (void);
This commit also changes the implementation of the parser termination:
when there are multiple start symbols, it is the initial rules that
explicitly YYACCEPT. They do that after having exported the
start-symbol's value (if it is typed):
switch (yyn)
{
case 1: /* $accept: YY_EXPRESSION expression $end */
{ ((*yyvalue).TOK_expression) = (yyvsp[-1].TOK_expression); YYACCEPT; }
break;
case 2: /* $accept: YY_INPUT input $end */
{ YYACCEPT; }
break;
I have tried several ways to deal with termination, and this is the
one that appears the best one to me. It is also the most natural.
* src/scan-code.h, src/scan-code.l (obstack_for_actions): New.
* src/reader.c (grammar_rule_check_and_complete): Generate the actions
of the rules for each start symbol.
* data/skeletons/bison.m4 (b4_symbol_slot): New, with safer semantics
than type and type_tag.
* data/skeletons/yacc.c (b4_accept): New.
Generates the body of the action of the start rules.
(_b4_declare_sub_yyparse): For each start symbol define a dedicated
return type for its parsing function.
Adjust the declaration of its parsing function.
(_b4_define_sub_yyparse): Adjust the definition of the function.
* examples/c/lexcalc/parse.y: Check the case of valueless symbols.
* examples/c/lexcalc/lexcalc.test: Check start symbols.
|
| |
|
|
|
|
| |
* data/skeletons/yacc.c: Add support for multiple start symbols.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that the parser can read several start symbols, let's process
them, and create the corresponding rules.
* src/parse-gram.y (grammar_declaration): Accept a list of start symbols.
* src/reader.h, src/reader.c (grammar_start_symbol_set): Rename as...
(grammar_start_symbols_set): this.
* src/reader.h, src/reader.c (start_flag): Replace with...
(start_symbols): this.
* src/reader.c (grammar_start_symbols_set): Build a list of start
symbols.
(switching_token, create_start_rules): New.
(check_and_convert_grammar): Use them to turn the list of start
symbols into a set of rules.
* src/reduce.c (nonterminals_reduce): Don't complain about $accept,
it's an internal detail.
(reduce_grammar): Complain about all the start symbols that don't
derive sentences.
* src/symtab.c (startsymbol, startsymbol_loc): Remove, replaced by
start_symbols.
symbols_pack): Move the check about the start symbols
to...
* src/symlist.c (check_start_symbols): here.
Adjust to multiple start symbols.
* tests/reduce.at (Empty Language): Generalize into...
(Bad start symbols): this.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* data/skeletons/lalr1.d: Change the return value.
* examples/d/calc/calc.y, examples/d/simple/calc.y: Adjust.
* tests/scanner.at: Adjust.
* tests/calc.at (_AT_DATA_CALC_Y(d)): New, extracted from...
(_AT_DATA_CALC_Y(c)): here.
The two grammars have been sufficiently different to be separated.
Still trying to be them together results in a maintenance burden. For
the same reason, instead of specifying the results for D and for the
rest, compute the expected results with D from the regular case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For instance with GCC8:
616. regression.at:1560: testing Lex and parse params: glr2.cc ...
tests/regression.at:1560: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y
tests/regression.at:1560: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS
stderr:
input.cc: In member function 'YYRESULTTAG glr_stack::yyresolveValue(glr_state*)':
input.cc:1796:10: error: potential null pointer dereference [-Werror=null-dereference]
return yypred ? &(asItem(this) - yypred)->getState() : YY_NULLPTR;
^~~~~~
input.cc:1796:10: error: potential null pointer dereference [-Werror=null-dereference]
return yypred ? &(asItem(this) - yypred)->getState() : YY_NULLPTR;
^~~~~~
cc1plus: all warnings being treated as errors
It complains that the implicit this in yypred might be null. It fears
it because of loops such as
for (glr_state* yys = firstTopState();
yys != yystateStack.yysplitPoint;
yys = yys->pred())
yyn += 1;
that could possibly set yys to null, since yys->pred might return
null. However, the warning is incorrect, since in C++ `this` cannot
be null. GCC 10 no longer emits this warning.
GCC 7 also complains many times about glr_stack::yyresolveLocations
when NDEBUG is enabled (when it is not, YYASSERT (yyoption !=
YY_NULLPTR) is probably enough to pacify GCC):
616. regression.at:1560: testing Lex and parse params: glr2.cc ...
tests/regression.at:1560: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y
tests/regression.at:1560: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS
stderr:
input.cc: In member function 'void glr_stack::yyresolveLocations(glr_state*, int)':
input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference]
yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference]
yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference]
yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
input.cc: In member function 'YYRESULTTAG glr_stack::yyresolveValue(glr_state*)':
input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference]
yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference]
yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference]
yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference]
yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference]
yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
input.cc:3061:46: error: potential null pointer dereference [-Werror=null-dereference]
yyrhsloc[0].getState().yyloc = yyoption->state()->yyloc;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
* data/skeletons/glr2.cc (YY_IGNORE_NULL_DEREFERENCE_BEGIN)
(YY_IGNORE_NULL_DEREFERENCE_BEGIN): New.
(glr_state::pred, glr_stack::yyresolveLocations): Use them.
|
|
|
|
|
|
|
|
| |
Taking into account comments from H. S. Teoh.
https://lists.gnu.org/r/bison-patches/2020-09/msg00021.html
* data/skeletons/d.m4, data/skeletons/lalr1.d (SymbolKind): Wrap the
enum in a structure that contains its string representation.
|
|
|
|
| |
* data/skeletons/glr2.cc: here.
|
|
|
|
| |
* data/skeletons/glr2.cc: Use std::ptrdiff_t and numeric_limits.
|
|
|
|
| |
* data/skeletons/glr2.cc: here.
|