X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/05ac60f348b722ec6157cf57c31d8165466ec3ec..302c0aeeba0264be6031b48540ae4f2108a3d799:/src/scan-gram.l diff --git a/src/scan-gram.l b/src/scan-gram.l index adf97616..3c7d37c4 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -16,14 +16,19 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA */ %option debug nodefault nounput noyywrap never-interactive %option prefix="gram_" outfile="lex.yy.c" %{ +/* Work around a bug in flex 2.5.31. See Debian bug 333231 + . */ +#undef gram_wrap +#define gram_wrap() 1 + #include "system.h" #include @@ -34,6 +39,7 @@ #include "files.h" #include "getargs.h" #include "gram.h" +#include "quotearg.h" #include "reader.h" #include "uniqstr.h" @@ -47,6 +53,19 @@ } \ while (0) +/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */ +int gram_get_lineno (void); +FILE *gram_get_in (void); +FILE *gram_get_out (void); +int gram_get_leng (void); +char *gram_get_text (void); +void gram_set_lineno (int); +void gram_set_in (FILE *); +void gram_set_out (FILE *); +int gram_get_debug (void); +void gram_set_debug (int); +int gram_lex_destroy (void); + /* Location of scanner cursor. */ boundary scanner_cursor; @@ -210,6 +229,7 @@ splice (\\[ \f\t\v]*\n)* "%prec" rule_length--; return PERCENT_PREC; "%printer" token_type = PERCENT_PRINTER; BEGIN SC_PRE_CODE; "%pure"[-_]"parser" return PERCENT_PURE_PARSER; + "%require" return PERCENT_REQUIRE; "%right" return PERCENT_RIGHT; "%skeleton" return PERCENT_SKELETON; "%start" return PERCENT_START; @@ -249,7 +269,7 @@ splice (\\[ \f\t\v]*\n)* "'" STRING_GROW; token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER; /* Strings. */ - "\"" STRING_GROW; token_start = loc->start; BEGIN SC_ESCAPED_STRING; + "\"" token_start = loc->start; BEGIN SC_ESCAPED_STRING; /* Prologue. */ "%{" code_start = loc->start; BEGIN SC_PROLOGUE; @@ -360,7 +380,6 @@ splice (\\[ \f\t\v]*\n)* { "\"" { - STRING_GROW; STRING_FINISH; loc->start = token_start; val->chars = last_string; @@ -384,7 +403,9 @@ splice (\\[ \f\t\v]*\n)* STRING_GROW; STRING_FINISH; loc->start = token_start; - val->symbol = symbol_get (last_string, *loc); + val->symbol = symbol_get (quotearg_style (escape_quoting_style, + last_string), + *loc); symbol_class_set (val->symbol, token_sym, *loc); last_string_1 = last_string[1]; symbol_user_token_number_set (val->symbol, last_string_1, *loc); @@ -534,7 +555,7 @@ splice (\\[ \f\t\v]*\n)* } else { - complain_at (*loc, _("missing `{' in `%s'"), + complain_at (*loc, _("missing `{' in %s"), token_name (token_type)); obstack_sgrow (&obstack_for_string, "{}"); STRING_FINISH; @@ -597,6 +618,15 @@ splice (\\[ \f\t\v]*\n)* "$"("<"{tag}">")?(-?[0-9]+|"$") handle_dollar (token_type, yytext, *loc); "@"(-?[0-9]+|"$") handle_at (token_type, yytext, *loc); + "$" { + warn_at (*loc, _("stray `$'")); + obstack_sgrow (&obstack_for_string, "$]["); + } + "@" { + warn_at (*loc, _("stray `@'")); + obstack_sgrow (&obstack_for_string, "@@"); + } + <> unexpected_eof (code_start, "}"); BEGIN INITIAL; }