]> git.saurik.com Git - bison.git/log
bison.git
12 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Fri, 6 Jul 2012 08:58:26 +0000 (10:58 +0200)] 
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  maint: update release instructions
  maint: post-release administrivia
  version 2.5.90
  build: fix gen-ChangeLog call.
  gnulib: update.
  tests: fix SKIP_IF for Java.
  api.prefix: incompatible with %name-prefix.
  api.prefix: strengthen the tests and fix push-parsers.
  skeletons: style changes.
  NEWS: minor changes.
  api.prefix: improve the documentation for YYDEBUG.
  gnulib: update.

Conflicts:
NEWS
cfg.mk
data/bison.m4
doc/bison.texi
m4/.gitignore
tests/calc.at
tests/headers.at

12 years agomaint: update release instructions
Akim Demaille [Fri, 6 Jul 2012 08:14:49 +0000 (10:14 +0200)] 
maint: update release instructions

* README-hacking: here.

12 years agomaint: post-release administrivia
Akim Demaille [Thu, 5 Jul 2012 14:29:06 +0000 (16:29 +0200)] 
maint: post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

12 years agoversion 2.5.90
Akim Demaille [Thu, 5 Jul 2012 14:20:44 +0000 (16:20 +0200)] 
version 2.5.90

* NEWS: Record release date.

12 years agobuild: fix gen-ChangeLog call.
Akim Demaille [Thu, 5 Jul 2012 14:09:17 +0000 (16:09 +0200)] 
build: fix gen-ChangeLog call.

* Makefile.am: Be sure to catch errors, and fix option name

12 years agognulib: update.
Akim Demaille [Thu, 5 Jul 2012 13:24:34 +0000 (15:24 +0200)] 
gnulib: update.

* gnulib/build-aux/do-release-commit-and-tag: Fix.

12 years agotests: fix SKIP_IF for Java.
Akim Demaille [Thu, 5 Jul 2012 12:27:09 +0000 (14:27 +0200)] 
tests: fix SKIP_IF for Java.

* tests/local.at (AT_JAVA_COMPILE): here.

12 years agoapi.prefix: incompatible with %name-prefix.
Akim Demaille [Thu, 5 Jul 2012 10:33:42 +0000 (12:33 +0200)] 
api.prefix: incompatible with %name-prefix.

* data/bison.m4: Make it incompatible.
* tests/input.at: Check that it is.

12 years agoapi.prefix: strengthen the tests and fix push-parsers.
Akim Demaille [Thu, 5 Jul 2012 10:33:37 +0000 (12:33 +0200)] 
api.prefix: strengthen the tests and fix push-parsers.

* tests/calc.at: Check api.prefix in addition to %name-prefix.
* tests/headers.at: Check push parsers and pure interface.
* tests/local.at: Use YYLTYPE renamed.
* data/yacc.c (b4_declare_yyparse_push_): Handle api.prefix.
* doc/bison.texi: Style changes.

12 years agoskeletons: style changes.
Akim Demaille [Thu, 5 Jul 2012 09:11:38 +0000 (11:11 +0200)] 
skeletons: style changes.

* data/bison.m4: Define default values after having defined
the support macros.
Kill a dead comment.

12 years agoNEWS: minor changes.
Akim Demaille [Thu, 5 Jul 2012 08:30:47 +0000 (10:30 +0200)] 
NEWS: minor changes.

* NEWS: style changes.

12 years agoapi.prefix: improve the documentation for YYDEBUG.
Akim Demaille [Thu, 5 Jul 2012 08:30:09 +0000 (10:30 +0200)] 
api.prefix: improve the documentation for YYDEBUG.

* doc/bison.texi: Explain how api.prefix is applied to YYDEBUG.

12 years agognulib: update.
Akim Demaille [Thu, 5 Jul 2012 07:37:20 +0000 (09:37 +0200)] 
gnulib: update.

* bootstrap, gnulib: Update.
* cfg.mk (syntax-check): Don't check "error" usage in bison.texi.

12 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Wed, 4 Jul 2012 15:14:35 +0000 (17:14 +0200)] 
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  tests: headers.at: strengthen.
  glr.cc: do not override C++ definitions by C macros.
  YYLLOC_DEFAULT: factor, and don't export it in headers.
  api.prefix: do not use #define to handle YYSTYPE_IS_TRIVIAL etc.
  tests: portability fixes.
  c++: fewer #includes in the headers.
  glr.cc: formatting changes.
  tests: more logs.
  api.prefix: also rename YYDEBUG.

