]> git.saurik.com Git - bison.git/log
bison.git
11 years agovariants: document move and swap
Theophile Ranquet [Fri, 11 Jan 2013 11:38:35 +0000 (12:38 +0100)] 
variants: document move and swap

* data/variant.hh (swap): Doc.
(build): Rename as...
(move): This, more coherent naming with clearer meaning.
* data/c++.m4 (move): Adjust.

11 years agoc++: privatize variant blind copies
Theophile Ranquet [Fri, 11 Jan 2013 10:41:07 +0000 (11:41 +0100)] 
c++: privatize variant blind copies

* data/variant.hh (variant, operator=): Make private.
* data/c++.m4 (operator=): New, to avoid needing a definition of that operator
for each class member (such as a possible variant).
* data/glr.cc, data/lalr.cc: Add the necessary include for the abort.

11 years agoglr.c: fix an unused argument issue
Akim Demaille [Fri, 4 Jan 2013 15:01:07 +0000 (16:01 +0100)] 
glr.c: fix an unused argument issue

* data/glr.c (yyuserAction): "Use" yyrhslen, as in variant mode, we might
not use it.

11 years agoglr.c: style changes
Akim Demaille [Fri, 4 Jan 2013 15:00:59 +0000 (16:00 +0100)] 
glr.c: style changes

* data/glr.c (yyuserAction): Use a size_t for sizes.

11 years agoc.m4: style fix
Akim Demaille [Fri, 4 Jan 2013 14:58:50 +0000 (15:58 +0100)] 
c.m4: style fix

* data/c.m4 (b4_parse_param_use): Add missing space before paren.

11 years agoskel: better aliasing of identifiers
Theophile Ranquet [Fri, 4 Jan 2013 11:30:01 +0000 (12:30 +0100)] 
skel: better aliasing of identifiers

* data/glr.c, data/yacc.c: Avoid emitting useless defines.
* data/glr.cc: Restore prefixes for epilogue.

11 years agoglr.cc: fatal if using api.token.ctor without variants
Theophile Ranquet [Fri, 4 Jan 2013 17:52:21 +0000 (18:52 +0100)] 
glr.cc: fatal if using api.token.ctor without variants

* data/glr.cc: Here.

11 years agoskel: correctly indent switch cases
Theophile Ranquet [Wed, 9 Jan 2013 11:46:55 +0000 (12:46 +0100)] 
skel: correctly indent switch cases

* data/bison.m4 (b4_type_action_): Here.

11 years agovariants: assert changes
Theophile Ranquet [Fri, 21 Dec 2012 15:48:54 +0000 (16:48 +0100)] 
variants: assert changes

* data/variant.hh (swap): More asserts can't hurt. Don't perform useless swaps.
(build): Deactivate problematic asserts, pending further investigation.
(variant): Prohibit copy construction.

11 years agolalr1.cc: use a vector for the symbol stack
Theophile Ranquet [Fri, 21 Dec 2012 15:46:05 +0000 (16:46 +0100)] 
lalr1.cc: use a vector for the symbol stack

* data/lalr1.cc: Adjust includes.
* data/stack.hh (push, pop): Use push_back and pop_back.
(operator []): Access vector from the end.

11 years agolalr1.cc: change symbols implementation
Theophile Ranquet [Fri, 21 Dec 2012 15:49:48 +0000 (16:49 +0100)] 
lalr1.cc: change symbols implementation

A "symbol" groups together the symbol type (INT, PLUS, etc.), its
possible semantic value, and its optional location.  The type is
needed to access the value, as it is stored as a variant/union.

There are two kinds of symbols. "symbol_type" are "external symbols":
they have type, value and location, and are returned by yylex.
"stack_symbol_type" are "internal symbols", they group state number,
value and location, and are stored in the parser stack.  The type of
the symbol is computed from the state number.

The class template symbol_base_type<Exact> factors the code common to
stack_symbol_type and symbol_type.  It uses the Curiously Recurring
Template pattern so that we can always (static_) downcast to the exact
type.  symbol_base_type features value and location, and delegates the
handling of the type to its parameter.

When trying to generalize the support for variant, a significant issue
was revealed: because stack_symbol_type and symbol_type _derive_ from
symbol_base_type, the type/state member is defined _after_ the value
and location.  In C++ the order of the definition of the members
defines the order in which they are initialized, things go backward:
the value is initialized _before_ the type.  This is wrong, since the
type is needed to access the value.

Therefore, we need another means to factor the common code, one that
ensures the order of the members.

The idea is simple: define two (base) classes that code the symbol
type ("by_type" codes it by its type, and "by_state" by the state
number).  Define basic_symbol<Base> as the class template that
provides value and location support.  Make it _derive_ from its
parameter, by_type or by_state.  Then define stack_symbol_type and
symbol_type as basic_symbol<by_state>, basic_symbol<by_type>.  The
name basic_symbol was chosen by similarity with basic_string and
basic_ostream.

