970 Commits

Author SHA1 Message Date
Paul Eggert
39c1239ed5 doc: improve yacc man page fonts
Problem reported by Helge Kreutzmann in:
https://lists.gnu.org/r/bug-bison/2025-12/msg00000.html
* doc/yacc.1.in: Fix fonts.
2026-01-18 10:16:18 -08:00
Paul Eggert
dcf16ff191 maint: make update-copyright 2026-01-18 09:45:29 -08:00
Paul Eggert
c6d1f65185 doc: improve man page (mostly fonts)
Problems reported by Helge Kreutzmann in:
https://lists.gnu.org/r/bug-bison/2026-01/msg00000.html
* doc/bison.x: Refontify, mostly.
* src/getargs.c (usage): Clarify usage message.
2026-01-18 09:39:28 -08:00
Paul Eggert
4ff0741f58 maint: make update-copyright 2025-03-17 17:48:06 -07:00
Paul Eggert
3ad31c23f1 doc: pacify texinfo 7.1
* doc/bison.texi: Don’t put @anchor inside @item,
as texinfo 7.1 complains.
2025-03-13 13:39:45 -07:00
Akim Demaille
c025891547 cex: provide the user with a means to change the timeout
Reported by Frank Heckenbach.
https://lists.gnu.org/r/bug-bison/2022-07/msg00011.html

* bootstrap.conf: Use c_strtod, so that even in French locales "1.5"
is accepted, instead of "1,5".
* src/counterexample.c, src/state-item.c: Use xtime_t instead of
time_t, so that accuracy goes from seconds to nanoseconds.
( counterexample_init): Depend on cex.timeout rather than
$TIME_LIMIT.
* doc/bison.texi (%define Summary): Document cex.timeout.
2022-09-16 06:03:28 +02:00
Akim Demaille
15b97a0a6a doc: define the syntax of named references
Reported by Arthur Schwarz.
https://lists.gnu.org/r/help-bison/2022-06/msg00007.html

* doc/bison.texi (Named References): Define the syntax of named
references.
2022-09-12 07:24:21 +02:00
Akim Demaille
374cf8bbaf doc: fix the description of the syntax of %token and %left
Reported by Frank Heckenbach.
https://lists.gnu.org/r/bug-bison/2022-07/msg00007.html

* doc/bison.texi (Symbol Decls): here.
2022-09-10 14:48:24 +02:00
Paul Eggert
6d58f297cc maint: don’t use \] in BREs and EREs
* .travis.yml (jobs):
* doc/local.mk ($(top_srcdir)/%D%/bison.help):
* tests/regression.at (Web2c Actions, Useless Tokens):
* tests/scanner.at (Token numbers: $1):
Use plain ], not \], in a POSIX regular expression,
as POSIX says the interpretation of \] is undefined.
2022-07-31 13:28:52 -07:00
Paul Eggert
4e89da6e5d maint: don’t get fdl.texi from Gnulib
This reverses the 2012-01-13T09:39:45Tmeyering@redhat.com patch,
as Gnulib’s fdl.texi module now says “Don't use this module!”
* bootstrap.conf (gnulib_modules): Remove fdl.
* doc/.gitignore: Don’t ignore fdl.texi.
* doc/fdl.texi: New file, copied from Gnulib.
2022-07-31 12:00:28 -07:00
Akim Demaille
6ee1494d6e doc: explain why location's "column" are defined vaguely
Suuggested by Frank Heckenbach.
<https://lists.gnu.org/r/bug-bison/2022-01/msg00000.html>

* doc/bison.texi (Location Type): Explain why location's "column" are
defined vaguely.
Show tab handling in ltcalc and calc++.
* examples/c/bistromathic/parse.y: Show tab handling.
* examples/c++/calc++/calc++.test,
* examples/c/bistromathic/bistromathic.test:
Check tab handling.
2022-06-15 07:55:13 +02:00
Paul Eggert
8b96c82b05 doc: improve calling-convention doc
* doc/bison.texi (Calling Convention, Error Reporting Function):
Suggest ‘%code provides’ to declare yylex and yyerror.
Prompted by this email thread:
https://lists.gnu.org/r/bug-bison/2022-01/msg00002.html
2022-01-15 11:16:30 -08:00
Paul Eggert
07e18e7fb4 package: bump copyrights to 2022
Run "make update-copyright".
2022-01-15 11:16:30 -08:00
Akim Demaille
f8e8f57e9f doc: add indexes
* doc/bison.texi (Special Tokens): here.
2021-12-19 16:41:05 +01:00
Akim Demaille
c83425ef4e tests: address portability issues about strdup
Reported by Dennis Clarke
<https://lists.gnu.org/r/bug-bison/2021-10/msg00005.html>.
In particular
<https://lists.gnu.org/r/bug-bison/2021-10/msg00023.html>.

