mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
skeletons: use "end of file" instead of "$end"
The name "$end" is nice in the report, in particular it avoids that pointed-rules (aka items) be too long. It also helps keeping them "standard". But it is bad in error messages, we should report "end of file" (or maybe "end of input", this is debatable). So, unless the user already defined the alias for the error token herself, make it "end of file". It should even be translated if the user already translated some tokens, so that there is now no strong reason to redefine the $end token. * src/output.c (prepare_symbol_names): Issue "end of file" instead of "$end". * data/skeletons/lalr1.java (yytnamerr_): Remove the renaming hack. * build-aux/update-test: Accept files with names containing a "+", such as c++.at. * tests/actions.at, tests/c++.at, tests/conflicts.at, * tests/glr-regression.at, tests/regression.at, tests/skeletons.at: Adjust.
This commit is contained in:
15
src/output.c
15
src/output.c
@@ -192,6 +192,9 @@ xescape_trigraphs (const char *src)
|
||||
static void
|
||||
prepare_symbol_names (char const *muscle_name)
|
||||
{
|
||||
const bool eof_is_user_defined
|
||||
= !endtoken->alias || STRNEQ (endtoken->alias->tag, "$end");
|
||||
|
||||
/* We assume that the table will be output starting at column 2. */
|
||||
const bool quote = STREQ (muscle_name, "tname");
|
||||
bool has_translations = false;
|
||||
@@ -201,10 +204,16 @@ prepare_symbol_names (char const *muscle_name)
|
||||
set_quoting_flags (qo, QA_SPLIT_TRIGRAPHS);
|
||||
for (int i = 0; i < nsyms; i++)
|
||||
{
|
||||
/* Use "end of file" rather than "$end". But keep "$end" in the
|
||||
reports, it's shorter and more consistent. */
|
||||
const char *tag
|
||||
= !eof_is_user_defined && symbols[i]->content == endtoken->content
|
||||
? "\"end of file\""
|
||||
: symbols[i]->tag;
|
||||
char *cp
|
||||
= symbols[i]->tag[0] == '"' && !quote
|
||||
? xescape_trigraphs (symbols[i]->tag)
|
||||
: quotearg_alloc (symbols[i]->tag, -1, qo);
|
||||
= tag[0] == '"' && !quote
|
||||
? xescape_trigraphs (tag)
|
||||
: quotearg_alloc (tag, -1, qo);
|
||||
/* Width of the next token, including the two quotes, the
|
||||
comma and the space. */
|
||||
int width
|
||||
|
||||
Reference in New Issue
Block a user