Commit Graph

4734 Commits

Author SHA1 Message Date
Akim Demaille
e3f12e0818 skeletons: renamings after knr removal
* data/c.m4 (b4_yydestruct_generate, b4_yy_symbol_print_generate):
Rename as...
(b4_yydestruct_define, b4_yy_symbol_print_define): these, for consistency.
* data/glr.c, data/glr.cc, data/yacc.c: Adjust.
2012-08-03 10:33:39 +02:00
Akim Demaille
ee52f6ec6b c++: fix a comment
* data/c++.m4: Be sure to attach a ';' to its declaration, otherwise
it appears in the preceding comment.
2012-08-02 15:32:52 +02:00
Akim Demaille
d00ff612f8 skeletons: simplify after knr removal
* data/c.m4 (b4_yydestruct_generate, b4_yy_symbol_print_generate):
They no longer need an argument, it has a single possible value.
* data/glr.c, data/yacc.c: Adjust.
2012-08-02 15:32:52 +02:00
Akim Demaille
15f6666958 skeletons: renamings after knr removal
* data/c.m4 (b4_c_comment_, b4_c_args, b4_c_function_def)
(b4_c_function_decl, b4_c_formals, b4_c_call, b4_c_arg): Rename as...
(b4_comment, b4_args, b4_function_define, b4_function_declare,
b4_formals, b4_function_call, b4_arg): these.
* data/glr.c, data/glr.cc, data/lalr1.cc, data/yacc.c: Adjust.
2012-08-02 15:32:50 +02:00
Akim Demaille
710c4a6571 skeletons: b4_args -> b4_join to prepare forthcoming changes
* data/bison.m4 (b4_args, _b4_args): Rename as...
(b4_join, _b4_join): these.
* data/c++.m4, data/lalr1.cc, data/variant.hh: Adjust.
2012-08-02 15:32:50 +02:00
Akim Demaille
86027be930 regen 2012-08-02 15:32:50 +02:00
Akim Demaille
de62ae867b YYPARSE_PARAM: drop support
* data/yacc.c: No longer support it.
* doc/bison.texi, tests/headers.at: Adjust.
* NEWS: Document.
2012-08-02 15:32:48 +02:00
Akim Demaille
71b56f4683 skeletons: remove K&R C support
* data/c.m4 (b4_c_modern, b4_c_knr_formal_names, b4_c_knr_formal_decls)
(b4_c_knr_formal_decl, b4_c_formal_names, b4_c_formal_decls)
(b4_c_formal_decl): Remove.
(b4_c_ansi_formal_names, b4_c_ansi_formal_decls, b4_c_ansi_formal_decl):
Rename as...
(b4_c_formal_names, b4_c_formal_decls, b4_c_formal_decl):
these.
* data/glr.c, data/glr.cc, data/yacc.c: Adjust.
2012-08-02 14:20:37 +02:00
Akim Demaille
c28e8b685b todo: more items
* TODO: $ in the epilogue, and obstack_copy.
2012-07-31 13:23:08 +02:00
Akim Demaille
cb9ec4fada Merge branch 'maint'
* maint:
  use obstack_printf
  scanner: restore a missing start condition
  gnulib: update
  maint: post-release administrivia
  version 2.6.1
  gnulib: update
  maint: fix some syntax-check issues
  tests: do not depend on __cplusplus to decide for C++ or C output

Conflicts:
	NEWS
	bootstrap.conf
	cfg.mk
	lib/.gitignore
2012-07-31 12:03:55 +02:00
Akim Demaille
84271837f6 tests: comment changes
* tests/actions.at, tests/input.at: here.
2012-07-31 11:33:47 +02:00
Akim Demaille
1a5fb4f29b tests: really check the set of generated files
* tests/output.at (AT_CHECK_OUTPUT): It used to check that the
expected files are indeed generated, but it did not check that
there are no additional ones.
Do that, and adjust expectations (in particular alphabetical order).
2012-07-31 11:33:47 +02:00
Akim Demaille
5de5b98751 lalr1.cc: do not create stack.hh without %defines
* data/stack.hh (b4_stack_define): New.
* data/lalr1.cc: Use it when %defines is not passed.
* tests/output.at: Adjust expected output.
2012-07-31 11:33:46 +02:00
Akim Demaille
93549bcd43 lalr1.cc: location.hh and position.hh are not generated without %defines
* data/location.cc (b4_position_define, b4_location_define): New.
(location.hh, position.hh): Generate only if %defines.
* data/lalr1.cc: therefore, define these classes when locations are
needed, but headers are not generated.
* tests/output.at: Check that these files are not generated.
* NEWS: Document.
2012-07-31 11:33:46 +02:00
Akim Demaille
85f0b29e6d lalr1.cc: no longer require %defines.
* data/lalr1.cc: Generate the parser header only when %defines is
passed.
* tests/calc.at: Check it.
2012-07-31 11:33:46 +02:00
Akim Demaille
28427f57ce skeletons: style changes
* data/glr.c, data/lalr1.cc: Use more consistent comments,
and YY_NULL declaration.
2012-07-31 11:33:46 +02:00
Akim Demaille
d27c5e6534 glr.cc, lalr1.cc: define b4_shared_declarations
* data/glr.cc, data/lalr1.cc: here.
The name is no longer right, but at least it is consistent with
the other skeletons.
2012-07-31 11:33:46 +02:00
Akim Demaille
34904c575a glr.cc: no longer require location support
* data/glr.cc: Use b4_locations_if where appropriate.
* data/lalr1.cc: M4 quotation changes to highlight code duplication
with glr.cc.
* tests/calc.at: Check glr.cc with and without %location.
While at it, fuse multiple %parse-params into one.
* tests/actions.at: Simplify.
* NEWS: Doc this.
Some other wording changes.
2012-07-31 11:33:44 +02:00
Akim Demaille
aaf63e45b6 use obstack_printf
This is not just nicer, it is also much safer, since we were
using sprintf...