Conflicts:
data/c.m4
data/glr.c
data/glr.cc
data/lalr1.cc
data/yacc.c

12 years agotests: headers.at: strengthen.
Akim Demaille [Wed, 4 Jul 2012 10:04:19 +0000 (12:04 +0200)] 
tests: headers.at: strengthen.

* tests/headers.at (Several headers): Be stricter when checking
the exported macros.

12 years agoglr.cc: do not override C++ definitions by C macros.
Akim Demaille [Wed, 4 Jul 2012 10:00:24 +0000 (12:00 +0200)] 
glr.cc: do not override C++ definitions by C macros.

* data/glr.c: here.
* data/glr.cc: Fix overquotation.
* tests/headers.at: Comment changes.

12 years agoYYLLOC_DEFAULT: factor, and don't export it in headers.
Akim Demaille [Wed, 4 Jul 2012 09:41:06 +0000 (11:41 +0200)] 
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.

12 years agoapi.prefix: do not use #define to handle YYSTYPE_IS_TRIVIAL etc.
Akim Demaille [Wed, 4 Jul 2012 09:04:52 +0000 (11:04 +0200)] 
api.prefix: do not use #define to handle YYSTYPE_IS_TRIVIAL etc.

The following mixture is insane:

  #define YYSTYPE_IS_TRIVIAL PREFIX_STYPE_IS_TRIVIAL
  #if (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)

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

  #if (defined PREFIX_STYPE_IS_TRIVIAL && PREFIX_STYPE_IS_TRIVIAL)

* 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.

12 years agotests: portability fixes.
Akim Demaille [Wed, 4 Jul 2012 10:04:07 +0000 (12:04 +0200)] 
tests: portability fixes.

Reported by Hydra.

* tests/headers.at (Several headers): Be sure to include config.h
in the files to compile.

12 years agoc++: fewer #includes in the headers.
Akim Demaille [Wed, 4 Jul 2012 07:57:40 +0000 (09:57 +0200)] 
c++: fewer #includes in the headers.

* data/lalr1.cc: Define YY_NULL in the *.cc file, it is not needed
in the header.
* data/location.cc: iosfwd suffices.

12 years agoglr.cc: formatting changes.
Akim Demaille [Mon, 2 Jul 2012 12:55:54 +0000 (14:55 +0200)] 
glr.cc: formatting changes.

* data/glr.cc: here.

12 years agotests: more logs.
Akim Demaille [Mon, 2 Jul 2012 10:11:51 +0000 (12:11 +0200)] 
tests: more logs.

* tests/headers.at (Several parsers): Here.

12 years agoapi.prefix: also rename YYDEBUG.
Akim Demaille [Mon, 2 Jul 2012 12:56:22 +0000 (14:56 +0200)] 
api.prefix: also rename YYDEBUG.

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.

12 years agoformatting changes.
Akim Demaille [Mon, 2 Jul 2012 08:28:36 +0000 (10:28 +0200)] 
formatting changes.

* data/lalr1.cc: here.

12 years agoNEWS: spell fixes.
Akim Demaille [Mon, 2 Jul 2012 07:58:56 +0000 (09:58 +0200)] 
NEWS: spell fixes.

* NEWS: here.
Reported by Stefano Lattarini.

12 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Mon, 2 Jul 2012 07:55:43 +0000 (09:55 +0200)] 
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  NEWS: spell check.
  api.prefix.

Conflicts:
data/c.m4
data/glr.cc
data/lalr1.cc
doc/bison.texi

12 years agoNEWS: spell check.
Akim Demaille [Mon, 2 Jul 2012 07:26:22 +0000 (09:26 +0200)] 
NEWS: spell check.

* NEWS: here.

12 years agoapi.prefix.
Akim Demaille [Tue, 26 Jun 2012 08:09:10 +0000 (10:09 +0200)] 
api.prefix.

* data/c.m4 (b4_api_prefix, b4_api_PREFIX): New.
(b4_prefix, b4_union_name, b4_token_enums, b4_declare_yylstype): Use them.
* data/glr.c, data/yacc.c, data/glr.cc, data/lalr1.cc: Use them to change
the prefix of exported preprocessor symbols.
* src/getargs.c (usage): Ditto.
* tests/headers.at (Several parsers): New.
* tests/local.at (AT_API_PREFIX): New.
AT_YYSTYPE, AT_YYLTYPE): Adjust.
* doc/bison.texi (Multiple Parsers): Move documentation of %name-prefix to...
(Table of Symbols): here.
(Multiple Parsers): Document api.prefix.
(%define Summary): Point to it.
Use @code for variable names.
(Bison Options): -p/--name-prefix are obsoleted.
* NEWS: Announce api.prefix.

