The conversion from @ to @@ and so forth is coded is too many
different places. Factor, a bit.
* src/scan-code.l: Instead of duplicating the logic of obstack_escape,
use it.
It sure is less efficient, but the cost is negligible.
This allows to factor rules that are alike.
And to factor some start-condition clauses.
* tests/input.at (Stray $ or @): New.
* NEWS: Document it.
* src/scan-code.l, src/scan-skel.l: Use a more traditional indentation
style for start-conditions.
Prefer "continue" to a comment, for empty actions.
Strip useless {}.
Remove useless start-condition clauses.
* src/scan-code.l (SC_SYMBOL_ACTION): Accept $<tag>$, not just $$.
* data/c.m4 (b4_dollar_dollar_): New.
(b4_symbol_actions): Let b4_dollar_dollar use b4_dollar_dollar_.
* NEWS, doc/bison.texi: Document it.
* tests/actions.at: Check this for C and C++.
muscles: fix another occurrence of unescaped type name
* src/output.c (quoted_output): Split into...
(quoted_output, string_output): these.
Use the former when outputting a type_name.
* tests/input.at: Check this case.
* src/symtab.h: Comment changes.
* src/scan-code.l: Use obstack_quote when passing type_name to m4.
* tests/input.at (Code injection): New.
* NEWS: Document it.
Thanks to Paul Eggert for the wording.
* src/system.h (obstack_quote): New.
* src/muscle-tab.c: Use it instead of obstack_escape where applicable.
* src/scan-code.l: Since obstack_quote supports NULL, leave type_name
as NULL instead of defaulting to "".
* src/muscle-tab.c (MUSCLE_COMMON_DECODE, muscle_string_decode)
(muscle_location_decode): Not related to muscles, rename as...
(COMMON_DECODE, string_decode, location_decode): these.
* src/muscle-tab.h (MUSCLE_OBSTACK_SGROW): This is not related to
muscles, so move to, and rename as...
* src/system.h (obstack_escape): this.
Adjust dependencies.
doc: avoid problems with case insensitive file systems
makeinfo --html generates index.html, and the node "Index" will result
in Index.html. On case insensitive file systems, such as on Mac OS X
by default, this results in a single, invalid, file (Texinfo 4.13).
See http://lists.gnu.org/archive/html/bug-texinfo/2012-07/msg00032.html
* doc/bison.texi (Index): Rename as...
(Index of Terms): this.
* configure.ac: In the AC_SUBST call on 'VALGRIND_PREBISON'. Without
this change, when running ./configure, I see:
...
checking for valgrind... valgrind
./configure: line 35221: -q: command not found
checking for Java compiler... gcj -C -fsource=1.3 -ftarget=1.4
...
* configure.ac (VALGRIND_PREBISON): New.
* tests/Makefile.am (maintainer-check-valgrind): Use it.
* etc/darwin11.4.0.supp: New.
* configure.ac, etc/Makefile.am: Use it.
* configure.ac: Disable Valgrind on Mac OS X.
* README-hacking: Explain why.
YYLLOC_DEFAULT: factor, and don't export it in headers.
* data/c++.m4, data/c.m4 (b4_yylloc_default_define): New.
* data/glr.c, data/glr.cc, data/lalr1.cc, data/yacc.c: Use it.
* data/glr.cc: Do not define YYLLOC_DEFAULT in the header file,
but in the implementation one.
since, of course YYSTYPE_IS_TRIVIAL is defined. Instead we could
define YYSTYPE_IS_TRIVIAL as PREFIX_STYPE_IS_TRIVIAL only when the
later is defined, but let's avoid stacking CPP on top of M4: rather, use
* data/glr.c, data/yacc.c: Use YYSTYPE_IS_TRIVIAL, YYSTYPE_IS_DECLARED,
YYLTYPE_IS_TRIVIAL and YYLTYPE_IS_DECLARED under their api.prefix-renamed
name.
The testsuite in master has shown weird errors for the "Mulitple
Parsers" tests: the caller of p5.parse() received some apparently
random value, while tracing p5.parse() showed that the function was
consistently returning 0.
It happens when mixing several parser headers, some generated without
%debug, others with. In particular the C++ parser was generated with
%debug, i.e., with:
#ifndef YYDEBUG
# define YYDEBUG 1
#endif
and compiled separatedly. Yet, its header was included after the one
of another parser, this time without %debug, i.e., with
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
in its header. As a result, the parser was compiled with YYDEBUG set,
but its header was used without. Since the layout of the objects are
then completely different, boom.
Therefore, do not change the value of YYDEBUG. Rather, use it as a
default value for <API.PREFIX>DEBUG.
* data/c.m4 (b4_YYDEBUG_define): New.
(b4_declare_yydebug): Rename as...
(b4_yydebug_declare): this, for consistency.
* data/glr.c, data/glr.cc, data/lalr1.cc, data/yacc.c: Use it.
* NEWS: Document it.
Akim Demaille [Tue, 26 Jun 2012 12:05:56 +0000 (14:05 +0200)]
tests: do not output m4 set up.
* tests/local.at (AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS):
Use a diversion to avoid outputting comments etc.
Removes 17k lines from testsuite (10% of the number of lines).
Akim Demaille [Tue, 26 Jun 2012 09:54:13 +0000 (11:54 +0200)]
tests: use the generic yyerror function.
* tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Factor.
Use AT_YYERROR_DEFINE.
Therefore, instead of using stdout, use and check stderr.
* tests/glr-regression.at (Uninitialized location when reporting ambiguity):
Use AT_YYERROR_DEFINE.
Akim Demaille [Mon, 25 Jun 2012 14:37:18 +0000 (16:37 +0200)]
tests: generalize the compilation macros.
* tests/local.at (AT_COMPILE, AT_COMPILE_CXX): If OUTPUT ends with ".o",
then append the "natural" extension for the input file (.c or .cc).
If there is no source, pass -c.
* tests/headers.at, tests/input.at, tests/regression.at: Adjust.
Akim Demaille [Tue, 26 Jun 2012 07:35:31 +0000 (09:35 +0200)]
tests: fix confusion between api.prefix and name-prefix.
* tests/local.at (AT_NAME_PREFIX): Take api.prefix into account.
(AT_API_PREFIX): Rename as...
(AT_API_prefix): this.
Do not take %name-prefix into account.
Fix misuses.
Akim Demaille [Mon, 25 Jun 2012 08:15:44 +0000 (10:15 +0200)]
yacc: work around the ylwrap limitation.
* data/yacc.c (b4_shared_declarations): Include the header guards.
Do not include the header in the *.c file, duplicate it.
* NEWS (Future Changes): Extend, and announce the forthcoming change
about the use of the parser header.
Akim Demaille [Fri, 22 Jun 2012 10:08:02 +0000 (12:08 +0200)]
tests: more uniformity.
* tests/local.at (AT_LEX_FORMALS, AT_LEX_ARGS, AT_LEX_PRE_FORMALS)
(AT_LEX_PRE_ARGS): Rename as...
(AT_YYLEX_FORMALS, AT_YYLEX_ARGS, AT_YYLEX_PRE_FORMALS)
(AT_YYLEX_PRE_ARGS): these, for consistency.
(AT_API_PREFIX): Take %name-prefix into account.
(AT_YYLEX_PROTOTYPE): New.
Use it.
* tests/actions.at, tests/calc.at, tests/cxx-type.at: Adjust to
use them.
Akim Demaille [Fri, 22 Jun 2012 09:34:37 +0000 (11:34 +0200)]
tests: handle locations in a more generic way.
* tests/local.at (AT_YYERROR_PROTOTYPE): New.
Use it.
* tests/cxx-type.at: Extensive revamp to use a more traditional
quotation scheme, and to use the generic yyerror implementation.
Prefer Autotest macros to CPP macros.
* tests/java.at: .
Akim Demaille [Fri, 22 Jun 2012 08:20:28 +0000 (10:20 +0200)]
tests: handle locations in the generic yyerror functions.
* tests/local.at (AT_YYERROR_DECLARE_EXTERN, AT_YYERROR_DECLARE)
(AT_YYERROR_DEFINE): Handle locations for C and C++.
* tests/calc.at: Use it for C++ (as C has extra arguments which
are not yet handled by AT_BISON_OPTION_PUSHDEFS).
* tests/actions.at: Adjust.
Akim Demaille [Thu, 21 Jun 2012 21:05:05 +0000 (23:05 +0200)]
tests: improve infrastructure
* tests/local.at (AT_LANG): Use c++ instead of cxx for C++.
Adjust dependencies.
(AT_YYERROR_DECLARE_EXTERN, AT_YYERROR_DECLARE): Issue nothing
for C++/Java.
(AT_YYERROR_DEFINE): Use m4_case.
(AT_JAVA_COMPILE): Use AT_SKIP_IF.
Akim Demaille [Sun, 17 Jun 2012 10:10:44 +0000 (12:10 +0200)]
c skeletons: factor the declaration of yylloc and yylval.
There is one difference: now, even without --defines, we generate
extern declarations for these variables. The factoring is worth it.
* data/c.m4 (b4_declare_yylstype): Declare them.
* data/glr.c, data/yacc.c: Adjust.
Akim Demaille [Mon, 11 Jun 2012 14:47:46 +0000 (16:47 +0200)]
tests: call the parser from another compilation unit.
In order to improve the testing of %defines, which exports the
interface of the generated parser, change the calc.at tests so that
when %defines is passed, main will be in another compilation unit. It
loads the generated header.
* tests/calc.at (AT_CALC_MAIN): New.
Includes the definition of the global variables.
Therefore, now declare them from the %requires section of the parser.
Adjust to yydebug and yyparse being renamed by %name-prefix.
Akim Demaille [Fri, 15 Jun 2012 13:19:16 +0000 (15:19 +0200)]
glr.c, yacc.c: declare yydebug in the header.
* data/c.m4 (b4_declare_yydebug): New.
* data/glr.c, data/yacc.c (b4_shared_declarations): Use it.
Remove the corresponding code from the parser body.
* NEWS: Doc this.