* bootstrap.conf: Require it.
* src/system.h (obstack_fgrow1, obstack_fgrow2, obstack_fgrow3)
(obstack_fgrow4): Remove.
Adjust dependencies.
2012-07-31 10:50:06 +02:00
Akim Demaille
dbfcf7a89f scanner: restore a missing start condition
$ flex src/scan-skel.l
src/scan-skel.l:145: multiple <<EOF>> rules for start condition SC_AT_DIRECTIVE_ARGS
src/scan-skel.l:145: multiple <<EOF>> rules for start condition SC_AT_DIRECTIVE_SKIP_WS
This is warning, and it seems there are no means to make it an error.

* src/scan-skel.l: Restore the start-condition INITIAL for an <<EOF>>
clause.
2012-07-30 14:54:27 +02:00
Akim Demaille
8c707b10e7 gnulib: update 2012-07-30 14:53:58 +02:00
Akim Demaille
9c26b8fc03 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2012-07-30 11:47:29 +02:00
Akim Demaille
77b214ef48 version 2.6.1
* NEWS: Record release date.
v2.6.1
2012-07-30 11:18:23 +02:00
Akim Demaille
d35d6dd2cd gnulib: update 2012-07-30 11:17:44 +02:00
Akim Demaille
466a2de317 maint: fix some syntax-check issues
* cfg.mk: Nuke the following warnings which are confused by our
text reports (that state that the error token is number 256).
  prohibit_magic_number_exit
  ../../doc/bison.texi:8170:error (256)
  ../../tests/conflicts.at:570:error (256)
  ../../tests/conflicts.at:673:error (256)
  ../../tests/conflicts.at:811:error (256)
  ../../tests/conflicts.at:1154:error (256)
  ../../tests/regression.at:281:error (256)
  ../../tests/regression.at:582:error (256)
  maint.mk: use EXIT_* values rather than magic number
2012-07-27 17:00:28 +02:00
Akim Demaille
7cb40fd2b5 regen 2012-07-27 16:46:15 +02:00
Akim Demaille
4acc22e5cf tests: do not depend on __cplusplus to decide for C++ or C output
Since we do support compiling C code with a C++ compiler.

* tests/actions.at (Qualified $$ in actions): Use AT_SKEL_CC_IF.
2012-07-27 16:36:07 +02:00
Akim Demaille
4323e0dac3 Merge remote-tracking branch 'origin/maint'
* origin/maint: (29 commits)
  regen
  synclines: remove spurious empty line
  also support $<foo>$ in the %initial-action
  skeletons: b4_dollar_pushdef and popdef to simpify complex definitions
  regen
  printer/destructor: translate only once
  factor the handling of m4 escaping
  news: schedule the removal of the ";" hack
  style changes in the scanners
  regen
  support $<tag>$ in printers and destructors
  scan-code: factor the handling of the type in $<TYPE>$
  muscles: fix another occurrence of unescaped type name
  glr.cc: fix the handling of yydebug
  gnulib: update
  formatting changes
  tests: fix an assertion
  tests: adjust to GCC 4.8, which displays caret errors
  be sure to properly escape type names
  obstack_quote: escape and quote for M4
  muscles: shuffle responsabilities
  muscles: make private functions static
  muscles: rename private functions/macros
  obstack_escape: escape M4 characters
  remove dead macro
  maint: style changes
  doc: avoid problems with case insensitive file systems
  configure: fix botched quoting
  news: fix typo.

Conflicts:
	NEWS
	data/c.m4
	data/glr.cc
	data/lalr1.cc
	examples/rpcalc/local.mk
	src/muscle-tab.h
	src/output.c
	src/parse-gram.c
	src/parse-gram.h
	src/parse-gram.y
	src/scan-code.l
	src/symlist.c
	src/symlist.h
	src/symtab.h
	tests/calc.at
