Commit Graph

5341 Commits

Author SHA1 Message Date
Akim Demaille
8faace8d1d version 2.7.91
* NEWS: Record release date.
v2.7.91
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
Akim Demaille
45c64fa627 java: rename YYMORE as YYPUSH_MORE for consistency with C
http://lists.gnu.org/archive/html/bison-patches/2013-06/msg00008.html

* data/lalr1.java, doc/bison.texi, tests/javapush.at:
s/YYMORE/YYPUSH_MORE.
2013-06-24 09:37:18 +02:00
Akim Demaille
58b465ae5f tests: fix Java push failure when running with BISON_USE_PUSH_FOR_PULL
* tests/javapush.at (Trivial Push Parser with api.push-pull verification):
When push for pull is enabled, there is one such function generated.
2013-06-21 11:39:02 +02:00
Akim Demaille
d116722c54 style: minor changes in the Java tests
* tests/java.at (AT_CHECK_JAVA_GREP): Ignore the exit status.
* tests/javapush.at (AT_CHECK_JAVA_GREP): Be more alike the previous
one.
Formating changes.
Remove stray debugging "jj" file.
2013-06-21 11:38:47 +02:00
Akim Demaille
1d678854a4 java: push: do not reset the error counter
* data/lalr1.java (parse): here, when in push-pull is in "both" mode.
This breaks the test suite, for instance
make check TESTSUITEFLAGS='-d 388 BISON_USE_PUSH_FOR_PULL=1'.
More generally make maintainer-push-check.
2013-06-21 11:17:05 +02:00
Akim Demaille
28c4075b58 build: add Valgrind suppression file for GNU/Linux
* build-aux/linux-gnu.valgrind: New.
* build-aux/local.mk: Ship it.
* configure.ac: Use it.
2013-06-14 09:58:12 +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
0fcc2e9a74 build: ship all the files, even if the C++ compiler is broken
* examples/calc++/local.mk: Be sure to ship calc++.test even if
the current C++ compiler is not sufficient to run the tests.
2013-06-11 16:36:38 +02:00
Dennis Heimbigner
94a6225578 style: comment changes in Java skeleton
* data/lalr1.java: Here.
2013-06-05 10:04:21 +02:00
Akim Demaille
02798ba13d tests: fix a G++ warning
* tests/c++.at: Use YY_NULL instead of 0 for the null pointer.
And formatting changes.
2013-06-03 16:41:17 +02:00
Akim Demaille
8e13c5c03b build: fix a warning from clang
* src/muscle-tab.c: Declare local functions static.
2013-06-03 16:40:30 +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.
v2.7.90
2013-05-30 15:02:52 +02:00
Akim Demaille
c0ef22ab0b style: syntax-check fixes
* data/yacc.c, src/Sbitset.c, src/Sbitset.h, src/muscle-tab.h,
* src/output.c, src/parse-gram.y, src/reader.c, src/symtab.c,
* src/uniqstr.c, src/uniqstr.h: Fix space before parens.
* cfg.mk (_space_before_paren_exempt): Add needed exceptions.
2013-05-30 14:10:05 +02:00
Akim Demaille
971ef18e30 xml: use %empty in the text output
* data/xslt/xml2text.xsl: here.
2013-05-30 11:07:57 +02:00
Akim Demaille
ec991d74e1 build: locally disable new GCC warnings that fail on Flex generated code
* configure.ac: here.
2013-05-30 11:07:57 +02:00
Akim Demaille
c0efa83c0b fix a memory leak
* src/print-xml.c (num_escape_bufs): New.
(print_xml): Be sure to release all the escape_bufs.
2013-05-30 11:07:57 +02:00
Akim Demaille
e37054cf27 regen 2013-05-30 11:07:56 +02:00
Akim Demaille
89ff1b5e71 build: be sure to include config.h first in the generated parser
Using %code for config.h is wrong, as some headers will already have
been included by Bison.  In some cases, e.g., glibc's string.h, this
results in some declaration not being made for lack of definition of
_GNU_SOURCE, which is performed by config.h.

* src/parse-gram.y: here.
2013-05-30 10:47:49 +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
Petr Machata
30465cb778 drop unused options --raw, -n, -e, --include and -I
* --raw appears to be ignored.  It was marked as obsolete in the
  commit ec3bc39, and documented as no longer supported as of 1.29
  (2001-09-07).  Support for %raw appears to have been dropped in
  e9955c83 on 2002-06-11, but --raw was kept around.  Maybe it's time
  to drop it as well?

* Commit e9955c83 dropped support for %no-parser as well, and
  converted it to option.  --no-parser was later dropped in 728c4be2
  on 2007-08-12, but -n was kept around, probably as an omission.  All
  three are documented as removed since 2.3b (2008-05-27).