* doc/bison.texi, examples/c/glr/c++-types.y,
* examples/c/bistromathic/parse.y tests/testsuite.h:
Define _XOPEN_SOURCE to 600, to get a strdup that works on Solaris.

* tests/glr-regression.at: Use strdup freely.
2021-11-06 09:00:58 +01:00
Akim Demaille
5d9ccd5a87 yacc: declare yyerror/yylex only when POSIXLY_CORRECT
The recent changes to comply with POSIX are breaking Automake's test
suite.
Reported by Kiyoshi Kanazawa.
<https://lists.gnu.org/r/bug-bison/2021-09/msg00005.html>

To limit the impact of POSIX changes, bind them to $POSIXLY_CORRECT.
Suggested by Karl Berry.
<https://lists.gnu.org/r/bug-bison/2021-09/msg00009.html>

The existing `maintainer-check-posix` Make target checks these
changes.

* src/getargs.h, src/getargs.c (set_yacc): New.
Use it.
* data/skeletons/bison.m4 (b4_posix_if): New.
* data/skeletons/yacc.c (b4_declare_yyerror_and_yylex): Use it.
* doc/bison.texi, tests/local.at: Adjust.
2021-09-11 08:26:10 +02:00
Akim Demaille
a7ded4284e style: rename stmtMerge as stmt_merge
Follow the GNU Coding Style.