12 years agowarnings: display warnings categories
Victor Santet [Fri, 29 Jun 2012 14:23:42 +0000 (16:23 +0200)] 
warnings: display warnings categories

* src/complain.c (error_message): Call 'warnings_print_categories'.
* src/gram.c (grammar_rules_useless_report): Display itself warning
category.
* tests/actions.at, tests/conflicts.at, tests/existing.at,
tests/input.at, tests/named-refs.at, tests/output.at, tests/reduce.at,
tests/regression.at, tests/skeletons.at: Adjust.
* NEWS: Document this.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agowarnings: be ready to print warnings categories
Victor Santet [Fri, 29 Jun 2012 13:22:09 +0000 (15:22 +0200)] 
warnings: be ready to print warnings categories

A function to print warnings categories, like -Wyacc, -Wother, etc.

* src/complain.h, src/complain.c (print_warning_categories): New function.
* src/output.c (ARRAY_CARDINALITY): Move it to file 'src/system.h'.
* src/complain.h (enum warnings): New value, 'silent', "complain"
must not display the warning type.

12 years agomaint: prepare forthcoming changes
Akim Demaille [Fri, 29 Jun 2012 13:58:59 +0000 (15:58 +0200)] 
maint: prepare forthcoming changes

* src/gram.c (rule_rhs_print): Do not print new line anymore.
(rule_print): Make it static.
* src/closure.c, src/derives.c, src/gram.c: Adjust.

12 years agostyle changes
Victor Santet [Fri, 29 Jun 2012 13:22:12 +0000 (15:22 +0200)] 
style changes

* src/complain.c, src/reader.c, src/reduce.c, src/main.c:
Fix indentation.
Simplify a bit.

12 years agoregen.
Akim Demaille [Thu, 28 Jun 2012 15:18:51 +0000 (17:18 +0200)] 
regen.

12 years agowarnings: factoring: complaints
Victor Santet [Thu, 28 Jun 2012 14:44:21 +0000 (16:44 +0200)] 
warnings: factoring: complaints

* src/complain.c (error_message): Accept warning categories (an integer) as
argument.
Location is a 'const location *' instead of 'location *'.
(ERROR_MESSAGE): Delete it.
* src/complain.c, src/complain.h (complains): New function.
(complain, complain_at, complain_at_indent): Generic functions for
complaints. Call 'complains'.
(warn_at, warn_at_indent, warn, yacc_at, midrule_value_at)
(fatal_at, fatal): Delete them. Adjust dependencies.
* src/complain.h (enum warnings): New fields 'complaint' and 'fatal'.
* bootstrap.conf (XGETTEXT_OPTIONS): Adjust.

12 years agowarnings: move them to complain.c.
Victor Santet [Thu, 28 Jun 2012 14:44:20 +0000 (16:44 +0200)] 
warnings: move them to complain.c.

* src/getargs.h, src/getargs.c (warnings, warnings_flags): Move to...
* src/complain.h, src/complain.c: Here.

12 years agowarnings: rename the categories
Victor Santet [Thu, 28 Jun 2012 14:44:19 +0000 (16:44 +0200)] 
warnings: rename the categories

Forthcoming changes will use the warning categories much more often,
so shortening them will improve readability.

* src/complain.c, src/complain.h, src/conflicts.c,
* src/getargs.c, src/getargs.h, src/gram.c (enum warnings):
s/warnings_/W/g.

12 years agofix merge.
Akim Demaille [Thu, 28 Jun 2012 14:59:47 +0000 (16:59 +0200)] 
fix merge.

* data/bison.m4: Use b4_error_verbose_if after it was defined.

12 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Thu, 28 Jun 2012 13:29:18 +0000 (15:29 +0200)] 
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  tests: use the generalized default yylex.
  tests: AT_YYERROR_DEFINE: prepare for list of ints.
  skeletons: no longer define YYLSP_NEEDED.
  c++: do not export YYTOKEN_TABLE and YYERROR_VERBOSE.

Conflicts:
data/c.m4
data/glr.cc
data/lalr1.cc
doc/bison.texi
tests/regression.at

