Commit Graph

558 Commits

Author SHA1 Message Date
Akim Demaille
0bd5ee5f89 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-12-05 15:16:28 +01:00
Akim Demaille
a3efd13e44 version 3.0.2
* NEWS: Record release date.
2013-12-05 14:58:22 +01:00
Akim Demaille
184b42c85b output: do not generate source files when early errors are caught
Reported by Alexandre Duret-Lutz as "second problem" in:
http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00015.html

One problem is that some errors are caught early, before the
generation of output files, while others can only be detected
afterwards (since, for instance, skeletons can raise errors
themselves).

This will be addressed in two steps: early errors do not generate
source files at all, while later errors will remove the files that
have already been generated.

* src/scan-skel.l (yyout): Open to /dev/null when there are errors.
* tests/output.at (AT_CHECK_FILES): Factored out of...
(AT_CHECK_OUTPUT): this.
Fuse the "SHELLIO" argument in the "FLAGS" one.
Use $5 to denote the expected exit status.
Add a test case for early errors.
2013-12-04 15:53:01 +01:00
Akim Demaille
be29c71dd8 xml: also use "%empty" with html output
* data/xslt/xml2xhtml.xsl: No longer issue an Epsilon, display as in
dot and text formats.
2013-11-26 16:28:22 +01:00
Akim Demaille
7b0ca050f7 news: YYERROR vs variants 2013-11-26 15:31:51 +01:00
Akim Demaille
6d94eebba7 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-11-12 18:37:14 +01:00
Akim Demaille
c2ecada32b version 3.0.1
* NEWS: Record release date.
2013-11-12 15:55:33 +01:00
Akim Demaille
265640d56e install: do not install yacc.1 when --disable-yacc
* configure.ac (ENABLE_YACC): New conditional.
(YACC_SCRIPT, YACC_LIBRARY): Remove.
* lib/local.mk, src/local.mk: Use the former instead of the latter.
* doc/local.mk: Use ENABLE_YACC to avoid installing yacc.1.
2013-10-22 17:34:22 +02:00
Akim Demaille
39bace5da8 tests: fix incorrect object construction
Reported by Ken Moffat.
http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00009.html

* tests/c++.at (Exception safety): Here.
2013-10-21 10:36:53 +02:00
Akim Demaille
071863b3d8 glr: allow spaces between "%?" and "{" in predicates
Reported by Rici Lake.
http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00004.html
http://stackoverflow.com/questions/19330171/

* src/scan-gram.l: Do not try to be too smart when diagnosing invalid
directives.
* tests/glr-regression.at (Predicates): New test.
2013-10-16 15:51:25 +02:00
Akim Demaille
e4678430c2 diagnostics: "-Werror -Wno-error=foo" must not emit errors
Currently "-Werror -Wno-error=foo" still turns "foo" warnings into errors.
Reported by Alexandre Duret-Lutz.
See http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00015.html.

* src/complain.c (errority, errority_flag): New.
(complain_init): Initialize the latter.
(warning_argmatch): Extract the loop iterating on the flag's bits.
Set and unset errority_flag here.
(warnings_argmatch): -Wno-error is not the same as -Wno-error=everything:
we must remember if category foo was explicitly turned in an error/warning
via -W(no-)error=foo.
(warning_severity): Use errority_flag.

* tests/input.at (Symbols): Just check --yacc, not -Wyacc, that's the
job of tests on -W.
(-Werror is not affected by -Wnone and -Wall): Rename as...
(-Werror combinations): this.
Tests more combinations of -W, -W(no-)error, and -W(no-)error=foo.
* tests/local.at (AT_BISON_CHECK_WARNINGS): Don't expect -Werror
to turn runs that issue warnings into runs with errors, as the
warnings might be enforced as warnings by -Wno-error=foo, in which
case -Werror does not change anything.