* data/c++.m4 (symbol_base_type<Exact>): Remove, replace by...
(basic_symbol<Base>): which derives from its parameter, one of...
(by_state, by_type): which provide means to retrieve the actual type of
symbol.
(symbol_type): Is now basic_symbol<by_type>.
(stack_symbol_type): Is now basic_symbol<by_state>.
* data/lalr1.cc: Many adjustments.

11 years agobench: add %b directive to use a specific Bison
Theophile Ranquet [Wed, 26 Dec 2012 15:26:17 +0000 (16:26 +0100)] 
bench: add %b directive to use a specific Bison

For example,
  $ bench.pl -v '%s lalr1.cc & %d variant & ( %b ~/old-bison/bin/bison
    | %b ~/new-bison/bin/bison )' -g list -i 10000

* etc/bench.pl.in: Here.

11 years agoregen
Akim Demaille [Fri, 4 Jan 2013 15:30:16 +0000 (16:30 +0100)] 
regen

11 years agognulib: update
Akim Demaille [Fri, 28 Dec 2012 10:49:19 +0000 (11:49 +0100)] 
gnulib: update

11 years agodoc: use deffn to declare the list of %define variables
Akim Demaille [Mon, 31 Dec 2012 15:21:34 +0000 (16:21 +0100)] 
doc: use deffn to declare the list of %define variables

* doc/bison.texi (%define Summary): Use @deffn instead of @table, it
spares a lot of width, especially in PDF, and looks nicer in the other
formats too.
It is also more consistent with the rest of the document.

11 years agodoc: minor completion and fixes
Akim Demaille [Mon, 31 Dec 2012 10:18:48 +0000 (11:18 +0100)] 
doc: minor completion and fixes

* doc/bison.texi (%define Summary): Provide more history to some
variables.

11 years agojava: stype is obsoleted by api.value.type
Akim Demaille [Mon, 31 Dec 2012 10:13:50 +0000 (11:13 +0100)] 
java: stype is obsoleted by api.value.type

This is consistent with the other %define variable names.

* data/java.m4: Use api.value.type instead of stype.
* doc/bison.texi, NEWS: Document that change.
* src/muscle-tab.c (muscle_percent_variable_update): Provide backward
compatibility.
* tests/java.at: Adjust.

11 years agodoc: fix html build
Akim Demaille [Mon, 31 Dec 2012 15:31:14 +0000 (16:31 +0100)] 
doc: fix html build

* doc/local.mk (bison.html): Fix dependencies.

11 years agotodo: remove erroneous task
Akim Demaille [Sun, 30 Dec 2012 08:28:42 +0000 (09:28 +0100)] 
todo: remove erroneous task

* tests/input.at: Check that there are no warnings about stray $ and @
in the epilogue.
* TODO: Remove the correponding task.

11 years agognulib: update
Akim Demaille [Fri, 28 Dec 2012 10:49:19 +0000 (11:49 +0100)] 
gnulib: update

11 years agoregen
Akim Demaille [Fri, 28 Dec 2012 10:28:36 +0000 (11:28 +0100)] 
regen

11 years agosyncline: one line is enough
Akim Demaille [Fri, 28 Dec 2012 10:25:02 +0000 (11:25 +0100)] 
syncline: one line is enough

So far we were issuing two lines for each syncline change:

  /* Line 356 of yacc.c  */
  #line 1 "src/parse-gram.y"

This is a lot of clutter, especially when reading diffs, as these
lines change often.  Fuse them into a single, shorter, line:

  #line 1 "src/parse-gram.y" /* yacc.c:356  */

* data/bison.m4 (b4_syncline): Issue a single line.
Comment improvements.
(b4_sync_start, b4_sync_end): Issue a shorter comment.
* data/c++.m4 (b4_semantic_type_declare): b4_user_code must be
on its own line as it might start with a "#line" directive.

11 years agoregen
Akim Demaille [Fri, 28 Dec 2012 10:07:17 +0000 (11:07 +0100)] 
regen

11 years agomaint: restore ANSI 89 compliance
Akim Demaille [Fri, 28 Dec 2012 10:04:37 +0000 (11:04 +0100)] 
maint: restore ANSI 89 compliance

* data/bison.m4, src/conflicts.c, src/files.c, src/output.c,
* src/symtab.c: Use /* ... */ comments only.
Declare variables before statements.

11 years agograph: minor simplification
Akim Demaille [Fri, 28 Dec 2012 09:04:49 +0000 (10:04 +0100)] 
graph: minor simplification

* src/gram.c (print_lhs): Use %*s to indent.
* src/print_graph.c (print_lhs): Use obstack_printf.
Became simple enough to be inlined in...
(print_core): here.
Use a "rule*" instead of an index in "rules[]".

11 years agoclosure, gram: add missing const
Akim Demaille [Fri, 28 Dec 2012 09:16:37 +0000 (10:16 +0100)] 
closure, gram: add missing const