12 years agotests: use the generalized default yylex.
Akim Demaille [Thu, 28 Jun 2012 12:54:45 +0000 (14:54 +0200)] 
tests: use the generalized default yylex.

* tests/actions.at, tests/glr-regression.at, tests/regression.at: here.

12 years agotests: AT_YYERROR_DEFINE: prepare for list of ints.
Akim Demaille [Thu, 28 Jun 2012 12:20:17 +0000 (14:20 +0200)] 
tests: AT_YYERROR_DEFINE: prepare for list of ints.

* tests/local.at (AT_YYERROR_DEFINE): Don't add quotes, check their
presence to detect char/int types.
* tests/actions.at, tests/conflicts.at, tests/glr-regression.at,
* tests/push.at, tests/regression.at: Adjust.

12 years agoskeletons: no longer define YYLSP_NEEDED.
Akim Demaille [Mon, 25 Jun 2012 14:55:11 +0000 (16:55 +0200)] 
skeletons: no longer define YYLSP_NEEDED.

* data/c.m4, data/glr.cc: here.
* NEWS, TODO: Adjust.

12 years agoc++: do not export YYTOKEN_TABLE and YYERROR_VERBOSE.
Akim Demaille [Mon, 25 Jun 2012 14:52:30 +0000 (16:52 +0200)] 
c++: do not export YYTOKEN_TABLE and YYERROR_VERBOSE.

* src/output.c (prepare_symbols): Do not define b4_token_table.
(prepare): Define b4_token_table_flag.
* data/bison.m4 (b4_token_table_if): New.
Arm it when error-verbose.
* data/glr.c, data/yacc.c (YYTOKEN_TABLE): Remove.
Use m4.
* data/lalr1.cc: Likewise.
(YYERROR_VERBOSE): Remove.
* NEWS, doc/bison.texi: Document this.

12 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Tue, 26 Jun 2012 15:13:36 +0000 (17:13 +0200)] 
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  maint: use *.texi.

Conflicts:
doc/Makefile.am
examples/calc++/Makefile.am

12 years agomaint: use *.texi.
Akim Demaille [Tue, 26 Jun 2012 14:55:23 +0000 (16:55 +0200)] 
maint: use *.texi.

This is more consistent with the other packages, and Automake-NG
supports only *.texi.

* doc/bison.texinfo: Rename as...
* doc/bison.texi: this.
* doc/Makefile.am, examples/calc++/Makefile.am: Adjust.

12 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Tue, 26 Jun 2012 14:43:22 +0000 (16:43 +0200)] 
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  tests: do not output m4 set up.
  tests: use the generic yyerror function.
  tests: use assert instead of plain abort.
  tests: improve the generic yylex implementation.
  tests: generalize the compilation macros.
  tests: fix confusion between api.prefix and name-prefix.
  maint: gitignores.
  yacc: work around the ylwrap limitation.

Conflicts:
NEWS
tests/local.at

12 years agowarnings: raise warning for useless printers or destructors
Victor Santet [Thu, 14 Jun 2012 12:20:07 +0000 (14:20 +0200)] 
warnings: raise warning for useless printers or destructors

* src/scan-code.h (code_props): Add field 'is_used'.
(CODE_PROPS_NONE_INIT): Adjust.
* src/scan-code.l (code_props_plain_init, code_props_symbol_action_init)
(code_props_rule_action_init): Instead of implementing several
times the initialization of the code_props structures,
use code_props_none_init.
* src/symtab.c (symbol_check_defined): If a symbol does not have a
destructor (resp. printer) but has a type which has a destructor (resp.
printer), then set field 'is_used' to true.
(semantic_type_check_defined): If a type has a destructor (resp. printer)
but all symbols of this type have already a destructor (resp. printer),
then raise a warning.
* tests/input.at (Useless printers or destructors): New.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
12 years agotests: do not output m4 set up.
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).

12 years agotests: use the generic yyerror function.
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.

12 years agotests: use assert instead of plain abort.
Akim Demaille [Tue, 26 Jun 2012 08:20:35 +0000 (10:20 +0200)] 
tests: use assert instead of plain abort.

* tests/actions.at, tests/calc.at, tests/conflicts.at,
* tests/cxx-type.at, tests/glr-regression.at, tests/input.at,
* tests/named-refs.at, tests/regression.at, tests/torture.at,
* tests/local.at:
Prefer assert to abort.

12 years agotests: improve the generic yylex implementation.
Akim Demaille [Tue, 26 Jun 2012 08:09:10 +0000 (10:09 +0200)] 
tests: improve the generic yylex implementation.

