X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/6e30ede87a1c39c53842a6a747ecd9f7484d92a5..5422d56a718805a2470558808355e04182a12d65:/src/scan-code.l diff --git a/src/scan-code.l b/src/scan-code.l index 6cda417d..c13f8805 100644 --- a/src/scan-code.l +++ b/src/scan-code.l @@ -1,7 +1,6 @@ /* Bison Action Scanner -*- C -*- - Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software - Foundation, Inc. + Copyright (C) 2006-2011 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -85,8 +84,8 @@ splice (\\[ \f\t\v]*\n)* /* 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}"]"|"$" %% @@ -621,7 +620,17 @@ parse_ref (char *cp, symbol_list *rule, int rule_length, 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");