Commit Graph

4108 Commits

Author SHA1 Message Date
Theophile Ranquet
9318e335c8 cpp: simplify the Flex version checking macro
* src/flex-scanner,h (FLEX_VERSION): Consider YY_FLEX_SUBMINOR_VERSION
defined.
2012-12-07 12:13:38 +01:00
Theophile Ranquet
fb6040f0a8 news: improve the carets example and fix a typo
* NEWS: Here.
2012-12-07 12:02:00 +01:00
Theophile Ranquet
c49e2f1535 cpp: improve the Flex version checking macro
* src/flex-scanner.h (FLEX_VERSION): Here.
2012-12-07 12:02:00 +01:00
Theophile Ranquet
dbda560400 carets: improve the code
* src/location.c: Remove duplicate documentations.
(caret_info): Stylistic change.
(location_caret): Many reworks.
2012-12-07 12:02:00 +01:00
Akim Demaille
edf9a06f27 maint: update news
* NEWS: There is no 2.6.6, remove its stub.
2012-12-07 10:40:31 +01:00
Akim Demaille
85a2f27fc4 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.
2012-12-07 10:16:47 +01:00
Akim Demaille
28d16d1f7c 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.
2012-12-07 09:48:41 +01:00
Akim Demaille
f72721518b gnulib: update 2012-12-07 09:15:13 +01:00
Theophile Ranquet
9960a6ae75 misc: pacify the Tiny C Compiler
* src/graphviz.c (conclude_red): Remove a useless return.
2012-12-06 10:53:30 +01:00
Theophile Ranquet
b56484a5d3 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.
2012-12-05 19:14:23 +01:00
Theophile Ranquet
e35cd6def7 misc: require getline
* bootstrap.conf: Here, used by src/location.c.
* src/getargs.c (long_options): Rename --flags to --feature.
2012-12-05 15:39:52 +01:00
Akim Demaille
7ae57e2a35 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.
2012-12-05 13:22:21 +01:00
Theophile Ranquet
7bada5355e doc: document carets
* NEWS: Announce it.
* doc/bison.texi (Bison Options):  Here.
2012-12-05 13:46:01 +01:00
Theophile Ranquet
505ece5171 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.
2012-12-05 13:46:01 +01:00
Theophile Ranquet
3f5d1b2c67 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.
2012-12-05 13:46:01 +01:00
Theophile Ranquet
0db2648930 getargs: add support for --flags/-f
Introduce -fdiagnostics-show-caret

* src/getargs.c (flag_flag): New global.
* src/getargs.h (flag): New enum.
2012-12-05 12:10:51 +01:00
Theophile Ranquet
effd30c08d getargs: don't label --language/-l as experimental
* NEWS: Announce it.
* doc/bison.texi, src/getargs.c (usage): Here.
2012-12-04 15:54:43 +01:00
Theophile Ranquet
a37131cc63 getargs: fix the locations of command-line input
* src/getargs.c (command_line_location): Here.
* tests/input.at: Adjust.
2012-12-03 17:21:15 +01:00
Theophile Ranquet
d4e985d587 errors: indent missing action code semicolon warning
Also, remove a duplicate #define.