* tests/local.at (AT_YYSTYPE, AT_YYLTYPE): New.
(AT_YYLEX_FORMALS): Use them.
(AT_YYLEX_DEFINE): Be independent of the location implementation.

12 years agotests: generalize the compilation macros.
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.

12 years agotests: fix confusion between api.prefix and name-prefix.
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.

12 years agomaint: gitignores.
Akim Demaille [Tue, 26 Jun 2012 07:37:27 +0000 (09:37 +0200)] 
maint: gitignores.

12 years agowarnings: useless semantic types
Victor Santet [Mon, 18 Jun 2012 13:44:38 +0000 (15:44 +0200)] 
warnings: useless semantic types

* src/symtab.h (symbol_list): Represent semantic types as structure
'semantic_type'.
* src/symlist.c (symbol_list_type_new): Allocate this structure.
(symbol_list_code_props_set): Set this semantic type's status to used if it
was not declared.
* src/symtab.c (semantic_types_sorted): New.
(semantic_type_new): Set the new semantic type's location appropriately.
(symbol_check_defined): If a symbol has a type, then set this type's status
to "declared".
(semantic_type_check_defined, semantic_type_check_defined_processor): Same
as symbol_check_defined and symbol_check_defined_processor, but for semantic
types.
(symbol_check_defined): Check semantic types usefulness.
* src/symtab.h (semantic_type): New fields 'location' and 'status'.
* src/symtab.h, src/symtab.c (semantic_type_new)
(semantic_type_from_uniqstr, semantic_type_get): Accept a location as a
supplementary argument.
* tests/input.at (Unassociated types used for printer of destructor): New.
* tests/c++.at (AT_CHECK_VARIANTS): Fix an error caught by this commit.

12 years agoyacc: work around the ylwrap limitation.
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.

12 years agofix for printers and destructors.
Akim Demaille [Mon, 25 Jun 2012 07:49:04 +0000 (09:49 +0200)] 
fix for printers and destructors.

The previous "code_props: factor more" patch sends has_%printer
etc. to m4, instead of has_printer.

* src/output.c (prepare_symbol_definitions): Fix value of pname.

12 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Mon, 25 Jun 2012 07:26:48 +0000 (09:26 +0200)] 
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  tests: more uniformity.
  tests: handle locations in a more generic way.
  tests: handle locations in the generic yyerror functions.
  tests: fix AT_CHECK_CALC.
  tests: improve infrastructure
  tests: factor.
  skeletons: minor style changes
  tests: AT_LANG.
  c skeletons: factor the declaration of yylloc and yylval.
  news: condemn YYPARSE_PARAM and YYLEX_PARAM.
  maint: regen.

Conflicts:
tests/calc.at
tests/local.at
tests/regression.at

12 years agocode_props: factor more.
Akim Demaille [Fri, 22 Jun 2012 12:47:31 +0000 (14:47 +0200)] 
code_props: factor more.

* src/symtab.h, src/symtab.c (code_props_type_string): No longer static.
* src/output.c (CODE_PROPS): Remove, we can now iterate on both the
destructor and the printer.
(SET_KEY2): New.

12 years agomaint: factor the handling of %printer and %destructor
Victor Santet [Fri, 22 Jun 2012 12:11:05 +0000 (14:11 +0200)] 
maint: factor the handling of %printer and %destructor

There is too much code duplication between %printer and %destructor.
We used to have two functions for each action: the first one for
destructors, the second one for printers. Factor using a
'code_props_type', and an array of code_props instead of two
members.

* src/symlist.h, src/symlist.c (symbol_list_destructor_set)
(symbol_list_printer_set): Fuse into...
(symbol_list_code_props_set): this.
* src/symtab.h, src/symtab.c (default_tagged_destructor)
(default_tagged_printer): Fuse into...
(default_tagged_code_props): this.
(default_tagless_destructor, default_tagless_printer)
(default_tagless_code_props): Likewise.
(code_props_type_string): new.
(symbol_destructor_set, symbol_destructor_get, semantic_type_destructor_set)
(default_tagged_destructor_set, default_tagless_destructor_set)
(symbol_printer_set, symbol_printer_get, semantic_type_printer_set)
(default_tagged_printer_set, default_tagless_printer_set): Replace by...
(symbol_code_props_set, symbol_code_props_get, semantic_type_code_props_set)
(default_tagged_code_props_set, default_tagless_code_props_set): these.
* src/parse-gram.y (grammar_declaration): Adjust.
* src/output.c (CODE_PROP, grammar_declaration): Ditto.
* src/reader.c (symbol_should_be_used): Ditto.