* doc/bison.texi (Bison Options): Try to be clearer about how
-W(no-)error and -W(no-)error=foo interact.
2013-10-16 14:56:09 +02:00
Akim Demaille
0a244a2269 tests: do not use grep -q
Reported by Daniel Galloway.
http://lists.gnu.org/archive/html/bug-bison/2013-08/msg00020.html

* tests/java.at: Ignore grep's output instead.
2013-09-04 17:26:17 +02:00
Akim Demaille
e386b50f26 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-07-25 18:13:53 +02:00
Akim Demaille
534497f54b version 3.0
* NEWS: Record release date.
2013-07-25 17:55:58 +02:00
Akim Demaille
de1a2f20dd news: prepare 3.0
* NEWS (3.0): Reorder.
2013-07-25 17:53:59 +02:00
Akim Demaille
facb910cbd maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-06-24 10:29:36 +02:00
Akim Demaille
8faace8d1d version 2.7.91
* NEWS: Record release date.
2013-06-24 10:21:33 +02:00
Akim Demaille
9cdcbdf2cf NEWS: prepare for 2.7.91
* NEWS (2.7.91): Java push parsers.
2013-06-24 10:20:46 +02:00
Dennis Heimbigner
aa94def12d java: add push-parser support
* data/lalr1.java: Capture the declarations as m4 macros to avoid
duplication.  When push parsing, the declarations occur at the class
instance level rather than within the parse() function.

Change the way that the parser state is initialized.  For
push-parsing, the parse state declarations are moved to
"push_parse_initialize()", which is called on the first invocation of
"push_parse()". The %initial-action code is also inserted after the
invocation of "push_parse_initialize()".

The body of the parse loop is modified to return values at appropriate
points when doing push parsing.  In order to make push parsing work,
it is necessary to divide YYNEWSTATE into two states: YYNEWSTATE and
YYGETTOKEN. On the first call to push_parse(), the state is
YYNEWSTATE. On all later entries, the state is set to YYGETTOKEN. The
YYNEWSTATE switch arm falls through into YYGETTOKEN. YYGETTOKEN
indicates that a new token is potentially needed.  Normally, with a
pull parser, this new token would be obtained by calling "yylex()". In
the push parser, the value YYMORE is returned to the caller. On the
next call to push_parse(), the parser will return to the YYGETTOKEN
state and continue operation.

* tests/javapush.at: New test file for java push parsing.
* tests/testsuite.at: Use it.
* tests/local.mk: Adjust.
* doc/bison.texi (Java Push Parser Interface): New.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2013-06-13 10:38:14 +02:00
Akim Demaille
266cdc3025 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-05-30 15:28:44 +02:00
Akim Demaille
fea2516636 version 2.7.90
* NEWS: Record release date.
2013-05-30 15:02:52 +02:00
Akim Demaille
f122444873 Merge remote-tracking branch 'origin/maint'
* origin/maint:
  maint: post-release administrivia
  version 2.7.1
  regen
2013-05-29 09:05:12 +02:00
Akim Demaille
abcfd805b8 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-04-15 14:09:40 +02:00
Akim Demaille
1f5542fe2d version 2.7.1
* NEWS: Record release date.
2013-04-15 13:59:02 +02:00
Akim Demaille
bb4b189b9c muscle: minor simplification which uncovers a missing warning
* src/muscle-tab.c (muscle_percent_define_ensure): Discover the virtues
of || to factor conditionals.
* NEWS: As api.pure is no longer flagged as "used" by accident,
we now have warnings for useless definitions.
* tests/calc.at: So remove api.pure settings when running C++ tests,
since C++ skeletons use a pure interface.
2013-04-15 10:50:30 +02:00
Akim Demaille
630a021850 api.token.prefix: use code values
* data/bison.m4: Remove useless (and incorrect: m4_* instead of b4_*)
default assignment to api.token.prefix.
Check that api.token.prefix is assigned code.
* tests/input.at (%define code variables): New test.
* NEWS, doc/bison.texi, tests/c++.at, tests/calc.at,
* tests/java.at, tests/local.at: Adjust to use braces.
2013-04-11 15:54:46 +02:00
Akim Demaille
75ae829984 c++: fix several issues with locations
Reported by Daniel Frużyński.
http://lists.gnu.org/archive/html/bug-bison/2013-02/msg00000.html