* src/closure.h, src/closure.c, src/gram.h, src/gram.c: Add some missing
const where appropriate.

11 years agocarets: properly display when no line feed is present
Theophile Ranquet [Thu, 13 Dec 2012 10:28:11 +0000 (11:28 +0100)] 
carets: properly display when no line feed is present

* src/location.c (location_caret): finish the line with one whether or not it
is present in input. Rewrite code without getline.
(cleanup_caret): Reset the caret_info global.
* bootstrap.conf: No longer require getline.

11 years agoscanner: reintroduce unput for missing end tokens
Theophile Ranquet [Thu, 15 Nov 2012 17:10:35 +0000 (17:10 +0000)] 
scanner: reintroduce unput for missing end tokens

Unput was no longer used since a POSIX-compatiblity issue with Flex 2.5.31,
which has been adressed in newer versions of Flex.  See this discussion:
<http://lists.gnu.org/archive/html/bug-bison/2003-04/msg00029.html>

This partially reverts commit aa4180418fff518198e1b0f2c43fec6432210dc7.

* src/scan-gram.l (unexpected_end): Here.
* tests/input.at: Adjust for new order of error reports.

11 years agotables: scope reduction
Akim Demaille [Thu, 27 Dec 2012 09:52:42 +0000 (10:52 +0100)] 
tables: scope reduction

* src/tables.c (default_goto): Make it easier to understand.

11 years agoregen
Akim Demaille [Thu, 27 Dec 2012 09:33:46 +0000 (10:33 +0100)] 
regen

11 years agoskeletons: fix comments
Akim Demaille [Thu, 27 Dec 2012 09:01:58 +0000 (10:01 +0100)] 
skeletons: fix comments

The commit 38de4e570fdc7c8db9633c3b2054e565d8c1c6b9 underquoted the
content of the comments, which resulted in losing square brackets in
the comments.  Besides, some other invocations were underquoting the
effective arguments.

* data/c.m4 (b4_comment_): Properly quote the comment.
(b4_comment_, b4_comment): Move to...
* data/c-like.m4: here, so that...
* data/java.m4: can use it instead of its own copy.
* data/bison.m4 (b4_integral_parser_tables_map): Fix some comments.

* data/lalr1.cc, data/lalr1.java, data/yacc.c: Comment fixes.

* data/lalr1.cc: Reorder a bit to factor some CPP directives.

11 years agomaint: which -> whose
Akim Demaille [Thu, 27 Dec 2012 08:45:17 +0000 (09:45 +0100)] 
maint: which -> whose

Apparently, I was confusing both.

* data/bison.m4, data/c.m4, data/glr.c, data/lalr1.cc, data/yacc.c:
Use "whose" where appropriate.

11 years agotables: scope reduction
Akim Demaille [Wed, 26 Dec 2012 17:16:55 +0000 (18:16 +0100)] 
tables: scope reduction

* src/tables.c (matching_state): here.

11 years agotables: scope reduction
Akim Demaille [Wed, 26 Dec 2012 17:15:21 +0000 (18:15 +0100)] 
tables: scope reduction

* src/tables.c (token_actions): here.

11 years agotables: scope reduction
Akim Demaille [Wed, 26 Dec 2012 17:14:47 +0000 (18:14 +0100)] 
tables: scope reduction

* src/tables.c (save_row): here.

11 years agotables: scope reduction
Akim Demaille [Wed, 26 Dec 2012 16:56:20 +0000 (17:56 +0100)] 
tables: scope reduction

* src/tables.c (save_column, pack_vector): Reduce the scope to
emphasize the structure of the code.
Rename the returned value "res" to make understanding easier.

11 years agotables: use size_t where appropriate
Akim Demaille [Wed, 26 Dec 2012 16:55:02 +0000 (17:55 +0100)] 
tables: use size_t where appropriate

These changes aim at making the code easier to understand.

* src/tables.c (tally): This is a size, always >= 0, so make it
a size_t.

11 years agotables: style changes
Akim Demaille [Wed, 26 Dec 2012 16:53:01 +0000 (17:53 +0100)] 
tables: style changes

* src/tables.c: Prefer < to >.
Fix/complete some comments.
Remove useless parens.

11 years agoskeletons: no longer call yylex via a CPP macro
Akim Demaille [Wed, 26 Dec 2012 07:18:03 +0000 (08:18 +0100)] 
skeletons: no longer call yylex via a CPP macro

The YYLEX existed only to support YYLEX_PARAM, which is now removed.
This macro was a nuisance, since incorrect yylex calls where pointed
the macro _use_, instead of its definition.

* data/c.m4 (b4_lex_formals, b4_lex): New.
* data/glr.c, data/yacc.c: Use it.
* data/lalr1.cc (b4_lex): New.
Use it.

squash! skeletons: no longer call yylex via a CPP macro

11 years agoYYLEX_PARAM: drop support
Akim Demaille [Tue, 25 Dec 2012 16:13:39 +0000 (17:13 +0100)] 
YYLEX_PARAM: drop support

