Commit Graph

4712 Commits

Author SHA1 Message Date
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
7cb40fd2b5 regen 2012-07-27 16:46:15 +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
Akim Demaille
c1cc91bdcd muscles: rename private functions/macros
* 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.
2012-07-26 12:30:03 +02:00
Akim Demaille
13b712d7d4 obstack_escape: escape M4 characters
* 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.
2012-07-26 12:30:02 +02:00
Akim Demaille
dba9149595 remove dead macro
* src/system.h (DEFAULT_TMPDIR): Remove, unused.
2012-07-26 12:28:40 +02:00
Akim Demaille
9b8585410a maint: style changes
* src/scan-code.l: Remove useless braces.
Formatting changes.
Prefer NULL to 0.
* src/muscle-tab.c, src/system.h: Formatting changes.
2012-07-26 12:28:17 +02:00
Akim Demaille
f9b8635172 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.
2012-07-24 13:30:49 +02:00
Stefano Lattarini
733d4546ce configure: fix botched quoting
* 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
    ...

Copyright-paperwork-exempt: yes
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2012-07-24 12:22:17 +02:00
Akim Demaille
9e41ba026a regen 2012-07-24 08:55:26 +02:00
Akim Demaille
5f819b2f98 yystype, yyltype: remove.
* data/c.m4: here.
* NEWS: Doc it.
2012-07-24 08:53:48 +02:00
Akim Demaille
007c5908b9 regen 2012-07-22 21:18:43 +02:00
Akim Demaille
47db7ed1a8 YYFAIL: remove.
* data/lalr1.java, data/yacc.c, src/scan-code.l: Remove YYFAIL support.
* NEWS, TODO: Update.
2012-07-22 21:17:07 +02:00
Akim Demaille
a34361a52a todo: update.
* TODO: obsolete items.
2012-07-22 21:17:07 +02:00
Akim Demaille
0294b13074 regen. 2012-07-22 21:17:07 +02:00
Akim Demaille
d507251c81 space changes.
* data/bison.m4 (b4_symbol_action): Remove spurious eol in the output.
2012-07-22 21:17:06 +02:00
Akim Demaille
585a791ef0 parser: fix %printer usage.
* src/parse-gram.y: Instead of stderr, using yyo.
2012-07-22 21:17:06 +02:00
Akim Demaille
4919604766 parser: factor the handling of code_props
* src/parse-gram.y: Now that %printer and %destructor are treated
equally, let...
(code_props_type): handle them.
2012-07-22 21:16:56 +02:00
Akim Demaille
a82cbb63b6 parser: factor handling of type tags
* src/parse-gram.y: Now that <*> and <> are processed like regular
tags, let...
(tag): handle them.
2012-07-22 21:16:36 +02:00
Akim Demaille
e501ea04e7 regen. 2012-07-22 20:19:51 +02:00
Akim Demaille
9534d2be80 simplify the handling of <> and <*>'s code_props.
Currently they are treated in separated variables, contrary to other
<TYPE> code_props.  This duplicates code (and messages for translators)
uselessly, as demonstrated by the fact that thanks to this patch, now
useless <*> and <> code_props are reported like the others.

* src/parse-gram.y (generic_symlist_item): Treat "<*>" and "<>" as regular
type tags.
* src/symlist.h, src/symlist.c (symbol_list_default_tagged_new)
(symbol_list_default_tagless_new,SYMLIST_DEFAULT_TAGGED)
(SYMLIST_DEFAULT_TAGLESS): Remove.
* src/symtab.h, src/symtab.c (default_tagged_code_props)
(default_tagless_code_props, default_tagged_code_props_set)
(default_tagless_code_props_set): Remove.
(symbol_code_props_get): Default to <*> or <>'s code_props.

* tests/actions.at: Complete expected errors: there are new warnings.
* tests/input.at: Likewise.
(Useless printers or destructors): Extend.
2012-07-22 20:19:51 +02:00
Akim Demaille
70946cff5e allow modification on retrieved code_props.
The logic to compute the %printer or %destructor to used (i.e., a
code_props) is implemented twice: one, of course, in
symbol_code_props_get, and another time in symbol_check_defined to
record the fact that a code_props is used (so that we can reported
unused ones).  Let the former use the latter.

I would probably use "mutable" in C++ and keep these guys const,
but this is C.  And casting away constness triggers warnings.

* src/scan-code.h, src/scan-code.l (code_props_none): Is not const.
* src/symtab.h, src/symtab.c (symbol_code_props_get): The symbol
is not const.
(symbol_check_defined): Use it.
2012-07-22 20:19:51 +02:00
Akim Demaille
a943967010 maint: regen. 2012-07-22 20:19:51 +02:00
Akim Demaille
afa4ec917b maint: fix bison's own header guards.
Because I'm using a VPATH build with an absolute srcdir, I have
GRAM__USERS_AKIM_SRC_GNU_BISON_SRC_PARSE_GRAM_H.  Before, I was using
a relative srcdir, and had GRAM_______SRC_PARSE_GRAM_H (coming from
../../).  Let it be GRAM_SRC_PARSE_GRAM_H.

* tests/bison.in: Do not depend on the value of $top_srcdir for
Bison itself.
If we were to use relative paths from .c to .y, we would not have
this problem.
2012-07-22 20:19:51 +02:00
Akim Demaille
c5289832f2 maint: add missing const.
* src/symtab.h, src/symtab.c (symbol_print): here.
2012-07-22 20:19:51 +02:00