platform/upstream/bison.git
11 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.

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

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

11 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 //.

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

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

11 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).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* doc/local.mk: here.

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

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

11 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

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

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

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

11 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).

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

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

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

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

* tests/synclines.at: here.

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

11 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).

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

11 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

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

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

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

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

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

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

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

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

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

11 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
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

11 years agonews: improve the carets example and fix a typo
Theophile Ranquet [Fri, 7 Dec 2012 10:57:19 +0000 (11:57 +0100)]
news: improve the carets example and fix a typo

* NEWS: Here.

11 years agocpp: improve the Flex version checking macro
Theophile Ranquet [Thu, 6 Dec 2012 12:21:36 +0000 (13:21 +0100)]
cpp: improve the Flex version checking macro

* src/flex-scanner.h (FLEX_VERSION): Here.

11 years agocarets: improve the code
Theophile Ranquet [Thu, 6 Dec 2012 12:17:55 +0000 (13:17 +0100)]
carets: improve the code

* src/location.c: Remove duplicate documentations.
(caret_info): Stylistic change.
(location_caret): Many reworks.

11 years agomaint: update news
Akim Demaille [Fri, 7 Dec 2012 09:40:31 +0000 (10:40 +0100)]
maint: update news

* NEWS: There is no 2.6.6, remove its stub.

11 years agobuild: keep -Wmissing-declarations and -Wmissing-prototypes for modern GCCs
Akim Demaille [Fri, 7 Dec 2012 08:58:40 +0000 (09:58 +0100)]
build: keep -Wmissing-declarations and -Wmissing-prototypes for modern GCCs

Fixes a -Werror failure of xalloc.h used in src.
From Eric Blake.
http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00006.html

* configure.ac: Check whether GCC pragma diagnostic push/pop works.
Enable these warnings for bison if it does.
Enable these warnings for the test suite anyway.

11 years agobuild: drop -Wcast-qual
Akim Demaille [Fri, 7 Dec 2012 08:48:41 +0000 (09:48 +0100)]
build: drop -Wcast-qual

Suggested by Jim Meyering.
http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00017.html
* configure.ac (warn_common): Remove -Wcast-qual.

11 years agognulib: update
Akim Demaille [Wed, 5 Dec 2012 15:16:17 +0000 (16:16 +0100)]
gnulib: update

11 years agoMerge remote-tracking branch 'origin/maint'
Theophile Ranquet [Thu, 6 Dec 2012 10:43:02 +0000 (11:43 +0100)]
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  misc: pacify the Tiny C Compiler
  cpp: make the check of Flex version portable
  misc: require getline
  c++: support wide strings for file names
  doc: document carets
  tests: enhance existing tests with carets
  errors: show carets
  getargs: add support for --flags/-f

Conflicts:
doc/bison.texi
m4/.gitignore
src/complain.c
src/flex-scanner.h
src/getargs.c
src/getargs.h
src/gram.c
src/main.c
tests/headers.at

11 years agomisc: pacify the Tiny C Compiler
Theophile Ranquet [Thu, 6 Dec 2012 09:49:12 +0000 (10:49 +0100)]
misc: pacify the Tiny C Compiler

* src/graphviz.c (conclude_red): Remove a useless return.

11 years agocpp: make the check of Flex version portable
Theophile Ranquet [Wed, 5 Dec 2012 17:26:36 +0000 (18:26 +0100)]
cpp: make the check of Flex version portable

This was problematic with tcc 0.9.25

* src/flex-scanner.h (FLEX_VERSION_GT): Rewrite and rename as...
(FLEX_VERSION): This.

11 years agomisc: require getline
Theophile Ranquet [Wed, 5 Dec 2012 14:27:25 +0000 (15:27 +0100)]
misc: require getline

* bootstrap.conf: Here, used by src/location.c.
* src/getargs.c (long_options): Rename --flags to --feature.

11 years agoc++: support wide strings for file names
Akim Demaille [Wed, 5 Dec 2012 10:21:21 +0000 (11:21 +0100)]
c++: support wide strings for file names

Reported by Mark Boyall.
http://lists.gnu.org/archive/html/help-bison/2011-08/msg00002.html

* data/location.cc (operator<<): Be templated on the type of
output stream.
* tests/headers.at (Several parsers): Adjust.

11 years agodoc: document carets
Theophile Ranquet [Tue, 4 Dec 2012 12:12:12 +0000 (13:12 +0100)]
doc: document carets

* NEWS: Announce it.
* doc/bison.texi (Bison Options):  Here.

11 years agotests: enhance existing tests with carets
Theophile Ranquet [Mon, 3 Dec 2012 10:12:07 +0000 (11:12 +0100)]
tests: enhance existing tests with carets