* data/yacc.c, doc/bison.texi: Remove YYLEX_PARAM support.
* NEWS: Document it.

11 years agoexamples: minor improvements
Akim Demaille [Wed, 26 Dec 2012 07:12:38 +0000 (08:12 +0100)] 
examples: minor improvements

* examples/variant.yy: Don't use debug_stream(), obsoleted.
Use <*>.

11 years agoskeletons: factor comments about symbols
Akim Demaille [Tue, 25 Dec 2012 15:27:16 +0000 (16:27 +0100)] 
skeletons: factor comments about symbols

* data/variant.hh (b4_char_sizeof_): Rename as...
* data/bison.m4 (b4_symbol_tag_comment): this.
Provide more documentation about b4_symbol_*.

11 years agoc: improve the definition of public types
Akim Demaille [Sun, 23 Dec 2012 16:54:59 +0000 (17:54 +0100)] 
c: improve the definition of public types

* data/c.m4 (b4_token_enum): Improve comments.
(b4_value_type_define, b4_location_type_define): New, extracted
from...
(b4_declare_yylstype): here.
Separate the typedefs from the union/struct definitions.

11 years agodoc: update variant usage
Akim Demaille [Sun, 23 Dec 2012 11:47:31 +0000 (12:47 +0100)] 
doc: update variant usage

* doc/bison.texi, examples/variant.yy: Use "%define api.value.type variant",
instead of "%define variant".

11 years agotests: check the "%define variant" is deprecated.
Akim Demaille [Sun, 23 Dec 2012 09:52:23 +0000 (10:52 +0100)] 
tests: check the "%define variant" is deprecated.

* tests/input.at: Rename some AT_SETUP to avoid that
AT_SETUP_STRIP thinks they contain %define directives.
("%define" backward compatibility): Merge tests together
to speed up the test suite, and to make maintenance easier
(multiple AT_CHECK means multiple runs of the test suite to
be sure to have updated all the error messages).
Check the "%define variant" is properly obsoleted.

12 years ago%define variables: support value changes in deprecation
Akim Demaille [Sun, 16 Dec 2012 09:20:46 +0000 (10:20 +0100)] 
%define variables: support value changes in deprecation

* src/muscle-tab.c (define_directive): Be robust to "assignment"
containing '='.
(muscle_percent_variable_update): Upgrade "variant" to "api.value.type".
Support such upgrade patterns.
Adjust callers.

* data/bison.m4: Use api.value.type for variants.
* tests/c++.at: Adjust tests.

12 years agodiagnostics: treat obsolete %define variable names as obsolete directives
Akim Demaille [Sat, 15 Dec 2012 21:14:16 +0000 (22:14 +0100)] 
diagnostics: treat obsolete %define variable names as obsolete directives

Instead of

  warning: deprecated %define variable name: 'namespace', use 'api.namespace' [-Wdeprecated]

display (in -fno-caret mode):

  warning: deprecated directive: '%define namespace foo', use '%define api.namespace foo' [-Wdeprecated]

and (in -fcaret mode):

  warning: deprecated directive, use '%define api.namespace toto' [-Wdeprecated]
   %define namespace toto
           ^^^^^^^^^

This is in preparation of cases where not only the variable is
renamed, but the values are too:

  warning: deprecated directive: '%define variant', use '%define api.value.type variant' [-Wdeprecated]

* src/muscle-tab.c (define_directive): New.
(muscle_percent_variable_update): Take the value as argument, and use it
in the diagnostics.
Loop with a pointer instead of an index.
* tests/input.at (%define backward compatibility): Adjust.

12 years agodiagnostics: factor the deprecated directive message
Akim Demaille [Sat, 15 Dec 2012 20:54:17 +0000 (21:54 +0100)] 
diagnostics: factor the deprecated directive message

* src/complain.h, src/complain.c (deprecated_directive): New.
* src/muscle-tab.c: Use it.

12 years agovariant: produce stable results
Akim Demaille [Sat, 22 Dec 2012 09:16:49 +0000 (10:16 +0100)] 
variant: produce stable results

Improve the output by ensuring a well defined order for type switches.

* src/uniqstr.h: Style changes for macro arguments.
(UNIQSTR_CMP): Replace by...
(uniqstr_cmp): this.
* src/uniqstr.c (uniqstr_cmp): New.
Produce well defined results.
* src/output.c: Use it.

12 years agouniqstr: formatting changes
Akim Demaille [Sat, 22 Dec 2012 09:21:17 +0000 (10:21 +0100)] 
uniqstr: formatting changes

* src/uniqstr.h: Sort functions by object type.

12 years agoskeletons: fix an error message
Akim Demaille [Sun, 23 Dec 2012 08:49:14 +0000 (09:49 +0100)] 
skeletons: fix an error message

* data/bison.m4 (b4_flag_if): Display the invalid value.