12 years agotests: more uniformity.
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.

12 years agotests: handle locations in a more generic way.
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: .

12 years agotests: handle locations in the generic yyerror functions.
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.

12 years agotests: fix AT_CHECK_CALC.
Akim Demaille [Fri, 22 Jun 2012 07:41:36 +0000 (09:41 +0200)] 
tests: fix AT_CHECK_CALC.

* tests/calc.at (AT_CHECK_CALC): Contrary to its documentation,
the test was skipped if given a second argument.
Unused feature, remove it.

12 years agotests: improve infrastructure
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.

12 years agotests: factor.
Akim Demaille [Thu, 21 Jun 2012 16:26:44 +0000 (18:26 +0200)] 
tests: factor.

* tests/glr-regression.at, tests/output.at, tests/push.at,
* tests/regression.at, tests/torture.at, tests/actions.at:
Use AT_YYLEX_* and AT_YYERROR_*.

12 years agoskeletons: minor style changes
Akim Demaille [Sun, 17 Jun 2012 10:12:52 +0000 (12:12 +0200)] 
skeletons: minor style changes

* data/glr.c, data/yacc.c: here.

12 years agotests: AT_LANG.
Akim Demaille [Sun, 17 Jun 2012 18:39:17 +0000 (20:39 +0200)] 
tests: AT_LANG.

* tests/local.at (AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS):
Define/undefine AT_LANGE
(AT_LANG_COMPILE): New.
(AT_FULL_COMPILE): Use AT_LANG.

12 years agosymtab: refactoring
Victor Santet [Wed, 20 Jun 2012 08:19:04 +0000 (10:19 +0200)] 
symtab: refactoring

Prepares forthcoming changes.

* src/symtab.c (symbols_do): Accept the hash table and the sorted
list as arguments. Adjust dependencies.

12 years agomaint: address syntax-check issues.
Akim Demaille [Thu, 21 Jun 2012 14:01:21 +0000 (16:01 +0200)] 
maint: address syntax-check issues.

* examples/calc++/local.mk: Space changes.
* src/files.c: Avoid unmarked_diagnostics.
* src/output.c: Remove useless include.

12 years agoc skeletons: factor the declaration of yylloc and yylval.
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.

12 years agonews: condemn YYPARSE_PARAM and YYLEX_PARAM.
Akim Demaille [Sun, 17 Jun 2012 08:54:15 +0000 (10:54 +0200)] 
news: condemn YYPARSE_PARAM and YYLEX_PARAM.

* NEWS: here.
(Bison 1.875): Add %parse-param and %lex-param.
* doc/bison.texinfo: Spello.

12 years agofix warnings for useless %printer/%destructor
Akim Demaille [Wed, 20 Jun 2012 10:33:34 +0000 (12:33 +0200)] 
fix warnings for useless %printer/%destructor

The previous commit, which turns into a warning what used to be an
error:

    %printer {} foo;
    %%
    exp: '0';

has two shortcomings: the warning is way too long (foo is reported
to be useless later), and besides, it also turns into a warning much
more serious errors:

   %printer {} foo;
   %%
   exp: foo;

Reduce the amount to warnings in the first case, restore the error in
the second.

* src/symtab.h (status): Add a new inital state: undeclared.
* src/symtab.c (symbol_new): Initialize to undeclared.
(symbol_class_set): Simplify the logic of the code that neutralize
the "redeclared" warning after the "redefined" one.
(symbol_check_defined): "undeclared" is also an error.
* src/reader.c (grammar_current_rule_symbol_append): Symbols appearing
in a rule are "needed".
* src/symlist.c (symbol_list_destructor_set, symbol_list_printer_set):
An unknown symbol appearing in a %printer/%destructor is "used".
* src/reduce.c (nonterminals_reduce): Do not report as "useless" symbols
that are not used (e.g., those that for instance appeared only in a
%printer).
* tests/input.at (Undeclared symbols used for a printer or destructor):
Improve the cover the cases described above.

12 years agogitignore: test-driver.
Akim Demaille [Wed, 20 Jun 2012 09:19:26 +0000 (11:19 +0200)] 
gitignore: test-driver.

12 years agomaint: style changes.
Akim Demaille [Wed, 20 Jun 2012 09:16:47 +0000 (11:16 +0200)] 
maint: style changes.

