* src/scan-gram.l (YY_OBS_FINISH): Don't set yylval.

Adjust all callers.
(scanner_last_string_free): New.
This commit is contained in:
Akim Demaille
2002-06-11 21:45:49 +00:00
parent 44995b2e39
commit 4cdb01db9b
7 changed files with 858 additions and 1010 deletions

View File

@@ -1,3 +1,10 @@
2002-06-11 Akim Demaille <akim@epita.fr>
* src/scan-gram.l (YY_OBS_FINISH): Don't set yylval.
Adjust all callers.
(scanner_last_string_free): New.
2002-06-11 Akim Demaille <akim@epita.fr> 2002-06-11 Akim Demaille <akim@epita.fr>
* src/scan-gram.l (YY_INIT, YY_GROW, YY_FINISH): Rename as... * src/scan-gram.l (YY_INIT, YY_GROW, YY_FINISH): Rename as...

File diff suppressed because it is too large Load Diff

View File

@@ -1,124 +1,70 @@
#ifndef BISON_PARSE_GRAM_H #ifndef BISON_PARSE_GRAM_H
# define BISON_PARSE_GRAM_H # define BISON_PARSE_GRAM_H
/* Tokens. */
#ifndef YYTOKENTYPE
# if defined (__STDC__) || defined (__cplusplus)
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
GRAM_EOF = 0,
STRING = 258,
CHARACTER = 259,
INT = 260,
PERCENT_TOKEN = 261,
PERCENT_NTERM = 262,
PERCENT_TYPE = 263,
PERCENT_UNION = 264,
PERCENT_EXPECT = 265,
PERCENT_START = 266,
PERCENT_LEFT = 267,
PERCENT_RIGHT = 268,
PERCENT_NONASSOC = 269,
PERCENT_PREC = 270,
PERCENT_VERBOSE = 271,
PERCENT_ERROR_VERBOSE = 272,
PERCENT_OUTPUT = 273,
PERCENT_FILE_PREFIX = 274,
PERCENT_NAME_PREFIX = 275,
PERCENT_DEFINE = 276,
PERCENT_PURE_PARSER = 277,
PERCENT_DEFINES = 278,
PERCENT_YACC = 279,
PERCENT_DEBUG = 280,
PERCENT_LOCATIONS = 281,
PERCENT_NO_LINES = 282,
PERCENT_SKELETON = 283,
PERCENT_TOKEN_TABLE = 284,
TYPE = 285,
EQUAL = 286,
SEMICOLON = 287,
COLON = 288,
PIPE = 289,
ID = 290,
PERCENT_PERCENT = 291,
PROLOGUE = 292,
EPILOGUE = 293,
BRACED_CODE = 294
};
# endif
/* POSIX requires `int' for tokens in interfaces. */
# define YYTOKENTYPE int
#endif /* !YYTOKENTYPE */
#define GRAM_EOF 0
#define STRING 258
#define CHARACTER 259
#define INT 260
#define PERCENT_TOKEN 261
#define PERCENT_NTERM 262
#define PERCENT_TYPE 263
#define PERCENT_UNION 264
#define PERCENT_EXPECT 265
#define PERCENT_START 266
#define PERCENT_LEFT 267
#define PERCENT_RIGHT 268
#define PERCENT_NONASSOC 269
#define PERCENT_PREC 270
#define PERCENT_VERBOSE 271
#define PERCENT_ERROR_VERBOSE 272
#define PERCENT_OUTPUT 273
#define PERCENT_FILE_PREFIX 274
#define PERCENT_NAME_PREFIX 275
#define PERCENT_DEFINE 276
#define PERCENT_PURE_PARSER 277
#define PERCENT_DEFINES 278
#define PERCENT_YACC 279
#define PERCENT_DEBUG 280
#define PERCENT_LOCATIONS 281
#define PERCENT_NO_LINES 282
#define PERCENT_SKELETON 283
#define PERCENT_TOKEN_TABLE 284
#define TYPE 285
#define EQUAL 286
#define SEMICOLON 287
#define COLON 288
#define PIPE 289
#define ID 290
#define PERCENT_PERCENT 291
#define PROLOGUE 292
#define EPILOGUE 293
#define BRACED_CODE 294
#ifndef YYSTYPE #ifndef YYSTYPE
#line 70 "parse-gram.y"
typedef union typedef union
{ {
symbol_t *symbol; symbol_t *symbol;
int integer; int integer;
char *string; char *string;
associativity assoc; associativity assoc;
} } yystype;
yystype;
# define YYSTYPE yystype # define YYSTYPE yystype
# define YYSTYPE_IS_TRIVIAL 1
#endif #endif
#ifndef YYLTYPE #ifndef YYLTYPE
typedef struct yyltype typedef struct yyltype
{ {
int first_line; int first_line;
int first_column; int first_column;
int last_line; int last_line;
int last_column; int last_column;
} yyltype; } yyltype;
# define YYLTYPE yyltype # define YYLTYPE yyltype
# define YYLTYPE_IS_TRIVIAL 1
#endif #endif
# define GRAM_EOF 0
# define STRING 257
# define CHARACTER 258
# define INT 259
# define PERCENT_TOKEN 260
# define PERCENT_NTERM 261
# define PERCENT_TYPE 262
# define PERCENT_UNION 263
# define PERCENT_EXPECT 264
# define PERCENT_START 265
# define PERCENT_LEFT 266
# define PERCENT_RIGHT 267
# define PERCENT_NONASSOC 268
# define PERCENT_PREC 269
# define PERCENT_VERBOSE 270
# define PERCENT_ERROR_VERBOSE 271
# define PERCENT_OUTPUT 272
# define PERCENT_FILE_PREFIX 273
# define PERCENT_NAME_PREFIX 274
# define PERCENT_DEFINE 275
# define PERCENT_PURE_PARSER 276
# define PERCENT_DEFINES 277
# define PERCENT_YACC 278
# define PERCENT_DEBUG 279
# define PERCENT_LOCATIONS 280
# define PERCENT_NO_LINES 281
# define PERCENT_SKELETON 282
# define PERCENT_TOKEN_TABLE 283
# define TYPE 284
# define EQUAL 285
# define SEMICOLON 286
# define COLON 287
# define PIPE 288
# define ID 289
# define PERCENT_PERCENT 290
# define PROLOGUE 291
# define EPILOGUE 292
# define BRACED_CODE 293
#endif /* not BISON_PARSE_GRAM_H */ #endif /* not BISON_PARSE_GRAM_H */

