Commit Graph

5559 Commits

Author SHA1 Message Date
Paul Eggert
b5e27aa262 build: don't require flex for ordinary builds
* configure.ac (LEX): Don't fail if this is lex, as flex is not
required for ordinary builds.  Instead, issue a warning and
substitute a no-op LEX.  Reported by Michael Felt in
<http://lists.gnu.org/archive/html/bug-bison/2013-08/msg00009.html>.
2013-08-24 18:22:44 -07:00
Paul Eggert
0149d39e6e maint: update .gitignore
* .gitignore: Add *.eps, *.o, *.pdf, *.png, *.stamp, *~,
.deps, .dirstamp.  Needed to suppress unwanted chatter from
'git status' after a bootstrap build.
2013-08-24 18:00:52 -07:00
Paul Eggert
1d91bfdf1c build: port to pre-5.8.7 perl
* examples/local.mk (extract): Omit -f from perl options.
This doesn't work with perl versions before 5.8.7
that are configured without USE_SITECUSTOMIZE.
Reported by Michael Felt in
<http://lists.gnu.org/archive/html/bug-bison/2013-08/msg00006.html>.
2013-08-24 07:55:47 -07:00
Akim Demaille
db40c3f869 tests: minor change to make it easier to test other skeletons
* tests/c++.at (Variants): Pass the skeleton as argument.
2013-08-01 16:11:27 +02:00
Valentin Tolmer
b663fd5322 uniqstr: fix assertion
* src/uniqstr.c (uniqstr_assert): Really make sure str is a uniqstr,
not just whether some uniqstr with the same content was registered.
2013-08-01 15:29:21 +02:00
Valentin Tolmer
a728075710 symbols: improve symbol aliasing
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).
2013-08-01 12:49:51 +02:00
Akim Demaille
c4aa4ff541 build: ship the ASCII art figures
We don't ship the *.txt files that are used to build the info
file.
Reported by Colin Daley.

* doc/figs/example.txt: New.
* doc/local.mk (bison.info): Depend on the txt files.
And ship them.
2013-08-01 11:41:49 +02:00
Akim Demaille
b97bbbaed7 doc: prefer the ".gv" extension to ".dot"
See http://marc.info/?l=graphviz-devel&m=129418103126092 for the
motivation (basically, some word processor now uses *.dot).

* doc/figs/example-reduce.dot: Rename as...
* doc/figs/example-reduce.gv: this.
* doc/figs/example-shift.dot: Rename as...
* doc/figs/example-shift.gv: this.
* doc/figs/example.dot: Rename as...
* doc/figs/example.gv: this.
* doc/local.mk: Adjust.
2013-08-01 11:20:13 +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.
v3.0
2013-07-25 17:55:58 +02:00
Akim Demaille
a62a7b014c regen 2013-07-25 17:55:32 +02:00
Akim Demaille
de1a2f20dd news: prepare 3.0
* NEWS (3.0): Reorder.
2013-07-25 17:53:59 +02:00
Akim Demaille
afcc58c63e tests: fix invalid assignment when using variants in C++11
* tests/c++.at (Exception safety): In variant mode $$ is an instance
of Object.  Assigning YY_NULL in C++98 is incorrect, but behaves ok,
as it assigns YY_NULL=0 using Object::operator= (char v).  It is wrong
in C++11 as there is operator for "$$ = nullptr".
2013-07-25 17:53:59 +02:00
Akim Demaille
d3ae5af6ec yacc: beware of "uninitialized uses" warnings
Again some issues with the fact that yylval is reported by GCC as
possibly not initialized in some cases.  Here, the case at hand is the
%destructor.

I am still not convinced that it is worth going all the trouble of
using pragmas to disable temporarily some warnings, instead of just
initializing the looking symbol once for all, but that's what Paul
voted for, see
<http://lists.gnu.org/archive/html/bison-patches/2012-10/msg00050.html>.

* data/c.m4 (b4_attribute_define): Define
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN, YY_IGNORE_MAYBE_UNINITIALIZED_END,
YY_INITIAL_VALUE here, as we will need them in the generation of the
destructor function, which is defined in yacc.c before yyparse, which
was in charge of defining these macros.
* data/yacc.c (b4_declare_scanner_communication_variables): Simplify:
trying to factor the definitions of the case pure and impure is
too complex.
Actually, it is not even clear that this macro should really exist,
as even the calls are complex.
Be careful not to issue a lone ";", as this is a statement, and C90
forbids declarations after statements ; so write
"YY_INITIAL_VALUE(Decl;)", not "YY_INITIAL_VALUE(Decl);".
2013-07-25 17:53:59 +02:00
Akim Demaille
41dfa1cbf0 gnulib: update 2013-07-25 13:47:01 +02:00
Akim Demaille
b7171c45f4 tests: skip C++ tests if we can't compile a simple program
There are possible conflicts between gnulib replacement functions (in
<stdio.h>) and their C++ wrappers (in <stream>).  Trying to address
these in configure seems too hard, and I don't know how to fix the issue
in gnulib.  Cowardly avoid the problem by skipping C++ tests when this
happens.
Reported by Stefano Lattarini.
http://lists.gnu.org/archive/html/bug-bison/2013-06/msg00001.html

* tests/atlocal.in (BISON_CXX_WORKS): Also set it to "skip" if we can't
compile a simple program using <stream>.
* tests/local.at: Comment changes.
2013-07-03 17:18:54 +02:00
Akim Demaille
ac953ff80a tests: fix 'find' portability issues
Reported by Stefano Lattarini.
http://lists.gnu.org/archive/html/bug-bison/2013-06/msg00000.html

* tests/output.at (AT_CHECK_OUTPUT): Use Perl instead.
2013-07-03 08:39:41 +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.
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