| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
* src/state.h, src/state.c: Comment changes.
(transitions_to): Take a state* as argument.
* src/lalr.h, src/lalr.c: Comment changes.
(initialize_F): Use clear variable names.
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* maint:
maint: post-release administrivia
version 3.3.2
style: minor fixes
NEWS: named constructors are preferable to symbol_type ctors
gram: fix handling of nterms in actions when some are unused
style: rename local variable
CI: update the ICC serial number for travis-ci.org
|
| |
| |
| |
| |
| | |
* NEWS, src/reduce.c, src/reduce.h: Use 'nonterminal'.
Fix comments.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Since Bison 3.3, semantic values in rule actions (i.e., '$...') are
passed to the m4 backend as the symbol number. Unfortunately, when
there are unused symbols, the symbols are renumbered _after_ the
numbers were used in the rule actions. As a result, the evaluation of
the skeleton failed because it used non existing symbol numbers.
Which is the happy scenario: we could use numbers of other existing
symbols...
Reported by Balázs Scheidler.
http://lists.gnu.org/archive/html/bug-bison/2019-01/msg00044.html
Translating the rule actions after the symbol renumbering moves too
many parts in bison. Relying on the symbol identifiers is more
troublesome than it might first seem: some don't have an
identifier (tokens with only a literal string), some might have a
complex one (tokens with a literal string with characters special for
M4). Well, these are tokens, but nterms also have issues: "dummy"
nterms (for midrule actions) are named $@32 etc. which is risky for
M4.
Instead, let's simply give M4 the mapping between the old numbers and
the new ones. To avoid confusion between old and new numbers, always
emit pre-renumbering numbers as "orig NUM".
* data/README: Give details about "orig NUM".
* data/skeletons/bison.m4 (__b4_symbol, _b4_symbol): Resolve the
"orig NUM".
* src/output.c (prepare_symbol_definitions): Pass nterm_map to m4.
* src/reduce.h, src/reduce.c (nterm_map): Extract it from
nonterminals_reduce, to make it public.
(reduce_free): Free it.
* src/scan-code.l (handle_action_dollar): When referring to a nterm,
use "orig NUM".
* tests/reduce.at (Useless Parts): New, based Balázs Scheidler's
report.
|
| |
| |
| |
| |
| | |
* src/reduce.c (nonterminals_reduce): Rename nontermmap as nterm_map.
We will expose it.
|
| |
| |
| |
| | |
* src/symlist.c (symbol_list_free): New.
|
| |
| |
| |
| |
| |
| | |
* src/symtab.c (dummy_symbol_get): There's no need for the buffer to
be so big and static.
Use snprintf for safety.
|
| |
| |
| |
| |
| |
| | |
* src/output.c (prepare_symbol_names): here.
* src/reader.c: Remove obsolete comment.
* src/scan-code.l: Use || for Boolean or.
|
| |
| |
| |
| | |
* src/reader.c, src/scan-code.l: here.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A rule is a useless chain iff it's a chain (aka unit, or injection)
rule (i.e., the RHS has length 1), and it's useless (it has no used
defined semantic action).
* src/gram.h, src/gram.c (rule_useless_chain_p): New.
(grammar_dump): Report useless chain rules.
* tests/sets.at: Check the traces.
|
| |
| |
| |
| |
| | |
* src/lr0.c (core_print, kernel_print): New.
Use them.
|
| |
| |
| |
| |
| | |
* src/lr0.c (new_itemsets): There's no harm in setting a Boolean
several times.
|
| |
| |
| |
| |
| |
| | |
* src/symtab.c: Sort includes.
* src/gram.c (grammar_rules_print_xml): Avoid assignments to define
'usefulness'.
|
| |
| |
| |
| | |
* src/print-graph.c, src/print-xml.c: here.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There are several places where we need to recover the rule from an
item, let's factor that into item_rule. We also want to print items
in a nice way: we do it when generating the *output file, but it is
also useful in debug messages.
* src/gram.h, src/gram.c (item_rule, item_print): New.
* src/print.c (print_core): Use them.
* src/state.h, src/state.c: Propagate constness.
|
| |
| |
| |
| | |
* src/print-xml.c: here.
|
| |
| |
| |
| | |
* src/lr0.c, src/state.c, src/state.h: here.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The memory allocated by 'closure' (and some data such as 'fderives')
is used to computed a state's full itemset from its core. This is
needed during the construction of the LR(0) automaton, and the memory
is reclaimed immediately afterwards.
Unfortunately the reports (graph, text, xml) also need this
information when describing the states with their full itemsets. As a
consequence the memory was allocated again, fderives computed again
too, and more --trace reports are generated which only duplicate what
was already reported.
Stop that. It does mean that we release the memory later (hence the
peak memory usage is higher now), but I don't think that's a problem
today.
* src/lr0.c (generate_states): Don't call closure_free.
* src/state.c (states_free): Do it here.
(for symmetry with closure_new which is called in generate_states).
* src/print-graph.c, src/print-xml.c, src/print.c: You can now expect
the closure module to be functional.
|
| |
| |
| |
| |
| |
| |
| |
| | |
This is more consistent with the other files.
* closure.h, closure.c (new_closure, free_closure): Rename as...
(closure_new, closure_free): this.
Adjust dependencies.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This will make it easier to add new elements (that might already be
part of shift_symbol) without having to worry about the size of
shift_symbol (which is currently a fixed size vector).
I could not measure any significant differences in performances in the
generation of LR(0) automaton (benched on gramamrs of Ruby, C, and C++).
* src/lr0.c (shift_symbol): Make it a bitset.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When debugging Bison itself, this is very handy, especially when
tweaking the frontend badly enough to break the backends. It can also
be used to check a grammar.
* src/getargs.h, src/getargs.c (feature_syntax_only): New.
(feature_args, feature_types): Adjust.
* src/main.c (main): Use it.
|
| |
| |
| |
| |
| |
| |
| | |
* src/symtab.h (status): Rename as...
(declaration_status): this, to avoid colliding with status, the
argument of 'usage'.
'status' seems a tad too general to be used only here.
|
| |
| |
| |
| |
| | |
* src/getargs.c (usage): Document -ffixit.
Document the aliases of -f.
|
| | |
|
|\ \
| |/
| |
| |
| |
| |
| |
| |
| | |
* maint:
maint: post-release administrivia
version 3.3.1
yacc: issue warnings, not errors, for Bison extensions
style: formatting changes in NEWS and complain.c
tests: don't depend on the user's definition of SHELL
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Reported by Kiyoshi Kanazawa.
http://lists.gnu.org/archive/html/bug-bison/2019-01/msg00029.html
* src/getargs.c (getargs): Let --yacc imply -Wyacc, not -Werror=yacc.
* tests/input.at: Adjust.
* doc/bison.tex (Bison Options): Document.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* src/gram.c (grammar_dump): Print the effective number first instead
of last. And fix it (remove the incorrect "+1").
Use t/f for Booleans.
* src/reduce.c: When asked, always print the reduced grammar, even if
there was nothing useless.
* tests/sets.at (Reduced Grammar): Check that.
|
| |
| |
| |
| |
| |
| |
| | |
Let's stick to lower case for file names.
* src/LR0.h, src/LR0.c: Rename as...
* src/lr0.h, src/lr0.c: these.
|
| |
| |
| |
| |
| |
| |
| | |
These are the only files with _.
* src/print_graph.h, src/print_graph.c: Rename as...
* src/print-graph.h, src/print-graph.c: these.
|
| |
| |
| |
| |
| |
| |
| | |
* src/gram.c: Use consistent variable names.
Prefix prefix unary operators.
(grammar_dump): Use rule_rhs_length instead of duplicating it.
* src/reduce.c: Avoid useless variables.
|
|/
|
|
| |
* src/gram.h: Shorten comments.
|
|
|
|
|
|
|
|
|
|
|
| |
It is inconvenient that we also generate the output files when we
update the grammar file, and it's somewhat unexpected. Let's not do
that.
* src/main.c (main): Skip generation when --update is passed.
* src/getargs.c (usage): Update the help message.
* doc/bison.texi (Bison Options): Likewise.
* tests/input.at: Check that we don't generate the output.
|
|
|
|
|
|
|
|
| |
After all, this is clearly harmless.
* src/muscle-tab.c (muscle_percent_define_insert): Let equal
definitions of a %define variable be only a warning.
Adjust test cases.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Don't repeat the name of the warning in the sub messages. E.g.,
remove the second "[-Wother]" in the following message
foo.y:2.1-27: warning: %define variable 'parse.error' redefined [-Wother]
%define parse.error verbose
^~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.y:1.1-27: previous definition [-Wother]
%define parse.error verbose
^~~~~~~~~~~~~~~~~~~~~~~~~~~
* src/complain.c (error_message): Don't print the warning type when
it's indented.
Adjust test cases.
|
|
|
|
|
| |
* src/state.h, src/state.c (state::consistent): Make it a bool.
Adjust dependencies.
|
|
|
|
|
|
|
|
|
| |
Some reported by syntax-check.
* po/POTFILES.in: Add fixits.cc.
* src/muscle-tab.c: Don't cast for free.
* src/files.c: Reduce scopes.
* cfg.mk: We need the cast for free in muscle_percent_define_insert.
|
|
|
|
|
|
|
|
|
|
| |
The test case "Deprecated directives" (currently 56) no longer emits
warnings after 'bison -u'!
* src/files.h, src/files.c (spec_name_prefix_loc): New.
* src/parse-gram.y (handle_name_prefix): Emit fixits for duplicate
%name-prefix.
* tests/input.at (Deprecated directives): Adjust.
|
| |
|
|
|
|
|
|
|
|
| |
* src/files.h, src/files.c (spec_file_prefix_loc): New.
* src/scan-gram.l (%file-prefix): Delegate diagnostics to...
* src/parse-gram.y (handle_file_prefix): here.
* src/complain.c (duplicate_directive): Quote the directive.
* tests/input.at: Adjust.
|
|
|
|
|
| |
* src/complain.c (duplicate_rule_directive): Here.
* tests/actions.at (Invalid uses of %empty): Check it.
|
|
|
|
|
| |
* src/complain.c (duplicate_directive): Fix the complaint level.
* tests/input.at: Adjust.
|
|
|
|
|
| |
* src/complain.c (duplicate_directive, duplicate_rule_directive):
Here.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
"handle_" is the prefix used in scan-code.l for instance.
* src/parse-gram.y (do_error_verbose, do_name_prefix, do_require)
(do_skeleton, do_yacc):
Rename as...
(handle_error_verbose, handle_name_prefix, handle_require)
(handle_skeleton, handle_yacc):
these.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We should use -ffixit and --update to clean files with duplicate
directives. And we should complain only once about duplicate obsolete
directives: keep only the "duplicate" warning. Let's start with %yacc.
For instance on:
%fixed-output_files
%fixed-output-files
%yacc
%%
exp:
This run of bison:
$ bison /tmp/foo.y -u
foo.y:1.1-19: warning: deprecated directive, use '%fixed-output-files' [-Wdeprecated]
%fixed-output_files
^~~~~~~~~~~~~~~~~~~
foo.y:2.1-19: warning: duplicate directive [-Wother]
%fixed-output-files
^~~~~~~~~~~~~~~~~~~
foo.y:1.1-19: previous declaration
%fixed-output_files
^~~~~~~~~~~~~~~~~~~
foo.y:3.1-5: warning: duplicate directive [-Wother]
%yacc
^~~~~
foo.y:1.1-19: previous declaration
%fixed-output_files
^~~~~~~~~~~~~~~~~~~
bison: file 'foo.y' was updated (backup: 'foo.y~')
gives:
%fixed-output-files
%%
exp:
* src/location.h, src/location.c (location_empty): New.
* src/complain.h, src/complain.c (duplicate_directive): New.
* src/getargs.h, src/getargs.c (yacc_flag): Instead of a Boolean, be
the location of the definition.
Update dependencies.
* src/scan-gram.l (%yacc, %fixed-output-files): Move the handling of
its warnings to...
* src/parse-gram.y (do_yacc): This new function.
* tests/input.at (Deprecated Directives): Adjust expectations.
|
|
|
|
|
| |
* src/complain.h, src/complain.c: here.
Adjust callers.
|
|
|
|
|
|
|
|
|
|
|
| |
* src/fixits.h, src/fixits.c (fixits_empty): New.
* src/complain.c (deprecated_directive): Register the Wdeprecated
fixits only if -Wdeprecated was enabled, so that we don't apply
updates if the user didn't ask for them.
* src/main.c (main): If there were fixits, issue a warning suggesting
running with --update.
Free uniqstrs after the fixits, since the latter use the former.
* tests/headers.at, tests/input.at: Update expectations.
|
|
|
|
|
|
| |
* src/fixits.c (fixits_run): If erase the content of a line, also
erase the following \n.
* tests/input.at (Deprecated directives): Update expectations.
|
|
|
|
|
|
|
|
| |
They should not have been pushed, sorry about that.
This reverts
- commit 8575bd06ae6e65f3a30b21a3e022a968e4c7ae7a.
- commit 55bf52860eac5c1394dc344a691220272df32b09.
|