* data/location.cc (position::columns, position::lines): Check for
underflow.
Fix some weird function signatures.
(location): Accept signed integers as arguments where appropriate.
Add operator- and operator+=.
* doc/bison.texi (C++ position, C++ location): Various fixes
and completion.
* tests/c++.at (C++ Locations): New tests.
2013-04-11 12:50:59 +02:00
Akim Demaille
cc8962bdde Merge remote-tracking branch 'origin/maint'
* origin/maint:
  glr.cc: fix a clang warning
  maint: update copyright years
  build: fix VPATH issue
  build: avoid clang's colored diagnostics in the test suite
  tests: please clang and use ".cc", not ".c", for C++ input
  gnulib: update
  skeletons: avoid empty switch constructs
  lalr1.cc: fix compiler warnings
  yacc.c: do not use __attribute__ unprotected
  tests: style changes
2013-04-10 10:24:56 +02:00
Akim Demaille
435575cb5e api.value.type: use keyword/brace values
Suggested by Joel E. Denny.
http://lists.gnu.org/archive/html/bison-patches/2013-03/msg00016.html

* data/bison.m4 (b4_percent_define_get_kind): New.
(b4_variant_flag): Check that api.value.type is defined as the 'variant'
keyword value.
* data/c.m4 (_b4_value_type_setup_keyword): New.
(b4_value_type_setup): Use it to simplify reading.
Use b4_define_silent.
Decode api.value.type, including its type.
(b4_value_type_define): Likewise.
* data/c++.m4 (b4_value_type_declare): Adjust the decoding of api.value.type,
taking its kind into account.
* doc/bison.texi: Adjust all the examples to the new syntax.
* NEWS: Ditto.
* tests/types.at: Adjust
2013-04-09 16:59:06 +02:00
Akim Demaille
1fa19a7697 api.value.type: diagnose guaranteed failure with --yacc
Instead of generating invalid C code, generate an error when --yacc and
'%define api.value.type union' are used together.

* data/bison.m4: Issue an error in this case.
* tests/types.at (%yacc vs. %define api.value.type union): New, check this
error.
* doc/bison.texi (Type Generation): Document it.
* tests/output.at: Check that '-o y.tab.c' and '-y' behave equally
wrt generated file names.
* NEWS (Use of YACC='bison -y'): New.
Promote the use of 'bison -o y.tab.c'.
2013-04-09 14:07:52 +02:00
Akim Demaille
6574576cfb api.value.type: implement proper support, check, and document
* data/c.m4 (b4_symbol_type_register, b4_type_define_tag)
(b4_symbol_value_union, b4_value_type_setup_union)
(b4_value_type_setup_variant, b4_value_type_setup):
New.
(b4_value_type_define): Use it to set up properly the type.
Handle the various possible values of api.value.type.
* data/c++.m4 (b4_value_type_declare): Likewise.
* data/lalr1.cc (b4_value_type_setup_variant): Redefine.

* tests/types.at: New.
Exercise all the C/C++ skeletons with different types of
api.value.type values.
* tests/local.mk, tests/testsuite.at: Use it.

* doc/bison.texi (%define Summary): Document api.value.type.
* NEWS: Advertise it, together with api.token.constructor.
2013-04-09 14:07:51 +02:00
Akim Demaille
68f91d58f1 maint: update copyright years
Run "make update-copyright".
2013-04-08 13:44:57 +02:00
Akim Demaille
e83be476a5 lalr1.cc: fix compiler warnings
Reported by Rob Conde.
http://lists.gnu.org/archive/html/bug-bison/2013-03/msg00003.html