12 years agotests: improve titles
Akim Demaille [Sat, 22 Dec 2012 12:39:54 +0000 (13:39 +0100)] 
tests: improve titles

* tests/local.at (AT_SETUP_STRIP): New.
(AT_SETUP): Use it to shorten the test titles: remove %defines, %language
and %skeleton whose arguments suffice.
* tests/synclines.at: Use more precise AT_SETUP.

12 years agoc++: comment changes
Akim Demaille [Sat, 22 Dec 2012 09:51:55 +0000 (10:51 +0100)] 
c++: comment changes

* data/c++.m4, data/glr.cc, data/lalr1.cc: Convert some /* ... */
comments to //.

12 years agoc++: use // comments in the output
Akim Demaille [Sat, 22 Dec 2012 08:14:05 +0000 (09:14 +0100)] 
c++: use // comments in the output

This is mostly used for the license header, the synclines, and the
generated tables:

-  /* STOS_[STATE-NUM] -- The (internal number of the) accessing
-     symbol of state STATE-NUM.    */
+  // STOS_[STATE-NUM] -- The (internal number of the) accessing
+  // symbol of state STATE-NUM.
   static const unsigned char yystos_[];

* data/c.m4: Comment changes.
(b4_comment_): Expand the text argument.
Before this change, we were actually formatting M4 code as a
C comment, and then expand it.
(b4_comment): Fix the closing of comments: there is no reason to
add the (line) prefix before the closing "*/".
* data/c++.m4 (b4_comment): New.

12 years agomaint: disable sc_prohibit_test_backticks
Akim Demaille [Fri, 21 Dec 2012 17:11:34 +0000 (18:11 +0100)] 
maint: disable sc_prohibit_test_backticks

* cfg.mk: here.
And fix typos.
Reported by Stefano Lattarini.

12 years agomaint: more syntax-checks
Akim Demaille [Fri, 21 Dec 2012 15:52:11 +0000 (16:52 +0100)] 
maint: more syntax-checks

* cfg.mk (sc_prohibit_tab_based_indentation, sc_prohibit_test_backticks)
(sc_preprocessor_indentation, sc_space_before_open_paren): New,
stolen from Coreutils (2e9f5ca4ebbbdb6a9fa2dd3d5add3f7720a172d7).

12 years agodebug: no longer generate tabs
Akim Demaille [Fri, 21 Dec 2012 15:51:17 +0000 (16:51 +0100)] 
debug: no longer generate tabs

* src/closure.c, src/derives.c, src/nullable.c, tests/sets.at: Use
spaces.

12 years agostyle changes: run cppi
Akim Demaille [Fri, 21 Dec 2012 15:45:30 +0000 (16:45 +0100)] 
style changes: run cppi

Run it in src/ for a start.

* src/AnnotationList.h, src/InadequacyList.h, src/Sbitset.h,
* src/closure.c, src/complain.h, src/flex-scanner.h, src/getargs.h,
* src/gram.h, src/graphviz.h, src/ielr.h, src/location.h,
* src/muscle-tab.h, src/named-ref.h, src/relation.h, src/scan-code.h,
* src/state.h, src/symtab.h, src/system.h, src/uniqstr.h:
Reindent preprocessor directives.

12 years agostyle changes: untabify
Akim Demaille [Fri, 21 Dec 2012 15:36:32 +0000 (16:36 +0100)] 
style changes: untabify

* data/xslt/xml2dot.xsl, data/xslt/xml2text.xsl, m4/flex.m4,
* tests/glr-regression.at, tests/torture.at: here.

12 years agotests: be robust to set -e.
Akim Demaille [Fri, 21 Dec 2012 12:23:54 +0000 (13:23 +0100)] 
tests: be robust to set -e.

* examples/test (run): here.

12 years agovariants: prohibit simple copies
Akim Demaille [Wed, 19 Dec 2012 09:18:03 +0000 (10:18 +0100)] 
variants: prohibit simple copies

The "variant" structure provides a means to store, in a typeless way,
C++ objects.  Manipulating it without provide the type of the stored
content is doomed to failure.  So provide a means to copy in a type
safe way, and prohibit typeless assignments.

* data/c++.m4 (symbol_type::move): New.
* data/lalr1.cc: Use it.
* data/variant.hh (b4_variant_define): Provide variant::copy.
Let variant::operator= abort.
We cannot undefine it, yet, as it is still uses by the implicit
assigment in symbols, which must also be disabled.

12 years agovariant: more assertions
Akim Demaille [Wed, 19 Dec 2012 09:09:07 +0000 (10:09 +0100)] 
variant: more assertions

Equip variants with more checking code.  Provide a means to request
includes.

* data/variant.hh (b4_variant_includes): New.
* data/lalr1.cc: Use it.
* data/variant.hh (variant::built): Define at the end, as a private member.
(variant::tname): New.
Somewhat makes "built" useless, but let's keep both for a start, in
case using "typeinfo" is considered unacceptable in some environments.
Fix some formatting issues.