* -e existed for a single day in 2001.  It was introduced in eeeb962b
  on 2001-11-27.  The handling was removed in c7925b99 on 2001-11-28,
  but "e" was kept in the list of short options.  Probably an
  omission.

* --include appears to be dead code.  The option sets a variable, but
  that variable is not used anywhere.  It was added in f6bd5427 on
  2001-11-26 as a %-directive, with comments that it's not yet
  implemented.  It was converted to a command-line option later, but
  doesn't seem to ever have been actually implemented.

Signed-off-by: Petr Machata <pmachata@redhat.com>
Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2013-05-29 08:57:31 +02:00
Akim Demaille
f9340b27b2 gnulib: update 2013-05-28 16:40:44 +02:00
Akim Demaille
f249e803f0 diagnostics: always point to the first directive
Some directives cannot be used several times (e.g., a given symbol may
only have a single printer).  In case of repeated definitions, an
error is issued for the second definition, yet it is not discarded,
and becomes the definition used for the rest of the file.

This is not consistent with the idea that multiple definitions are not
allowed: discard any repeated directive.

* src/symtab.c (symbol_type_set, symbol_code_props_set)
(semantic_type_code_props_set, symbol_class_set, symbol_translation):
Discard repeated directives.
* tests/input.at (Default %printer and %destructor redeclared)
(Per-type %printer and %destructor redeclared): Update expectations.
2013-04-22 13:55:00 +02:00
Akim Demaille
dfb12d6845 tests: factor test for printer/desctructor redefined
* tests/input.at (Default %printer and %destructor redeclared):
Introduce AT_TEST to factor.
2013-04-22 13:47:50 +02:00
Akim Demaille
d8ce703102 diagnostics: use appropriate location for useless precedence/associativity
* src/symtab.c (symbol_precedence_set): Use prec_location, not
location (which is the first occurrence of the symbol, possibly just
%token).
Also, as redefinitions are not allowed, keep the first values, not
the subsequent ones.
* tests/conflicts.at, tests/existing.at, tests/regression.at: Adjust.
2013-04-22 11:36:22 +02:00
Akim Demaille
8782fe26cb tests: factor duplicate expected warnings
* tests/existing.at: Instead of "t ? abc : aBc", write "a(t?b:B)c".
2013-04-22 11:13:09 +02:00
Akim Demaille
7ba01e111c tests: enable -Wsign-compare and fix corresponding warnings
-Wsign-compare was disabled for bison's own code, following gnulib's
approach.  However, the generated parsers should not trigger such
warnings.

Reported by Efi Fogel.
http://lists.gnu.org/archive/html/help-bison/2013-04/msg00018.html

See also http://stackoverflow.com/questions/16101062 for the weird
"-(unsigned)i" piece of code.

* configure.ac (warn_tests): Enable -Wsign-compare.
* data/location.cc (position::add_): New.
(position::lines, position::columns): Use it.
* tests/actions.at (AT_CHECK_PRINTER_AND_DESTRUCTOR): Fix signedness issues.
2013-04-19 17:13:07 +02:00
Akim Demaille
6ce4b4ff1b muscle: check more cases of %define variables with code values
* data/bison.m4 (b4_percent_define_check_kind): Fix overquotation.
(api.location.type, api.position.type): Check they have code values here.
* data/c++.m4 (api.location.type): No longer checked here.
(parser_class_name): Check it here.
* data/java.m4 (api.value.type, init_throws, lex_throws, parser_class_name)
(throws, annotations, extends, implements): Check they have code values.
* doc/bison.texi: Fix every incorrect occurrence of %define.
Document the additional syntax for %define: code values.
Document the additional syntax for -D/-F: string and code values.
* tests/calc.at, tests/headers.at, tests/input.at, tests/java.at,
* tests/local.at: Fix dependencies.
2013-04-18 17:19:30 +02:00
Akim Demaille
332019e19a regen 2013-04-18 16:47:41 +02:00
Akim Demaille
9402b62353 parser: do not convert $ and @ in code values of %define variables
* src/parse-gram.y (value: "{...}"): Just strip the braces, but pass
the value as is.
2013-04-18 16:37:23 +02:00
Akim Demaille
985d7177e8 parser: no longer use the "braceless" non-terminal
The purpose of this symbol was only to factor function calls.  As a
result the actions were indeed simpler, but the grammar was somewhat
uselessly obfuscated.  Get rid of this symbol, but introduce functions
to simplify dependencies.

There is no (intended) changes of behavior here.