* data/stack.hh (operator=, stack(const stack&)): Make this class
uncopyable, i.e., "undefine" these operators: make them private and
don't implement them.
(clear): New.
* data/lalr1.cc: Use it instead of an assignment.
(parser): Make this class uncopyable.
2013-04-08 10:59:19 +02:00
Akim Demaille
80a2826e69 yacc.c: do not use __attribute__ unprotected
Reported by Victor Khomenko.
http://lists.gnu.org/archive/html/bug-bison/2013-04/msg00001.html

* data/glr.c (YYUSE, __attribute__): Fuse their definition into...
* data/c.m4 (b4_attribute_define): this new macro.
* data/yacc.c, data/glr.c: Use it.
2013-04-08 10:44:09 +02:00
Valentin Tolmer
5202b6ac1d gram: correct token numbering in precedence declarations
In a precedence declaration, when tokens are declared with a litteral
character (e.g., 'a') or with a identifier (e.g., B), Bison behaved
differently: the litteral tokens would be numbered first, and then the
other ones, leading to the following grammar:

  %right A B 'c' 'd'

being numbered as such: 'c' 'd' A B.

* src/parse-gram.y (symbol.prec): Set the symbol number when reading the
symbols.
* tests/conflicts.at (Token declaration order: literals vs. identifiers):
New.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2013-03-06 10:31:47 +01:00
Akim Demaille
f24695eff9 diagnostics: no longer include the yacc category in -Wall
It would be a pity to warn the users against Bison features...
http://lists.gnu.org/archive/html/bison-patches/2013-02/msg00107.html

* src/complain.h, src/complain.c (Wall): Disable Wyacc.
(Weverything): New (hidden so far) category which really denotes all
the categories (what used to be Wall).
(warnings_args, warnings_types): Adjust.
(warning_argmatch): Now !none = Weverything and conversely, no longer Wall.
* NEWS, doc/bison.texi, src/getargs.c: Adjust the documentation.
* tests/input.at (-Werror is not affected by -Wnone and -Wall): Adjust
by not using a -Wyacc type of warning.
2013-03-04 18:21:44 +01:00
Akim Demaille
05e25f2384 grammar: no longer detect and cure missing semicolon at end of actions
Bison 3.0 is already breaking backward compatibility with other
features.  It is an appropriate time to drop this feature.  Note that
it was disabled when --yacc is passed.  See
http://lists.gnu.org/archive/html/bison-patches/2013-02/msg00102.html

Basically, revert e8cd1ad655.

