summaryrefslogtreecommitdiff
path: root/src/symlist.c
Commit message (Collapse)AuthorAgeFilesLines
* package: bump copyrights to 2022Paul Eggert2022-01-151-1/+1
| | | | Run "make update-copyright".
* Update URLs to prefer https: to http:Paul Eggert2021-01-291-1/+1
| | | | Also, fix a few http: URLs that were no longer working.
* package: bump copyrights to 2021Akim Demaille2021-01-161-1/+1
| | | | Run 'make update-copyright'.
* multistart: check duplicatesAkim Demaille2020-11-301-7/+23
| | | | | | | | | * src/symlist.h, src/symlist.c (symbol_list_find_symbol) (symbol_list_last): New. (symbol_list_append): Use symbol_list_last. * src/reader.c (grammar_start_symbols_add): Check and discard duplicates. * tests/input.at (Duplicate %start symbol): New. * tests/reduce.at (Bad start symbols): Add the multistart keyword.
* style: change the format of a debugging functionAkim Demaille2020-11-221-10/+11
| | | | | * src/symlist.c (symbol_list_syms_print): Use braces to make traces easier to read.
* diagnostics: better location for type redeclarationsAkim Demaille2020-08-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | From foo.y:1.7-11: error: %type redeclaration for bar 1 | %type <foo> bar bar | ^~~~~ foo.y:1.7-11: note: previous declaration 1 | %type <foo> bar bar | ^~~~~ to foo.y:1.17-19: error: %type redeclaration for bar 1 | %type <foo> bar bar | ^~~ foo.y:1.13-15: note: previous declaration 1 | %type <foo> bar bar | ^~~ * src/symlist.h, src/symlist.c (symbol_list_type_set): There's no need for the tag's location, use that of the symbol. * src/parse-gram.y: Adjust. * tests/input.at: Adjust.
* package: bump copyrights to 2020Akim Demaille2020-01-051-1/+1
| | | | Run 'make update-copyright'.
* style: use consistently *_loc for locationsAkim Demaille2019-05-031-4/+4
| | | | | | | | | | | Some members are called foo_location, others are foo_loc. Stick to the latter. * src/gram.h, src/location.h, src/location.c, src/output.c, * src/parse-gram.y, src/reader.h, src/reader.c, src/reduce.c, * src/scan-gram.l, src/symlist.h, src/symlist.c, src/symtab.h, * src/symtab.c: Use _loc consistently, not _location.
* style: clarify the use of symbol_lists' locationsAkim Demaille2019-05-031-2/+3
| | | | | | | | | | | | | symbol_list features a 'location' and a 'sym_loc' member. The former is expected to be set only for symbol_lists that denote a symbol (not a type name), and the latter should only denote the location of the symbol/type name. Yet both are set, and the name "location" is too unprecise. * src/symlist.h, src/symlist.c (symbol_list::location): Rename as rhs_loc for clarity. Move it to the "section" of data valid only for rules. * src/reader.c, src/scan-code.l: Adjust.
* traces: improve logsAkim Demaille2019-04-121-2/+5
| | | | | | | * src/lalr.c: Move logs to a better place to understand the chronology of events. * src/symlist.c (symbol_list_syms_print): Don't dump core on type elements.
* style: reduce scopesAkim Demaille2019-02-031-7/+6
| | | | * src/symlist.c (symbol_list_free): New.
* package: bump copyrights to 2019Akim Demaille2019-01-051-1/+1
|
* symbols: clean up their parsingAkim Demaille2018-12-161-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prompted by Rici Lake. http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00000.html We have four classes of directives that declare symbols: %nterm, %type, %token, and the family of %left etc. Currently not all of them support the possibility to have several type tags (`<type>`), and not all of them support the fact of not having any type tag at all (%type). Let's unify this. - %type POSIX Yacc specifies that %type is for nonterminals only. However, some Bison users want to use it for both tokens and nterms (actually, Bison's own grammar does this in several places, e.g., CHAR). So it should accept char/string literals. As a consequence cannot be used to declare tokens with their alias: `%type foo "foo"` would be ambiguous (are we defining foo = "foo", or are these two different symbols?) POSIX specifies that it is OK to use %type without a type tag. I'm not sure what it means, but we support it. - %token Accept token declarations with number and string literal: (ID|CHAR) NUM? STRING?. - %left, etc. They cannot be the same as %token, because we accept to declare the symbol with %token, and to then qualify its precedence with %left. Then `%left foo "foo"` would also be ambiguous: foo="foo", or two symbols. They cannot be simply a list of identifiers, but POSIX Yacc says we can declare token numbers here. I personally think this is a bad idea, precedence management is tricky in itself and should not be cluttered with token declaration issues. We used to accept declaring a token number on a string literal here (e.g., `%left "token" 1`). This is abnormal. Either the feature is useful, and then it should be supported in %token, or it's useless and we should not support it in corner cases. - %nterm Obviously cannot accept tokens, nor char/string literals. Does not exist in POSIX Yacc, but since %type also works for terminals, it is a nice option to have. * src/parse-gram.y: Avoid relying on side effects. For instance, get rid of current_type, rather, build the list of symbols and iterate over it to assign the type. It's not always possible/convenient. For instance, we still use current_class. Prefer "decl" to "def", since in the rest of the implementation we actually "declare" symbols, we don't "define" them. (token_decls, token_decls_for_prec, symbol_decls, nterm_decls): New. Use them for %token, %left, %type and %nterm. * src/symlist.h, src/symlist.c (symbol_list_type_set): New. * tests/regression.at b/tests/regression.at (Token number in precedence declaration): We no longer accept to give a number to string literals.
* style: reduce scopesAkim Demaille2018-11-301-2/+1
| | | | * src/symlist.c: here.
* allow %expect and %expect-rr modifiers on individual rulesPaul Hilfinger2018-11-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change allows one to document (and check) which rules participate in shift/reduce and reduce/reduce conflicts. This is particularly important GLR parsers, where conflicts are a normal occurrence. For example, %glr-parser %expect 1 %% ... argument_list: arguments %expect 1 | arguments ',' | %empty ; arguments: expression | argument_list ',' expression ; ... Looking at the output from -v, one can see that the shift-reduce conflict here is due to the fact that the parser does not know whether to reduce arguments to argument_list until it sees the token AFTER the following ','. By marking the rule with %expect 1 (because there is a conflict in one state), we document the source of the 1 overall shift- reduce conflict. In GLR parsers, we can use %expect-rr in a rule for reduce/reduce conflicts. In this case, we mark each of the conflicting rules. For example, %glr-parser %expect-rr 1 %% stmt: target_list '=' expr ';' | expr_list ';' ; target_list: target | target ',' target_list ; target: ID %expect-rr 1 ; expr_list: expr | expr ',' expr_list ; expr: ID %expect-rr 1 | ... ; In a statement such as x, y = 3, 4; the parser must reduce x to a target or an expr, but does not know which until it sees the '='. So we notate the two possible reductions to indicate that each conflicts in one rule. See https://lists.gnu.org/archive/html/bison-patches/2013-02/msg00105.html. * doc/bison.texi (Suppressing Conflict Warnings): Document %expect, %expect-rr in grammar rules. * src/conflicts.c (count_state_rr_conflicts): Adjust comment. (rule_has_state_sr_conflicts): New static function. (count_rule_sr_conflicts): New static function. (rule_nast_state_rr_conflicts): New static function. (count_rule_rr_conflicts): New static function. (rule_conflicts_print): New static function. (conflicts_print): Also use rule_conflicts_print to report on individual rules. * src/gram.h (struct rule): Add new fields expected_sr_conflicts, expected_rr_conflicts. * src/reader.c (grammar_midrule_action): Transfer expected_sr_conflicts, expected_rr_conflicts to new rule, and turn off in current_rule. (grammar_current_rule_expect_sr): New function. (grammar_current_rule_expect_rr): New function. (packgram): Transfer expected_sr_conflicts, expected_rr_conflicts to new rule. * src/reader.h (grammar_current_rule_expect_sr): New function. (grammar_current_rule_expect_rr): New function. * src/symlist.c (symbol_list_sym_new): Initialize expected_sr_conflicts, expected_rr_conflicts. * src/symlist.h (struct symbol_list): Add new fields expected_sr_conflicts, expected_rr_conflicts. * tests/conflicts.at: Add tests "%expect in grammar rule not enough", "%expect in grammar rule right.", "%expect in grammar rule too much."
* Merge maint into masterAkim Demaille2018-06-171-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * upstream/maint: (48 commits) THANKS: update an address tests: adjust syncline tests to GCC 7 glr: fix improperly placed synclines bison: be git grep friendly Replace ftp with https maint: post-release administrivia version 3.0.5 bison: style: indentation fixes regen bison: please address sanitizer C++: style: fix indentation NEWS: update C++: style: prefer `unsigned` to `unsigned int` C++: style: space before paren C++: fix -Wdeprecated warnings tests: fix -Wdeprecated warning maint: update syntax-check exclusions autoconf: update regen Update copyright years ...
| * Update copyright yearsAkim Demaille2018-05-121-2/+2
| | | | | | | | Run `make update-copyright`.
* | Merge remote-tracking branch 'origin/maint'Akim Demaille2015-01-231-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | * origin/maint: maint: post-release administrivia version 3.0.4 gnulib: update build: re-enable compiler warnings, and fix them tests: c++: fix a C++03 conformance issue tests: fix a title c++: reserve 200 slots in the parser's stack tests: be more robust to unrecognized synclines, and try to recognize xlc tests: fix C++ conformance build: fix some warnings build: avoid infinite recursions on include_next
| * build: re-enable compiler warnings, and fix themAkim Demaille2015-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are warnings (-Wextra) in generated C++ code: ltlparse.cc: In member function 'ltlyy::parser::symbol_number_type ltlyy::parser::by_state::type_get() const': ltlparse.cc:452:33: warning: enumeral and non-enumeral type in conditional expression return state == empty_state ? empty_symbol : yystos_[state]; Reported by Alexandre Duret-Lutz. It turns out that -Wall and -Wextra were disabled because of a stupid typo. * configure.ac: Fix the stupid typo. * data/lalr1.cc, src/AnnotationList.c, src/InadequacyList.c, * src/ielr.c, src/print.c, src/scan-code.l, src/symlist.c, * src/symlist.h, src/symtab.c, src/tables.c, tests/actions.at, * tests/calc.at, tests/cxx-type.at, tests/glr-regression.at, * tests/named-refs.at, tests/torture.at: Fix warnings, mostly issues about variables used only with assertions, which are disabled with -DNDEBUG.
* | Merge remote-tracking branch 'origin/maint'Akim Demaille2015-01-131-20/+7
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * origin/maint: tests: split a large test case into several smaller ones package: a bit of trouble shooting indications doc: liby's main arms the internationalization bison: avoid warnings from static code analysis c++: fix the use of destructors when variants are enabled style: tests: simplify the handling of some C++ tests c++: symbols can be empty, so use it c++: variants: don't leak the lookahead in error recovery c++: provide a means to clear symbols c++: clean up the handling of empty symbols c++: comment and style changes c++: variants: comparing addresses of typeid.name() is undefined c++: locations: complete the API and fix comments build: do not clean figure sources in make clean
| * bison: avoid warnings from static code analysisAkim Demaille2015-01-091-20/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A static analysis tool reports that some callers of symbol_list_n_get might get NULL and not handle it properly. This is not the case, yet we can suppress this pattern. Reported by Mike Sullivan. <https://lists.gnu.org/archive/html/bug-bison/2013-12/msg00027.html> * src/symlist.c (symbol_list_n_get): Actually it is never called to return 0. Enforce this postcondition via aver. (symbol_list_n_type_name_get): Simplify accordingly. In particular, discards a (translated) useless error message. * src/symlist.h: Adjust documentation. * src/scan-code.l: Style change.
* | Merge remote-tracking branch 'origin/maint'Akim Demaille2015-01-051-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * origin/maint: build: don't try to generate docs when cross-compiling package: fix a reporter's name %union: fix the support for named %union package: bump to 2015 flex: don't trust YY_USER_INIT yacc.c: fix broken union when api.value.type=union and %defines are used doc: fix missing xref gnulib: update location: remove some ugly debugging code traces build: use abort to pacify compiler errors package: bump to 2014 doc: specify documentation encoding
| * package: bump to 2015Akim Demaille2015-01-041-1/+1
| | | | | | | | | | | | Which also requires: * gnulib: Update.
| * package: bump to 2014Akim Demaille2014-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * AUTHORS, ChangeLog-2012, Makefile.am, NEWS, PACKAGING, README, * README-alpha, README-hacking, THANKS, TODO, bootstrap.conf, * build-aux/darwin11.4.0.valgrind, build-aux/local.mk, * build-aux/update-b4-copyright, * build-aux/update-package-copyright-year, cfg.mk, configure.ac, * data/README, data/bison.m4, data/c++-skel.m4, data/c++.m4, * data/c-like.m4, data/c-skel.m4, data/c.m4, data/glr.c, data/glr.cc, * data/java-skel.m4, data/java.m4, data/lalr1.cc, data/lalr1.java, * data/local.mk, data/location.cc, data/stack.hh, data/variant.hh, * data/xslt/bison.xsl, data/xslt/xml2dot.xsl, data/xslt/xml2text.xsl, * data/xslt/xml2xhtml.xsl, data/yacc.c, djgpp/Makefile.maint, * djgpp/README.in, djgpp/config.bat, djgpp/config.sed, * djgpp/config.site, djgpp/config_h.sed, djgpp/djunpack.bat, * djgpp/local.mk, djgpp/subpipe.c, djgpp/subpipe.h, * djgpp/testsuite.sed, doc/bison.texi, doc/local.mk, doc/refcard.tex, * etc/README, etc/bench.pl.in, etc/local.mk, * examples/calc++/calc++.test, examples/calc++/local.mk, * examples/extexi, examples/local.mk, examples/mfcalc/local.mk, * examples/mfcalc/mfcalc.test, examples/rpcalc/local.mk, * examples/rpcalc/rpcalc.test, examples/test, examples/variant.yy, * lib/abitset.c, lib/abitset.h, lib/bbitset.h, lib/bitset.c, * lib/bitset.h, lib/bitset_stats.c, lib/bitset_stats.h, * lib/bitsetv-print.c, lib/bitsetv-print.h, lib/bitsetv.c, * lib/bitsetv.h, lib/ebitset.c, lib/ebitset.h, lib/get-errno.c, * lib/get-errno.h, lib/lbitset.c, lib/lbitset.h, lib/libiberty.h, * lib/local.mk, lib/main.c, lib/timevar.c, lib/timevar.def, * lib/timevar.h, lib/vbitset.c, lib/vbitset.h, lib/yyerror.c, * m4/bison-i18n.m4, m4/c-working.m4, m4/cxx.m4, m4/flex.m4, * m4/timevar.m4, src/AnnotationList.c, src/AnnotationList.h, * src/InadequacyList.c, src/InadequacyList.h, src/LR0.c, src/LR0.h, * src/Sbitset.c, src/Sbitset.h, src/assoc.c, src/assoc.h, * src/closure.c, src/closure.h, src/complain.c, src/complain.h, * src/conflicts.c, src/conflicts.h, src/derives.c, src/derives.h, * src/files.c, src/files.h, src/flex-scanner.h, src/getargs.c, * src/getargs.h, src/gram.c, src/gram.h, src/graphviz.c, * src/graphviz.h, src/ielr.c, src/ielr.h, src/lalr.c, src/lalr.h, * src/local.mk, src/location.c, src/location.h, src/main.c, * src/muscle-tab.c, src/muscle-tab.h, src/named-ref.c, * src/named-ref.h, src/nullable.c, src/nullable.h, src/output.c, * src/output.h, src/parse-gram.c, src/parse-gram.y, src/print-xml.c, * src/print-xml.h, src/print.c, src/print.h, src/print_graph.c, * src/print_graph.h, src/reader.c, src/reader.h, src/reduce.c, * src/reduce.h, src/relation.c, src/relation.h, src/scan-code.h, * src/scan-code.l, src/scan-gram.h, src/scan-gram.l, src/scan-skel.h, * src/scan-skel.l, src/state.c, src/state.h, src/symlist.c, * src/symlist.h, src/symtab.c, src/symtab.h, src/system.h, * src/tables.c, src/tables.h, src/uniqstr.c, src/uniqstr.h, * tests/actions.at, tests/atlocal.in, tests/bison.in, tests/c++.at, * tests/calc.at, tests/conflicts.at, tests/cxx-type.at, * tests/existing.at, tests/glr-regression.at, tests/headers.at, * tests/input.at, tests/java.at, tests/javapush.at, tests/local.at, * tests/local.mk, tests/named-refs.at, tests/output.at, tests/push.at, * tests/reduce.at, tests/regression.at, tests/sets.at, * tests/skeletons.at, tests/synclines.at, tests/testsuite.at, * tests/torture.at, tests/types.at: here.
* | symbols: improve symbol aliasingValentin Tolmer2013-08-011-3/+3
|/ | | | | | | | | | | | | | | | | Rather than having duplicate info in the symbol and the alias that has to be resolved later on, both the symbol and the alias have a common pointer to a separate structure containing this info. * src/symtab.h (sym_content): New structure. * src/symtab.c (sym_content_new, sym_content_free, symbol_free): New * src/AnnotationList.c, src/conflicts.c, src/gram.c, src/gram.h, * src/graphviz.c, src/ielr.c, src/output.c, src/parse-gram.y, src/print.c * src/print-xml.c, src/print_graph.c, src/reader.c, src/reduce.c, * src/state.h, src/symlist.c, src/symtab.c, src/symtab.h, src/tables.c: Adjust. * tests/input.at: Fix expectations (order changes).
* diagnostics: factor and enhance messages about duplicate rule directivesAkim Demaille2013-02-181-0/+2
| | | | | | | | | | | | | | | | | | | When reporting a duplicate directive on a rule, point to its first occurrence: one.y:11.10-15: error: only one %empty allowed per rule %empty {} %empty ^^^^^^ one.y:11.3-8: previous declaration %empty {} %empty ^^^^^^ And consistently discard the second one. * src/complain.h, src/complain.c (duplicate_directive): New. * src/reader.c: Use it where appropriate. * src/symlist.h, src/symlist.c (symbol_list): Add a dprec_location member. * tests/actions.at: Adjust expected output.
* grammar: introduce %emptyAkim Demaille2013-02-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Provide a means to explicitly denote empty right-hand sides of rules: instead of exp: { ... } allow exp: %empty { ... } Make sure that %empty is properly used. With help from Joel E. Denny and Gabriel Rassoul. http://lists.gnu.org/archive/html/bison-patches/2013-01/msg00142.html * src/reader.h, src/reader.c (grammar_current_rule_empty_set): New. * src/parse-gram.y (%empty): New token. Use it. * src/scan-gram.l (%empty): Scan it. * src/reader.c (grammar_rule_check): Check that %empty is properly used. * tests/actions.at (Invalid uses of %empty, Valid uses of %empty): New.
* debug: improve the display of symbol listsAkim Demaille2013-02-111-3/+8
| | | | | | | | * src/symtab.c (symbol_print): Remove useless quotes (the symbol already has quotes). Prefer fputs. * src/symlist.c (symbol_list_syms_print): Likewise. Fix separators.
* style: minor changesAkim Demaille2013-02-091-4/+3
| | | | | | | | | | * src/complain.c: Space changes. * src/reader.c: Comment changes. Avoid && in assertions. * src/location.c: Move comments to... * src/location.h: here. * src/symlist.h, src/symlist.c: Create a pseudo section for members that apply to the rule.
* symlist: use the right streamAkim Demaille2013-02-011-1/+1
| | | | * src/symlist.c (symbol_list_syms_print): Use "f", not stderr.
* grammar: preserve token declaration orderValentin Tolmer2013-01-271-0/+17
| | | | | | | | | | In a declaration %token A B, the token A is declared before B, but in %left A B (or with %precedence or %nonassoc or %right), the token B was declared before A (tokens were declared in reverse order). * src/symlist.h, src/symlist.c (symbol_list_append): New. * src/parse-gram.y: Use it instead of symbol_list_prepend. * tests/input.at: Adjust expectations.
* maint: update copyright yearsAkim Demaille2013-01-121-1/+1
| | | | | Suggested by Stefano Lattarini. Run "make update-copyright".
* symtab: fix some leaksTheophile Ranquet2012-12-141-0/+2
| | | | | | * src/symlist.c (symbol_list_free): Deep free it. * src/symtab.c (symbols_free, semantic_types_sorted): Free it too. (symbols_do, sorted): Call by address.
* warnings: fusion of complain and complain_atTheophile Ranquet2012-10-011-1/+1
| | | | | | | | | | | | | | | | | | | These functions are very similar, and keeping them seperate makes future improvements difficult, so merge them. This impacts 89 calls. * src/bootstrap.conf: Adjust. * src/complain.c (complain, complain_at): Merge into... (complain): this. (complain_args): Adjust. * src/complain.h, src/conflicts.c, src/files.c, src/getargs.c, * src/gram.c, src/location.c, src/muscle-tab.c, src/parse-gram.y, * src/reader.c, src/reduce.c, src/scan-code.l, src/scan-gram.l, * src/scan-skel.l, src/symlist.c, src/symtab.c: Adjust. Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
* style changesAkim Demaille2012-09-031-13/+13
| | | | | | * data/glr.cc, tests/actions.at: Fix comments. * src/symtab.h, src/symtab.c: Fix indentation/comments. * src/symlist.c: Fix indentation.
* Merge remote-tracking branch 'origin/maint'Akim Demaille2012-07-271-6/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * origin/maint: (29 commits) regen synclines: remove spurious empty line also support $<foo>$ in the %initial-action skeletons: b4_dollar_pushdef and popdef to simpify complex definitions regen printer/destructor: translate only once factor the handling of m4 escaping news: schedule the removal of the ";" hack style changes in the scanners regen support $<tag>$ in printers and destructors scan-code: factor the handling of the type in $<TYPE>$ muscles: fix another occurrence of unescaped type name glr.cc: fix the handling of yydebug gnulib: update formatting changes tests: fix an assertion tests: adjust to GCC 4.8, which displays caret errors be sure to properly escape type names obstack_quote: escape and quote for M4 muscles: shuffle responsabilities muscles: make private functions static muscles: rename private functions/macros obstack_escape: escape M4 characters remove dead macro maint: style changes doc: avoid problems with case insensitive file systems configure: fix botched quoting news: fix typo. Conflicts: NEWS data/c.m4 data/glr.cc data/lalr1.cc examples/rpcalc/local.mk src/muscle-tab.h src/output.c src/parse-gram.c src/parse-gram.h src/parse-gram.y src/scan-code.l src/symlist.c src/symlist.h src/symtab.h tests/calc.at
| * printer/destructor: translate only onceAkim Demaille2012-07-271-16/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently "%printer {...} a b c d e f" translates the {...} six times. Not only is this bad for time and space, it also issues six times the same warnings. * src/symlist.h, src/symlist.c (symbol_list_destructor_set) (symbol_list_printer_set): Take the action as code_props instead of const char *. * src/parse-gram.y: Translate these actions here. * src/scan-code.h: Comment change. * tests/input.at: Check that warnings are issued only once.
| * maint: run "make update-copyright".Akim Demaille2012-01-131-1/+1
| |
| * named references: fix double free.Akim Demaille2011-03-091-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In `rhs[name]: "a" | "b"', do not free "name" twice. Reported by Tys Lefering. <http://lists.gnu.org/archive/html/bug-bison/2010-06/msg00002.html> * src/named-ref.h, src/named-ref.c (named_ref_copy): New. * src/parse-gram.y (current_lhs): Rename as... (current_lhs_symbol): this. (current_lhs): New function. Use it to free the current lhs named reference. * src/reader.c: Bind lhs to a copy of the current named reference. * src/symlist.c: Rely on free (0) being valid. * tests/named-refs.at: Test this.
| * maint: run "make update-copyright".Joel E. Denny2011-01-021-2/+2
| |
| * Do not use date ranges in copyright notices.Paul Eggert2010-06-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See http://www.gnu.org/prep/maintain/maintain.html#Copyright-Notices * HACKING, Makefile.am, NEWS, PACKAGING, README, README-alpha: * TODO, bootstrap, bootstrap.conf: * build-aux/update-b4-copyright, cfg.mk, configure.ac: * data/README, data/bison.m4, data/c++-skel.m4, data/c++.m4: * data/c-skel.m4, data/c.m4, data/glr.c, data/glr.cc: * data/java-skel.m4, data/java.m4, data/lalr1.cc: * data/lalr1.java, data/location.cc: * data/xslt/bison.xsl: * data/xslt/xml2dot.xsl, data/xslt/xml2text.xsl: * data/xslt/xml2xhtml.xsl, data/yacc.c, djgpp/Makefile.maint: * djgpp/README.in, djgpp/config.bat, djgpp/config.sed: * djgpp/config.site, djgpp/config_h.sed, djgpp/djunpack.bat: * djgpp/subpipe.c, djgpp/subpipe.h: * djgpp/testsuite.sed, doc/bison.texinfo: * doc/refcard.tex, etc/README, etc/bench.pl.in: * examples/calc++/Makefile.am, examples/extexi: * lib/abitset.c, lib/abitset.h: * lib/bbitset.h, lib/bitset.c, lib/bitset.h: * lib/bitset_stats.c, lib/bitset_stats.h, lib/bitsetv-print.c: * lib/bitsetv-print.h, lib/bitsetv.c, lib/bitsetv.h: * lib/ebitset.c, lib/ebitset.h, lib/get-errno.c: * lib/get-errno.h, lib/lbitset.c, lib/lbitset.h: * lib/libiberty.h, lib/main.c, lib/timevar.c: * lib/timevar.def, lib/timevar.h, lib/vbitset.c: * lib/vbitset.h, lib/yyerror.c, m4/bison-i18n.m4: * m4/c-working.m4, m4/cxx.m4, m4/subpipe.m4, m4/timevar.m4: * src/AnnotationList.c, src/AnnotationList.h: * src/InadequacyList.c, src/InadequacyList.h, src/LR0.c: * src/LR0.h, src/Sbitset.c, src/Sbitset.h, src/assoc.c: * src/assoc.h, src/closure.c, src/closure.h, src/complain.c: * src/complain.h, src/conflicts.c, src/conflicts.h: * src/derives.c, src/derives.h, src/files.c, src/files.h: * src/flex-scanner.h, src/getargs.c, src/getargs.h: * src/gram.c, src/gram.h, src/graphviz.c, src/ielr.c: * src/ielr.h, src/lalr.c, src/lalr.h: * src/location.c, src/location.h, src/main.c: * src/muscle-tab.c, src/muscle-tab.h, src/named-ref.c: * src/named-ref.h, src/nullable.c, src/nullable.h: * src/output.c, src/output.h, src/parse-gram.y: * src/print-xml.c, src/print-xml.h, src/print.c, src/print.h: * src/print_graph.c, src/print_graph.h, src/reader.c: * src/reader.h, src/reduce.c, src/reduce.h, src/relation.c: * src/relation.h, src/scan-code.h, src/scan-code.l: * src/scan-gram.h, src/scan-gram.l, src/scan-skel.h: * src/scan-skel.l, src/state.c, src/state.h, src/symlist.c: * src/symlist.h, src/symtab.c, src/symtab.h, src/system.h: * src/tables.c, src/tables.h, src/uniqstr.c, src/uniqstr.h: * tests/actions.at, tests/atlocal.in, tests/c++.at: * tests/calc.at, tests/conflicts.at, tests/cxx-type.at: * tests/existing.at, tests/glr-regression.at: * tests/headers.at, tests/input.at, tests/java.at: * tests/local.at, tests/named-refs.at: * tests/output.at, tests/push.at, tests/reduce.at: * tests/regression.at, tests/sets.at, tests/skeletons.at: * tests/synclines.at, tests/testsuite.at, tests/torture.at: * data/Makefile.am, data/location.cc, doc/Makefile.am, src/Makefile.am: * tests/Makefile.am, lib/Makefile.am, examples/Makefile.am: * etc/Makefile.am: Don't use date ranges in copyright notices. Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
| * maint: run "make update-copyright"Joel E. Denny2010-01-041-1/+1
| |
| * maint: run "make update-copyright"Joel E. Denny2009-08-061-1/+2
| |
| * Fix some memory leaks.Alex Rozenman2009-07-241-1/+8
| | | | | | | | | | | | | | * src/named-ref.c: Add a pointer check (named_ref_free). * src/scan-code.l: New function (variant_table_free). Called in code_scanner_free. * src/symlist.c: Call to named_ref_free (symbol_list_free).
| * Style changes and factoring.Alex Rozenman2009-07-041-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | * src/named-ref.h: Add comments. * src/parse-gram.y: Readability and style changes. * src/reader.c: Factoring: assign_named_ref function. * src/scan-code.l: Factoring and style changes. Rename parse_named_ref to parse_ref. Use "c-ctype.h" from gnulib. Use "unsigned" type for variant index. Improve readablity. * src/scan-gram.l: Change error messages and add comments. * src/symlist.h: symbol_list_null: New function decl. * src/symlist.c: symbol_list_null: Implement here. * tests/named-refs.at: Adjust for new error messages.
| * Named symbol references.Alex Rozenman2009-06-271-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Discussed in: http://lists.gnu.org/archive/html/bison-patches/2009-01/msg00000.html http://lists.gnu.org/archive/html/bison-patches/2009-02/msg00002.html http://lists.gnu.org/archive/html/bison-patches/2009-03/msg00009.html * src/parse-gram.y: Add new syntax (named_ref.opt). * src/reader.c: Store named refs in symbol lists. * src/reader.h: New argument for symbol_append and action_append functions. * src/scan-code.h: Add new field (named_ref) into code_props data structure. Keeps named ref of midrule actions. * src/scan-code.l: Support for named refs in semantic action code. New function 'parse_named_ref'. * src/scan-gram.l: Support bracketed id. * src/symlist.c: Store named refs in symbol lists. * src/symlist.h: New field in symbol list: named_ref. * src/named-ref.h: New file, a struct for named_ref. * src/named-ref.c: New file, named_ref_new function. * src/Makefile.am: Add two new files. * tests/testsuite.at: Include new test group: * tests/named-refs.at: this new file.
* | simplify the handling of <> and <*>'s code_props.Akim Demaille2012-07-221-42/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently they are treated in separated variables, contrary to other <TYPE> code_props. This duplicates code (and messages for translators) uselessly, as demonstrated by the fact that thanks to this patch, now useless <*> and <> code_props are reported like the others. * src/parse-gram.y (generic_symlist_item): Treat "<*>" and "<>" as regular type tags. * src/symlist.h, src/symlist.c (symbol_list_default_tagged_new) (symbol_list_default_tagless_new,SYMLIST_DEFAULT_TAGGED) (SYMLIST_DEFAULT_TAGLESS): Remove. * src/symtab.h, src/symtab.c (default_tagged_code_props) (default_tagless_code_props, default_tagged_code_props_set) (default_tagless_code_props_set): Remove. (symbol_code_props_get): Default to <*> or <>'s code_props. * tests/actions.at: Complete expected errors: there are new warnings. * tests/input.at: Likewise. (Useless printers or destructors): Extend.
* | warnings: factoring: complaintsVictor Santet2012-06-281-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/complain.c (error_message): Accept warning categories (an integer) as argument. Location is a 'const location *' instead of 'location *'. (ERROR_MESSAGE): Delete it. * src/complain.c, src/complain.h (complains): New function. (complain, complain_at, complain_at_indent): Generic functions for complaints. Call 'complains'. (warn_at, warn_at_indent, warn, yacc_at, midrule_value_at) (fatal_at, fatal): Delete them. Adjust dependencies. * src/complain.h (enum warnings): New fields 'complaint' and 'fatal'. * bootstrap.conf (XGETTEXT_OPTIONS): Adjust.
* | warnings: useless semantic typesVictor Santet2012-06-251-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/symtab.h (symbol_list): Represent semantic types as structure 'semantic_type'. * src/symlist.c (symbol_list_type_new): Allocate this structure. (symbol_list_code_props_set): Set this semantic type's status to used if it was not declared. * src/symtab.c (semantic_types_sorted): New. (semantic_type_new): Set the new semantic type's location appropriately. (symbol_check_defined): If a symbol has a type, then set this type's status to "declared". (semantic_type_check_defined, semantic_type_check_defined_processor): Same as symbol_check_defined and symbol_check_defined_processor, but for semantic types. (symbol_check_defined): Check semantic types usefulness. * src/symtab.h (semantic_type): New fields 'location' and 'status'. * src/symtab.h, src/symtab.c (semantic_type_new) (semantic_type_from_uniqstr, semantic_type_get): Accept a location as a supplementary argument. * tests/input.at (Unassociated types used for printer of destructor): New. * tests/c++.at (AT_CHECK_VARIANTS): Fix an error caught by this commit.
* | maint: factor the handling of %printer and %destructorVictor Santet2012-06-221-35/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is too much code duplication between %printer and %destructor. We used to have two functions for each action: the first one for destructors, the second one for printers. Factor using a 'code_props_type', and an array of code_props instead of two members. * src/symlist.h, src/symlist.c (symbol_list_destructor_set) (symbol_list_printer_set): Fuse into... (symbol_list_code_props_set): this. * src/symtab.h, src/symtab.c (default_tagged_destructor) (default_tagged_printer): Fuse into... (default_tagged_code_props): this. (default_tagless_destructor, default_tagless_printer) (default_tagless_code_props): Likewise. (code_props_type_string): new. (symbol_destructor_set, symbol_destructor_get, semantic_type_destructor_set) (default_tagged_destructor_set, default_tagless_destructor_set) (symbol_printer_set, symbol_printer_get, semantic_type_printer_set) (default_tagged_printer_set, default_tagless_printer_set): Replace by... (symbol_code_props_set, symbol_code_props_get, semantic_type_code_props_set) (default_tagged_code_props_set, default_tagless_code_props_set): these. * src/parse-gram.y (grammar_declaration): Adjust. * src/output.c (CODE_PROP, grammar_declaration): Ditto. * src/reader.c (symbol_should_be_used): Ditto.