* src/parse-gram.y (strip_braces, translate_code(
(translate_code_braceless): New.
(braceless): Remove, use "{...}" instead, and one of the previous
functions depending on the context.
(STRING, "%{...%}", EPILOGUE): Declare as <code>, instead of <chars>,
the difference between both is useless (well, I couldn't make sense of
it, even after having read the initial commit that introduced them).
(%union): Remove the now useless "chars" type.
Adjust the printers.
* src/scan-gram.l: Adjust.
2013-04-18 16:36:58 +02:00
Akim Demaille
7dbadca2d0 regen 2013-04-18 15:12:24 +02:00
Akim Demaille
3f21a394f4 style: avoid %{...%} in our parser
* src/parse-gram.y (%{...%}): Split in %code and %code requires.
* src/location.h: Add missing includes for self containedness.
2013-04-18 15:11:53 +02:00
Akim Demaille
827aca04eb style: use %code for local function declarations in our parser
* src/parse-gram.y (version_check, gram_error, char_name, lloc_default):
Move their prototypes from %{...%} to %code.
(YYLLOC_DEFAULT, YY_LOCATION_PRINT): Move from %{...%} to %code.
(current_lhs): Move its implementation to the epilogue.
2013-04-18 15:10:35 +02:00
Akim Demaille
ff2e3d397a regen 2013-04-16 18:06:08 +02:00
Akim Demaille
aba47f5624 muscle: check the kind of api.prefix, api.location.type
* data/bison.m4: Check api.prefix.
* data/c++.m4: Check api.location.type.
* doc/bison.texi: Fix uses of api.value.type, api.prefix, api.location.type.
Document {...} values for %define.
* src/parse-gram.y: Fix use of api.prefix.
* tests/calc.at: Fix uses of api.location.type.
* tests/input.at: Check api.prefix, and api.location.type.
2013-04-16 17:42:43 +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.
v2.7.1
2013-04-15 13:59:02 +02:00
Akim Demaille
d065cb3853 regen 2013-04-15 11:29:54 +02:00
Akim Demaille
c53b684889 muscle: enforce definition syntax for keyword variables
* src/muscle-tab.c (muscle_percent_define_get_kind)
(muscle_percent_define_check_kind): New.
(muscle_percent_define_default): Variables with a default value are
of "keyword" kind.
(muscle_percent_define_flag_if, muscle_percent_define_check_values):
Check that the variable is of keyword kind.
* data/bison.m4: Likewise, but in M4.  That is to say...
(b4_percent_define_default): Define the kind when the variable is undefined.
(b4_percent_define_check_kind): Use a better error message.
(_b4_percent_define_check_values, _b4_percent_define_check_values):
Former "enum" variables should be defined using the keyword syntax.
* doc/bison.texi: Update.
A couple of fixes.
* tests/input.at (%define keyword variables): New.
2013-04-15 10:57:19 +02:00
Akim Demaille
5fad4d4f09 muscle: let -D/-F support the three kinds of %define variable values
See http://lists.gnu.org/archive/html/bison-patches/2013-04/msg00012.html

* src/getargs.c (getargs): Recognize {value} and "value" for -D and -F.
2013-04-15 10:57:19 +02:00
Akim Demaille
7956485cd6 muscle: minor refactoring
* src/muscle-tab.c (muscle_percent_define_default): Reduce the scopes.
2013-04-15 10:57:05 +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
d9cfa2bee2 muscle: factor the field retrieval
* src/muscle-tab.c (muscle_percent_define_get_raw): New.
Use it where appropriate.
(location_decode): No longer fetch the value from the table,
take the value as argument.
2013-04-15 10:50:30 +02:00
Akim Demaille
0f9583b69b muscle: factor the handling of used variables
* src/muscle-tab.c (muscle_percent_define_use): New, corresponding
to b4_percent_define_use.
Use it where appropriate.
2013-04-15 10:50:30 +02:00
Akim Demaille
c98b5143b0 muscle: factor the computation of variable names
* src/muscle-tab.c (muscle_name): New.
Use it.
Propagate "uniqstr" as value type instead of plain "char const *".
2013-04-15 10:50:12 +02:00
Akim Demaille
07e65a77aa muscle: factor the kind check in M4
* data/bison.m4 (b4_percent_define_check_kind): New.
Use it to check api.token.prefix.
* data/c++.m4: Check the kind of api.namespace.
* doc/bison.texi: Update a reference to former 'namespace' variable.
* tests/input.at ("%define" code variables): Check api.namespace.
2013-04-15 10:37:00 +02:00
Akim Demaille
ee616bdc62 muscle: factor conditionals on defined %define variables
* data/bison.m4 (b4_percent_define_ifdef_): New.
Use it where appropriate.
2013-04-15 10:32:48 +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