* src/reduce.c (reduce_grammar_tables): Define variables with their
initial value.

12 years agonews: fixes.
Akim Demaille [Wed, 20 Jun 2012 08:33:16 +0000 (10:33 +0200)] 
news: fixes.

* NEWS: Fix spelling.

12 years agowarnings: used but undeclared symbols are warnings
Victor Santet [Tue, 19 Jun 2012 14:14:55 +0000 (16:14 +0200)] 
warnings: used but undeclared symbols are warnings

We used to raise an error if a symbol appears only in a %printer or
%destructor.  Make it a warning.

* src/symtab.h (status): New enum.
(symbol): Replace the binary "declared" with the three-state "status".
Adjust dependencies.
* src/symtab.c (symbol_check_defined): Needed symbols are an error,
whereas "used" are simply warnings.
* src/symlist.c (symbol_list_destructor_set, symbol_list_printer): Set
symbol status to 'used' when associated to destructors or printers.
* input.at (Undeclared symbols used for a printer or destructor): New.

12 years agomaint: regen.
Akim Demaille [Wed, 20 Jun 2012 08:02:11 +0000 (10:02 +0200)] 
maint: regen.

* Makefile.am (regen): New target.
(cherry picked from commit 71bff31edd4ddbfe3c350933652bb0e3a4a7f3e2)

12 years agoregen.
Akim Demaille [Wed, 20 Jun 2012 08:13:16 +0000 (10:13 +0200)] 
regen.

12 years agomaint: regen.
Akim Demaille [Wed, 20 Jun 2012 08:02:11 +0000 (10:02 +0200)] 
maint: regen.

* Makefile.am (regen): New target.

12 years agotests: enhance AT_YYERROR_DEFINE.
Akim Demaille [Tue, 19 Jun 2012 15:43:11 +0000 (17:43 +0200)] 
tests: enhance AT_YYERROR_DEFINE.

* tests/local.at: Handle the fact that locations are no longer
needed with lalr1.cc.

12 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Tue, 19 Jun 2012 15:35:53 +0000 (17:35 +0200)] 
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  maint: formatting changes.
  tests: support api.prefix.
  tests: pacify font-lock-mode.
  tests: remove test covered elsewhere.
  tests: factor the declaration/definition of yyerror and yylex.
  regen.
  tests: portability issues.
  tests: call the parser from another compilation unit.
  glr.c, yacc.c: declare yydebug in the header.
  skeletons: use header guards.
  tests: improve AT_FULL_COMPILE.
  tests: reorder.
  tests: strengthen the test on generated headers inclusion
  yacc.c: instead of duplicating y.tab.h inside y.tac.c, include it.
  yacc.c: factor.

Conflicts:
NEWS
data/glr.c
data/yacc.c
src/parse-gram.c
src/parse-gram.h
tests/conflicts.at
tests/regression.at

12 years agomaint: formatting changes.
Akim Demaille [Tue, 19 Jun 2012 15:01:35 +0000 (17:01 +0200)] 
maint: formatting changes.

* NEWS: Fix indentation of code snippets.
Untabify.

12 years agotests: support api.prefix.
Akim Demaille [Sun, 17 Jun 2012 16:52:59 +0000 (18:52 +0200)] 
tests: support api.prefix.

* tests/local.at (AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS):
Define AT_API_PREFIX.
(AT_YYERROR_DEFINE, AT_YYERROR_DECLARE_EXTERN, AT_YYLEX_DECLARE_EXTERN)
(AT_YYLEX_DEFINE): Use it.
* tests/input.at, tests/regression.at, tests/torture.at: Add
AT_BISON_OPTION_PUSHDEFS/POPDEFS.

12 years agotests: pacify font-lock-mode.
Akim Demaille [Sun, 17 Jun 2012 16:04:19 +0000 (18:04 +0200)] 
tests: pacify font-lock-mode.

* tests/local.at: here.

12 years agotests: remove test covered elsewhere.
Akim Demaille [Sun, 17 Jun 2012 16:03:24 +0000 (18:03 +0200)] 
tests: remove test covered elsewhere.

* tests/headers.at (%union and --defines): Remove, pretty useless and
insignificant.

12 years agotests: factor the declaration/definition of yyerror and yylex.
Akim Demaille [Sun, 17 Jun 2012 16:01:14 +0000 (18:01 +0200)] 
tests: factor the declaration/definition of yyerror and yylex.