* src/scan-code.l (SC_RULE_ACTION): Here.
* tests/actions.at: Adjust.
2012-12-03 17:21:15 +01:00
Akim Demaille
03dbf629d5 parser: accept #line NUM
* src/scan-gram.l (scanner): Accept '#line NUM'.
(handle_syncline): Adjust to the possible missing file name.
2012-12-03 15:59:57 +01:00
Akim Demaille
1c7ec959b1 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.
2012-12-03 15:44:40 +01:00
Akim Demaille
6ee95cd0d9 tests: beware of gnulib's need for config.h
* tests/skeletons.at, tests/torture.at: Be sure to include config.h
where appropriate.
2012-12-03 15:44:40 +01:00
Akim Demaille
8aef6e0db5 gnulib: update
* lib/yyerror.c: Include config.h since the following stdio.h might be
from gnulib.
2012-11-30 12:37:34 +01:00
Akim Demaille
3804aa260b 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.
2012-11-30 11:19:43 +01:00
Akim Demaille
4c36bc2b8d 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.
2012-11-30 11:19:33 +01:00
Akim Demaille
5215919366 glr.c: remove stray macro
* data/glr.c (YYOPTIONAL_LOC): Remove, unused since commit
769a8ef9bc.
2012-11-30 11:15:12 +01:00
Akim Demaille
511dd971ba doc: minor fixes
* doc/bison.texi: Use stderr for error messages.
Meta-variables are usually spelled in lower case.
Use @code for function names.
2012-11-29 14:35:48 +01:00
Akim Demaille
371f1b2b7b 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.
2012-11-29 14:09:34 +01:00
Theophile Ranquet
1f1bd57297 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'.
2012-11-29 11:08:58 +01:00
Theophile Ranquet
6428a8a4a5 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.
2012-11-29 11:08:36 +01:00
Theophile Ranquet
dbb998364f 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.
2012-11-26 12:00:14 +00:00
Akim Demaille
c6bf97ccb4 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
2012-11-26 09:05:28 +01:00
Theophile Ranquet
fb4c8a7cb9 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.
2012-11-23 15:44:19 +01:00
Akim Demaille
68ac70bc7b 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.
2012-11-23 11:36:42 +01:00
Akim Demaille
ac7f308c8e tests: formatting changes
* tests/named-refs.at: Here.
2012-11-23 11:31:10 +01:00
Akim Demaille
53e2cd1ebd 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.
2012-11-23 09:47:20 +01:00
Akim Demaille
c28cd5dc5a 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.
2012-11-22 15:58:44 +01:00
Akim Demaille
534cee7ae8 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.
2012-11-22 15:58:43 +01:00
Akim Demaille
51356dd2ad doc: formatting changes
* doc/bison.texi: Use @group.
2012-11-22 14:24:54 +01:00
Akim Demaille
96029914a6 scanner: use explicit "ignore" statements
* src/scan-gram.l: here.
2012-11-14 10:57:45 +01:00
Theophile Ranquet
05c93b7d84 tests: close files in glr-regression
* tests/glr-regression.at: Here.
2012-11-12 16:46:57 +01:00
Theophile Ranquet
be3517b007 xml: match DOT output and xml2dot.xsl processing
Make the DOT produced by XSLT processing equivalent to the one made with the
--graph option.

* data/xslt/xml2dot.xsl: Stylistic changes, and add support for reductions.
* doc/bison.texi (Xml): Update.
* src/graphviz.c (conclude_red): Minor stylistic changes to DOT internals.
(output_red): Swap enabled and disabled reductions output, for coherence
with XSLT output.
* src/print_graph.c (print_core): Minor stylistic change to States' output.
(print_actions): Swap order of output for reductions and transitions.
* tests/local.at (AT_BISON_CHECK_XML): Ignore differences in order.
* tests/output.at: Adjust to changes in DOT internals.
2012-11-12 16:46:55 +01:00
Theophile Ranquet
489b320d4a xml: factor xslt space template
* data/xslt/bison.xsl (space): New, import from...
* data/xslt/xml2text.xsl: Here.
2012-11-12 16:45:09 +01:00
Theophile Ranquet
ccda5c9eac graph: fix a memory leak
* src/graphviz.c (output_red): Here.
2012-11-12 16:45:09 +01:00
Theophile Ranquet
9c16d39944 xml: documentation
The XML output combined with the XSL Transformations provided in data/ are
incredibly useful, they should be documented.

* doc/bison.texi (Xml): New node.
2012-11-12 16:44:54 +01:00
Theophile Ranquet
d42fe46ec3 output: capitalize State
* src/print.c (print_state): Here.
* tests/conflicts.at, tests/existing.at, tests/local.at, tests/reduce.at,
tests/regression.at, tests/sets.at: Adjust.
2012-11-12 10:25:13 +00:00
Akim Demaille
bfdcc3a0b2 maint: address syntax-check errors.
* cfg.mk: Ignore the "error" call in tests/c++.at, it is not to be
translated.
* doc/bison.texi: Fix incorrect @pxref use.
* po/POTFILES.in: Add missing file.
* src/print_graph.c: Remove useless include.
2012-11-12 09:39:41 +01:00
Akim Demaille
ebbc76d0d7 tests: use valgrind where appropriate
Reported by Théophile Ranquet.

* cfg.mk (sc_at_parser_check): New.
* tests/c++.at: Fix use of AT_CHECK vs. AT_PARSER_CHECK.
2012-11-12 09:33:26 +01:00
Akim Demaille
9bf1eca7c9 Merge remote-tracking branch 'origin/branch-2.6' into maint
* origin/branch-2.6:
  tests: use valgrind where appropriate
  tests: don't expect $EGREP to support -w
2012-11-12 09:06:55 +01:00
Akim Demaille
2bb8f621eb tests: use valgrind where appropriate
Reported by Théophile Ranquet.

* tests/glr-regression.at: Rewrite some test cases so that AT_PARSER_CHECK,
which runs valgrind, is exposed with the parser, not with "echo".
* tests/local.at, tests/regression.at, tests/headers.at:
Use AT_PARSER_CHECK for generated parsers.
2012-11-10 09:29:33 +01:00