/* Bison Action Scanner -*- C -*-
- Copyright (C) 2006, 2007, 2008-2009 Free Software Foundation, Inc.
+ Copyright (C) 2006-2012 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
/* C style identifier. Must start with letter. Will be used for
named symbol references. Shall be kept synchronized with
scan-gram.l "letter" and "id". */
-letter [-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]
-id {letter}({letter}|[0-9])*
+letter [.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]
+id {letter}({letter}|[-0-9])*
ref -?[0-9]+|{id}|"["{id}"]"|"$"
%%
{splice} STRING_GROW;
[\n\r] STRING_GROW; if (in_cpp) in_cpp = need_semicolon = false;
[ \t\f] STRING_GROW;
- . STRING_GROW; need_semicolon = true;
+
+ /* YYFAIL is undocumented and was formally deprecated in Bison
+ 2.4.2. */
+ YYFAIL {
+ STRING_GROW; need_semicolon = true;
+ warn_at (*loc, _("use of YYFAIL, which is deprecated and will be"
+ " removed"));
+ }
+
+ /* The sole purpose of this is to make sure identifiers that merely
+ contain YYFAIL don't produce the above warning. */
+ [A-Za-z_][0-9A-Za-z_]* STRING_GROW; need_semicolon = true;
+
+ . STRING_GROW; need_semicolon = true;
}
<SC_SYMBOL_ACTION>
complain_at_indent (text_loc, &indent, _("invalid reference: %s"),
quote (text));
indent += SUB_INDENT;
- if (midrule_rhs_index)
+ if (len == 0)
+ {
+ location sym_loc = text_loc;
+ sym_loc.start.column += 1;
+ sym_loc.end = sym_loc.start;
+ const char *format =
+ _("syntax error after `%c', expecting integer, letter,"
+ " `_', `[', or `$'");
+ complain_at_indent (sym_loc, &indent, format, dollar_or_at);
+ }
+ else if (midrule_rhs_index)
{
const char *format =
_("symbol not found in production before $%d: %.*s");