* doc/bison.texi, examples/c++/glr/c++-types.yy,
* examples/c/glr/c++-types.y, tests/cxx-type.at: s/stmtMerge/stmt_merge/g.
2021-08-29 16:25:38 +02:00
Akim Demaille
3c5f73fe51 yacc: comply with recent POSIX updates: declare yyerror and yylex
In POSIX Yacc mode, declare yyerror and yylex unless already #defined,
or if YYERROR_IS_DECLARED/YYLEX_IS_DECLARED are defined (for
consistency with Bison's YYSTYPE_IS_DECLARED/YYLTYPE_IS_DECLARED).
See <https://austingroupbugs.net/view.php?id=1388#c5220>.

* data/skeletons/c.m4 (b4_function_declare): Resurect.
(b4_lex_formals): Since we will possibly expose this prototype
in the header, take the prefix into account.
* data/skeletons/yacc.c (b4_declare_yyerror_and_yylex): New.
(b4_shared_declarations): Use it.

* tests/local.at (AT_YACC_IF): New.
When in Yacc mode, set the `yacc` Autotest keyword.
(AT_YYERROR_DECLARE(c)): Don't declare in Yacc mode,
to avoid clashes (since this signature is static).
(AT_YYERROR_DEFINE(c)): Don't define as static in Yacc mode.
* tests/regression.at (Early token definitions with --yacc): Specify
that we are in Yacc mode.
2021-08-09 07:17:19 +02:00
Akim Demaille
a83202a436 doc: avoid #define YYDEBUG in C++
* doc/bison.texi (Enabling Traces): here.
2021-08-07 07:57:58 +02:00
Akim Demaille
d4b195ece6 doc: more pointers to the examples
* doc/bison.texi (Infix Calc): Here.
2021-08-06 18:02:23 +02:00
Akim Demaille
93f9e527ca doc: refer to the examples
* doc/bison.texi: Point to rpcalc, mfcalc, simple.y, calc++, c/glr and
c++/glr.
2021-08-04 21:36:41 +02:00
Akim Demaille
413d318940 doc: glr: document typed mergers
See <https://lists.gnu.org/r/help-bison/2020-12/msg00016.html>.

* doc/bison.texi (Merging GLR Parses): document typed mergers.
And avoid #define YYSTYPE.
2021-08-04 09:14:49 +02:00
Akim Demaille
b293d4fbca doc: fix spello
* doc/bison.texi (Multiple start-symbols): here.
2021-08-03 12:22:52 +02:00
Akim Demaille
98823ea402 doc: update Doxygen template file
* doc/Doxyfile.in: here.
2021-08-03 09:04:15 +02:00
Akim Demaille
ad40c80a03 doc: a bit of editing
* doc/bison.texi: Use @samp{...}, not "..." for pieces of code.
Use @samp{...}, not @command{...} for command lines.
Promote %header/--header over %defines/--defines.
Spellcheck.
2021-08-03 08:57:35 +02:00
Akim Demaille
5325292e5d d: minor clean up
* doc/bison.texi: Use @samp, not "...", around pieces of code.
* examples/d/calc/calc.y: Don't promote %union.
2021-07-25 18:21:12 +02:00
Adela Vais
7eee2ccbd2 d: update documentation
* doc/bison.texi: Various fixes.
(D Push Parser Interface, D Complete Symbols): New sections.
2021-04-11 07:57:50 +02:00
Joshua Watt
f08110cb50 doc: fix documented function name
* data/README.md: Fix the name of a referenced function to match the
name in code.
2021-02-25 06:55:22 +01:00
Akim Demaille
2d1d2f87f9 doc: printing locations
Document YYLOCATION_PRINT.

* doc/bison.texi (Printing Locations): New node.
2021-02-09 07:05:08 +01:00
Akim Demaille
d50a3e450e graph: output foo.gv by default, instead of *.dot
That change was started in Bison 3.4.  The announcement for 3.7 stated
that in Bison 3.8 we would use *.gv by default.

* src/files.c (compute_output_file_names): spec_graph_file defaults
too *.gv.
* doc/bison.texi, examples/c++/calc++/local.mk, tests/output.at:
Adjust.
2021-02-02 06:51:39 +01:00
Akim Demaille
1efe31185f yacc: remove support for YYPRINT
Its removal was annonced several times in NEWS (for Bison 3.5, 3.6, 3.7).

* data/skeletons/c.m4, data/skeletons/yacc.c: Remove support for YYPRINT.
* NEWS: Fix the mess introduced by the merge.
Document the removal of YYPRINT.
* doc/bison.texi (The YYPRINT Macro): Remove.
2021-02-01 06:51:15 +01:00
Akim Demaille
dc8fe0678a c++: make it clear that #define YYSTYPE is not supported
We have been accepting this for years, but it is deprecated: people
are expecting to define api.value.type instead.

* doc/bison.texi: Make it clear that YYSTYPE and YYLTYPE are for C
only.
2021-02-01 05:54:06 +01:00
Paul Eggert
b4582f1918 Update URLs to prefer https: to http:
Also, fix a few http: URLs that were no longer working.
2021-01-29 13:48:43 -08:00
Akim Demaille
d7e8aaa271 package: bump copyrights to 2021
Run 'make update-copyright'.
2021-01-16 16:11:17 +01:00
Akim Demaille
17fb1d0377 c: add support for YYNOMEM
Suggested by Joe Nelson <joe@begriffs.com>.
https://lists.gnu.org/r/help-bison/2020-12/msg00020.html

* data/skeletons/glr.c, data/skeletons/yacc.c (YYNOMEM): New.
Use it.
(yyexhaustedlab): Rename as...
(yynomemlab): this.
* tests/calc.at: Check it.
* doc/bison.texi: Document it.
Fix incorrect statements about non-existing constants for YYERROR etc.
2021-01-16 09:37:09 +01:00
Akim Demaille
a9f9f317b5 doc: spell check
Gettext uses "catalog", not "catalogue".

* doc/bison.texi, examples/c/README.md,
* examples/c/bistromathic/Makefile,
* examples/c/bistromathic/README.md,
* examples/c/bistromathic/parse.y:
Spell check.
2021-01-16 09:37:09 +01:00
Adela Vais
c13b3c02d3 d: remove support for parse.error verbose
Without the history, D should not support this option. Before the
removal, 'detailed' and 'verbose' options generated the same code.

* data/skeletons/lalr1.d: Here.
* doc/bison.texi: Adapt tests to use 'detailed' instead of 'verbose'.
* tests/calc.at: Document it.
2021-01-07 18:51:48 +01:00
Adela Vais
594cae57ca d: add internationalisation support
The D parser implements this feature similarly to the C parser,
by using Gettext. Functions gettext() and dgettext() are
imported using extern(C). The internationalisation uses yysymbol_name
to report the name of the SymbolKinds.

* data/skeletons/d.m4 (SymbolKind.toString.yytranslatable,
SymbolKind.toString.yysymbol_name: New), data/skeletons/lalr1.d: Here.
* doc/bison.texi: Document it.
* tests/calc.at: Test it.
2021-01-06 18:33:41 +01:00
Akim Demaille
8733959954 c++: I'm tired of Flex's warnings
* doc/bison.texi: Disable another warning I'm tired to see.
New releases would be most welcome.
2021-01-03 20:11:48 +01:00
Akim Demaille
2157ced3dd c++: rename semantic_type as value_type
We always refer to the triplet "kind, value, location".  All of them
are nouns, and we support api.value.type and api.location.type.  On
this regard, "semantic_type" was a poor choice.  Make it "value_type".

The test suite was not updated to use value_type, on purpose, to
enforce backward compatibility.

* data/skeletons/c++.m4, data/skeletons/glr.cc, data/skeletons/glr2.cc,
* data/skeletons/variant.hh, doc/bison.texi: Define value_type rather
than semantic_type.
Add a backward compatibility typedef.
* examples/c++/glr/c++-types.yy: Migrate.
2020-12-26 09:05:45 +01:00
Adela Vais
32bb53870b d: remove unnecessary methods from the Lexer interface
The complete symbol approach in yylex removes the need for the methods
semanticVal, startPos and endPos, which were used when the values were
reported separately.

* data/skeletons/lalr1.d: Here.
* doc/bison.texi: Remove sections about the three methods.
* examples/d/calc/calc.y, examples/d/simple/calc.y: Remove the unused methods.
* tests/calc.at, tests/d.at, tests/scanner.at: Test it.
2020-12-21 15:53:32 +01:00
Adela Vais
20d657c1dd d: create alias Position for YYPosition
* data/skeletons/d.m4 (b4_public_types_declare): Here.
* data/skeletons/lalr1.d: Adjust.
* doc/bison.texi: Document it.
* examples/d/calc/calc.y: Use it.
* tests/calc.at: Test it.
2020-12-21 07:16:25 +01:00
Adela Vais
8e44b24ba8 d: create alias Location for YYLocation
* data/skeletons/d.m4: Here.
* doc/bison.texi: Document it.
* examples/d/calc/calc.y: Adjust.
* tests/calc.at: Test it.
2020-12-21 07:13:17 +01:00
Adela Vais
13bb2b78b3 d: create alias Symbol for YYParse.Symbol
* data/skeletons/lalr1.d: Here.
* doc/bison.texi: Document it.
* examples/d/calc/calc.y, examples/d/simple/calc.y: Adjust.
* tests/calc.at, tests/d.at, tests/scanner.at: Test it.
2020-12-21 06:47:57 +01:00
Adela Vais
e5854bbddd d: change YYLocation's type from class to struct
This avoids heap allocation and gives minimal costs for the
creation and destruction of the YYParser.Symbol struct if
the location tracking is active.

Suggested by H. S. Teoh.

* data/skeletons/lalr1.d: Here.
* doc/bison.texi: Document it.
* examples/d/calc/calc.y: Adjust.
* tests/calc.at: Test it.
2020-11-20 22:09:31 +01:00
Adela Vais
10305f3e94 d: change the return value of yylex from TokenKind to YYParser.Symbol
The complete symbol approach was deemed to be the right approach for Dlang.
Now, the user can return from yylex() an instance of YYParser.Symbol structure,
which binds together the TokenKind, the semantic value and the location. Before,
the last two were reported separately to the parser.
Only the user API is changed, Bisons's internal structure is kept the same.

* data/skeletons/d.m4 (struct YYParser.Symbol): New.
* data/skeletons/lalr1.d: Change the return value.
* doc/bison.texi: Document it.
* examples/d/calc/calc.y, examples/d/simple/calc.y: Demonstrate it.
* tests/calc.at, tests/scanner.at: Test it.
2020-11-20 22:09:31 +01:00
Akim Demaille
336089123f gnulib: update
* Makefile.am (gitsort): New.
Use it.
2020-11-20 06:28:42 +01:00
Adela Vais
593724366f d: add support for lookahead correction
When using lookahead correction, the method YYParser.Context.getExpectedTokens
is not annotated with const, because the method calls yylacCheck, which is not
const. Also, because of yylacStack and yylacEstablished, yylacCheck needs to
be called from the context of the parser class, which is sent as parameter to
the Context's constructor.

* data/skeletons/lalr1.d (yylacCheck, yylacEstablish, yylacDiscard,
yylacStack, yylacEstablished): New.
(Context): Use it.
* doc/bison.texi: Document it.
* tests/calc.at: Check it.
2020-11-18 08:14:43 +01:00
Adela Vais
0e51f6146a d: change the name of the custom error message function to reportSyntaxError
Changed from syntax_error to reportSyntaxError to be similar to the Java parser.

* data/skeletons/lalr1.d: Change the function name.
* doc/bison.texi: Document it.
* tests/local.at: Adjust.
2020-11-18 08:14:21 +01:00
Akim Demaille
23472033ee Merge branch 'maint'
* maint:
  c++: shorten the assertions that check whether tokens are correct
  c++: don't glue functions together
  lalr1.cc: YY_ASSERT should use api.prefix
  c++: don't use YY_ASSERT at all if parse.assert is disabled
  c++: style: follow the Bison m4 quoting pattern
  yacc.c: provide the Bison version as an integral macro
  regen
  style: make conversion of version string to int public
  %require: accept version numbers with three parts ("3.7.4")
  yacc.c: fix #definition of YYEMPTY
  gnulib: update
  doc: fix incorrect section title
  doc: minor grammar fixes in counterexamples section
2020-11-13 07:01:19 +01:00