View File

@@ -24,7 +24,7 @@
%defines %defines
%locations %locations
%pure-parser %pure-parser
%error-verbose // %error-verbose
%defines %defines
%name-prefix="gram_" %name-prefix="gram_"
@@ -38,6 +38,8 @@
#include "reader.h" #include "reader.h"
#include "conflicts.h" #include "conflicts.h"
#define YYERROR_VERBOSE 1
/* Pass the control structure to YYPARSE and YYLEX. */ /* Pass the control structure to YYPARSE and YYLEX. */
#define YYPARSE_PARAM gram_control #define YYPARSE_PARAM gram_control
#define YYLEX_PARAM gram_control #define YYLEX_PARAM gram_control
@@ -120,7 +122,8 @@ int current_prec = 0;
%token PROLOGUE EPILOGUE %token PROLOGUE EPILOGUE
%token BRACED_CODE %token BRACED_CODE
%type <string> CHARACTER TYPE BRACED_CODE PROLOGUE EPILOGUE epilogue.opt action STRING string_content %type <string> CHARACTER TYPE STRING string_content
BRACED_CODE PROLOGUE EPILOGUE epilogue.opt action
%type <integer> INT %type <integer> INT
%type <symbol> ID symbol string_as_id %type <symbol> ID symbol string_as_id
%type <assoc> precedence_directive %type <assoc> precedence_directive
@@ -140,7 +143,10 @@ directives:
directive: directive:
grammar_directives grammar_directives
| PROLOGUE { prologue_augment ($1, @1.first_line); } | PROLOGUE
{
prologue_augment ($1, @1.first_line);
}
| "%debug" { debug_flag = 1; } | "%debug" { debug_flag = 1; }
| "%define" string_content string_content { muscle_insert ($2, $3); } | "%define" string_content string_content { muscle_insert ($2, $3); }
| "%defines" { defines_flag = 1; } | "%defines" { defines_flag = 1; }

View File

