X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/97650f4efc420eb5eb0af124f28987875e10428a..8434f2222ee028206633ecee9d2336103414b53c:/src/scan-gram.l?ds=inline diff --git a/src/scan-gram.l b/src/scan-gram.l index 1d3c0cfb..d5298452 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -34,14 +34,14 @@ #define YY_USER_INIT \ do { \ LOCATION_RESET (*yylloc); \ + yylloc->file = infile; \ /* This is only to avoid GCC warnings. */ \ if (yycontrol) {;}; \ } while (0) -#define YY_USER_ACTION LOCATION_COLUMNS (*yylloc, yyleng) -#define YY_LINES LOCATION_LINES (*yylloc, yyleng); lineno += yyleng; -#define YY_STEP LOCATION_STEP (*yylloc) - +#define YY_USER_ACTION LOCATION_COLUMNS (*yylloc, yyleng); +#define YY_LINES LOCATION_LINES (*yylloc, yyleng); +#define YY_STEP LOCATION_STEP (*yylloc); /* STRING_OBSTACK -- Used to store all the characters that we need to keep (to construct ID, STRINGS etc.). Use the following macros to @@ -90,7 +90,7 @@ static void handle_at PARAMS ((braced_code_t code_kind, %x SC_ESCAPED_STRING SC_ESCAPED_CHARACTER %x SC_BRACED_CODE SC_PROLOGUE SC_EPILOGUE -id [.a-zA-Z][.a-zA-Z_0-9]* +id [.a-zA-Z_][.a-zA-Z_0-9]* int [0-9]+ eols (\n|\r|\n\r|\r\n)+ blanks [ \t\f]+ @@ -294,7 +294,8 @@ blanks [ \t\f]+ YY_OBS_FINISH; yylval->symbol = symbol_get (last_string, *yylloc); symbol_class_set (yylval->symbol, token_sym, *yylloc); - symbol_user_token_number_set (yylval->symbol, last_string[1], *yylloc); + symbol_user_token_number_set (yylval->symbol, + (unsigned char) last_string[1], *yylloc); YY_OBS_FREE; yy_pop_state (); return ID; @@ -730,4 +731,6 @@ void scanner_free (void) { obstack_free (&string_obstack, 0); + /* Reclaim Flex's buffers. */ + yy_delete_buffer (YY_CURRENT_BUFFER); }