* src/scan-code.l (braces_level, need_semicolon, in_cpp): Remove.
Remove every rule needed to detect and add missing semicolon.
* tests/actions.at (Fix user actions without a trailing semicolon):
Remove.
* NEWS: Adjust.
2013-03-04 08:29:18 +01:00
Akim Demaille
6c7022f7d3 news: typo
* NEWS: here.
2013-02-23 16:16:15 +01:00
Akim Demaille
1282c12476 news: spell fixes
* NEWS: here.
2013-02-18 14:30:19 +01:00
Akim Demaille
6240346aa0 doc: use %empty instead of /* empty */
* doc/bison.texi: Change the comments into explicit %empty.
2013-02-18 10:01:28 +01:00
Akim Demaille
09add9c24f doc: introduce %empty and -Wempty-rule
* doc/bison.texi (Grammar Rules): Make it a @section which
contains...
(Rules Syntax): this new subsection (with the previous contents of
"Grammar Rules".
(Empty Rules): New subsection, extracted from the former
"Grammar Rules".
Document %empty.
(Recursion): New a subsection of "Grammar Rules".
Complete a few index entries.
(Bison Options): Document -Wempty-rule.
2013-02-18 10:01:28 +01:00
Akim Demaille
fec5f3c0cc diagnostics: no longer pretty-print rules in error messages, carets suffice
* src/gram.c (grammar_rules_useless_report): Let -fcaret handle the
pretty-printing of the guilty rules.
(rule_print): Inline in its only use.
* tests/conflicts.at, tests/existing.at, tests/reduce.at,
* tests/regression.at: Adjust.
* NEWS: Document.
2013-02-14 15:00:51 +01:00
Akim Demaille
c21e515e05 news: restructure, document variants for C++
* NEWS: here.
2013-02-08 17:28:06 +01:00
Akim Demaille
d2f9ae18be news: name contributors
* NEWS: here.
2013-01-30 21:40:47 +01:00
Valentin Tolmer
cc2235ace2 warnings: introduce -Wprecedence
The new warning category "precedence" flags useless precedence and
associativity.  -Wprecedence can now be used, it is disabled by default.
The warnings about precedence and associativity are grouped into one, and
the testsuite was corrected accordingly.

* src/complain.h (warnings): Introduce "precedence".
* src/complain.c (warnings_print_categories): Adjust.
* src/getargs.c (warnings_args, warning_types): Likewise.
* src/symtab.h, src/symtab.c (print_associativity_warnings): Remove.
* src/symtab.h (register_assoc): Correct arguments.
* src/symtab.c (print_precedence_warnings): Print both warnings together.
* doc/bison.texi (Bison options): Document the warnings and provide an
example.
* tests/conflicts.at, tests/existing.at, tests/local.at,
* tests/regression.at: Adapt the testsuite for the new category
(-Wprecedence instead of -Wother where appropriate).
2013-01-30 21:39:08 +01:00
Valentin Tolmer
284bc49c83 grammar: warn about unused precedence for symbols
Symbols with precedence but no associativity, and whose precedence is
never used, can be declared with %token instead.  The used precedence
relationships are recorded and a warning about useless ones is issued.

* src/conflicts.c (resolve_sr_conflict): Record precedence relation.
* src/symtab.c, src/symtab.h (prec_nodes, init_prec_nodes)
(symgraphlink_new, register_precedence_second_symbol)
(print_precedence_warnings): New.
Record relationships in a graph and warn about useless ones.
* src/main.c (main): Print precedence warnings.
* tests/conflicts.at: New.
2013-01-29 15:11:35 +01:00
Akim Demaille
8458a41144 news: minor improvements
* NEWS: Name some more contributors.
Restructure slightly.
2013-01-28 17:46:13 +01:00
Valentin Tolmer
93561c21e8 grammar: preserve token declaration order
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.
2013-01-27 10:37:12 +01:00
Akim Demaille
f0f95a50ee c: no longer require stdio.h when locations are enabled
Recent changes (in 2.7) introduced a dependency on both FILE and
fprintf, which are "available" only in %debug mode.  This was to
define yy_location_print_, which is used only in %debug mode by the
parser, but massively used by the test suite to output the locations
in yyerror.

Break this dependency: the test suite should define its own routines
to display the locations.  Eventually Bison will provide the user with
a means to display locations, but not yet.

* data/c.m4 (b4_yy_location_print_define): Use YYFPRINTF instead of
fprintf directly.
* data/yacc.c (b4_yy_location_print_define): Invoke it only in %debug
mode, so that stdio.h is included (needed for FILE*), and YYFPRINTF
is defined.

* tests/local.at (AT_YYERROR_DECLARE, AT_YYERROR_DEFINE): Declare
and define location_print and LOCATION_PRINT.

* tests/actions.at, tests/existing.at, tests/glr-regression.at,
* tests/input.at, tests/named-refs.at, tests/regression.at: Adjust
to use them.
Fix the expected line numbers (as the prologue's length has changed).
2013-01-25 16:45:17 +01:00
Akim Demaille
597afd73d7 news: prepare for 2.8
* NEWS: Restructure.
Name contributors.
2013-01-25 16:35:35 +01:00