Akim Demaille 935d119c82 diagnostics: better rule locations
The "identifier and colon" of a rule is implemented as a single token,
but whose location is only that of the identifier (so that messages
about the lhs of a rule are accurate).  When reducing empty rules, the
default location is the single point location on the end of the
previous symbol.  As a consequence, when Bison parses a grammar, the
location of the right-hand side of an empty rule is based on the
lhs, *independently of the position of the colon*.  And the colon can
be way farther, separated by comments, white spaces, including empty
lines.

As a result, some messages look really bad.  For instance:

    $ cat foo.y
    %%
    foo     : /* empty */
    bar
    : /* empty */

gives

    $ bison -Wall foo.y
    foo.y:2.4: warning: empty rule without %empty [-Wempty-rule]
        2 | foo     : /* empty */
          |    ^
    foo.y:3.4: warning: empty rule without %empty [-Wempty-rule]
        3 | bar
          |    ^

The carets are not at the right column, not even the right line.

This commit passes the colon "again" after the "id colon" token, which
gives more accurate locations for these messages:

    $ bison -Wall foo.y
    foo.y:2.10: warning: empty rule without %empty [-Wempty-rule]
        2 | foo     : /* empty */
          |          ^
    foo.y:4.2: warning: empty rule without %empty [-Wempty-rule]
        4 | : /* empty */
          |  ^

* src/scan-gram.l (SC_AFTER_IDENTIFIER): Rollback the colon, so that
we scan it again afterwards.
(INITIAL): Scan colons.
* src/parse-gram.y (COLON): New.
(rules): Parse the colon after the rule's id_colon (and possible
named reference).
* tests/actions.at, tests/conflicts.at, tests/diagnostics.at,
* tests/existing.at: Adjust.
2019-04-24 13:08:51 +02:00
2019-04-12 08:38:30 +02:00
2019-01-05 14:58:05 +01:00
2019-04-23 19:28:08 +02:00
2019-04-24 13:08:51 +02:00
2018-05-19 15:17:28 +02:00
2019-04-24 13:08:51 +02:00
2006-01-22 07:59:51 +00:00
2006-01-22 07:59:51 +00:00
2019-01-05 14:58:05 +01:00
2019-01-12 09:38:57 +01:00
2019-01-18 08:43:06 +01:00
2007-08-15 20:21:33 +00:00
2019-04-24 13:08:51 +02:00
2019-01-05 14:58:05 +01:00
2019-02-12 06:19:10 +01:00
2019-01-05 14:58:05 +01:00
2019-04-23 19:28:08 +02:00

This package contains the GNU Bison parser generator.

* Installation
** Build from git
Here are basic installation instructions for a repository checkout:

    $ git submodules update --init
    $ ./bootstrap

then proceed with the usual 'configure && make' steps.

README-hacking contains more information about building and modifying the
software.

** Build for tarball
See the file INSTALL for generic compilation and installation instructions.

Bison requires GNU m4 1.4.6 or later.  See:

      https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz

** Relocatability
If you pass '--enable-relocatable' to 'configure', Bison is relocatable.

A relocatable program can be moved or copied to a different location on the
file system.  It can also be used through mount points for network sharing.
It is possible to make symlinks to the installed and moved programs, and
invoke them through the symlink.

See "Enabling Relocatability" in the documentation.

** Internationalization
Bison supports two catalogs: one for Bison itself (i.e., for the
maintainer-side parser generation), and one for the generated parsers (i.e.,
for the user-side parser execution).  The requirements between both differ:
bison needs ngettext, the generated parsers do not.  To simplify the build
system, neither are installed if ngettext is not supported, even if
generated parsers could have been localized.  See
http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html for more
details.

* Questions
See the section FAQ in the documentation (doc/bison.info) for frequently
asked questions.  The documentation is also available in PDF and HTML,
provided you have a recent version of Texinfo installed: run "make pdf" or
"make html".

If you have questions about using Bison and the documentation does not
answer them, please send mail to <help-bison@gnu.org>.

* Bug reports
Please send bug reports to <bug-bison@gnu.org>.  Be sure to include the
version number from 'bison --version', and a complete, self-contained test
case in each bug report.

* Copyright statements
For any copyright year range specified as YYYY-ZZZZ in this package, note
that the range specifies every single year in that closed interval.

-----

Local Variables:
mode: outline
fill-column: 76
ispell-dictionary: "american"
End:

Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2019 Free
Software Foundation, Inc.

This file is part of GNU bison, the GNU Compiler Compiler.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

# LocalWords:  parsers ngettext Texinfo pdf html YYYY ZZZZ ispell american
# LocalWords:  MERCHANTABILITY
Description
No description provided
Readme 18 MiB
Languages
C 61%
M4 11.7%
C++ 11.3%
Shell 4.1%
XSLT 3.1%
Other 8.8%