12 years agognulib: update
Akim Demaille [Wed, 19 Dec 2012 10:19:52 +0000 (11:19 +0100)] 
gnulib: update

12 years agoskeletons: fix output directives
Akim Demaille [Wed, 19 Dec 2012 10:17:29 +0000 (11:17 +0100)] 
skeletons: fix output directives

* data/lalr1.cc, data/location.cc, data/glr.cc: Use b4_output_begin.
Broken during a merge.

12 years agoyacc.c: style changes
Akim Demaille [Wed, 19 Dec 2012 10:05:56 +0000 (11:05 +0100)] 
yacc.c: style changes

* data/yacc.c (b4_lex_param): Provide arguments with a name.

12 years agoglr.cc: simplifying the handling of parse/lex params
Akim Demaille [Wed, 19 Dec 2012 10:01:52 +0000 (11:01 +0100)] 
glr.cc: simplifying the handling of parse/lex params

The fact that glr.cc uses glr.c makes the handling of parse params
more complex, as the parser object of glr.cc must be passed to the
parse function of glr.c.  Yet not all the functions need access to
the parser object.

* data/glr.cc (b4_parse_param_wrap): New.
Use them.

12 years agoglr: rename lex params
Akim Demaille [Wed, 19 Dec 2012 09:48:09 +0000 (10:48 +0100)] 
glr: rename lex params

* data/glr.c (b4_lex_param): Rename as...
(b4_lex_formals): this, for consistency.
Provide arguments a name.
(LEX): Adjust.

12 years agoglr.c: move function declaration earlier
Akim Demaille [Wed, 19 Dec 2012 09:36:40 +0000 (10:36 +0100)] 
glr.c: move function declaration earlier

* data/glr.c (yypstack, yypdumpstack): Declare earlier, to make
it easier to call them from other functions.

12 years ago%define variables: backward compatibility
Akim Demaille [Wed, 19 Dec 2012 09:33:58 +0000 (10:33 +0100)] 
%define variables: backward compatibility

* src/muscle-tab.c (muscle_percent_variable_update): Accept lex_symbol.
Reported by Roland Levillain.

12 years agodiagnostics: improve -fcaret for list of accepted values
Akim Demaille [Sat, 15 Dec 2012 20:54:27 +0000 (21:54 +0100)] 
diagnostics: improve -fcaret for list of accepted values

Instead of

  input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither'
   %define api.push_pull "neither"
           ^^^^^^^^^^^^^
  input.y:1.9-21:     accepted value: 'pull'
   %define api.push_pull "neither"
           ^^^^^^^^^^^^^
  input.y:1.9-21:     accepted value: 'push'
   %define api.push_pull "neither"
           ^^^^^^^^^^^^^
  input.y:1.9-21:     accepted value: 'both'
   %define api.push_pull "neither"
           ^^^^^^^^^^^^^

report

  input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither'
   %define api.push_pull "neither"
           ^^^^^^^^^^^^^
  input.y:1.9-21:     accepted value: 'pull'
  input.y:1.9-21:     accepted value: 'push'
  input.y:1.9-21:     accepted value: 'both'

* src/complain.h (no_caret): New.
* src/complain.c (error_message): Use it.
* src/muscle-tab.c (muscle_percent_define_check_values): Use it.
* src/scan-skel.l (flag): Ditto.
* tests/input.at: Adjust and check.

12 years agoskeletons: simplify the handling of default api.location.type
Akim Demaille [Sat, 15 Dec 2012 14:27:10 +0000 (15:27 +0100)] 
skeletons: simplify the handling of default api.location.type

* data/bison.m4 (b4_bison_locations_if): New.
* data/glr.cc, data/lalr1.cc: Use it.

12 years agotests: address syntax-check failures
Akim Demaille [Sat, 15 Dec 2012 16:16:28 +0000 (17:16 +0100)] 
tests: address syntax-check failures