* tests/actions.at: Unset value.
* tests/conflicts.at: Rule useless due to conflicts.
* tests/input.at: Missing terminator, unexpected end of file, command line
redefinition of variable.
* tests/named-refs.at: Many errors.
* tests/reduce.at: Useless nonterminals and rules.
* tests/regression.at: Large token.

11 years agoerrors: show carets
Theophile Ranquet [Fri, 30 Nov 2012 13:34:56 +0000 (14:34 +0100)]
errors: show carets

* src/locations.c (caret_info): New, persistant information useful
for...
(location_caret): New, print a caret.
(cleanup_caret): Release caret_info cleanly, call it...
* src/main.c (main): Here.
* src/complain.c (error_message): Call location_caret here.

11 years agogetargs: add support for --flags/-f
Theophile Ranquet [Fri, 30 Nov 2012 13:33:05 +0000 (14:33 +0100)]
getargs: add support for --flags/-f

Introduce -fdiagnostics-show-caret

* src/getargs.c (flag_flag): New global.
* src/getargs.h (flag): New enum.

11 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Wed, 5 Dec 2012 10:03:08 +0000 (11:03 +0100)]
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  getargs: don't label --language/-l as experimental
  getargs: fix the locations of command-line input
  errors: indent missing action code semicolon warning

Conflicts:
NEWS
src/scan-code.l
tests/actions.at

11 years agogetargs: don't label --language/-l as experimental
Theophile Ranquet [Fri, 30 Nov 2012 14:27:54 +0000 (15:27 +0100)]
getargs: don't label --language/-l as experimental

* NEWS: Announce it.
* doc/bison.texi, src/getargs.c (usage): Here.

11 years agotests: minor improvements
Akim Demaille [Mon, 3 Dec 2012 16:27:54 +0000 (17:27 +0100)]
tests: minor improvements

* tests/calc.at (AT_CHECK_SPACES): To speed up, accept several files
at once, and factor some calls.

11 years agogetargs: fix the locations of command-line input
Theophile Ranquet [Mon, 12 Mar 2012 09:01:09 +0000 (10:01 +0100)]
getargs: fix the locations of command-line input

* src/getargs.c (command_line_location): Here.
* tests/input.at: Adjust.

11 years agoerrors: indent missing action code semicolon warning
Theophile Ranquet [Thu, 15 Nov 2012 12:02:40 +0000 (12:02 +0000)]
errors: indent missing action code semicolon warning

Also, remove a duplicate #define.

* src/scan-code.l (SC_RULE_ACTION): Here.
* tests/actions.at: Adjust.

11 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Mon, 3 Dec 2012 15:27:23 +0000 (16:27 +0100)]
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  parser: accept #line NUM
  m4: use a safer pattern to enable/disable output
  tests: beware of gnulib's need for config.h
  gnulib: update
  yacc.c, glr.c: check and fix the display of locations
  formatting changes
  glr.c: remove stray macro

Conflicts:
data/c.m4
data/glr.cc
data/lalr1.cc
data/lalr1.java
data/location.cc
data/stack.hh
data/yacc.c
src/scan-gram.l

11 years agoparser: accept #line NUM
Akim Demaille [Mon, 3 Dec 2012 14:59:57 +0000 (15:59 +0100)]
parser: accept #line NUM

* src/scan-gram.l (scanner): Accept '#line NUM'.
(handle_syncline): Adjust to the possible missing file name.

11 years agom4: use a safer pattern to enable/disable output
Akim Demaille [Mon, 3 Dec 2012 14:29:44 +0000 (15:29 +0100)]
m4: use a safer pattern to enable/disable output

Work on some other areas of Bison revealed that some macros expanded
to be expanded only once were actually expanded several times.  This
was due to the fact that changecom was not properly restored each
time, and macro names appearing in comments were then expanded.

