Dennis Heimbigner [Thu, 13 Jun 2013 08:08:19 +0000 (10:08 +0200)]
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>
Akim Demaille [Tue, 11 Jun 2013 13:26:48 +0000 (15:26 +0200)]
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.
Dennis Heimbigner [Wed, 5 Jun 2013 08:03:16 +0000 (10:03 +0200)]
style: comment changes in Java skeleton
* data/lalr1.java: Here.
Akim Demaille [Mon, 3 Jun 2013 14:40:53 +0000 (16:40 +0200)]
tests: fix a G++ warning
* tests/c++.at: Use YY_NULL instead of 0 for the null pointer.
And formatting changes.
Akim Demaille [Mon, 3 Jun 2013 14:40:30 +0000 (16:40 +0200)]
build: fix a warning from clang
* src/muscle-tab.c: Declare local functions static.
Akim Demaille [Thu, 30 May 2013 13:28:44 +0000 (15:28 +0200)]
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
Akim Demaille [Thu, 30 May 2013 13:02:52 +0000 (15:02 +0200)]
version 2.7.90
* NEWS: Record release date.
Akim Demaille [Thu, 30 May 2013 12:08:41 +0000 (14:08 +0200)]
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.
Akim Demaille [Wed, 29 May 2013 15:07:32 +0000 (17:07 +0200)]
xml: use %empty in the text output
* data/xslt/xml2text.xsl: here.
Akim Demaille [Wed, 29 May 2013 14:27:59 +0000 (16:27 +0200)]
build: locally disable new GCC warnings that fail on Flex generated code
* configure.ac: here.
Akim Demaille [Wed, 29 May 2013 14:26:53 +0000 (16:26 +0200)]
fix a memory leak
* src/print-xml.c (num_escape_bufs): New.
(print_xml): Be sure to release all the escape_bufs.
Akim Demaille [Wed, 29 May 2013 07:27:59 +0000 (09:27 +0200)]
regen
Akim Demaille [Wed, 29 May 2013 07:17:48 +0000 (09:17 +0200)]
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.
Akim Demaille [Wed, 29 May 2013 07:05:12 +0000 (09:05 +0200)]
Merge remote-tracking branch 'origin/maint'
* origin/maint:
maint: post-release administrivia
version 2.7.1
regen
Petr Machata [Fri, 17 May 2013 15:23:14 +0000 (17:23 +0200)]
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>
Akim Demaille [Tue, 28 May 2013 14:38:26 +0000 (16:38 +0200)]
gnulib: update
Akim Demaille [Mon, 22 Apr 2013 11:55:00 +0000 (13:55 +0200)]
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.
Akim Demaille [Mon, 22 Apr 2013 11:47:50 +0000 (13:47 +0200)]
tests: factor test for printer/desctructor redefined
* tests/input.at (Default %printer and %destructor redeclared):
Introduce AT_TEST to factor.
Akim Demaille [Mon, 22 Apr 2013 09:26:28 +0000 (11:26 +0200)]
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.
Akim Demaille [Mon, 22 Apr 2013 09:13:09 +0000 (11:13 +0200)]
tests: factor duplicate expected warnings
* tests/existing.at: Instead of "t ? abc : aBc", write "a(t?b:B)c".
Akim Demaille [Fri, 19 Apr 2013 15:13:07 +0000 (17:13 +0200)]
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.
Akim Demaille [Thu, 18 Apr 2013 14:52:55 +0000 (16:52 +0200)]
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.
Akim Demaille [Thu, 18 Apr 2013 14:47:41 +0000 (16:47 +0200)]
regen
Akim Demaille [Thu, 18 Apr 2013 14:37:23 +0000 (16:37 +0200)]
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.
Akim Demaille [Thu, 18 Apr 2013 14:36:54 +0000 (16:36 +0200)]
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.
Akim Demaille [Thu, 18 Apr 2013 13:12:24 +0000 (15:12 +0200)]
regen
Akim Demaille [Thu, 18 Apr 2013 13:11:53 +0000 (15:11 +0200)]
style: avoid %{...%} in our parser
* src/parse-gram.y (%{...%}): Split in %code and %code requires.
* src/location.h: Add missing includes for self containedness.
Akim Demaille [Thu, 18 Apr 2013 12:46:06 +0000 (14:46 +0200)]
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.
Akim Demaille [Tue, 16 Apr 2013 16:06:08 +0000 (18:06 +0200)]
regen
Akim Demaille [Tue, 16 Apr 2013 15:42:43 +0000 (17:42 +0200)]
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.
Akim Demaille [Mon, 15 Apr 2013 12:09:40 +0000 (14:09 +0200)]
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
Akim Demaille [Mon, 15 Apr 2013 11:59:02 +0000 (13:59 +0200)]
version 2.7.1
* NEWS: Record release date.
Akim Demaille [Mon, 15 Apr 2013 09:29:54 +0000 (11:29 +0200)]
regen
Akim Demaille [Sun, 14 Apr 2013 12:42:15 +0000 (14:42 +0200)]
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.
Akim Demaille [Mon, 15 Apr 2013 08:05:44 +0000 (10:05 +0200)]
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.
Akim Demaille [Sun, 14 Apr 2013 11:51:19 +0000 (13:51 +0200)]
muscle: minor refactoring
* src/muscle-tab.c (muscle_percent_define_default): Reduce the scopes.
Akim Demaille [Sun, 14 Apr 2013 08:28:26 +0000 (10:28 +0200)]
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.
Akim Demaille [Sun, 14 Apr 2013 08:21:22 +0000 (10:21 +0200)]
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.
Akim Demaille [Sun, 14 Apr 2013 08:12:36 +0000 (10:12 +0200)]
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.
Akim Demaille [Sun, 14 Apr 2013 08:11:13 +0000 (10:11 +0200)]
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 *".
Akim Demaille [Sat, 13 Apr 2013 07:30:05 +0000 (09:30 +0200)]
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.
Akim Demaille [Mon, 15 Apr 2013 08:31:04 +0000 (10:31 +0200)]
muscle: factor conditionals on defined %define variables
* data/bison.m4 (b4_percent_define_ifdef_): New.
Use it where appropriate.
Akim Demaille [Thu, 11 Apr 2013 13:43:26 +0000 (15:43 +0200)]
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.
Akim Demaille [Thu, 11 Apr 2013 07:53:18 +0000 (09:53 +0200)]
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.
Akim Demaille [Thu, 11 Apr 2013 07:21:08 +0000 (09:21 +0200)]
muscles: be sure that %code snippets are not glue together on a single line
Recently "braceless" in the parser was changed so that an eol was no
longer added to the value. This is not correct when a %code is used
multiple times, because the syncline of the next snippet might be
appended to the last (and not ended) line of the previous snippet.
* src/muscle-tab.h (muscle_grow): Make it private.
* src/muscle-tab.c (muscle_grow): Accept a fourth argument: a required
terminator.
Adjust callers.
* tests/input.at (Multiple %code): New.
Akim Demaille [Thu, 11 Apr 2013 06:47:22 +0000 (08:47 +0200)]
style: fix comments
* tests/actions.at: Fix incorrect "prototype".
Akim Demaille [Wed, 10 Apr 2013 07:23:20 +0000 (09:23 +0200)]
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
Akim Demaille [Fri, 5 Apr 2013 12:40:25 +0000 (14:40 +0200)]
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
Akim Demaille [Wed, 27 Mar 2013 08:18:32 +0000 (09:18 +0100)]
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'.
Akim Demaille [Mon, 25 Feb 2013 09:31:03 +0000 (10:31 +0100)]
doc: style changes
* doc/bison.texi (Destructor Decl, Printer Decl): Group series of %token
and %type together.
Akim Demaille [Sat, 23 Feb 2013 16:04:17 +0000 (17:04 +0100)]
doc: display locations in error as recommended by GNU Coding Standards
* doc/bison.texi (Actions and Locations): here.
Akim Demaille [Sat, 23 Feb 2013 14:11:24 +0000 (15:11 +0100)]
doc: api.value.type union
* doc/bison.texi (Type Generation): New section.
(Multi-function Calc): Convert to use api.value.type=union.
Akim Demaille [Sat, 23 Feb 2013 13:37:44 +0000 (14:37 +0100)]
doc: move the section about "%union" where types are discussed
* doc/bison.texi (Union Decl): Move to...
(Defining Language Semantics): here.
Akim Demaille [Fri, 22 Feb 2013 11:47:25 +0000 (12:47 +0100)]
doc: deprecate #define YYSTYPE in favor of %define api.value.type
* doc/bison.texi: Convert examples with YYSTYPE to use api.value.type.
Deprecate YYSTYPE.
Akim Demaille [Thu, 21 Feb 2013 14:58:05 +0000 (15:58 +0100)]
value type: accept "->" in type tags
Provide a means to dereference pointers when defining tags. One
example could be:
%code requires
{
typedef struct ListElementType
{
union value
{
int intVal;
float floatVal;
char* charptrVal;
} value;
struct ListElementType* next;
} ListElementType;
}
%union
{
ListElementType* list;
}
%token <list->value.charptrVal> STRING
%token <list->value.intVal> INTEGER
%token <list->value.floatVal> REAL
%type <list> ElementList LiteralType
* src/scan-code.l, src/scan-gram.l: Accept "->" in tags.
* tests/types.at: Add more test cases to cover this case.
Akim Demaille [Thu, 21 Feb 2013 13:32:16 +0000 (14:32 +0100)]
style: simplify the scanning of type tags
* src/scan-gram.l: Remove the rule for simple tags: the "complex" case
subsumes it. It was more efficient, but duplicated the code for a
negligible benefit.
Akim Demaille [Fri, 8 Feb 2013 16:17:33 +0000 (17:17 +0100)]
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.
Akim Demaille [Mon, 8 Apr 2013 18:37:09 +0000 (20:37 +0200)]
m4: allow the definition of side-effect only macros
* data/bison.m4 (b4_divert_kill, b4_define_silent): New.
* data/c.m4: Comment change.
Akim Demaille [Mon, 8 Apr 2013 18:22:04 +0000 (20:22 +0200)]
variant: fix inconsistent quotation
* data/variant.hh (b4_char_sizeof): De-overquote.
(b4_value_type_declare): De-underquote.
Akim Demaille [Fri, 5 Apr 2013 12:00:49 +0000 (14:00 +0200)]
m4: style changes in error messages
* data/bison.m4: Use $0 to denote the current macro's name.
Akim Demaille [Mon, 8 Apr 2013 17:52:16 +0000 (19:52 +0200)]
glr.cc: fix a clang warning
* data/glr.cc (b4_epilogue): Be sure to end with an end-of-line,
so that the file does end with one.
Akim Demaille [Mon, 8 Apr 2013 11:43:32 +0000 (13:43 +0200)]
maint: update copyright years
Run "make update-copyright".
Akim Demaille [Sat, 12 Jan 2013 15:03:15 +0000 (16:03 +0100)]
build: fix VPATH issue
* Makefile.am (update-b4-copyright, update-package-copyright-year): Fix
path to build-aux.
(cherry picked from commit
f6df83b4e80b2a53c08b5dc654e247076a3b9b03)
Conflicts:
Makefile.am
Akim Demaille [Wed, 30 Jan 2013 14:52:34 +0000 (15:52 +0100)]
build: avoid clang's colored diagnostics in the test suite
The syncline tests, which try to recognize compiler diagnostics,
are confused by escapes for colors.
* configure.ac (warn_tests): New, to factor the warnings for both
C and C++ tests.
Add -fno-color-diagnostics to it.
* tests/local.at (AT_TEST_TABLES_AND_PARSE): Do not remove glue
together compiler flags.
Conflicts:
configure.ac
Akim Demaille [Mon, 28 Jan 2013 15:50:50 +0000 (16:50 +0100)]
tests: please clang and use ".cc", not ".c", for C++ input
When fed with foo.c, clang++ 3.2 answers:
clang: error: treating 'c' input as 'c++' when in C++ mode,
this behavior is deprecated
* tests/output.at (AT_CHECK_OUTPUT_FILE_NAME): Use *.cc and *.hh
for C++.
Akim Demaille [Mon, 8 Apr 2013 09:19:09 +0000 (11:19 +0200)]
gnulib: update
Akim Demaille [Mon, 8 Apr 2013 09:13:22 +0000 (11:13 +0200)]
skeletons: avoid empty switch constructs
Reported by Rob Conde.
http://lists.gnu.org/archive/html/bug-bison/2013-03/msg00003.html
* data/c.m4 (b4_symbol_actions): Rename as...
(_b4_symbol_actions): this.
(b4_symbol_actions): New wrapper.
Do not emit empty switches.
Adjust all b4_symbol_actions callers.
Akim Demaille [Mon, 8 Apr 2013 08:54:12 +0000 (10:54 +0200)]
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.
Akim Demaille [Mon, 8 Apr 2013 08:39:48 +0000 (10:39 +0200)]
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.
Akim Demaille [Thu, 4 Apr 2013 15:27:36 +0000 (17:27 +0200)]
api.namespace: demonstrate and use {...} values instead of "..." values
* tests/c++.at, tests/input.at: Use "%define api.namespace {foo}" instead
of using quotes.
* tests/local.at (AT_SETUP_STRIP, AT_NAME_PREFIX): Recognize uses of
braces instead of quotes.
* doc/bison.texi: Use braces for api.namespace's values.
Akim Demaille [Thu, 4 Apr 2013 15:21:55 +0000 (17:21 +0200)]
grammar: do not add a \n at the end of blocks of code
Now that we use "braceless" (which is {...} blocks of code with
initial and final braces stripped) to denote "short" values (such as
api.namespaces), the added end-of-line is a nuisance. As a matter of
fact, this extra-safety was useless, as every expansion of "braceless"
(aka, "user code") is followed by an end of line.
* src/parse-gram.y, src/parse-gram.c (braceless): Instead of replacing
the final brace by \n, just delete the brace.
Akim Demaille [Thu, 4 Apr 2013 14:50:30 +0000 (16:50 +0200)]
regen
Akim Demaille [Thu, 4 Apr 2013 14:38:17 +0000 (16:38 +0200)]
grammar: record the kind of %define variable values
Provide a means to tell the difference between "keyword" values (e.g.,
%define api.pull both), "string" values (e.g., %define file.name
"foo"), and "code" values (e.g., %define api.namespace {calc}).
Suggested by Joel E. Denny.
http://lists.gnu.org/archive/html/bison-patches/2013-03/msg00016.html
* src/muscle-tab.h, src/muscle-tab.c (muscle_kind, muscle_kind_new)
(muscle_kind_string): New.
(muscle_percent_define_insert): Take the kind as new argument.
Insert it in the muscle table.
Adjust callers.
* src/getargs.c: Adjust callers.
* src/parse-gram.y: Ditto.
(content.opt): Remove, replaced by...
(value): this new non-terminal, whose semantics value is stored
in the new "value" union member.
Provide a printer.
Support values in braces in additions to keyword and string values.
fuse me
Akim Demaille [Thu, 4 Apr 2013 14:27:54 +0000 (16:27 +0200)]
style: fix comments
* src/muscle-tab.c (muscle_percent_define_ensure): Update obsolete
comments.
Akim Demaille [Thu, 4 Apr 2013 13:48:08 +0000 (15:48 +0200)]
regen
Akim Demaille [Thu, 4 Apr 2013 13:41:49 +0000 (15:41 +0200)]
grammar: style changes
* src/parse-gram.y (PARAM_TYPE): Remove useless typedef guard.
There's a header guard.
Use 'yyo' with %printer.
Use a consistent style for %union one-liners.
Akim Demaille [Thu, 4 Apr 2013 13:32:49 +0000 (15:32 +0200)]
grammar: split %union to group together related aspects
* src/parse-gram.y (INT): Fuse the %type and %token declaration.
Move its %union right before its introduction.
(%union): Split in several %unions, right before their use.
Akim Demaille [Thu, 4 Apr 2013 13:18:29 +0000 (15:18 +0200)]
muscle: refactor
* src/muscle-tab.c (muscle_lookup, muscle_entry_new): New.
(muscle_insert, muscle_grow, muscle_find_const, muscle_find): Use them.
Akim Demaille [Wed, 3 Apr 2013 15:07:56 +0000 (17:07 +0200)]
style: comment changes
* src/muscle-tab.c: Move the documentation of public functions to...
* src/muscle-tab.h: here.
Fix comment consistency issues.
Akim Demaille [Wed, 3 Apr 2013 15:07:22 +0000 (17:07 +0200)]
muscle: minor refactoring
* src/muscle-tab.h (MUSCLE_INSERT_C_STRING): Use MUSCLE_INSERT_STRING.
Akim Demaille [Wed, 6 Mar 2013 09:28:16 +0000 (10:28 +0100)]
regen
Valentin Tolmer [Tue, 5 Mar 2013 11:29:50 +0000 (12:29 +0100)]
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>
Akim Demaille [Mon, 4 Mar 2013 17:26:25 +0000 (18:26 +0100)]
maint: update autoconf submodule
* submodules/autoconf: Up to master.
No significant changes in the files we use (m4sugar.m4 and foreach.m4).
Akim Demaille [Mon, 4 Mar 2013 17:15:49 +0000 (18:15 +0100)]
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.
Akim Demaille [Mon, 25 Feb 2013 14:33:55 +0000 (15:33 +0100)]
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
e8cd1ad655bcc704b06fb2f191dc3ac1df32b796.
* 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.
Akim Demaille [Wed, 27 Feb 2013 14:41:55 +0000 (15:41 +0100)]
build: stop using bison -y
* Makefile.am (YACC): Pass -o y.tab.c, so that ylwrap is happy, and
yet we don't pass --yacc to bison.
(AM_YFLAGS): Disable Yacc warnings.
Akim Demaille [Fri, 8 Feb 2013 16:09:33 +0000 (17:09 +0100)]
c++: rename b4_semantic_type_declare as b4_value_type_declare
This is to match the names used in C and api.value.type, even if the
parser actually defines semantic_type.
* data/c++.m4 (b4_semantic_type_declare): Rename as...
(b4_value_type_declare): this.
* data/variant.hh: Likewise.
Akim Demaille [Sat, 23 Feb 2013 13:37:27 +0000 (14:37 +0100)]
news: typo
* NEWS: here.
Akim Demaille [Sat, 23 Feb 2013 13:44:33 +0000 (14:44 +0100)]
style: space changes in the tests
* tests/local.at: here.
Akim Demaille [Fri, 22 Feb 2013 12:18:17 +0000 (13:18 +0100)]
style: formatting changes in the doc
* doc/bison.texi: Use @file where appropriate.
Akim Demaille [Tue, 19 Feb 2013 16:44:08 +0000 (17:44 +0100)]
tests: fix invalid C++11 code
* tests/c++.at (Object): Somehow instances of Object were assigned
YY_NULL, which is 0 most of the time (that case passes), but is
nullptr in C++11, and there is nothing in Object to support such an
assignment (failure). Use 0 as value, and provide the needed
assignment operator.
Also, use a more natural order within the class definition.
Akim Demaille [Tue, 19 Feb 2013 16:42:33 +0000 (17:42 +0100)]
tests: fix failures with G++ 4.8 in Flex scanner
* configure.ac (WARN_NO_NULL_CONVERSION_CXXFLAGS): Rename as...
(FLEX_SCANNER_CXXFLAGS): this.
Pass -Wno-zero-as-null-pointer-constant to G++ if it supports it.
* examples/calc++/local.mk: Adjust.
Akim Demaille [Tue, 19 Feb 2013 09:07:37 +0000 (10:07 +0100)]
regen
Akim Demaille [Tue, 19 Feb 2013 08:32:43 +0000 (09:32 +0100)]
gnulib: update
Akim Demaille [Tue, 19 Feb 2013 08:25:58 +0000 (09:25 +0100)]
style: rename variant private members
* data/variant.hh (buffer, tname, as_, raw, align_me): Rename as...
(yybuffer_, yytname_,yyas_, yyraw, yyalign_me): these.
Akim Demaille [Tue, 19 Feb 2013 08:21:26 +0000 (09:21 +0100)]
style: space changes
* data/variant.hh: Be sure to leave a space before arguments in function
calls.
Akim Demaille [Tue, 19 Feb 2013 07:55:15 +0000 (08:55 +0100)]
variant: fix G++ 4.4 warnings
The changes by Théophile Ranquet about type punning issues need
to be extend to in-place new to please G++ 4.4.7.
* data/variant.hh (variant::as_): New, factors the casts that avoid
compiler warnings.
(as, build): Use them.
Akim Demaille [Mon, 18 Feb 2013 13:29:43 +0000 (14:29 +0100)]
news: spell fixes
* NEWS: here.
Akim Demaille [Sun, 17 Feb 2013 11:47:35 +0000 (12:47 +0100)]
diagnostics: factor and enhance messages about duplicate rule directives
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.
Akim Demaille [Sat, 16 Feb 2013 13:21:09 +0000 (14:21 +0100)]
style: no longer use backquotes
* tests/actions.at, tests/atlocal.in, tests/c++.at, tests/calc.at,
* tests/conflicts.at, tests/existing.at, tests/glr-regression.at,
* tests/input.at, tests/java.at, tests/local.at, tests/sets.at,
* tests/synclines.at, doc/bison.texi, lib/libiberty.h, lib/timevar.h:
Use single quotes.