2012-07-27 16:35:49 +02:00
Akim Demaille
7b18c11231 regen 2012-07-27 14:52:55 +02:00
Akim Demaille
e6cab382c5 synclines: remove spurious empty line
* data/bison.m4 (b4_syncline): Do not start with an empty line.
2012-07-27 14:52:23 +02:00
Akim Demaille
cd735a8c6c also support $<foo>$ in the %initial-action
scan-code.l is already passing argument to b4_dollar_dollar for the
initial acton, but its definition (of b4_dollar_dollar) does not use
this argument.

Generalize this definition, and use it for the %initial-action too.

* data/c.m4 (b4_dollar_dollar_, b4_dollar_pushdef, b4_dollar_popdef):
Instead of expecting a pointer, require a value, and use ".".
Since they are now generic enough, move to...
* data/c-like.m4: this new file.
* data/c.m4, data/java.m4: Load it.
* data/glr.c, data/lalr1.cc, data/lalr1.java, data/yacc.c: Use
b4_dollar_pushdef for the %initial-action.
* tests/actions.at: Check that.
* data/Makefile.am: Adjust.
* NEWS, doc/bison.texi: Document.
2012-07-27 14:47:20 +02:00
Akim Demaille
d6a44ffd00 skeletons: b4_dollar_pushdef and popdef to simpify complex definitions
M4 is really making it uselessly hard to define macros that define
macros.
* data/c.m4 (b4_dollar_pushdef, b4_dollar_popdef): New.
Use it.
2012-07-27 13:47:24 +02:00
Akim Demaille
93e3dbab95 regen 2012-07-27 12:54:31 +02:00
Akim Demaille
1c292035e1 printer/destructor: translate only once
Currently "%printer {...} a b c d e f" translates the {...} six times.
Not only is this bad for time and space, it also issues six times the
same warnings.

* src/symlist.h, src/symlist.c (symbol_list_destructor_set)
(symbol_list_printer_set): Take the action as code_props instead of
const char *.
* src/parse-gram.y: Translate these actions here.
* src/scan-code.h: Comment change.
* tests/input.at: Check that warnings are issued only once.
2012-07-27 12:54:31 +02:00
Akim Demaille
263137264f factor the handling of m4 escaping
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.
2012-07-27 12:54:31 +02:00
Akim Demaille
e20e6a50d5 news: schedule the removal of the ";" hack
scan-code.l is significantly more complex because of this.

* NEWS: Doc it.
2012-07-27 12:54:31 +02:00
Akim Demaille
4d24ffb75e style changes in the scanners
* 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.
2012-07-27 12:13:40 +02:00
Akim Demaille
a74a3158d4 regen 2012-07-26 18:30:43 +02:00
Akim Demaille
4982f078bf support $<tag>$ in printers and destructors
* 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++.
2012-07-26 18:30:43 +02:00
Akim Demaille
65a99eca25 scan-code: factor the handling of the type in $<TYPE>$
* src/scan-code.l (fetch_type_name): New.
(handle_action_dollar): Use it.
(gt_ptr): Remove, useless.
2012-07-26 17:03:54 +02:00
Akim Demaille
9a86ee6058 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.
2012-07-26 17:03:54 +02:00
Akim Demaille
0e164d43d1 glr.cc: fix the handling of yydebug
* data/glr.cc (yydebug_): Remove, unused.
(set_debug_level, debug_level): Work on yydebug instead.
* doc/bison.texi, NEWS: Document this.
2012-07-26 17:03:52 +02:00
Akim Demaille
d511fbd576 gnulib: update 2012-07-26 16:51:26 +02:00
Akim Demaille
9c46ba16e3 formatting changes
* src/symtab.h: here.
2012-07-26 16:51:26 +02:00
Akim Demaille
55e075f229 tests: fix an assertion
* tests/local.at (AT_YYLEX_DEFINE): Be sure to check the array
against its length, not its size in bytes.
2012-07-26 16:51:26 +02:00
Akim Demaille
0bb672d87c tests: adjust to GCC 4.8, which displays caret errors
With GCC 4.8, the tests on synclines are skipped.  Transform

  input.y:1:2: error: #error "1"
   #error "1"
    ^

into

  input.y:1: #error "1"

* tests/synclines.at (AT_SYNCLINES_COMPILE): Do it, using Perl instead of
sed.
2012-07-26 16:51:26 +02:00
Akim Demaille
8617d87e24 be sure to properly escape type names
* 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.
2012-07-26 14:20:47 +02:00
Akim Demaille
0601c3bf0f obstack_quote: escape and quote for M4
* 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 "".
2012-07-26 14:20:18 +02:00
Akim Demaille
eea7239a23 muscles: shuffle responsabilities
* src/muscle-tab.c (muscle_boundary_grow): Be in charge of quotation,
instead of leaving this to the caller.
2012-07-26 12:30:03 +02:00
Akim Demaille
e58782294d muscles: make private functions static
* src/muscle-tab.h, src/muscle-tab.c (muscle_boundary_grow)
(muscle_location_grow): Now static.
2012-07-26 12:30:03 +02:00