Introduce begin/end macros which are easier to match that
changecom()/changecom(#).

* data/bison.m4 (b4_output_begin, b4_output_end): New.
* data/glr.c, data/glr.cc, data/lalr1.cc, data/lalr1.java,
* data/location.cc, data/stack.hh, data/yacc.c:
Use them.

11 years agotests: beware of gnulib's need for config.h
Akim Demaille [Mon, 3 Dec 2012 14:43:57 +0000 (15:43 +0100)]
tests: beware of gnulib's need for config.h

* tests/skeletons.at, tests/torture.at: Be sure to include config.h
where appropriate.

11 years agognulib: update
Akim Demaille [Fri, 30 Nov 2012 11:17:10 +0000 (12:17 +0100)]
gnulib: update

* lib/yyerror.c: Include config.h since the following stdio.h might be
from gnulib.

11 years agoyacc.c, glr.c: check and fix the display of locations
Akim Demaille [Fri, 30 Nov 2012 10:19:43 +0000 (11:19 +0100)]
yacc.c, glr.c: check and fix the display of locations

In some case, negative column number could be displayed.
Make YY_LOCATION_PRINT similar to bison's own implementation of
locations.  Since the macro is getting fat, make it a static
function.
Reported by Jonathan Fabrizio.

* data/c.m4 (yy_location_print_define): Improve the implementation,
and generate the yy_location_print_ function.
Adjust YY_LOCATION_PRINT.
* tests/actions.at (Location Print): New tests.

11 years agoformatting changes
Akim Demaille [Fri, 30 Nov 2012 10:19:33 +0000 (11:19 +0100)]
formatting changes

* data/c.m4: Fix comments, put macros in a more natural order.
Space changes (from M-x whitespace-cleanup).
* src/location.c: Fix spaces.
* tests/actions.at: Space changes.

11 years agoglr.c: remove stray macro
Akim Demaille [Fri, 30 Nov 2012 10:15:12 +0000 (11:15 +0100)]
glr.c: remove stray macro

* data/glr.c (YYOPTIONAL_LOC): Remove, unused since commit
769a8ef9bcb5e14d0be9d0869f5dca20ab093930.

11 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Thu, 29 Nov 2012 13:54:37 +0000 (14:54 +0100)]
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  doc: minor fixes
  doc: improve the index
  doc: introduce api.pure full, rearrange some examples
  yacc.c: support "%define api.pure full"
  local.at: improvements

Conflicts:
NEWS
data/yacc.c
doc/bison.texi
tests/calc.at

11 years agodoc: minor fixes
Akim Demaille [Thu, 29 Nov 2012 13:35:48 +0000 (14:35 +0100)]
doc: minor fixes

* doc/bison.texi: Use stderr for error messages.
Meta-variables are usually spelled in lower case.
Use @code for function names.

11 years agodoc: improve the index
Akim Demaille [Thu, 29 Nov 2012 13:09:34 +0000 (14:09 +0100)]
doc: improve the index

* doc/bison.texi: Fix uses of "deffn" so that the arguments of the
directives do not show in the index.
Remove a duplicate entry for api.pure.

11 years agodoc: introduce api.pure full, rearrange some examples
Theophile Ranquet [Mon, 26 Nov 2012 17:17:15 +0000 (18:17 +0100)]
doc: introduce api.pure full, rearrange some examples

* NEWS: Add entry.
* doc/bison.texi (%define Summary): Show the old Yacc behaviour.
(Parser Function): Move parse-param examples here.
(Pure Calling): Remove parse-param examples.
(Error Reporting): Don't show the old behavior, stick to 'full'.

11 years agoyacc.c: support "%define api.pure full"
Theophile Ranquet [Fri, 23 Nov 2012 17:30:47 +0000 (17:30 +0000)]
yacc.c: support "%define api.pure full"

This makes the interface for yyerror() pure without the need for a spurious
parse_param.

* data/yacc.c (b4_pure_if, b4_pure_flag): New definition, accept three states.
(b4_yacc_pure_if): Rename as...
(b4_yyerror_arg_loc_if): This, and use b4_pure_flag.
* tests/actions.at (%define api.pure): Modernize.
* test/calc.at (Simple LALR Calculator): Modernize.
* tests/local.at (AT_YYERROR_ARG_LOC_IF): Adjust.

11 years agotests: check variants without locations
Akim Demaille [Wed, 28 Nov 2012 09:51:45 +0000 (10:51 +0100)]
tests: check variants without locations

* tests/c++.at (Variants): Support non-use of locations, and
check its support.

11 years agolocal.at: improvements
Theophile Ranquet [Fri, 23 Nov 2012 16:23:27 +0000 (16:23 +0000)]
local.at: improvements

* tests/local.at (AT_YYERROR_FORMALS): Make llocp const.
(AT_PURE_AND_LOC_IF, AT_GLR_OR_PARAM_IF): Remove, expand...
(AT_YYERROR_ARG_LOC_IF): Here, and use m4_join for readability.

11 years agotests: use -fno-strict-aliasing with variants
Akim Demaille [Mon, 26 Nov 2012 09:42:49 +0000 (10:42 +0100)]
tests: use -fno-strict-aliasing with variants

Reported by Théophile Ranquet.

* configure.ac (NO_STRICT_ALIAS_CXXFLAGS): New.
* tests/c++.at, tests/atlocal.in, examples/local.mk: Use it.