* cfg.mk: Ignore failures in timevar (uses GCC style configuration,
not gnulib's).
* doc/local.mk: Space changes.
* lib/main.c, tests/calc.at: Remove useless HAVE_ tests.

12 years agoremove duplicate definitions
Akim Demaille [Sat, 15 Dec 2012 15:20:51 +0000 (16:20 +0100)] 
remove duplicate definitions

* src/system.h: here, inherited from a merge.

12 years agodoc: fix dependencies
Akim Demaille [Sat, 15 Dec 2012 07:19:59 +0000 (08:19 +0100)] 
doc: fix dependencies

* doc/local.mk: here.

12 years agodoc: style fixes
Akim Demaille [Fri, 14 Dec 2012 15:38:02 +0000 (16:38 +0100)] 
doc: style fixes

* doc/bison.texi: Add a couple of missing @var and @code.

12 years agodoc: fix build dependencies
Theophile Ranquet [Tue, 4 Dec 2012 15:09:24 +0000 (16:09 +0100)] 
doc: fix build dependencies

Suggested by Nick Bowler
<http://lists.gnu.org/archive/html/bug-automake/2012-12/msg00001.html>

* doc/local.mk: Avoid overwriting Automake's rules.

12 years agoMerge branch 'origin/maint'
Akim Demaille [Fri, 14 Dec 2012 12:56:11 +0000 (13:56 +0100)] 
Merge branch 'origin/maint'

* origin/maint:
  maint: credit Wojciech Polak
  maint: post-release administrivia
  version 2.7
  yacc.c: scope reduction
  tests: C90 compliance
  fix C90 compliance
  glr.c: scope reduction
  gnulib: update

Conflicts:
NEWS
gnulib
src/scan-gram.l
src/system.h

12 years agosymtab: add missing initializations
Theophile Ranquet [Tue, 11 Dec 2012 12:23:44 +0000 (13:23 +0100)] 
symtab: add missing initializations

* src/symtab.c (semantic_type_new): Here.

12 years agosymtab: fix some leaks
Theophile Ranquet [Tue, 11 Dec 2012 12:16:22 +0000 (13:16 +0100)] 
symtab: fix some leaks

* src/symlist.c (symbol_list_free): Deep free it.
* src/symtab.c (symbols_free, semantic_types_sorted): Free it too.
(symbols_do, sorted): Call by address.

12 years agotests: remove use of PARSE_PARAM
Theophile Ranquet [Mon, 10 Dec 2012 18:28:43 +0000 (19:28 +0100)] 
tests: remove use of PARSE_PARAM

* tests/header.at: Here.

12 years agomaint: credit Wojciech Polak
Akim Demaille [Thu, 13 Dec 2012 08:25:34 +0000 (09:25 +0100)] 
maint: credit Wojciech Polak

* NEWS, THANKS: He is the author of XML support (including XSLTs).

12 years agomaint: post-release administrivia
Akim Demaille [Wed, 12 Dec 2012 15:23:44 +0000 (16:23 +0100)] 
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.7 v2.7
Akim Demaille [Wed, 12 Dec 2012 15:07:46 +0000 (16:07 +0100)] 
version 2.7

* NEWS: Record release date.

12 years agoyacc.c: scope reduction
Akim Demaille [Wed, 12 Dec 2012 11:38:43 +0000 (12:38 +0100)] 
yacc.c: scope reduction

* data/yacc.c (yysyntax_error): here.

12 years agotests: C90 compliance
Akim Demaille [Wed, 12 Dec 2012 11:38:28 +0000 (12:38 +0100)] 
tests: C90 compliance

* tests/synclines.at: here.

12 years agofix C90 compliance
Akim Demaille [Wed, 12 Dec 2012 10:37:02 +0000 (11:37 +0100)] 
fix C90 compliance

* data/glr.c, src/graphviz.h, src/ielr.c, src/scan-gram.l,
* src/system.h, tests/actions.at, tests/glr-regression.at: Do not
use // comments.
Do not introduce variables after statements.
Provide "main" with a return value.

12 years agoglr.c: scope reduction
Akim Demaille [Wed, 12 Dec 2012 10:28:24 +0000 (11:28 +0100)] 
glr.c: scope reduction

* data/glr.c (yyreportSyntaxError): Reduce the scope of yysize1 (now
yysz).

12 years agognulib: update
Akim Demaille [Tue, 11 Dec 2012 10:39:51 +0000 (11:39 +0100)] 
gnulib: update

12 years agoMerge remote-tracking branch 'origin/maint'
Theophile Ranquet [Mon, 10 Dec 2012 16:01:55 +0000 (17:01 +0100)] 
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  news: prepare for forthcoming release
  doc: explain how mid-rule actions are translated
  error: use better locations for unused midrule values
  doc: various minor improvements and fixes
  tests: ignore more useless compiler warnings
  tests: be robust to C being compiled with a C++11 compiler
  build: beware of Clang++ not supporting POSIXLY_CORRECT
  maint: post-release administrivia
  version 2.6.90
  build: fix syntax-check error.
  cpp: simplify the Flex version checking macro
  news: improve the carets example and fix a typo
  cpp: improve the Flex version checking macro
  carets: improve the code
  maint: update news
  build: keep -Wmissing-declarations and -Wmissing-prototypes for modern GCCs
  build: drop -Wcast-qual
  gnulib: update

Conflicts:
NEWS
doc/Makefile.am
doc/bison.texi
gnulib
src/reader.c
tests/actions.at
tests/atlocal.in
tests/input.at

12 years agonews: prepare for forthcoming release
Akim Demaille [Sun, 9 Dec 2012 15:50:12 +0000 (16:50 +0100)] 
news: prepare for forthcoming release

* NEWS: Fill paragraph.
Reorder.
Update examples.
Remove line for 2.6.90.

12 years agodoc: explain how mid-rule actions are translated
Akim Demaille [Sun, 9 Dec 2012 15:49:58 +0000 (16:49 +0100)] 
doc: explain how mid-rule actions are translated

* doc/bison.texi (Actions in Mid-Rule): Mention and use named references.
Split into three subsections, among which...
(Mid-Rule Action Translation): this new section.

12 years agoerror: use better locations for unused midrule values
Akim Demaille [Sun, 9 Dec 2012 11:06:21 +0000 (12:06 +0100)] 
error: use better locations for unused midrule values

On

  %%
  exp: {;} {$$;} { $$ = $1; }

instead of reporting (with -fcaret -Wmidrule-value)

  midrule.y:2.6-8: warning: unset value: $$ [-Wmidrule-values]
   exp: {;} {$$;} { $$ = $1; }
        ^^^
  midrule.y:2.6-27: warning: unused value: $2 [-Wmidrule-values]
   exp: {;} {$$;} { $$ = $1; }
        ^^^^^^^^^^^^^^^^^^^^^^

report

  midrule.y:2.6-8: warning: unset value: $$
   exp: {;} {$$;} { $$ = $1; }
        ^^^
  midrule.y:2.10-14: warning: unused value: $2
   exp: {;} {$$;} { $$ = $1; }
            ^^^^^

* src/reader.c (grammar_rule_check): When warning about the value of a
midrule action, use the location of the midrule action instead of the
location of the rule.
the location of the part of the rule.
* tests/actions.at (Default %printer and %destructor for mid-rule values):
Adjust expectations
* tests/input.at (Unused values with default %destructor): Ditto.
(AT_CHECK_UNUSED_VALUES): Ditto.
And use -fcaret.

12 years agodoc: various minor improvements and fixes
Akim Demaille [Sat, 8 Dec 2012 15:18:07 +0000 (16:18 +0100)] 
doc: various minor improvements and fixes

* doc/figs/example.dot, doc/figs/example.y: New.
* doc/bison.texi: Prefer "token" to TOKEN.
Use @group where appropriate.
Adjust with style changes in the output (State 0, not state 0).
Fix some @ref that were missing the third argument.
Fix some incorrect line numbers.
Use "nonterminal", not "non-terminal".
Fix overfull and underfull TeX hboxes.
Put the comments in the index.
Remove duplicate index entries.
Fuse glossary entries where appropriate.
(Understanding): Improve the continuity between sections.
Use example.dot to show the whole graph.
* doc/Makefile.am: Adjust.

12 years agotests: ignore more useless compiler warnings
Akim Demaille [Sun, 9 Dec 2012 15:23:34 +0000 (16:23 +0100)] 
tests: ignore more useless compiler warnings

* tests/synclines.at (AT_SYNCLINES_COMPILE): Ignore complains about
using c++ to compile C.

12 years agotests: be robust to C being compiled with a C++11 compiler
Akim Demaille [Sun, 9 Dec 2012 14:41:50 +0000 (15:41 +0100)] 
tests: be robust to C being compiled with a C++11 compiler

* tests/glr-regression.at: Use YY_NULL instead of NULL.
Comment changes.

12 years agobuild: beware of Clang++ not supporting POSIXLY_CORRECT
Akim Demaille [Sat, 8 Dec 2012 18:33:50 +0000 (19:33 +0100)] 
build: beware of Clang++ not supporting POSIXLY_CORRECT

* m4/c-working.m4 (BISON_LANG_COMPILER_POSIXLY_CORRECT): New.
(BISON_C_COMPILER_POSIXLY_CORRECT): Use it.
For consistency with C++, also define BISON_C_WORKS.
* m4/cxx.m4 (BISON_CXX_COMPILER_POSIXLY_CORRECT): New.
* configure.ac: Use it.
* tests/atlocal.in: Get its result.
Propagate properly CXX values when used to compile C.
When POSIXLY_CORRECT, adjust BISON_C_WORKS and BISON_CXX_WORKS.
* tests/local.at (AT_COMPILE): Use BISON_C_WORKS.

12 years agomaint: post-release administrivia
Akim Demaille [Fri, 7 Dec 2012 10:49:12 +0000 (11:49 +0100)] 
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.6.90 v2.6.90
Akim Demaille [Fri, 7 Dec 2012 10:37:14 +0000 (11:37 +0100)] 
version 2.6.90

* NEWS: Record release date.

12 years agobuild: fix syntax-check error.
Akim Demaille [Fri, 7 Dec 2012 10:34:51 +0000 (11:34 +0100)] 
build: fix syntax-check error.

* cfg.mk: Exclude names-refs, it includes a "double" if (end of first
line, first of second line below).

test.y:43.12-44.59:  symbol not found in production: if
 if-stmt-a: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

12 years agocpp: simplify the Flex version checking macro
Theophile Ranquet [Fri, 7 Dec 2012 11:13:38 +0000 (12:13 +0100)] 
cpp: simplify the Flex version checking macro

* src/flex-scanner,h (FLEX_VERSION): Consider YY_FLEX_SUBMINOR_VERSION
defined.