* tests/local.at (AT_YYERROR_DECLARE, AT_YYERROR_DECLARE_EXTERN)
(AT_YYERROR_DEFINE, AT_YYLEX_DECLARE, AT_YYLEX_DECLARE_EXTERN)
(AT_YYLEX_DEFINE): New.
Must be used inside AT_BISON_OPTION_PUSHDEFS/POPDEFS pair.
* tests/actions.at, tests/conflicts.at, tests/glr-regression.at,
* tests/headers.at, tests/input.at, tests/named-refs.at,
* tests/regression.at, tests/skeletons.at, tests/synclines.at,
* tests/torture.at: Use them.

12 years agoregen.
Akim Demaille [Sun, 17 Jun 2012 09:17:46 +0000 (11:17 +0200)] 
regen.

12 years agotests: portability issues.
Akim Demaille [Sun, 17 Jun 2012 09:19:51 +0000 (11:19 +0200)] 
tests: portability issues.

* tests/calc.at (AT_CALC_MAIN): Missing include reported by Hydra.

12 years agotests: call the parser from another compilation unit.
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.

12 years agoglr.c, yacc.c: declare yydebug in the header.
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.

12 years agoskeletons: use header guards.
Akim Demaille [Fri, 15 Jun 2012 12:21:16 +0000 (14:21 +0200)] 
skeletons: use header guards.

* data/glr.c, data/glr.cc, data/yacc.c: here.
* NEWS: Document it.

12 years agotests: improve AT_FULL_COMPILE.
Akim Demaille [Mon, 11 Jun 2012 14:45:45 +0000 (16:45 +0200)] 
tests: improve AT_FULL_COMPILE.

* tests/local.at: Accept a third argument.
Simplify quotation pattern.
Calls for better refactoring, but will suffice for a while.

12 years agotests: reorder.
Akim Demaille [Mon, 11 Jun 2012 14:43:42 +0000 (16:43 +0200)] 
tests: reorder.

* tests/calc.at (power): Move its definition, as a preparation for
forthcoming changes.
And space changes.

12 years agotests: strengthen the test on generated headers inclusion
Akim Demaille [Tue, 12 Jun 2012 16:14:49 +0000 (18:14 +0200)] 
tests: strengthen the test on generated headers inclusion

* tests/headers.at (AT_TEST_CPP_GUARD_H): Accept Bison directives.
(Invalid CPP headers): Check glr.

12 years agoyacc.c: instead of duplicating y.tab.h inside y.tac.c, include it.
Akim Demaille [Tue, 12 Jun 2012 14:15:14 +0000 (16:15 +0200)] 
yacc.c: instead of duplicating y.tab.h inside y.tac.c, include it.

This is already what glr.c and lalr1.cc do.

* data/yacc.c: here.

12 years agomaint: xfdopen, and scope reduction.
Akim Demaille [Fri, 15 Jun 2012 09:56:13 +0000 (11:56 +0200)] 
maint: xfdopen, and scope reduction.

* src/files.h, src/files.c (xfdopen): New.
* src/output.c (output_skeleton): Use it.
Reduce the scope of argv.

12 years agomaint: space changes
Akim Demaille [Fri, 25 May 2012 12:36:32 +0000 (14:36 +0200)] 
maint: space changes

* configure.ac, src/complain.c: space changes.

12 years agoyacc.c: factor.
Akim Demaille [Tue, 12 Jun 2012 12:40:18 +0000 (14:40 +0200)] 
yacc.c: factor.

yacc.c used to include two almost identical sections: one for the *.h
file, and another for the *.c file.  The main difference is that in
the *.c file we used the yy* names (as %name-prefix is handled by
"#define yy* <prefix>*" before), while the *.hh used <prefix>* names.
Keep only the later.  If this is troublesome, b4_shared_declarations
can easily take the desired prefix as argument.

* data/yacc.c (b4_shared_declarations): New.
Use it to factor duplicated declarations.

12 years agocosmetics: prettify names for compiled object for bison
Stefano Lattarini [Fri, 8 Jun 2012 22:02:57 +0000 (00:02 +0200)] 
cosmetics: prettify names for compiled object for bison

* src/local.mk (src_bison_SHORTNAME): Define to "bison".

Copyright-paperwork-exempt: yes
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
12 years agolalr1.cc: spello.
Akim Demaille [Wed, 13 Jun 2012 19:12:15 +0000 (21:12 +0200)] 
lalr1.cc: spello.

* data/lalr1.cc: Reported by Gilles Espinasse.