11 years agotests: remove leftover
Akim Demaille [Mon, 26 Nov 2012 09:42:43 +0000 (10:42 +0100)]
tests: remove leftover

* tests/atlocal.in: Remove duplicate handling of --compile-c-with-cxx.

11 years agodoc: use %precedence instead of nonassoc when associativity is not wanted
Akim Demaille [Mon, 26 Nov 2012 08:49:23 +0000 (09:49 +0100)]
doc: use %precedence instead of nonassoc when associativity is not wanted

* doc/bison.texi: here.
Formatting changes in some grammars.
Fix a %prec into %precedence.

11 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Mon, 26 Nov 2012 08:14:51 +0000 (09:14 +0100)]
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  yacc.c: always initialize yylloc
  scanner: issue a single error for groups of invalid characters
  tests: formatting changes
  doc: one of the fixes for an ambiguous grammar was ambiguous too
  doc: fix the dangling else with precedence directives
  doc: prefer "token" to TOKEN
  doc: formatting changes
  scanner: use explicit "ignore" statements

Conflicts:
src/scan-gram.l

11 years agoMerge remote-tracking branch 'origin/branch-2.6' into maint
Akim Demaille [Mon, 26 Nov 2012 08:05:28 +0000 (09:05 +0100)]
Merge remote-tracking branch 'origin/branch-2.6' into maint

* origin/branch-2.6:
  yacc.c: always initialize yylloc
  doc: one of the fixes for an ambiguous grammar was ambiguous too
  doc: fix the dangling else with precedence directives
  doc: prefer "token" to TOKEN
  doc: formatting changes

Conflicts:
NEWS
doc/bison.texi

11 years agoyacc.c: always initialize yylloc
Theophile Ranquet [Mon, 19 Nov 2012 10:43:56 +0000 (10:43 +0000)]
yacc.c: always initialize yylloc

The initial location might be used if the parser starts by an empty
reduction, so really ensure proper initialization of the initial
location.  The previous approach fails for PostgreSQL, which uses
Reported by Peter Eisentraut.
http://lists.gnu.org/archive/html/bug-bison/2012-11/msg00023.html
With help from Théophile Ranquet.

* data/yacc.c (b4_declare_scanner_communication_variables): Be sure
to initialize yylloc, even when its structure is unknown.
(yyparse): Simplify the call to b4_dollar_pushdef.
* tests/actions.at (Initial location): Check of similar pattern
as in the case of PostgreSQL.

11 years agoscanner: issue a single error for groups of invalid characters
Akim Demaille [Fri, 23 Nov 2012 10:21:47 +0000 (11:21 +0100)]
scanner: issue a single error for groups of invalid characters

* src/scan-gram.l: Scan groups of invalid characters together.
* tests/input.at, tests/named-refs.at: Adjust.

11 years agotests: formatting changes
Akim Demaille [Fri, 23 Nov 2012 09:11:50 +0000 (10:11 +0100)]
tests: formatting changes

* tests/named-refs.at: Here.

11 years agodoc: one of the fixes for an ambiguous grammar was ambiguous too
Akim Demaille [Thu, 22 Nov 2012 14:49:18 +0000 (15:49 +0100)]
doc: one of the fixes for an ambiguous grammar was ambiguous too

Reported by Аскар Сафин.
http://lists.gnu.org/archive/html/bug-bison/2012-11/msg00024.html

* doc/bison.texi (Reduce/Reduce): Fix the resulting ambiguity using
precedence/associativity directives.

11 years agodoc: fix the dangling else with precedence directives
Akim Demaille [Thu, 22 Nov 2012 14:16:07 +0000 (15:16 +0100)]
doc: fix the dangling else with precedence directives

* doc/bison.texi (Non Operators): New node.
(Shift/Reduce): Point to it.
Don't promote "%expect n" too much.

11 years agodoc: prefer "token" to TOKEN
Akim Demaille [Thu, 22 Nov 2012 14:12:24 +0000 (15:12 +0100)]
doc: prefer "token" to TOKEN

This is more readable in short examples.

* doc/bison.texi (Shift/Reduce): here.
Make "win" and "lose" action more alike.

11 years agodoc: formatting changes
Akim Demaille [Thu, 22 Nov 2012 13:24:54 +0000 (14:24 +0100)]
doc: formatting changes

* doc/bison.texi: Use @group.

11 years agoscanner: use explicit "ignore" statements
Akim Demaille [Wed, 14 Nov 2012 09:57:45 +0000 (10:57 +0100)]
scanner: use explicit "ignore" statements

* src/scan-gram.l: here.