@@ -78,6 +78,8 @@ typedef struct gram_control_s
/* From the scanner. */ /* From the scanner. */
extern FILE *gram_in; extern FILE *gram_in;
extern int gram__flex_debug; extern int gram__flex_debug;
void scanner_last_string_free PARAMS ((void));
void scanner_free PARAMS ((void));
# define YY_DECL \ # define YY_DECL \
int gram_lex (yystype *yylval, yyltype *yylloc, \ int gram_lex (yystype *yylval, yyltype *yylloc, \

View File

@@ -689,16 +689,16 @@ int yy_flex_debug = 1;
static yyconst short int yy_rule_linenum[92] = static yyconst short int yy_rule_linenum[92] =
{ 0, { 0,
115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140,
135, 136, 137, 138, 139, 140, 141, 143, 144, 145, 141, 142, 143, 144, 145, 146, 147, 149, 150, 151,
146, 148, 149, 150, 157, 160, 163, 166, 167, 170, 152, 154, 155, 156, 161, 164, 167, 170, 171, 174,
173, 176, 178, 184, 200, 201, 212, 224, 225, 226, 177, 180, 189, 195, 211, 212, 223, 235, 236, 237,
243, 251, 253, 272, 286, 288, 307, 319, 323, 324, 254, 263, 265, 285, 299, 301, 321, 333, 337, 338,
325, 326, 327, 328, 329, 330, 331, 346, 352, 353, 339, 340, 341, 342, 343, 344, 345, 360, 366, 367,
355, 373, 379, 380, 382, 400, 403, 406, 407, 418, 369, 387, 393, 394, 396, 414, 417, 420, 421, 432,
428, 430, 431, 433, 434, 437, 456, 462, 463, 464, 443, 445, 446, 448, 449, 452, 472, 479, 480, 481,
484 502
} ; } ;
@@ -772,7 +772,6 @@ char *last_string;
do { \ do { \
obstack_1grow (&string_obstack, '\0'); \ obstack_1grow (&string_obstack, '\0'); \
last_string = obstack_finish (&string_obstack); \ last_string = obstack_finish (&string_obstack); \
yylval->string = last_string; \
} while (0) } while (0)
#define YY_OBS_FREE \ #define YY_OBS_FREE \
@@ -780,6 +779,13 @@ char *last_string;
obstack_free (&string_obstack, last_string); \ obstack_free (&string_obstack, last_string); \
} while (0) } while (0)
void
scanner_last_string_free (void)
{
YY_OBS_FREE;
}
/* This is only to avoid GCC warnings. */ /* This is only to avoid GCC warnings. */
#define YY_USER_INIT if (yycontrol) {;}; #define YY_USER_INIT if (yycontrol) {;};
@@ -802,7 +808,7 @@ static void handle_at PARAMS ((char *cp));
#define SC_PROLOGUE 7 #define SC_PROLOGUE 7
#define SC_EPILOGUE 8 #define SC_EPILOGUE 8
#line 806 "scan-gram.c" #line 812 "scan-gram.c"
/* Macros after this point can all be overridden by user definitions in /* Macros after this point can all be overridden by user definitions in
* section 1. * section 1.
@@ -964,7 +970,7 @@ YY_DECL
register char *yy_cp, *yy_bp; register char *yy_cp, *yy_bp;
register int yy_act; register int yy_act;
#line 91 "scan-gram.l" #line 97 "scan-gram.l"
/* At each yylex invocation, mark the current position as the /* At each yylex invocation, mark the current position as the
@@ -987,7 +993,7 @@ YY_DECL
/*----------------------------. /*----------------------------.
| Scanning Bison directives. | | Scanning Bison directives. |
`----------------------------*/ `----------------------------*/
#line 991 "scan-gram.c" #line 997 "scan-gram.c"
if ( yy_init ) if ( yy_init )
{ {
@@ -1089,228 +1095,232 @@ do_action: /* This label is used only to access EOF actions. */
case 1: case 1:
YY_RULE_SETUP YY_RULE_SETUP
#line 115 "scan-gram.l" #line 121 "scan-gram.l"
return PERCENT_NONASSOC; return PERCENT_NONASSOC;
YY_BREAK YY_BREAK
case 2: case 2:
YY_RULE_SETUP YY_RULE_SETUP
#line 116 "scan-gram.l" #line 122 "scan-gram.l"
return PERCENT_DEBUG; return PERCENT_DEBUG;
YY_BREAK YY_BREAK
case 3: case 3:
YY_RULE_SETUP YY_RULE_SETUP
#line 117 "scan-gram.l" #line 123 "scan-gram.l"
return PERCENT_DEFINE; return PERCENT_DEFINE;
YY_BREAK YY_BREAK
case 4: case 4:
YY_RULE_SETUP YY_RULE_SETUP
#line 118 "scan-gram.l" #line 124 "scan-gram.l"
return PERCENT_DEFINES; return PERCENT_DEFINES;
YY_BREAK YY_BREAK
case 5: case 5:
YY_RULE_SETUP YY_RULE_SETUP
#line 119 "scan-gram.l" #line 125 "scan-gram.l"
return PERCENT_ERROR_VERBOSE; return PERCENT_ERROR_VERBOSE;
YY_BREAK YY_BREAK
case 6: case 6:
YY_RULE_SETUP YY_RULE_SETUP
#line 120 "scan-gram.l" #line 126 "scan-gram.l"
return PERCENT_EXPECT; return PERCENT_EXPECT;
YY_BREAK YY_BREAK
case 7: case 7:
YY_RULE_SETUP YY_RULE_SETUP
#line 121 "scan-gram.l" #line 127 "scan-gram.l"
return PERCENT_FILE_PREFIX; return PERCENT_FILE_PREFIX;
YY_BREAK YY_BREAK
case 8: case 8:
YY_RULE_SETUP YY_RULE_SETUP
#line 122 "scan-gram.l" #line 128 "scan-gram.l"
return PERCENT_YACC; return PERCENT_YACC;
YY_BREAK YY_BREAK
case 9: case 9:
YY_RULE_SETUP YY_RULE_SETUP
#line 123 "scan-gram.l" #line 129 "scan-gram.l"
return PERCENT_LEFT; return PERCENT_LEFT;
YY_BREAK YY_BREAK
case 10: case 10:
YY_RULE_SETUP YY_RULE_SETUP
#line 124 "scan-gram.l" #line 130 "scan-gram.l"
return PERCENT_LOCATIONS; return PERCENT_LOCATIONS;
YY_BREAK YY_BREAK
case 11: case 11:
YY_RULE_SETUP YY_RULE_SETUP
#line 125 "scan-gram.l" #line 131 "scan-gram.l"
return PERCENT_NAME_PREFIX; return PERCENT_NAME_PREFIX;
YY_BREAK YY_BREAK
case 12: case 12:
YY_RULE_SETUP YY_RULE_SETUP
#line 126 "scan-gram.l" #line 132 "scan-gram.l"
return PERCENT_NO_LINES; return PERCENT_NO_LINES;
YY_BREAK YY_BREAK
case 13: case 13:
YY_RULE_SETUP YY_RULE_SETUP
#line 127 "scan-gram.l" #line 133 "scan-gram.l"
return PERCENT_NONASSOC; return PERCENT_NONASSOC;
YY_BREAK YY_BREAK
case 14: case 14:
YY_RULE_SETUP YY_RULE_SETUP
#line 128 "scan-gram.l" #line 134 "scan-gram.l"
return PERCENT_NTERM; return PERCENT_NTERM;
YY_BREAK YY_BREAK
case 15: case 15:
YY_RULE_SETUP YY_RULE_SETUP
#line 129 "scan-gram.l" #line 135 "scan-gram.l"
return PERCENT_OUTPUT; return PERCENT_OUTPUT;
YY_BREAK YY_BREAK
case 16: case 16:
YY_RULE_SETUP YY_RULE_SETUP
#line 130 "scan-gram.l" #line 136 "scan-gram.l"
return PERCENT_PREC; return PERCENT_PREC;
YY_BREAK YY_BREAK
case 17: case 17:
YY_RULE_SETUP YY_RULE_SETUP
#line 131 "scan-gram.l" #line 137 "scan-gram.l"
return PERCENT_PURE_PARSER; return PERCENT_PURE_PARSER;
YY_BREAK YY_BREAK
case 18: case 18:
YY_RULE_SETUP YY_RULE_SETUP
#line 132 "scan-gram.l" #line 138 "scan-gram.l"
return PERCENT_RIGHT; return PERCENT_RIGHT;
YY_BREAK YY_BREAK
case 19: case 19:
YY_RULE_SETUP YY_RULE_SETUP
#line 133 "scan-gram.l" #line 139 "scan-gram.l"
return PERCENT_SKELETON; return PERCENT_SKELETON;
YY_BREAK YY_BREAK
case 20: case 20:
YY_RULE_SETUP YY_RULE_SETUP
#line 134 "scan-gram.l" #line 140 "scan-gram.l"
return PERCENT_START; return PERCENT_START;
YY_BREAK YY_BREAK
case 21: case 21:
YY_RULE_SETUP YY_RULE_SETUP
#line 135 "scan-gram.l" #line 141 "scan-gram.l"
return PERCENT_TOKEN; return PERCENT_TOKEN;
YY_BREAK YY_BREAK
case 22: case 22:
YY_RULE_SETUP YY_RULE_SETUP
#line 136 "scan-gram.l" #line 142 "scan-gram.l"
return PERCENT_TOKEN; return PERCENT_TOKEN;
YY_BREAK YY_BREAK
case 23: case 23:
YY_RULE_SETUP YY_RULE_SETUP
#line 137 "scan-gram.l" #line 143 "scan-gram.l"
return PERCENT_TOKEN_TABLE; return PERCENT_TOKEN_TABLE;
YY_BREAK YY_BREAK
case 24: case 24:
YY_RULE_SETUP YY_RULE_SETUP
#line 138 "scan-gram.l" #line 144 "scan-gram.l"
return PERCENT_TYPE; return PERCENT_TYPE;
YY_BREAK YY_BREAK
case 25: case 25:
YY_RULE_SETUP YY_RULE_SETUP
#line 139 "scan-gram.l" #line 145 "scan-gram.l"
return PERCENT_UNION; return PERCENT_UNION;
YY_BREAK YY_BREAK
case 26: case 26:
YY_RULE_SETUP YY_RULE_SETUP
#line 140 "scan-gram.l" #line 146 "scan-gram.l"
return PERCENT_VERBOSE; return PERCENT_VERBOSE;
YY_BREAK YY_BREAK
case 27: case 27:
YY_RULE_SETUP YY_RULE_SETUP
#line 141 "scan-gram.l" #line 147 "scan-gram.l"
return PERCENT_YACC; return PERCENT_YACC;
YY_BREAK YY_BREAK
case 28: case 28:
YY_RULE_SETUP YY_RULE_SETUP
#line 143 "scan-gram.l" #line 149 "scan-gram.l"
return EQUAL; return EQUAL;
YY_BREAK YY_BREAK
case 29: case 29:
YY_RULE_SETUP YY_RULE_SETUP
#line 144 "scan-gram.l" #line 150 "scan-gram.l"
return COLON; return COLON;
YY_BREAK YY_BREAK
case 30: case 30:
YY_RULE_SETUP YY_RULE_SETUP
#line 145 "scan-gram.l" #line 151 "scan-gram.l"
return PIPE; return PIPE;
YY_BREAK YY_BREAK
case 31: case 31:
YY_RULE_SETUP YY_RULE_SETUP
#line 146 "scan-gram.l" #line 152 "scan-gram.l"
return SEMICOLON; return SEMICOLON;
YY_BREAK YY_BREAK
case 32: case 32:
YY_RULE_SETUP YY_RULE_SETUP
#line 148 "scan-gram.l" #line 154 "scan-gram.l"
YY_LINES; YY_STEP; YY_LINES; YY_STEP;
YY_BREAK YY_BREAK
case 33: case 33:
YY_RULE_SETUP YY_RULE_SETUP
#line 149 "scan-gram.l" #line 155 "scan-gram.l"
YY_STEP; YY_STEP;
YY_BREAK YY_BREAK
case 34: case 34:
YY_RULE_SETUP YY_RULE_SETUP
#line 150 "scan-gram.l" #line 156 "scan-gram.l"
{ {
YY_OBS_INIT; YY_OBS_GROW; YY_OBS_FINISH; yylval->symbol = getsym (yytext);
yylval->symbol = getsym (last_string);
YY_OBS_FREE;
return ID; return ID;
} }
YY_BREAK YY_BREAK
case 35: case 35:
YY_RULE_SETUP YY_RULE_SETUP
#line 157 "scan-gram.l" #line 161 "scan-gram.l"
yylval->integer = strtol (yytext, 0, 10); return INT; yylval->integer = strtol (yytext, 0, 10); return INT;
YY_BREAK YY_BREAK
/* Characters. We don't check there is only one. */ /* Characters. We don't check there is only one. */
case 36: case 36:
YY_RULE_SETUP YY_RULE_SETUP
#line 160 "scan-gram.l" #line 164 "scan-gram.l"
YY_OBS_INIT; YY_OBS_GROW; yy_push_state (SC_ESCAPED_CHARACTER); YY_OBS_INIT; YY_OBS_GROW; yy_push_state (SC_ESCAPED_CHARACTER);
YY_BREAK YY_BREAK
/* Strings. */ /* Strings. */
case 37: case 37:
YY_RULE_SETUP YY_RULE_SETUP
#line 163 "scan-gram.l" #line 167 "scan-gram.l"
YY_OBS_INIT; YY_OBS_GROW; yy_push_state (SC_ESCAPED_STRING); YY_OBS_INIT; YY_OBS_GROW; yy_push_state (SC_ESCAPED_STRING);
YY_BREAK YY_BREAK
/* Comments. */ /* Comments. */
case 38: case 38:
YY_RULE_SETUP YY_RULE_SETUP
#line 166 "scan-gram.l" #line 170 "scan-gram.l"
yy_push_state (SC_COMMENT); yy_push_state (SC_COMMENT);
YY_BREAK YY_BREAK
case 39: case 39:
YY_RULE_SETUP YY_RULE_SETUP
#line 167 "scan-gram.l" #line 171 "scan-gram.l"
YY_STEP; YY_STEP;
YY_BREAK YY_BREAK
/* Prologue. */ /* Prologue. */
case 40: case 40:
YY_RULE_SETUP YY_RULE_SETUP
#line 170 "scan-gram.l" #line 174 "scan-gram.l"
YY_OBS_INIT; yy_push_state (SC_PROLOGUE); YY_OBS_INIT; yy_push_state (SC_PROLOGUE);
YY_BREAK YY_BREAK
/* Code in between braces. */ /* Code in between braces. */
case 41: case 41:
YY_RULE_SETUP YY_RULE_SETUP
#line 173 "scan-gram.l" #line 177 "scan-gram.l"
YY_OBS_INIT; YY_OBS_GROW; ++braces_level; yy_push_state (SC_BRACED_CODE); YY_OBS_INIT; YY_OBS_GROW; ++braces_level; yy_push_state (SC_BRACED_CODE);
YY_BREAK YY_BREAK
/* A type. */ /* A type. */
case 42: case 42:
YY_RULE_SETUP YY_RULE_SETUP
#line 176 "scan-gram.l" #line 180 "scan-gram.l"
YY_OBS_INIT; obstack_grow (&string_obstack, yytext + 1, yyleng - 2); YY_OBS_FINISH; return TYPE; {
YY_OBS_INIT;
obstack_grow (&string_obstack, yytext + 1, yyleng - 2);
YY_OBS_FINISH;
yylval->string = last_string;
return TYPE;
}
YY_BREAK YY_BREAK
case 43: case 43:
YY_RULE_SETUP YY_RULE_SETUP
#line 178 "scan-gram.l" #line 189 "scan-gram.l"
{ {
if (++percent_percent_count == 2) if (++percent_percent_count == 2)
yy_push_state (SC_EPILOGUE); yy_push_state (SC_EPILOGUE);
@@ -1319,7 +1329,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 44: case 44:
YY_RULE_SETUP YY_RULE_SETUP
#line 184 "scan-gram.l" #line 195 "scan-gram.l"
{ {
LOCATION_PRINT (stderr, *yylloc); LOCATION_PRINT (stderr, *yylloc);
fprintf (stderr, ": invalid character: `%c'\n", *yytext); fprintf (stderr, ": invalid character: `%c'\n", *yytext);
@@ -1336,12 +1346,12 @@ YY_RULE_SETUP
case 45: case 45:
YY_RULE_SETUP YY_RULE_SETUP
#line 200 "scan-gram.l" #line 211 "scan-gram.l"
obstack_sgrow (&string_obstack, "@<:@"); obstack_sgrow (&string_obstack, "@<:@");
YY_BREAK YY_BREAK
case 46: case 46:
YY_RULE_SETUP YY_RULE_SETUP
#line 201 "scan-gram.l" #line 212 "scan-gram.l"
obstack_sgrow (&string_obstack, "@:>@"); obstack_sgrow (&string_obstack, "@:>@");
YY_BREAK YY_BREAK
@@ -1352,7 +1362,7 @@ obstack_sgrow (&string_obstack, "@:>@");
case 47: case 47:
YY_RULE_SETUP YY_RULE_SETUP
#line 212 "scan-gram.l" #line 223 "scan-gram.l"
{ /* End of the comment. */ { /* End of the comment. */
if (yy_top_state () == INITIAL) if (yy_top_state () == INITIAL)
{ {
@@ -1367,21 +1377,21 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 48: case 48:
YY_RULE_SETUP YY_RULE_SETUP
#line 224 "scan-gram.l" #line 235 "scan-gram.l"
if (yy_top_state () != INITIAL) YY_OBS_GROW; if (yy_top_state () != INITIAL) YY_OBS_GROW;
YY_BREAK YY_BREAK
case 49: case 49:
YY_RULE_SETUP YY_RULE_SETUP
#line 225 "scan-gram.l" #line 236 "scan-gram.l"
if (yy_top_state () != INITIAL) YY_OBS_GROW; YY_LINES; if (yy_top_state () != INITIAL) YY_OBS_GROW; YY_LINES;
YY_BREAK YY_BREAK
case 50: case 50:
YY_RULE_SETUP YY_RULE_SETUP
#line 226 "scan-gram.l" #line 237 "scan-gram.l"
/* Stray `*'. */if (yy_top_state () != INITIAL) YY_OBS_GROW; /* Stray `*'. */if (yy_top_state () != INITIAL) YY_OBS_GROW;
YY_BREAK YY_BREAK
case YY_STATE_EOF(SC_COMMENT): case YY_STATE_EOF(SC_COMMENT):
#line 228 "scan-gram.l" #line 239 "scan-gram.l"
{ {
LOCATION_PRINT (stderr, *yylloc); LOCATION_PRINT (stderr, *yylloc);
fprintf (stderr, ": unexpected end of file in a comment\n"); fprintf (stderr, ": unexpected end of file in a comment\n");
@@ -1397,32 +1407,34 @@ case YY_STATE_EOF(SC_COMMENT):
case 51: case 51:
YY_RULE_SETUP YY_RULE_SETUP
#line 243 "scan-gram.l" #line 254 "scan-gram.l"
{ {
assert (yy_top_state () == INITIAL); assert (yy_top_state () == INITIAL);
YY_OBS_GROW; YY_OBS_GROW;
YY_OBS_FINISH; YY_OBS_FINISH;
yylval->string = last_string;
yy_pop_state (); yy_pop_state ();
return STRING; return STRING;
} }
YY_BREAK YY_BREAK
case 52: case 52:
YY_RULE_SETUP YY_RULE_SETUP
#line 251 "scan-gram.l" #line 263 "scan-gram.l"
YY_OBS_GROW; YY_OBS_GROW;
YY_BREAK YY_BREAK
case 53: case 53:
YY_RULE_SETUP YY_RULE_SETUP
#line 253 "scan-gram.l" #line 265 "scan-gram.l"
obstack_1grow (&string_obstack, '\n'); YY_LINES; obstack_1grow (&string_obstack, '\n'); YY_LINES;
YY_BREAK YY_BREAK
case YY_STATE_EOF(SC_ESCAPED_STRING): case YY_STATE_EOF(SC_ESCAPED_STRING):
#line 255 "scan-gram.l" #line 267 "scan-gram.l"
{ {
LOCATION_PRINT (stderr, *yylloc); LOCATION_PRINT (stderr, *yylloc);
fprintf (stderr, ": unexpected end of file in a string\n"); fprintf (stderr, ": unexpected end of file in a string\n");
assert (yy_top_state () == INITIAL); assert (yy_top_state () == INITIAL);
YY_OBS_FINISH; YY_OBS_FINISH;
yylval->string = last_string;
yy_pop_state (); yy_pop_state ();
return STRING; return STRING;
} }
@@ -1436,7 +1448,7 @@ case YY_STATE_EOF(SC_ESCAPED_STRING):
case 54: case 54:
YY_RULE_SETUP YY_RULE_SETUP
#line 272 "scan-gram.l" #line 285 "scan-gram.l"
{ {
YY_OBS_GROW; YY_OBS_GROW;
assert (yy_top_state () == INITIAL); assert (yy_top_state () == INITIAL);
@@ -1453,21 +1465,22 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 55: case 55:
YY_RULE_SETUP YY_RULE_SETUP
#line 286 "scan-gram.l" #line 299 "scan-gram.l"
YY_OBS_GROW; YY_OBS_GROW;
YY_BREAK YY_BREAK
case 56: case 56:
YY_RULE_SETUP YY_RULE_SETUP
#line 288 "scan-gram.l" #line 301 "scan-gram.l"
obstack_1grow (&string_obstack, '\n'); YY_LINES; obstack_1grow (&string_obstack, '\n'); YY_LINES;
YY_BREAK YY_BREAK
case YY_STATE_EOF(SC_ESCAPED_CHARACTER): case YY_STATE_EOF(SC_ESCAPED_CHARACTER):
#line 290 "scan-gram.l" #line 303 "scan-gram.l"
{ {
LOCATION_PRINT (stderr, *yylloc); LOCATION_PRINT (stderr, *yylloc);
fprintf (stderr, ": unexpected end of file in a character\n"); fprintf (stderr, ": unexpected end of file in a character\n");
assert (yy_top_state () == INITIAL); assert (yy_top_state () == INITIAL);
YY_OBS_FINISH; YY_OBS_FINISH;
yylval->string = last_string;
yy_pop_state (); yy_pop_state ();
return CHARACTER; return CHARACTER;
} }
@@ -1480,7 +1493,7 @@ case YY_STATE_EOF(SC_ESCAPED_CHARACTER):
case 57: case 57:
YY_RULE_SETUP YY_RULE_SETUP
#line 307 "scan-gram.l" #line 321 "scan-gram.l"
{ {
long c = strtol (yytext + 1, 0, 8); long c = strtol (yytext + 1, 0, 8);
if (c > 255) if (c > 255)
@@ -1495,54 +1508,54 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 58: case 58:
YY_RULE_SETUP YY_RULE_SETUP
#line 319 "scan-gram.l" #line 333 "scan-gram.l"
{ {
obstack_1grow (&string_obstack, strtol (yytext + 2, 0, 16)); obstack_1grow (&string_obstack, strtol (yytext + 2, 0, 16));
} }
YY_BREAK YY_BREAK
case 59: case 59:
YY_RULE_SETUP YY_RULE_SETUP
#line 323 "scan-gram.l" #line 337 "scan-gram.l"
obstack_1grow (&string_obstack, '\a'); obstack_1grow (&string_obstack, '\a');
YY_BREAK YY_BREAK
case 60: case 60:
YY_RULE_SETUP YY_RULE_SETUP
#line 324 "scan-gram.l" #line 338 "scan-gram.l"
obstack_1grow (&string_obstack, '\b'); obstack_1grow (&string_obstack, '\b');
YY_BREAK YY_BREAK
case 61: case 61:
YY_RULE_SETUP YY_RULE_SETUP
#line 325 "scan-gram.l" #line 339 "scan-gram.l"
obstack_1grow (&string_obstack, '\f'); obstack_1grow (&string_obstack, '\f');
YY_BREAK YY_BREAK
case 62: case 62:
YY_RULE_SETUP YY_RULE_SETUP
#line 326 "scan-gram.l" #line 340 "scan-gram.l"
obstack_1grow (&string_obstack, '\n'); obstack_1grow (&string_obstack, '\n');
YY_BREAK YY_BREAK
case 63: case 63:
YY_RULE_SETUP YY_RULE_SETUP
#line 327 "scan-gram.l" #line 341 "scan-gram.l"
obstack_1grow (&string_obstack, '\r'); obstack_1grow (&string_obstack, '\r');
YY_BREAK YY_BREAK
case 64: case 64:
YY_RULE_SETUP YY_RULE_SETUP
#line 328 "scan-gram.l" #line 342 "scan-gram.l"
obstack_1grow (&string_obstack, '\t'); obstack_1grow (&string_obstack, '\t');
YY_BREAK YY_BREAK
case 65: case 65:
YY_RULE_SETUP YY_RULE_SETUP
#line 329 "scan-gram.l" #line 343 "scan-gram.l"
obstack_1grow (&string_obstack, '\v'); obstack_1grow (&string_obstack, '\v');
YY_BREAK YY_BREAK
case 66: case 66:
YY_RULE_SETUP YY_RULE_SETUP
#line 330 "scan-gram.l" #line 344 "scan-gram.l"
obstack_1grow (&string_obstack, yytext[1]); obstack_1grow (&string_obstack, yytext[1]);
YY_BREAK YY_BREAK
case 67: case 67:
YY_RULE_SETUP YY_RULE_SETUP
#line 331 "scan-gram.l" #line 345 "scan-gram.l"
{ {
LOCATION_PRINT (stderr, *yylloc); LOCATION_PRINT (stderr, *yylloc);
fprintf (stderr, ": unrecognized escape: %s\n", yytext); fprintf (stderr, ": unrecognized escape: %s\n", yytext);
@@ -1558,7 +1571,7 @@ YY_RULE_SETUP
case 68: case 68:
YY_RULE_SETUP YY_RULE_SETUP
#line 346 "scan-gram.l" #line 360 "scan-gram.l"
{ {
YY_OBS_GROW; YY_OBS_GROW;
assert (yy_top_state () != INITIAL); assert (yy_top_state () != INITIAL);
@@ -1567,21 +1580,21 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 69: case 69:
YY_RULE_SETUP YY_RULE_SETUP
#line 352 "scan-gram.l" #line 366 "scan-gram.l"
YY_OBS_GROW; YY_OBS_GROW;
YY_BREAK YY_BREAK
case 70: case 70:
YY_RULE_SETUP YY_RULE_SETUP
#line 353 "scan-gram.l" #line 367 "scan-gram.l"
YY_OBS_GROW; YY_OBS_GROW;
YY_BREAK YY_BREAK
case 71: case 71:
YY_RULE_SETUP YY_RULE_SETUP
#line 355 "scan-gram.l" #line 369 "scan-gram.l"
YY_OBS_GROW; YY_LINES; YY_OBS_GROW; YY_LINES;
YY_BREAK YY_BREAK
case YY_STATE_EOF(SC_CHARACTER): case YY_STATE_EOF(SC_CHARACTER):
#line 357 "scan-gram.l" #line 371 "scan-gram.l"
{ {
LOCATION_PRINT (stderr, *yylloc); LOCATION_PRINT (stderr, *yylloc);
fprintf (stderr, ": unexpected end of file in a character\n"); fprintf (stderr, ": unexpected end of file in a character\n");
@@ -1598,7 +1611,7 @@ case YY_STATE_EOF(SC_CHARACTER):
case 72: case 72:
YY_RULE_SETUP YY_RULE_SETUP
#line 373 "scan-gram.l" #line 387 "scan-gram.l"
{ {
assert (yy_top_state () != INITIAL); assert (yy_top_state () != INITIAL);
YY_OBS_GROW; YY_OBS_GROW;
@@ -1607,21 +1620,21 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 73: case 73:
YY_RULE_SETUP YY_RULE_SETUP
#line 379 "scan-gram.l" #line 393 "scan-gram.l"
YY_OBS_GROW; YY_OBS_GROW;
YY_BREAK YY_BREAK
case 74: case 74:
YY_RULE_SETUP YY_RULE_SETUP
#line 380 "scan-gram.l" #line 394 "scan-gram.l"
YY_OBS_GROW; YY_OBS_GROW;
YY_BREAK YY_BREAK
case 75: case 75:
YY_RULE_SETUP YY_RULE_SETUP
#line 382 "scan-gram.l" #line 396 "scan-gram.l"
YY_OBS_GROW; YY_LINES; YY_OBS_GROW; YY_LINES;
YY_BREAK YY_BREAK
case YY_STATE_EOF(SC_STRING): case YY_STATE_EOF(SC_STRING):
#line 384 "scan-gram.l" #line 398 "scan-gram.l"
{ {
LOCATION_PRINT (stderr, *yylloc); LOCATION_PRINT (stderr, *yylloc);
fprintf (stderr, ": unexpected end of file in a string\n"); fprintf (stderr, ": unexpected end of file in a string\n");
@@ -1638,24 +1651,24 @@ case YY_STATE_EOF(SC_STRING):
/* Characters. We don't check there is only one. */ /* Characters. We don't check there is only one. */
case 76: case 76:
YY_RULE_SETUP YY_RULE_SETUP
#line 400 "scan-gram.l" #line 414 "scan-gram.l"
YY_OBS_GROW; yy_push_state (SC_CHARACTER); YY_OBS_GROW; yy_push_state (SC_CHARACTER);
YY_BREAK YY_BREAK
/* Strings. */ /* Strings. */
case 77: case 77:
YY_RULE_SETUP YY_RULE_SETUP
#line 403 "scan-gram.l" #line 417 "scan-gram.l"
YY_OBS_GROW; yy_push_state (SC_STRING); YY_OBS_GROW; yy_push_state (SC_STRING);
YY_BREAK YY_BREAK
/* Comments. */ /* Comments. */
case 78: case 78:
YY_RULE_SETUP YY_RULE_SETUP
#line 406 "scan-gram.l" #line 420 "scan-gram.l"
YY_OBS_GROW; yy_push_state (SC_COMMENT); YY_OBS_GROW; yy_push_state (SC_COMMENT);
YY_BREAK YY_BREAK
case 79: case 79:
YY_RULE_SETUP YY_RULE_SETUP
#line 407 "scan-gram.l" #line 421 "scan-gram.l"
YY_OBS_GROW; YY_OBS_GROW;
YY_BREAK YY_BREAK
@@ -1667,56 +1680,58 @@ YY_OBS_GROW;
case 80: case 80:
YY_RULE_SETUP YY_RULE_SETUP
#line 418 "scan-gram.l" #line 432 "scan-gram.l"
{ {
YY_OBS_GROW; YY_OBS_GROW;
if (--braces_level == 0) if (--braces_level == 0)
{ {
yy_pop_state (); yy_pop_state ();
YY_OBS_FINISH; YY_OBS_FINISH;
yylval->string = last_string;
return BRACED_CODE; return BRACED_CODE;
} }
} }
YY_BREAK YY_BREAK
case 81: case 81:
YY_RULE_SETUP YY_RULE_SETUP
#line 428 "scan-gram.l" #line 443 "scan-gram.l"
YY_OBS_GROW; braces_level++; YY_OBS_GROW; braces_level++;
YY_BREAK YY_BREAK
case 82: case 82:
YY_RULE_SETUP YY_RULE_SETUP
#line 430 "scan-gram.l" #line 445 "scan-gram.l"
{ handle_dollar (yytext); } { handle_dollar (yytext); }
YY_BREAK YY_BREAK
case 83: case 83:
YY_RULE_SETUP YY_RULE_SETUP
#line 431 "scan-gram.l" #line 446 "scan-gram.l"
{ handle_at (yytext); } { handle_at (yytext); }
YY_BREAK YY_BREAK
case 84: case 84:
YY_RULE_SETUP YY_RULE_SETUP
#line 433 "scan-gram.l" #line 448 "scan-gram.l"
YY_OBS_GROW; YY_OBS_GROW;
YY_BREAK YY_BREAK
case 85: case 85:
YY_RULE_SETUP YY_RULE_SETUP
#line 434 "scan-gram.l" #line 449 "scan-gram.l"
YY_OBS_GROW; YY_LINES; YY_OBS_GROW; YY_LINES;
YY_BREAK YY_BREAK
/* A lose $, or /, or etc. */ /* A lose $, or /, or etc. */
case 86: case 86:
YY_RULE_SETUP YY_RULE_SETUP
#line 437 "scan-gram.l" #line 452 "scan-gram.l"
YY_OBS_GROW; YY_OBS_GROW;
YY_BREAK YY_BREAK
case YY_STATE_EOF(SC_BRACED_CODE): case YY_STATE_EOF(SC_BRACED_CODE):
#line 439 "scan-gram.l" #line 454 "scan-gram.l"
{ {
LOCATION_PRINT (stderr, *yylloc); LOCATION_PRINT (stderr, *yylloc);
fprintf (stderr, ": unexpected end of file in a braced code\n"); fprintf (stderr, ": unexpected end of file in a braced code\n");
yy_pop_state (); yy_pop_state ();
YY_OBS_FINISH; YY_OBS_FINISH;
return PROLOGUE; yylval->string = last_string;
return BRACED_CODE;
} }
YY_BREAK YY_BREAK
@@ -1727,35 +1742,37 @@ case YY_STATE_EOF(SC_BRACED_CODE):
case 87: case 87:
YY_RULE_SETUP YY_RULE_SETUP
#line 456 "scan-gram.l" #line 472 "scan-gram.l"
{ {
yy_pop_state (); yy_pop_state ();
YY_OBS_FINISH; YY_OBS_FINISH;
yylval->string = last_string;
return PROLOGUE; return PROLOGUE;
} }
YY_BREAK YY_BREAK
case 88: case 88:
YY_RULE_SETUP YY_RULE_SETUP
#line 462 "scan-gram.l" #line 479 "scan-gram.l"
YY_OBS_GROW; YY_OBS_GROW;
YY_BREAK YY_BREAK
case 89: case 89:
YY_RULE_SETUP YY_RULE_SETUP
#line 463 "scan-gram.l" #line 480 "scan-gram.l"
YY_OBS_GROW; YY_OBS_GROW;
YY_BREAK YY_BREAK
case 90: case 90:
YY_RULE_SETUP YY_RULE_SETUP
#line 464 "scan-gram.l" #line 481 "scan-gram.l"
YY_OBS_GROW; YY_LINES; YY_OBS_GROW; YY_LINES;
YY_BREAK YY_BREAK
case YY_STATE_EOF(SC_PROLOGUE): case YY_STATE_EOF(SC_PROLOGUE):
#line 466 "scan-gram.l" #line 483 "scan-gram.l"
{ {
LOCATION_PRINT (stderr, *yylloc); LOCATION_PRINT (stderr, *yylloc);
fprintf (stderr, ": unexpected end of file in a prologue\n"); fprintf (stderr, ": unexpected end of file in a prologue\n");
yy_pop_state (); yy_pop_state ();
YY_OBS_FINISH; YY_OBS_FINISH;
yylval->string = last_string;
return PROLOGUE; return PROLOGUE;
} }
YY_BREAK YY_BREAK
@@ -1768,24 +1785,25 @@ case YY_STATE_EOF(SC_PROLOGUE):
case 91: case 91:
YY_RULE_SETUP YY_RULE_SETUP
#line 484 "scan-gram.l" #line 502 "scan-gram.l"
YY_OBS_GROW; YY_OBS_GROW;
YY_BREAK YY_BREAK
case YY_STATE_EOF(SC_EPILOGUE): case YY_STATE_EOF(SC_EPILOGUE):
#line 486 "scan-gram.l" #line 504 "scan-gram.l"
{ {
yy_pop_state (); yy_pop_state ();
YY_OBS_FINISH; YY_OBS_FINISH;
yylval->string = last_string;
return EPILOGUE; return EPILOGUE;
} }
YY_BREAK YY_BREAK
case 92: case 92:
YY_RULE_SETUP YY_RULE_SETUP
#line 494 "scan-gram.l" #line 513 "scan-gram.l"
YY_FATAL_ERROR( "flex scanner jammed" ); YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK YY_BREAK
#line 1789 "scan-gram.c" #line 1807 "scan-gram.c"
case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(INITIAL):
yyterminate(); yyterminate();
@@ -2675,7 +2693,7 @@ int main()
return 0; return 0;
} }
#endif #endif
#line 494 "scan-gram.l" #line 513 "scan-gram.l"
/*------------------------------------------------------------------. /*------------------------------------------------------------------.
@@ -2792,3 +2810,9 @@ handle_at (char *cp)
complain (_("%s is invalid"), quote (buf)); complain (_("%s is invalid"), quote (buf));
} }
} }
void
scanner_free (void)
{
obstack_free (&string_obstack, 0);
}

View File

@@ -59,7 +59,6 @@ char *last_string;
do { \ do { \
obstack_1grow (&string_obstack, '\0'); \ obstack_1grow (&string_obstack, '\0'); \
last_string = obstack_finish (&string_obstack); \ last_string = obstack_finish (&string_obstack); \
yylval->string = last_string; \
} while (0) } while (0)
#define YY_OBS_FREE \ #define YY_OBS_FREE \
@@ -67,6 +66,13 @@ char *last_string;
obstack_free (&string_obstack, last_string); \ obstack_free (&string_obstack, last_string); \
} while (0) } while (0)
void
scanner_last_string_free (void)
{
YY_OBS_FREE;
}
/* This is only to avoid GCC warnings. */ /* This is only to avoid GCC warnings. */
#define YY_USER_INIT if (yycontrol) {;}; #define YY_USER_INIT if (yycontrol) {;};
@@ -148,9 +154,7 @@ blanks [ \t\f]+
{eols} YY_LINES; YY_STEP; {eols} YY_LINES; YY_STEP;
{blanks} YY_STEP; {blanks} YY_STEP;
{id} { {id} {
YY_OBS_INIT; YY_OBS_GROW; YY_OBS_FINISH; yylval->symbol = getsym (yytext);
yylval->symbol = getsym (last_string);
YY_OBS_FREE;
return ID; return ID;
} }
@@ -173,7 +177,14 @@ blanks [ \t\f]+
"{" YY_OBS_INIT; YY_OBS_GROW; ++braces_level; yy_push_state (SC_BRACED_CODE); "{" YY_OBS_INIT; YY_OBS_GROW; ++braces_level; yy_push_state (SC_BRACED_CODE);
/* A type. */ /* A type. */
"<"[^>]+">" YY_OBS_INIT; obstack_grow (&string_obstack, yytext + 1, yyleng - 2); YY_OBS_FINISH; return TYPE; "<"[^>]+">" {
YY_OBS_INIT;
obstack_grow (&string_obstack, yytext + 1, yyleng - 2);
YY_OBS_FINISH;
yylval->string = last_string;
return TYPE;
}
"%%" { "%%" {
if (++percent_percent_count == 2) if (++percent_percent_count == 2)
@@ -244,6 +255,7 @@ blanks [ \t\f]+
assert (yy_top_state () == INITIAL); assert (yy_top_state () == INITIAL);
YY_OBS_GROW; YY_OBS_GROW;
YY_OBS_FINISH; YY_OBS_FINISH;
yylval->string = last_string;
yy_pop_state (); yy_pop_state ();
return STRING; return STRING;
} }
@@ -257,6 +269,7 @@ blanks [ \t\f]+
fprintf (stderr, ": unexpected end of file in a string\n"); fprintf (stderr, ": unexpected end of file in a string\n");
assert (yy_top_state () == INITIAL); assert (yy_top_state () == INITIAL);
YY_OBS_FINISH; YY_OBS_FINISH;
yylval->string = last_string;
yy_pop_state (); yy_pop_state ();
return STRING; return STRING;
} }
@@ -292,6 +305,7 @@ blanks [ \t\f]+
fprintf (stderr, ": unexpected end of file in a character\n"); fprintf (stderr, ": unexpected end of file in a character\n");
assert (yy_top_state () == INITIAL); assert (yy_top_state () == INITIAL);
YY_OBS_FINISH; YY_OBS_FINISH;
yylval->string = last_string;
yy_pop_state (); yy_pop_state ();
return CHARACTER; return CHARACTER;
} }
@@ -421,6 +435,7 @@ blanks [ \t\f]+
{ {
yy_pop_state (); yy_pop_state ();
YY_OBS_FINISH; YY_OBS_FINISH;
yylval->string = last_string;
return BRACED_CODE; return BRACED_CODE;
} }
} }
@@ -441,7 +456,8 @@ blanks [ \t\f]+
fprintf (stderr, ": unexpected end of file in a braced code\n"); fprintf (stderr, ": unexpected end of file in a braced code\n");
yy_pop_state (); yy_pop_state ();
YY_OBS_FINISH; YY_OBS_FINISH;
return PROLOGUE; yylval->string = last_string;
return BRACED_CODE;
} }
} }
@@ -456,6 +472,7 @@ blanks [ \t\f]+
"%}" { "%}" {
yy_pop_state (); yy_pop_state ();
YY_OBS_FINISH; YY_OBS_FINISH;
yylval->string = last_string;
return PROLOGUE; return PROLOGUE;
} }
@@ -468,6 +485,7 @@ blanks [ \t\f]+
fprintf (stderr, ": unexpected end of file in a prologue\n"); fprintf (stderr, ": unexpected end of file in a prologue\n");
yy_pop_state (); yy_pop_state ();
YY_OBS_FINISH; YY_OBS_FINISH;
yylval->string = last_string;
return PROLOGUE; return PROLOGUE;
} }
@@ -486,6 +504,7 @@ blanks [ \t\f]+
<<EOF>> { <<EOF>> {
yy_pop_state (); yy_pop_state ();
YY_OBS_FINISH; YY_OBS_FINISH;
yylval->string = last_string;
return EPILOGUE; return EPILOGUE;
} }
} }
@@ -607,3 +626,9 @@ handle_at (char *cp)
complain (_("%s is invalid"), quote (buf)); complain (_("%s is invalid"), quote (buf));
} }
} }
void
scanner_free (void)
{
obstack_free (&string_obstack, 0);
}