1 #line 2 "glcpp/glcpp-lex.c"
3 #line 4 "glcpp/glcpp-lex.c"
5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 35
13 #if YY_FLEX_SUBMINOR_VERSION > 0
17 /* First, we deal with platform-specific or compiler-specific issues. */
19 /* begin standard C headers. */
25 /* end standard C headers. */
27 /* flex integer type definitions */
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
44 typedef int8_t flex_int8_t
;
45 typedef uint8_t flex_uint8_t
;
46 typedef int16_t flex_int16_t
;
47 typedef uint16_t flex_uint16_t
;
48 typedef int32_t flex_int32_t
;
49 typedef uint32_t flex_uint32_t
;
51 typedef signed char flex_int8_t
;
52 typedef short int flex_int16_t
;
53 typedef int flex_int32_t
;
54 typedef unsigned char flex_uint8_t
;
55 typedef unsigned short int flex_uint16_t
;
56 typedef unsigned int flex_uint32_t
;
59 /* Limits of integral types. */
61 #define INT8_MIN (-128)
64 #define INT16_MIN (-32767-1)
67 #define INT32_MIN (-2147483647-1)
70 #define INT8_MAX (127)
73 #define INT16_MAX (32767)
76 #define INT32_MAX (2147483647)
79 #define UINT8_MAX (255U)
82 #define UINT16_MAX (65535U)
85 #define UINT32_MAX (4294967295U)
88 #endif /* ! FLEXINT_H */
92 /* The "const" storage-class-modifier is valid. */
95 #else /* ! __cplusplus */
97 /* C99 requires __STDC__ to be defined as 1. */
98 #if defined (__STDC__)
102 #endif /* defined (__STDC__) */
103 #endif /* ! __cplusplus */
106 #define yyconst const
111 /* Returned upon end-of-file. */
114 /* Promotes a possibly negative, possibly signed char to an unsigned
115 * integer for use as an array index. If the signed char is negative,
116 * we want to instead treat it as an 8-bit unsigned char, hence the
119 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
121 /* An opaque pointer. */
122 #ifndef YY_TYPEDEF_YY_SCANNER_T
123 #define YY_TYPEDEF_YY_SCANNER_T
124 typedef void* yyscan_t
;
127 /* For convenience, these vars (plus the bison vars far below)
128 are macros in the reentrant scanner. */
129 #define yyin yyg->yyin_r
130 #define yyout yyg->yyout_r
131 #define yyextra yyg->yyextra_r
132 #define yyleng yyg->yyleng_r
133 #define yytext yyg->yytext_r
134 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
135 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
136 #define yy_flex_debug yyg->yy_flex_debug_r
138 /* Enter a start condition. This macro really ought to take a parameter,
139 * but we do it the disgusting crufty way forced on us by the ()-less
140 * definition of BEGIN.
142 #define BEGIN yyg->yy_start = 1 + 2 *
144 /* Translate the current start state into a value that can be later handed
145 * to BEGIN to return to the state. The YYSTATE alias is for lex
148 #define YY_START ((yyg->yy_start - 1) / 2)
149 #define YYSTATE YY_START
151 /* Action number for EOF rule of a given start state. */
152 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
154 /* Special action meaning "start processing a new file". */
155 #define YY_NEW_FILE glcpp_restart(yyin ,yyscanner )
157 #define YY_END_OF_BUFFER_CHAR 0
159 /* Size of default input buffer. */
161 #define YY_BUF_SIZE 16384
164 /* The state buf must be large enough to hold one state per character in the main buffer.
166 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
168 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
169 #define YY_TYPEDEF_YY_BUFFER_STATE
170 typedef struct yy_buffer_state
*YY_BUFFER_STATE
;
173 #define EOB_ACT_CONTINUE_SCAN 0
174 #define EOB_ACT_END_OF_FILE 1
175 #define EOB_ACT_LAST_MATCH 2
177 #define YY_LESS_LINENO(n)
179 /* Return all but the first "n" matched characters back to the input stream. */
183 /* Undo effects of setting up yytext. */ \
184 int yyless_macro_arg = (n); \
185 YY_LESS_LINENO(yyless_macro_arg);\
186 *yy_cp = yyg->yy_hold_char; \
187 YY_RESTORE_YY_MORE_OFFSET \
188 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
189 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
193 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
195 #ifndef YY_TYPEDEF_YY_SIZE_T
196 #define YY_TYPEDEF_YY_SIZE_T
197 typedef size_t yy_size_t
;
200 #ifndef YY_STRUCT_YY_BUFFER_STATE
201 #define YY_STRUCT_YY_BUFFER_STATE
202 struct yy_buffer_state
206 char *yy_ch_buf
; /* input buffer */
207 char *yy_buf_pos
; /* current position in input buffer */
209 /* Size of input buffer in bytes, not including room for EOB
212 yy_size_t yy_buf_size
;
214 /* Number of characters read into yy_ch_buf, not including EOB
219 /* Whether we "own" the buffer - i.e., we know we created it,
220 * and can realloc() it to grow it, and should free() it to
223 int yy_is_our_buffer
;
225 /* Whether this is an "interactive" input source; if so, and
226 * if we're using stdio for input, then we want to use getc()
227 * instead of fread(), to make sure we stop fetching input after
230 int yy_is_interactive
;
232 /* Whether we're considered to be at the beginning of a line.
233 * If so, '^' rules will be active on the next match, otherwise
238 int yy_bs_lineno
; /**< The line count. */
239 int yy_bs_column
; /**< The column count. */
241 /* Whether to try to fill the input buffer when we reach the
246 int yy_buffer_status
;
248 #define YY_BUFFER_NEW 0
249 #define YY_BUFFER_NORMAL 1
250 /* When an EOF's been seen but there's still some text to process
251 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
252 * shouldn't try reading from the input source any more. We might
253 * still have a bunch of tokens to match, though, because of
254 * possible backing-up.
256 * When we actually see the EOF, we change the status to "new"
257 * (via glcpp_restart()), so that the user can continue scanning by
258 * just pointing yyin at a new input file.
260 #define YY_BUFFER_EOF_PENDING 2
263 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
265 /* We provide macros for accessing buffer states in case in the
266 * future we want to put the buffer states in a more general
269 * Returns the top of the stack, or NULL.
271 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
272 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
275 /* Same as previous macro, but useful when we know that the buffer stack is not
276 * NULL or when we need an lvalue. For internal use only.
278 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
280 void glcpp_restart (FILE *input_file
,yyscan_t yyscanner
);
281 void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer
,yyscan_t yyscanner
);
282 YY_BUFFER_STATE
glcpp__create_buffer (FILE *file
,int size
,yyscan_t yyscanner
);
283 void glcpp__delete_buffer (YY_BUFFER_STATE b
,yyscan_t yyscanner
);
284 void glcpp__flush_buffer (YY_BUFFER_STATE b
,yyscan_t yyscanner
);
285 void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer
,yyscan_t yyscanner
);
286 void glcpp_pop_buffer_state (yyscan_t yyscanner
);
288 static void glcpp_ensure_buffer_stack (yyscan_t yyscanner
);
289 static void glcpp__load_buffer_state (yyscan_t yyscanner
);
290 static void glcpp__init_buffer (YY_BUFFER_STATE b
,FILE *file
,yyscan_t yyscanner
);
292 #define YY_FLUSH_BUFFER glcpp__flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
294 YY_BUFFER_STATE
glcpp__scan_buffer (char *base
,yy_size_t size
,yyscan_t yyscanner
);
295 YY_BUFFER_STATE
glcpp__scan_string (yyconst
char *yy_str
,yyscan_t yyscanner
);
296 YY_BUFFER_STATE
glcpp__scan_bytes (yyconst
char *bytes
,int len
,yyscan_t yyscanner
);
298 void *glcpp_alloc (yy_size_t
,yyscan_t yyscanner
);
299 void *glcpp_realloc (void *,yy_size_t
,yyscan_t yyscanner
);
300 void glcpp_free (void * ,yyscan_t yyscanner
);
302 #define yy_new_buffer glcpp__create_buffer
304 #define yy_set_interactive(is_interactive) \
306 if ( ! YY_CURRENT_BUFFER ){ \
307 glcpp_ensure_buffer_stack (yyscanner); \
308 YY_CURRENT_BUFFER_LVALUE = \
309 glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
311 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
314 #define yy_set_bol(at_bol) \
316 if ( ! YY_CURRENT_BUFFER ){\
317 glcpp_ensure_buffer_stack (yyscanner); \
318 YY_CURRENT_BUFFER_LVALUE = \
319 glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
321 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
324 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
326 /* Begin user sect3 */
328 #define glcpp_wrap(n) 1
329 #define YY_SKIP_YYWRAP
331 typedef unsigned char YY_CHAR
;
333 typedef int yy_state_type
;
335 #define yytext_ptr yytext_r
337 static yy_state_type
yy_get_previous_state (yyscan_t yyscanner
);
338 static yy_state_type
yy_try_NUL_trans (yy_state_type current_state
,yyscan_t yyscanner
);
339 static int yy_get_next_buffer (yyscan_t yyscanner
);
340 static void yy_fatal_error (yyconst
char msg
[] ,yyscan_t yyscanner
);
342 /* Done after the current pattern has been matched and before the
343 * corresponding action - sets up yytext.
345 #define YY_DO_BEFORE_ACTION \
346 yyg->yytext_ptr = yy_bp; \
347 yyleng = (size_t) (yy_cp - yy_bp); \
348 yyg->yy_hold_char = *yy_cp; \
350 yyg->yy_c_buf_p = yy_cp;
352 #define YY_NUM_RULES 43
353 #define YY_END_OF_BUFFER 44
354 /* This struct is not used in this scanner,
355 but its presence is necessary. */
358 flex_int32_t yy_verify
;
361 static yyconst flex_int16_t yy_acclist
[107] =
363 3, 3, 44, 39, 43, 40, 43, 41, 43, 43,
364 38, 43, 43, 38, 43, 38, 43, 38, 43, 25,
365 43, 24, 43, 38, 43, 38, 43, 38, 43, 37,
366 43, 37, 43, 38, 43, 40, 43, 23, 43, 3,
367 43, 4, 43, 5, 43, 42, 43, 18, 43, 18,
368 43, 18, 43, 39, 40, 32, 35, 33, 2, 1,
369 25, 25, 24, 24, 27, 29, 31, 30, 28, 37,
370 37, 34, 40, 23, 23, 3, 4, 5, 6, 5,
371 7, 1, 26, 37, 26, 37, 14, 37, 15, 16,
372 37, 17, 19, 12, 22, 36, 37, 21, 19, 13,
374 16404, 11, 9, 8, 8212, 10
377 static yyconst flex_int16_t yy_accept
[155] =
379 1, 1, 1, 1, 1, 2, 3, 3, 3, 3,
380 3, 4, 6, 8, 10, 11, 13, 14, 16, 18,
381 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
382 40, 42, 44, 46, 48, 50, 52, 54, 55, 56,
383 57, 58, 59, 60, 61, 62, 63, 63, 64, 65,
384 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
385 76, 76, 76, 76, 76, 76, 76, 76, 77, 78,
386 79, 80, 81, 82, 82, 82, 82, 82, 83, 84,
387 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
388 85, 86, 87, 87, 87, 87, 87, 87, 87, 88,
390 88, 88, 88, 88, 88, 88, 89, 89, 90, 91,
391 91, 91, 91, 91, 91, 91, 91, 91, 91, 92,
392 92, 93, 94, 94, 95, 95, 95, 95, 96, 96,
393 98, 99, 100, 100, 101, 101, 101, 101, 102, 102,
394 102, 103, 103, 104, 105, 105, 105, 105, 106, 106,
398 static yyconst flex_int32_t yy_ec
[256] =
400 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
401 4, 4, 4, 1, 1, 1, 1, 1, 1, 1,
402 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
403 1, 2, 5, 1, 6, 1, 7, 8, 1, 9,
404 7, 10, 7, 7, 7, 7, 11, 12, 13, 13,
405 13, 13, 13, 13, 13, 14, 14, 1, 7, 15,
406 16, 17, 1, 1, 18, 18, 18, 18, 18, 18,
407 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
408 19, 19, 19, 19, 20, 19, 19, 21, 19, 19,
409 7, 1, 7, 7, 19, 1, 22, 18, 18, 23,
411 24, 25, 26, 19, 27, 19, 19, 28, 29, 30,
412 31, 32, 19, 33, 34, 35, 36, 37, 19, 38,
413 19, 19, 7, 39, 7, 7, 1, 1, 1, 1,
414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
416 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
417 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
418 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
419 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
420 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
422 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
423 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
425 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
426 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430 static yyconst flex_int32_t yy_meta
[40] =
432 1, 2, 3, 1, 1, 1, 1, 1, 4, 5,
433 1, 6, 6, 6, 1, 1, 1, 7, 8, 8,
434 8, 7, 9, 7, 7, 8, 8, 8, 8, 10,
435 8, 8, 8, 8, 8, 8, 8, 8, 1
438 static yyconst flex_int16_t yy_base
[168] =
440 0, 38, 0, 0, 38, 39, 333, 332, 331, 44,
441 333, 331, 329, 337, 337, 314, 323, 337, 320, 41,
442 41, 44, 44, 311, 49, 0, 302, 286, 61, 79,
443 321, 337, 65, 337, 337, 67, 68, 322, 320, 337,
444 337, 337, 337, 0, 74, 337, 0, 76, 337, 337,
445 337, 337, 337, 337, 0, 296, 337, 72, 314, 313,
446 294, 71, 292, 289, 282, 284, 289, 309, 337, 110,
447 337, 114, 337, 91, 81, 112, 15, 0, 35, 284,
448 285, 57, 286, 275, 272, 96, 276, 283, 281, 270,
449 337, 272, 274, 275, 275, 271, 266, 272, 337, 271,
451 271, 264, 256, 257, 246, 255, 240, 337, 337, 235,
452 222, 224, 228, 222, 234, 189, 140, 137, 140, 138,
453 337, 0, 127, 337, 135, 116, 137, 337, 127, 0,
454 140, 0, 108, 337, 120, 0, 101, 125, 69, 135,
455 337, 138, 0, 337, 89, 52, 141, 337, 63, 143,
456 337, 154, 337, 168, 178, 188, 198, 203, 213, 223,
457 233, 238, 247, 257, 267, 276, 283
460 static yyconst flex_int16_t yy_def
[168] =
462 153, 1, 154, 154, 155, 155, 156, 156, 157, 157,
463 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
464 153, 153, 153, 153, 153, 158, 158, 153, 153, 153,
465 159, 153, 160, 153, 153, 153, 153, 153, 153, 153,
466 153, 153, 153, 161, 153, 153, 162, 153, 153, 153,
467 153, 153, 153, 153, 158, 158, 153, 153, 30, 30,
468 153, 153, 153, 153, 153, 153, 153, 159, 153, 160,
469 153, 160, 153, 153, 153, 153, 153, 161, 162, 158,
470 153, 153, 153, 153, 153, 163, 153, 153, 153, 153,
471 153, 158, 153, 153, 153, 153, 153, 153, 153, 153,
473 153, 153, 153, 153, 153, 158, 153, 153, 153, 153,
474 153, 153, 153, 153, 153, 153, 153, 153, 158, 153,
475 153, 164, 153, 153, 153, 153, 153, 153, 153, 158,
476 153, 164, 153, 153, 153, 165, 153, 166, 153, 153,
477 153, 153, 165, 153, 167, 153, 153, 153, 167, 153,
478 153, 153, 0, 153, 153, 153, 153, 153, 153, 153,
479 153, 153, 153, 153, 153, 153, 153
482 static yyconst flex_int16_t yy_nxt
[377] =
484 12, 13, 14, 15, 16, 17, 18, 19, 18, 18,
485 20, 21, 22, 22, 23, 24, 25, 26, 26, 26,
486 26, 26, 27, 26, 26, 26, 26, 26, 26, 26,
487 26, 26, 26, 26, 26, 26, 26, 26, 28, 29,
488 32, 32, 82, 30, 83, 36, 14, 33, 33, 37,
489 43, 44, 45, 45, 91, 48, 48, 48, 50, 51,
490 46, 47, 58, 49, 53, 54, 59, 71, 74, 76,
491 91, 148, 75, 58, 72, 73, 46, 59, 47, 49,
492 60, 136, 76, 94, 41, 45, 45, 48, 48, 48,
493 95, 77, 74, 46, 63, 49, 75, 148, 82, 146,
495 83, 61, 62, 84, 77, 63, 64, 63, 85, 46,
496 65, 49, 71, 76, 66, 67, 71, 126, 100, 153,
497 153, 140, 141, 72, 73, 101, 138, 135, 135, 135,
498 144, 142, 142, 142, 139, 77, 140, 141, 63, 140,
499 141, 138, 150, 151, 150, 151, 147, 147, 147, 142,
500 142, 142, 152, 152, 152, 150, 151, 137, 136, 134,
501 133, 131, 130, 129, 128, 152, 152, 152, 15, 15,
502 15, 15, 15, 15, 15, 15, 15, 15, 31, 31,
503 31, 31, 31, 31, 31, 31, 31, 31, 34, 34,
504 34, 34, 34, 34, 34, 34, 34, 34, 35, 35,
506 35, 35, 35, 35, 35, 35, 35, 35, 55, 55,
507 55, 55, 55, 68, 68, 68, 68, 127, 68, 68,
508 68, 68, 68, 70, 70, 70, 70, 70, 70, 70,
509 70, 70, 70, 78, 78, 126, 78, 78, 78, 78,
510 78, 78, 78, 79, 79, 125, 79, 99, 99, 99,
511 99, 99, 124, 123, 122, 99, 99, 132, 132, 121,
512 132, 132, 132, 132, 132, 132, 132, 143, 143, 120,
513 143, 143, 143, 143, 143, 143, 143, 145, 119, 118,
514 117, 116, 145, 145, 145, 145, 149, 115, 149, 149,
515 149, 149, 149, 114, 113, 112, 111, 110, 109, 108,
517 107, 106, 105, 104, 103, 102, 98, 97, 96, 93,
518 92, 69, 90, 89, 88, 87, 86, 81, 153, 153,
519 80, 39, 38, 69, 57, 56, 52, 42, 41, 40,
520 39, 38, 153, 14, 15, 15, 11, 153, 153, 153,
521 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
522 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
523 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
524 153, 153, 153, 153, 153, 153
527 static yyconst flex_int16_t yy_chk
[377] =
529 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
530 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
531 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
532 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
533 5, 6, 77, 2, 77, 10, 10, 5, 6, 10,
534 20, 20, 21, 21, 79, 22, 22, 22, 23, 23,
535 21, 21, 29, 22, 25, 25, 29, 33, 36, 37,
536 79, 149, 36, 58, 33, 33, 21, 58, 21, 22,
537 30, 146, 75, 82, 30, 45, 45, 48, 48, 48,
538 82, 37, 74, 45, 37, 48, 74, 145, 62, 139,
540 62, 30, 30, 62, 75, 30, 30, 75, 62, 45,
541 30, 48, 70, 76, 30, 30, 72, 126, 86, 70,
542 70, 135, 135, 72, 72, 86, 138, 126, 126, 126,
543 137, 135, 135, 135, 133, 76, 140, 140, 76, 142,
544 142, 131, 147, 147, 150, 150, 140, 140, 140, 142,
545 142, 142, 147, 147, 147, 152, 152, 129, 127, 125,
546 123, 120, 119, 118, 117, 152, 152, 152, 154, 154,
547 154, 154, 154, 154, 154, 154, 154, 154, 155, 155,
548 155, 155, 155, 155, 155, 155, 155, 155, 156, 156,
549 156, 156, 156, 156, 156, 156, 156, 156, 157, 157,
551 157, 157, 157, 157, 157, 157, 157, 157, 158, 158,
552 158, 158, 158, 159, 159, 159, 159, 116, 159, 159,
553 159, 159, 159, 160, 160, 160, 160, 160, 160, 160,
554 160, 160, 160, 161, 161, 115, 161, 161, 161, 161,
555 161, 161, 161, 162, 162, 114, 162, 163, 163, 163,
556 163, 163, 113, 112, 111, 163, 163, 164, 164, 110,
557 164, 164, 164, 164, 164, 164, 164, 165, 165, 107,
558 165, 165, 165, 165, 165, 165, 165, 166, 106, 105,
559 104, 103, 166, 166, 166, 166, 167, 102, 167, 167,
560 167, 167, 167, 101, 100, 98, 97, 96, 95, 94,
562 93, 92, 90, 89, 88, 87, 85, 84, 83, 81,
563 80, 68, 67, 66, 65, 64, 63, 61, 60, 59,
564 56, 39, 38, 31, 28, 27, 24, 19, 17, 16,
565 13, 12, 11, 9, 8, 7, 153, 153, 153, 153,
566 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
567 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
568 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
569 153, 153, 153, 153, 153, 153
572 #define YY_TRAILING_MASK 0x2000
573 #define YY_TRAILING_HEAD_MASK 0x4000
576 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ \
577 yy_cp = yyg->yy_full_match; /* restore poss. backed-over text */ \
578 yyg->yy_lp = yyg->yy_full_lp; /* restore orig. accepting pos. */ \
579 yyg->yy_state_ptr = yyg->yy_full_state; /* restore orig. state */ \
580 yy_current_state = *yyg->yy_state_ptr; /* restore curr. state */ \
585 #define yymore() yymore_used_but_not_detected
586 #define YY_MORE_ADJ 0
587 #define YY_RESTORE_YY_MORE_OFFSET
588 #line 1 "glcpp/glcpp-lex.l"
589 #line 2 "glcpp/glcpp-lex.l"
591 * Copyright © 2010 Intel Corporation
593 * Permission is hereby granted, free of charge, to any person obtaining a
594 * copy of this software and associated documentation files (the "Software"),
595 * to deal in the Software without restriction, including without limitation
596 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
597 * and/or sell copies of the Software, and to permit persons to whom the
598 * Software is furnished to do so, subject to the following conditions:
600 * The above copyright notice and this permission notice (including the next
601 * paragraph) shall be included in all copies or substantial portions of the
604 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
605 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
606 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
607 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
608 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
609 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
610 * DEALINGS IN THE SOFTWARE.
618 #include "glcpp-parse.h"
620 /* Flex annoyingly generates some functions without making them
621 * static. Let's declare them here. */
622 int glcpp_get_column (yyscan_t yyscanner
);
623 void glcpp_set_column (int column_no
, yyscan_t yyscanner
);
626 #define YY_NO_UNISTD_H
631 #define YY_USER_ACTION \
633 yylloc->first_column = yycolumn + 1; \
634 yylloc->first_line = yylineno; \
635 yycolumn += yyleng; \
638 #define YY_USER_INIT \
642 yylloc->source = 0; \
645 /* The OTHER class is simply a catch-all for things that the CPP
646 parser just doesn't care about. Since flex regular expressions that
647 match longer strings take priority over those matching shorter
648 strings, we have to be careful to avoid OTHER matching and hiding
649 something that CPP does care about. So we simply exclude all
650 characters that appear in any other expressions. */
651 #line 652 "glcpp/glcpp-lex.c"
656 #define UNREACHABLE 3
659 #define YY_EXTRA_TYPE glcpp_parser_t *
661 /* Holds the entire state of the reentrant scanner. */
665 /* User-defined. Not touched by flex. */
666 YY_EXTRA_TYPE yyextra_r
;
668 /* The rest are the same as the globals declared in the non-reentrant scanner. */
669 FILE *yyin_r
, *yyout_r
;
670 size_t yy_buffer_stack_top
; /**< index of top of stack. */
671 size_t yy_buffer_stack_max
; /**< capacity of stack. */
672 YY_BUFFER_STATE
* yy_buffer_stack
; /**< Stack as an array. */
679 int yy_did_buffer_switch_on_eof
;
680 int yy_start_stack_ptr
;
681 int yy_start_stack_depth
;
683 yy_state_type yy_last_accepting_state
;
684 char* yy_last_accepting_cpos
;
689 yy_state_type
*yy_state_buf
;
690 yy_state_type
*yy_state_ptr
;
694 /* These are only needed for trailing context rules,
695 * but there's no conditional variable for that yet. */
696 int yy_looking_for_trail_begin
;
708 }; /* end struct yyguts_t */
710 static int yy_init_globals (yyscan_t yyscanner
);
712 /* This must go here because YYSTYPE and YYLTYPE are included
713 * from bison output in section 1.*/
714 # define yylval yyg->yylval_r
716 # define yylloc yyg->yylloc_r
718 int glcpp_lex_init (yyscan_t
* scanner
);
720 int glcpp_lex_init_extra (YY_EXTRA_TYPE user_defined
,yyscan_t
* scanner
);
722 /* Accessor methods to globals.
723 These are made visible to non-reentrant scanners for convenience. */
725 int glcpp_lex_destroy (yyscan_t yyscanner
);
727 int glcpp_get_debug (yyscan_t yyscanner
);
729 void glcpp_set_debug (int debug_flag
,yyscan_t yyscanner
);
731 YY_EXTRA_TYPE
glcpp_get_extra (yyscan_t yyscanner
);
733 void glcpp_set_extra (YY_EXTRA_TYPE user_defined
,yyscan_t yyscanner
);
735 FILE *glcpp_get_in (yyscan_t yyscanner
);
737 void glcpp_set_in (FILE * in_str
,yyscan_t yyscanner
);
739 FILE *glcpp_get_out (yyscan_t yyscanner
);
741 void glcpp_set_out (FILE * out_str
,yyscan_t yyscanner
);
743 int glcpp_get_leng (yyscan_t yyscanner
);
745 char *glcpp_get_text (yyscan_t yyscanner
);
747 int glcpp_get_lineno (yyscan_t yyscanner
);
749 void glcpp_set_lineno (int line_number
,yyscan_t yyscanner
);
751 int glcpp_get_column (yyscan_t yyscanner
);
753 void glcpp_set_column (int column_no
,yyscan_t yyscanner
);
755 YYSTYPE
* glcpp_get_lval (yyscan_t yyscanner
);
757 void glcpp_set_lval (YYSTYPE
* yylval_param
,yyscan_t yyscanner
);
759 YYLTYPE
*glcpp_get_lloc (yyscan_t yyscanner
);
761 void glcpp_set_lloc (YYLTYPE
* yylloc_param
,yyscan_t yyscanner
);
763 /* Macros after this point can all be overridden by user definitions in
767 #ifndef YY_SKIP_YYWRAP
769 extern "C" int glcpp_wrap (yyscan_t yyscanner
);
771 extern int glcpp_wrap (yyscan_t yyscanner
);
775 static void yyunput (int c
,char *buf_ptr
,yyscan_t yyscanner
);
778 static void yy_flex_strncpy (char *,yyconst
char *,int ,yyscan_t yyscanner
);
781 #ifdef YY_NEED_STRLEN
782 static int yy_flex_strlen (yyconst
char * ,yyscan_t yyscanner
);
788 static int yyinput (yyscan_t yyscanner
);
790 static int input (yyscan_t yyscanner
);
795 static void yy_push_state (int new_state
,yyscan_t yyscanner
);
797 static void yy_pop_state (yyscan_t yyscanner
);
799 static int yy_top_state (yyscan_t yyscanner
);
801 /* Amount of stuff to slurp up with each read. */
802 #ifndef YY_READ_BUF_SIZE
803 #define YY_READ_BUF_SIZE 8192
806 /* Copy whatever the last rule matched to the standard output. */
808 /* This used to be an fputs(), but since the string might contain NUL's,
809 * we now use fwrite().
811 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
814 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
815 * is returned in "result".
818 #define YY_INPUT(buf,result,max_size) \
819 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
823 for ( n = 0; n < max_size && \
824 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
827 buf[n++] = (char) c; \
828 if ( c == EOF && ferror( yyin ) ) \
829 YY_FATAL_ERROR( "input in flex scanner failed" ); \
835 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
837 if( errno != EINTR) \
839 YY_FATAL_ERROR( "input in flex scanner failed" ); \
850 /* No semi-colon after return; correct usage is to write "yyterminate();" -
851 * we don't want an extra ';' after the "return" because that will cause
852 * some compilers to complain about unreachable statements.
855 #define yyterminate() return YY_NULL
858 /* Number of entries by which start-condition stack grows. */
859 #ifndef YY_START_STACK_INCR
860 #define YY_START_STACK_INCR 25
863 /* Report a fatal error. */
864 #ifndef YY_FATAL_ERROR
865 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
868 /* end tables serialization structures and prototypes */
870 /* Default declaration of generated scanner - a define so the user can
871 * easily add parameters.
874 #define YY_DECL_IS_OURS 1
876 extern int glcpp_lex \
877 (YYSTYPE
* yylval_param
,YYLTYPE
* yylloc_param
,yyscan_t yyscanner
);
879 #define YY_DECL int glcpp_lex \
880 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
881 #endif /* !YY_DECL */
883 /* Code executed at the beginning of each rule, after yytext and yyleng
886 #ifndef YY_USER_ACTION
887 #define YY_USER_ACTION
890 /* Code executed at the end of each rule. */
892 #define YY_BREAK break;
895 #define YY_RULE_SETUP \
897 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
898 (yytext[yyleng - 1] == '\n'); \
901 /** The main scanner function which does all the work.
905 register yy_state_type yy_current_state
;
906 register char *yy_cp
, *yy_bp
;
908 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
910 #line 88 "glcpp/glcpp-lex.l"
912 /* Implicitly switch between SKIP and INITIAL (non-skipping);
913 * don't switch if some other state was explicitly set.
915 glcpp_parser_t
*parser
= yyextra
;
916 if (YY_START
== 0 || YY_START
== SKIP
) {
917 if (parser
->lexing_if
|| parser
->skip_stack
== NULL
|| parser
->skip_stack
->type
== SKIP_NO_SKIP
) {
924 /* Single-line comments */
925 #line 926 "glcpp/glcpp-lex.c"
927 yylval
= yylval_param
;
929 yylloc
= yylloc_param
;
939 /* Create the reject buffer large enough to save one state per allowed character. */
940 if ( ! yyg
->yy_state_buf
)
941 yyg
->yy_state_buf
= (yy_state_type
*)glcpp_alloc(YY_STATE_BUF_SIZE
,yyscanner
);
942 if ( ! yyg
->yy_state_buf
)
943 YY_FATAL_ERROR( "out of dynamic memory in glcpp_lex()" );
945 if ( ! yyg
->yy_start
)
946 yyg
->yy_start
= 1; /* first start state */
954 if ( ! YY_CURRENT_BUFFER
) {
955 glcpp_ensure_buffer_stack (yyscanner
);
956 YY_CURRENT_BUFFER_LVALUE
=
957 glcpp__create_buffer(yyin
,YY_BUF_SIZE
,yyscanner
);
960 glcpp__load_buffer_state(yyscanner
);
963 while ( 1 ) /* loops until end-of-file is reached */
965 yy_cp
= yyg
->yy_c_buf_p
;
967 /* Support of yytext. */
968 *yy_cp
= yyg
->yy_hold_char
;
970 /* yy_bp points to the position in yy_ch_buf of the start of
975 yy_current_state
= yyg
->yy_start
;
976 yy_current_state
+= YY_AT_BOL();
978 yyg
->yy_state_ptr
= yyg
->yy_state_buf
;
979 *yyg
->yy_state_ptr
++ = yy_current_state
;
984 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
985 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
987 yy_current_state
= (int) yy_def
[yy_current_state
];
988 if ( yy_current_state
>= 154 )
989 yy_c
= yy_meta
[(unsigned int) yy_c
];
991 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
992 *yyg
->yy_state_ptr
++ = yy_current_state
;
995 while ( yy_current_state
!= 153 );
998 yy_current_state
= *--yyg
->yy_state_ptr
;
999 yyg
->yy_lp
= yy_accept
[yy_current_state
];
1000 find_rule
: /* we branch to this label when backing up */
1001 for ( ; ; ) /* until we find what rule we matched */
1003 if ( yyg
->yy_lp
&& yyg
->yy_lp
< yy_accept
[yy_current_state
+ 1] )
1005 yy_act
= yy_acclist
[yyg
->yy_lp
];
1006 if ( yy_act
& YY_TRAILING_HEAD_MASK
||
1007 yyg
->yy_looking_for_trail_begin
)
1009 if ( yy_act
== yyg
->yy_looking_for_trail_begin
)
1011 yyg
->yy_looking_for_trail_begin
= 0;
1012 yy_act
&= ~YY_TRAILING_HEAD_MASK
;
1016 else if ( yy_act
& YY_TRAILING_MASK
)
1018 yyg
->yy_looking_for_trail_begin
= yy_act
& ~YY_TRAILING_MASK
;
1019 yyg
->yy_looking_for_trail_begin
|= YY_TRAILING_HEAD_MASK
;
1023 yyg
->yy_full_match
= yy_cp
;
1024 yyg
->yy_full_state
= yyg
->yy_state_ptr
;
1025 yyg
->yy_full_lp
= yyg
->yy_lp
;
1032 yy_current_state
= *--yyg
->yy_state_ptr
;
1033 yyg
->yy_lp
= yy_accept
[yy_current_state
];
1036 YY_DO_BEFORE_ACTION
;
1038 do_action
: /* This label is used only to access EOF actions. */
1041 { /* beginning of action switch */
1044 #line 102 "glcpp/glcpp-lex.l"
1048 /* Multi-line comments */
1051 #line 106 "glcpp/glcpp-lex.l"
1052 { yy_push_state(COMMENT
, yyscanner
); }
1056 #line 107 "glcpp/glcpp-lex.l"
1060 /* rule 4 can match eol */
1062 #line 108 "glcpp/glcpp-lex.l"
1063 { yylineno
++; yycolumn
= 0; return NEWLINE
; }
1067 #line 109 "glcpp/glcpp-lex.l"
1071 /* rule 6 can match eol */
1073 #line 110 "glcpp/glcpp-lex.l"
1074 { yylineno
++; yycolumn
= 0; return NEWLINE
; }
1078 #line 111 "glcpp/glcpp-lex.l"
1080 yy_pop_state(yyscanner
);
1081 if (yyextra
->space_tokens
)
1087 #line 117 "glcpp/glcpp-lex.l"
1089 yylval
->str
= ralloc_strdup (yyextra
, yytext
);
1090 yyextra
->space_tokens
= 0;
1091 return HASH_VERSION
;
1094 /* glcpp doesn't handle #extension, #version, or #pragma directives.
1095 * Simply pass them through to the main compiler's lexer/parser. */
1098 #line 125 "glcpp/glcpp-lex.l"
1100 yylval
->str
= ralloc_strdup (yyextra
, yytext
);
1107 *yy_cp
= yyg
->yy_hold_char
; /* undo effects of setting up yytext */
1108 yyg
->yy_c_buf_p
= yy_cp
-= 1;
1109 YY_DO_BEFORE_ACTION
; /* set up yytext again */
1111 #line 132 "glcpp/glcpp-lex.l"
1113 /* Eat characters until the first digit is
1117 while (!isdigit(*ptr
))
1120 /* Subtract one from the line number because
1121 * yylineno is zero-based instead of
1124 yylineno
= strtol(ptr
, &ptr
, 0) - 1;
1125 yylloc
->source
= strtol(ptr
, NULL
, 0);
1129 *yy_cp
= yyg
->yy_hold_char
; /* undo effects of setting up yytext */
1130 yyg
->yy_c_buf_p
= yy_cp
-= 1;
1131 YY_DO_BEFORE_ACTION
; /* set up yytext again */
1133 #line 148 "glcpp/glcpp-lex.l"
1135 /* Eat characters until the first digit is
1139 while (!isdigit(*ptr
))
1142 /* Subtract one from the line number because
1143 * yylineno is zero-based instead of
1146 yylineno
= strtol(ptr
, &ptr
, 0) - 1;
1152 #line 164 "glcpp/glcpp-lex.l"
1154 yyextra
->lexing_if
= 1;
1155 yyextra
->space_tokens
= 0;
1161 #line 170 "glcpp/glcpp-lex.l"
1163 yyextra
->lexing_if
= 1;
1164 yyextra
->space_tokens
= 0;
1169 /* rule 14 can match eol */
1170 *yy_cp
= yyg
->yy_hold_char
; /* undo effects of setting up yytext */
1171 yyg
->yy_c_buf_p
= yy_cp
-= 1;
1172 YY_DO_BEFORE_ACTION
; /* set up yytext again */
1174 #line 176 "glcpp/glcpp-lex.l"
1176 yyextra
->lexing_if
= 1;
1177 yyextra
->space_tokens
= 0;
1183 #line 182 "glcpp/glcpp-lex.l"
1185 yyextra
->lexing_if
= 1;
1186 yyextra
->space_tokens
= 0;
1192 #line 188 "glcpp/glcpp-lex.l"
1194 yyextra
->space_tokens
= 0;
1200 #line 193 "glcpp/glcpp-lex.l"
1202 yyextra
->space_tokens
= 0;
1209 #line 199 "glcpp/glcpp-lex.l"
1214 #line 201 "glcpp/glcpp-lex.l"
1217 for (p
= yytext
; !isalpha(p
[0]); p
++); /* skip " # " */
1218 p
+= 5; /* skip "error" */
1219 glcpp_error(yylloc
, yyextra
, "#error%s", p
);
1224 #line 208 "glcpp/glcpp-lex.l"
1226 yyextra
->space_tokens
= 0;
1227 return HASH_DEFINE_FUNC
;
1232 #line 213 "glcpp/glcpp-lex.l"
1234 yyextra
->space_tokens
= 0;
1235 return HASH_DEFINE_OBJ
;
1240 #line 218 "glcpp/glcpp-lex.l"
1242 yyextra
->space_tokens
= 0;
1248 #line 223 "glcpp/glcpp-lex.l"
1250 yyextra
->space_tokens
= 0;
1256 #line 228 "glcpp/glcpp-lex.l"
1258 yylval
->str
= ralloc_strdup (yyextra
, yytext
);
1259 return INTEGER_STRING
;
1264 #line 233 "glcpp/glcpp-lex.l"
1266 yylval
->str
= ralloc_strdup (yyextra
, yytext
);
1267 return INTEGER_STRING
;
1272 #line 238 "glcpp/glcpp-lex.l"
1274 yylval
->str
= ralloc_strdup (yyextra
, yytext
);
1275 return INTEGER_STRING
;
1280 #line 243 "glcpp/glcpp-lex.l"
1287 #line 247 "glcpp/glcpp-lex.l"
1294 #line 251 "glcpp/glcpp-lex.l"
1296 return LESS_OR_EQUAL
;
1301 #line 255 "glcpp/glcpp-lex.l"
1303 return GREATER_OR_EQUAL
;
1308 #line 259 "glcpp/glcpp-lex.l"
1315 #line 263 "glcpp/glcpp-lex.l"
1322 #line 267 "glcpp/glcpp-lex.l"
1329 #line 271 "glcpp/glcpp-lex.l"
1336 #line 275 "glcpp/glcpp-lex.l"
1343 #line 279 "glcpp/glcpp-lex.l"
1350 #line 283 "glcpp/glcpp-lex.l"
1352 yylval
->str
= ralloc_strdup (yyextra
, yytext
);
1358 #line 288 "glcpp/glcpp-lex.l"
1365 #line 292 "glcpp/glcpp-lex.l"
1367 yylval
->str
= ralloc_strdup (yyextra
, yytext
);
1373 #line 297 "glcpp/glcpp-lex.l"
1375 if (yyextra
->space_tokens
) {
1381 /* rule 41 can match eol */
1383 #line 303 "glcpp/glcpp-lex.l"
1385 yyextra
->lexing_if
= 0;
1391 /* Handle missing newline at EOF. */
1392 case YY_STATE_EOF(INITIAL
):
1393 #line 311 "glcpp/glcpp-lex.l"
1395 BEGIN DONE
; /* Don't keep matching this rule forever. */
1396 yyextra
->lexing_if
= 0;
1400 /* We don't actually use the UNREACHABLE start condition. We
1401 only have this action here so that we can pretend to call some
1402 generated functions, (to avoid "defined but not used"
1406 #line 321 "glcpp/glcpp-lex.l"
1409 yy_top_state(yyextra
);
1414 #line 326 "glcpp/glcpp-lex.l"
1417 #line 1418 "glcpp/glcpp-lex.c"
1418 case YY_STATE_EOF(DONE
):
1419 case YY_STATE_EOF(COMMENT
):
1420 case YY_STATE_EOF(UNREACHABLE
):
1421 case YY_STATE_EOF(SKIP
):
1424 case YY_END_OF_BUFFER
:
1426 /* Amount of text matched not including the EOB char. */
1427 int yy_amount_of_matched_text
= (int) (yy_cp
- yyg
->yytext_ptr
) - 1;
1429 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1430 *yy_cp
= yyg
->yy_hold_char
;
1431 YY_RESTORE_YY_MORE_OFFSET
1433 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_NEW
)
1435 /* We're scanning a new file or input source. It's
1436 * possible that this happened because the user
1437 * just pointed yyin at a new source and called
1438 * glcpp_lex(). If so, then we have to assure
1439 * consistency between YY_CURRENT_BUFFER and our
1440 * globals. Here is the right place to do so, because
1441 * this is the first action (other than possibly a
1442 * back-up) that will match for the new input source.
1444 yyg
->yy_n_chars
= YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1445 YY_CURRENT_BUFFER_LVALUE
->yy_input_file
= yyin
;
1446 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
= YY_BUFFER_NORMAL
;
1449 /* Note that here we test for yy_c_buf_p "<=" to the position
1450 * of the first EOB in the buffer, since yy_c_buf_p will
1451 * already have been incremented past the NUL character
1452 * (since all states make transitions on EOB to the
1453 * end-of-buffer state). Contrast this with the test
1456 if ( yyg
->yy_c_buf_p
<= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] )
1457 { /* This was really a NUL. */
1458 yy_state_type yy_next_state
;
1460 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ yy_amount_of_matched_text
;
1462 yy_current_state
= yy_get_previous_state( yyscanner
);
1464 /* Okay, we're now positioned to make the NUL
1465 * transition. We couldn't have
1466 * yy_get_previous_state() go ahead and do it
1467 * for us because it doesn't know how to deal
1468 * with the possibility of jamming (and we don't
1469 * want to build jamming into it because then it
1470 * will run more slowly).
1473 yy_next_state
= yy_try_NUL_trans( yy_current_state
, yyscanner
);
1475 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1477 if ( yy_next_state
)
1479 /* Consume the NUL. */
1480 yy_cp
= ++yyg
->yy_c_buf_p
;
1481 yy_current_state
= yy_next_state
;
1487 yy_cp
= yyg
->yy_c_buf_p
;
1488 goto yy_find_action
;
1492 else switch ( yy_get_next_buffer( yyscanner
) )
1494 case EOB_ACT_END_OF_FILE
:
1496 yyg
->yy_did_buffer_switch_on_eof
= 0;
1498 if ( glcpp_wrap(yyscanner
) )
1500 /* Note: because we've taken care in
1501 * yy_get_next_buffer() to have set up
1502 * yytext, we can now set up
1503 * yy_c_buf_p so that if some total
1504 * hoser (like flex itself) wants to
1505 * call the scanner after we return the
1506 * YY_NULL, it'll still work - another
1507 * YY_NULL will get returned.
1509 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1511 yy_act
= YY_STATE_EOF(YY_START
);
1517 if ( ! yyg
->yy_did_buffer_switch_on_eof
)
1523 case EOB_ACT_CONTINUE_SCAN
:
1525 yyg
->yytext_ptr
+ yy_amount_of_matched_text
;
1527 yy_current_state
= yy_get_previous_state( yyscanner
);
1529 yy_cp
= yyg
->yy_c_buf_p
;
1530 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1533 case EOB_ACT_LAST_MATCH
:
1535 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
];
1537 yy_current_state
= yy_get_previous_state( yyscanner
);
1539 yy_cp
= yyg
->yy_c_buf_p
;
1540 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1541 goto yy_find_action
;
1548 "fatal flex scanner internal error--no action found" );
1549 } /* end of action switch */
1550 } /* end of scanning one token */
1551 } /* end of glcpp_lex */
1553 /* yy_get_next_buffer - try to read in a new buffer
1555 * Returns a code representing an action:
1556 * EOB_ACT_LAST_MATCH -
1557 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1558 * EOB_ACT_END_OF_FILE - end of file
1560 static int yy_get_next_buffer (yyscan_t yyscanner
)
1562 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1563 register char *dest
= YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
;
1564 register char *source
= yyg
->yytext_ptr
;
1565 register int number_to_move
, i
;
1568 if ( yyg
->yy_c_buf_p
> &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
+ 1] )
1570 "fatal flex scanner internal error--end of buffer missed" );
1572 if ( YY_CURRENT_BUFFER_LVALUE
->yy_fill_buffer
== 0 )
1573 { /* Don't try to fill the buffer, so this is an EOF. */
1574 if ( yyg
->yy_c_buf_p
- yyg
->yytext_ptr
- YY_MORE_ADJ
== 1 )
1576 /* We matched a single character, the EOB, so
1577 * treat this as a final EOF.
1579 return EOB_ACT_END_OF_FILE
;
1584 /* We matched some text prior to the EOB, first
1587 return EOB_ACT_LAST_MATCH
;
1591 /* Try to read more data. */
1593 /* First move last chars to start of buffer. */
1594 number_to_move
= (int) (yyg
->yy_c_buf_p
- yyg
->yytext_ptr
) - 1;
1596 for ( i
= 0; i
< number_to_move
; ++i
)
1597 *(dest
++) = *(source
++);
1599 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
1600 /* don't do the read, it's not guaranteed to return an EOF,
1603 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
= 0;
1608 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
- number_to_move
- 1;
1610 while ( num_to_read
<= 0 )
1611 { /* Not enough room in the buffer - grow it. */
1614 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1618 if ( num_to_read
> YY_READ_BUF_SIZE
)
1619 num_to_read
= YY_READ_BUF_SIZE
;
1621 /* Read in more data. */
1622 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
]),
1623 yyg
->yy_n_chars
, (size_t) num_to_read
);
1625 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
1628 if ( yyg
->yy_n_chars
== 0 )
1630 if ( number_to_move
== YY_MORE_ADJ
)
1632 ret_val
= EOB_ACT_END_OF_FILE
;
1633 glcpp_restart(yyin
,yyscanner
);
1638 ret_val
= EOB_ACT_LAST_MATCH
;
1639 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
=
1640 YY_BUFFER_EOF_PENDING
;
1645 ret_val
= EOB_ACT_CONTINUE_SCAN
;
1647 if ((yy_size_t
) (yyg
->yy_n_chars
+ number_to_move
) > YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
) {
1648 /* Extend the array by 50%, plus the number we really need. */
1649 yy_size_t new_size
= yyg
->yy_n_chars
+ number_to_move
+ (yyg
->yy_n_chars
>> 1);
1650 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
= (char *) glcpp_realloc((void *) YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
,new_size
,yyscanner
);
1651 if ( ! YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
1652 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1655 yyg
->yy_n_chars
+= number_to_move
;
1656 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] = YY_END_OF_BUFFER_CHAR
;
1657 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
+ 1] = YY_END_OF_BUFFER_CHAR
;
1659 yyg
->yytext_ptr
= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[0];
1664 /* yy_get_previous_state - get the state just before the EOB char was reached */
1666 static yy_state_type
yy_get_previous_state (yyscan_t yyscanner
)
1668 register yy_state_type yy_current_state
;
1669 register char *yy_cp
;
1670 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1672 yy_current_state
= yyg
->yy_start
;
1673 yy_current_state
+= YY_AT_BOL();
1675 yyg
->yy_state_ptr
= yyg
->yy_state_buf
;
1676 *yyg
->yy_state_ptr
++ = yy_current_state
;
1678 for ( yy_cp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
; yy_cp
< yyg
->yy_c_buf_p
; ++yy_cp
)
1680 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
1681 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1683 yy_current_state
= (int) yy_def
[yy_current_state
];
1684 if ( yy_current_state
>= 154 )
1685 yy_c
= yy_meta
[(unsigned int) yy_c
];
1687 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1688 *yyg
->yy_state_ptr
++ = yy_current_state
;
1691 return yy_current_state
;
1694 /* yy_try_NUL_trans - try to make a transition on the NUL character
1697 * next_state = yy_try_NUL_trans( current_state );
1699 static yy_state_type
yy_try_NUL_trans (yy_state_type yy_current_state
, yyscan_t yyscanner
)
1701 register int yy_is_jam
;
1702 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
; /* This var may be unused depending upon options. */
1704 register YY_CHAR yy_c
= 1;
1705 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1707 yy_current_state
= (int) yy_def
[yy_current_state
];
1708 if ( yy_current_state
>= 154 )
1709 yy_c
= yy_meta
[(unsigned int) yy_c
];
1711 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1712 yy_is_jam
= (yy_current_state
== 153);
1714 *yyg
->yy_state_ptr
++ = yy_current_state
;
1716 return yy_is_jam
? 0 : yy_current_state
;
1719 static void yyunput (int c
, register char * yy_bp
, yyscan_t yyscanner
)
1721 register char *yy_cp
;
1722 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1724 yy_cp
= yyg
->yy_c_buf_p
;
1726 /* undo effects of setting up yytext */
1727 *yy_cp
= yyg
->yy_hold_char
;
1729 if ( yy_cp
< YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
+ 2 )
1730 { /* need to shift things up to make room */
1731 /* +2 for EOB chars. */
1732 register int number_to_move
= yyg
->yy_n_chars
+ 2;
1733 register char *dest
= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[
1734 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
+ 2];
1735 register char *source
=
1736 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
];
1738 while ( source
> YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
1739 *--dest
= *--source
;
1741 yy_cp
+= (int) (dest
- source
);
1742 yy_bp
+= (int) (dest
- source
);
1743 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
=
1744 yyg
->yy_n_chars
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
;
1746 if ( yy_cp
< YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
+ 2 )
1747 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1750 *--yy_cp
= (char) c
;
1752 yyg
->yytext_ptr
= yy_bp
;
1753 yyg
->yy_hold_char
= *yy_cp
;
1754 yyg
->yy_c_buf_p
= yy_cp
;
1759 static int yyinput (yyscan_t yyscanner
)
1761 static int input (yyscan_t yyscanner
)
1766 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1768 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
1770 if ( *yyg
->yy_c_buf_p
== YY_END_OF_BUFFER_CHAR
)
1772 /* yy_c_buf_p now points to the character we want to return.
1773 * If this occurs *before* the EOB characters, then it's a
1774 * valid NUL; if not, then we've hit the end of the buffer.
1776 if ( yyg
->yy_c_buf_p
< &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] )
1777 /* This was really a NUL. */
1778 *yyg
->yy_c_buf_p
= '\0';
1781 { /* need more input */
1782 int offset
= yyg
->yy_c_buf_p
- yyg
->yytext_ptr
;
1785 switch ( yy_get_next_buffer( yyscanner
) )
1787 case EOB_ACT_LAST_MATCH
:
1788 /* This happens because yy_g_n_b()
1789 * sees that we've accumulated a
1790 * token and flags that we need to
1791 * try matching the token before
1792 * proceeding. But for input(),
1793 * there's no matching to consider.
1794 * So convert the EOB_ACT_LAST_MATCH
1795 * to EOB_ACT_END_OF_FILE.
1798 /* Reset buffer status. */
1799 glcpp_restart(yyin
,yyscanner
);
1803 case EOB_ACT_END_OF_FILE
:
1805 if ( glcpp_wrap(yyscanner
) )
1808 if ( ! yyg
->yy_did_buffer_switch_on_eof
)
1811 return yyinput(yyscanner
);
1813 return input(yyscanner
);
1817 case EOB_ACT_CONTINUE_SCAN
:
1818 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ offset
;
1824 c
= *(unsigned char *) yyg
->yy_c_buf_p
; /* cast for 8-bit char's */
1825 *yyg
->yy_c_buf_p
= '\0'; /* preserve yytext */
1826 yyg
->yy_hold_char
= *++yyg
->yy_c_buf_p
;
1828 YY_CURRENT_BUFFER_LVALUE
->yy_at_bol
= (c
== '\n');
1832 #endif /* ifndef YY_NO_INPUT */
1834 /** Immediately switch to a different input stream.
1835 * @param input_file A readable stream.
1836 * @param yyscanner The scanner object.
1837 * @note This function does not reset the start condition to @c INITIAL .
1839 void glcpp_restart (FILE * input_file
, yyscan_t yyscanner
)
1841 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1843 if ( ! YY_CURRENT_BUFFER
){
1844 glcpp_ensure_buffer_stack (yyscanner
);
1845 YY_CURRENT_BUFFER_LVALUE
=
1846 glcpp__create_buffer(yyin
,YY_BUF_SIZE
,yyscanner
);
1849 glcpp__init_buffer(YY_CURRENT_BUFFER
,input_file
,yyscanner
);
1850 glcpp__load_buffer_state(yyscanner
);
1853 /** Switch to a different input buffer.
1854 * @param new_buffer The new input buffer.
1855 * @param yyscanner The scanner object.
1857 void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
)
1859 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1861 /* TODO. We should be able to replace this entire function body
1863 * glcpp_pop_buffer_state();
1864 * glcpp_push_buffer_state(new_buffer);
1866 glcpp_ensure_buffer_stack (yyscanner
);
1867 if ( YY_CURRENT_BUFFER
== new_buffer
)
1870 if ( YY_CURRENT_BUFFER
)
1872 /* Flush out information for old buffer. */
1873 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
1874 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= yyg
->yy_c_buf_p
;
1875 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
1878 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1879 glcpp__load_buffer_state(yyscanner
);
1881 /* We don't actually know whether we did this switch during
1882 * EOF (glcpp_wrap()) processing, but the only time this flag
1883 * is looked at is after glcpp_wrap() is called, so it's safe
1884 * to go ahead and always set it.
1886 yyg
->yy_did_buffer_switch_on_eof
= 1;
1889 static void glcpp__load_buffer_state (yyscan_t yyscanner
)
1891 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1892 yyg
->yy_n_chars
= YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1893 yyg
->yytext_ptr
= yyg
->yy_c_buf_p
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
;
1894 yyin
= YY_CURRENT_BUFFER_LVALUE
->yy_input_file
;
1895 yyg
->yy_hold_char
= *yyg
->yy_c_buf_p
;
1898 /** Allocate and initialize an input buffer state.
1899 * @param file A readable stream.
1900 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1901 * @param yyscanner The scanner object.
1902 * @return the allocated buffer state.
1904 YY_BUFFER_STATE
glcpp__create_buffer (FILE * file
, int size
, yyscan_t yyscanner
)
1908 b
= (YY_BUFFER_STATE
) glcpp_alloc(sizeof( struct yy_buffer_state
) ,yyscanner
);
1910 YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
1912 b
->yy_buf_size
= size
;
1914 /* yy_ch_buf has to be 2 characters longer than the size given because
1915 * we need to put in 2 end-of-buffer characters.
1917 b
->yy_ch_buf
= (char *) glcpp_alloc(b
->yy_buf_size
+ 2 ,yyscanner
);
1918 if ( ! b
->yy_ch_buf
)
1919 YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
1921 b
->yy_is_our_buffer
= 1;
1923 glcpp__init_buffer(b
,file
,yyscanner
);
1928 /** Destroy the buffer.
1929 * @param b a buffer created with glcpp__create_buffer()
1930 * @param yyscanner The scanner object.
1932 void glcpp__delete_buffer (YY_BUFFER_STATE b
, yyscan_t yyscanner
)
1934 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1939 if ( b
== YY_CURRENT_BUFFER
) /* Not sure if we should pop here. */
1940 YY_CURRENT_BUFFER_LVALUE
= (YY_BUFFER_STATE
) 0;
1942 if ( b
->yy_is_our_buffer
)
1943 glcpp_free((void *) b
->yy_ch_buf
,yyscanner
);
1945 glcpp_free((void *) b
,yyscanner
);
1948 /* Initializes or reinitializes a buffer.
1949 * This function is sometimes called more than once on the same buffer,
1950 * such as during a glcpp_restart() or at EOF.
1952 static void glcpp__init_buffer (YY_BUFFER_STATE b
, FILE * file
, yyscan_t yyscanner
)
1956 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1958 glcpp__flush_buffer(b
,yyscanner
);
1960 b
->yy_input_file
= file
;
1961 b
->yy_fill_buffer
= 1;
1963 /* If b is the current buffer, then glcpp__init_buffer was _probably_
1964 * called from glcpp_restart() or through yy_get_next_buffer.
1965 * In that case, we don't want to reset the lineno or column.
1967 if (b
!= YY_CURRENT_BUFFER
){
1968 b
->yy_bs_lineno
= 1;
1969 b
->yy_bs_column
= 0;
1972 b
->yy_is_interactive
= 0;
1977 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1978 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1979 * @param yyscanner The scanner object.
1981 void glcpp__flush_buffer (YY_BUFFER_STATE b
, yyscan_t yyscanner
)
1983 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1989 /* We always need two end-of-buffer characters. The first causes
1990 * a transition to the end-of-buffer state. The second causes
1991 * a jam in that state.
1993 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
1994 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
1996 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
1999 b
->yy_buffer_status
= YY_BUFFER_NEW
;
2001 if ( b
== YY_CURRENT_BUFFER
)
2002 glcpp__load_buffer_state(yyscanner
);
2005 /** Pushes the new state onto the stack. The new state becomes
2006 * the current state. This function will allocate the stack
2008 * @param new_buffer The new state.
2009 * @param yyscanner The scanner object.
2011 void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
)
2013 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2014 if (new_buffer
== NULL
)
2017 glcpp_ensure_buffer_stack(yyscanner
);
2019 /* This block is copied from glcpp__switch_to_buffer. */
2020 if ( YY_CURRENT_BUFFER
)
2022 /* Flush out information for old buffer. */
2023 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
2024 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= yyg
->yy_c_buf_p
;
2025 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
2028 /* Only push if top exists. Otherwise, replace top. */
2029 if (YY_CURRENT_BUFFER
)
2030 yyg
->yy_buffer_stack_top
++;
2031 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
2033 /* copied from glcpp__switch_to_buffer. */
2034 glcpp__load_buffer_state(yyscanner
);
2035 yyg
->yy_did_buffer_switch_on_eof
= 1;
2038 /** Removes and deletes the top of the stack, if present.
2039 * The next element becomes the new top.
2040 * @param yyscanner The scanner object.
2042 void glcpp_pop_buffer_state (yyscan_t yyscanner
)
2044 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2045 if (!YY_CURRENT_BUFFER
)
2048 glcpp__delete_buffer(YY_CURRENT_BUFFER
,yyscanner
);
2049 YY_CURRENT_BUFFER_LVALUE
= NULL
;
2050 if (yyg
->yy_buffer_stack_top
> 0)
2051 --yyg
->yy_buffer_stack_top
;
2053 if (YY_CURRENT_BUFFER
) {
2054 glcpp__load_buffer_state(yyscanner
);
2055 yyg
->yy_did_buffer_switch_on_eof
= 1;
2059 /* Allocates the stack if it does not exist.
2060 * Guarantees space for at least one push.
2062 static void glcpp_ensure_buffer_stack (yyscan_t yyscanner
)
2065 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2067 if (!yyg
->yy_buffer_stack
) {
2069 /* First allocation is just for 2 elements, since we don't know if this
2070 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2071 * immediate realloc on the next call.
2074 yyg
->yy_buffer_stack
= (struct yy_buffer_state
**)glcpp_alloc
2075 (num_to_alloc
* sizeof(struct yy_buffer_state
*)
2077 if ( ! yyg
->yy_buffer_stack
)
2078 YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
2080 memset(yyg
->yy_buffer_stack
, 0, num_to_alloc
* sizeof(struct yy_buffer_state
*));
2082 yyg
->yy_buffer_stack_max
= num_to_alloc
;
2083 yyg
->yy_buffer_stack_top
= 0;
2087 if (yyg
->yy_buffer_stack_top
>= (yyg
->yy_buffer_stack_max
) - 1){
2089 /* Increase the buffer to prepare for a possible push. */
2090 int grow_size
= 8 /* arbitrary grow size */;
2092 num_to_alloc
= yyg
->yy_buffer_stack_max
+ grow_size
;
2093 yyg
->yy_buffer_stack
= (struct yy_buffer_state
**)glcpp_realloc
2094 (yyg
->yy_buffer_stack
,
2095 num_to_alloc
* sizeof(struct yy_buffer_state
*)
2097 if ( ! yyg
->yy_buffer_stack
)
2098 YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
2100 /* zero only the new slots.*/
2101 memset(yyg
->yy_buffer_stack
+ yyg
->yy_buffer_stack_max
, 0, grow_size
* sizeof(struct yy_buffer_state
*));
2102 yyg
->yy_buffer_stack_max
= num_to_alloc
;
2106 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2107 * @param base the character buffer
2108 * @param size the size in bytes of the character buffer
2109 * @param yyscanner The scanner object.
2110 * @return the newly allocated buffer state object.
2112 YY_BUFFER_STATE
glcpp__scan_buffer (char * base
, yy_size_t size
, yyscan_t yyscanner
)
2117 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
2118 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
2119 /* They forgot to leave room for the EOB's. */
2122 b
= (YY_BUFFER_STATE
) glcpp_alloc(sizeof( struct yy_buffer_state
) ,yyscanner
);
2124 YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_buffer()" );
2126 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
2127 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
2128 b
->yy_is_our_buffer
= 0;
2129 b
->yy_input_file
= 0;
2130 b
->yy_n_chars
= b
->yy_buf_size
;
2131 b
->yy_is_interactive
= 0;
2133 b
->yy_fill_buffer
= 0;
2134 b
->yy_buffer_status
= YY_BUFFER_NEW
;
2136 glcpp__switch_to_buffer(b
,yyscanner
);
2141 /** Setup the input buffer state to scan a string. The next call to glcpp_lex() will
2142 * scan from a @e copy of @a str.
2143 * @param yystr a NUL-terminated string to scan
2144 * @param yyscanner The scanner object.
2145 * @return the newly allocated buffer state object.
2146 * @note If you want to scan bytes that may contain NUL values, then use
2147 * glcpp__scan_bytes() instead.
2149 YY_BUFFER_STATE
glcpp__scan_string (yyconst
char * yystr
, yyscan_t yyscanner
)
2152 return glcpp__scan_bytes(yystr
,strlen(yystr
) ,yyscanner
);
2155 /** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will
2156 * scan from a @e copy of @a bytes.
2157 * @param bytes the byte buffer to scan
2158 * @param len the number of bytes in the buffer pointed to by @a bytes.
2159 * @param yyscanner The scanner object.
2160 * @return the newly allocated buffer state object.
2162 YY_BUFFER_STATE
glcpp__scan_bytes (yyconst
char * yybytes
, int _yybytes_len
, yyscan_t yyscanner
)
2169 /* Get memory for full buffer, including space for trailing EOB's. */
2170 n
= _yybytes_len
+ 2;
2171 buf
= (char *) glcpp_alloc(n
,yyscanner
);
2173 YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_bytes()" );
2175 for ( i
= 0; i
< _yybytes_len
; ++i
)
2176 buf
[i
] = yybytes
[i
];
2178 buf
[_yybytes_len
] = buf
[_yybytes_len
+1] = YY_END_OF_BUFFER_CHAR
;
2180 b
= glcpp__scan_buffer(buf
,n
,yyscanner
);
2182 YY_FATAL_ERROR( "bad buffer in glcpp__scan_bytes()" );
2184 /* It's okay to grow etc. this buffer, and we should throw it
2185 * away when we're done.
2187 b
->yy_is_our_buffer
= 1;
2192 static void yy_push_state (int new_state
, yyscan_t yyscanner
)
2194 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2195 if ( yyg
->yy_start_stack_ptr
>= yyg
->yy_start_stack_depth
)
2199 yyg
->yy_start_stack_depth
+= YY_START_STACK_INCR
;
2200 new_size
= yyg
->yy_start_stack_depth
* sizeof( int );
2202 if ( ! yyg
->yy_start_stack
)
2203 yyg
->yy_start_stack
= (int *) glcpp_alloc(new_size
,yyscanner
);
2206 yyg
->yy_start_stack
= (int *) glcpp_realloc((void *) yyg
->yy_start_stack
,new_size
,yyscanner
);
2208 if ( ! yyg
->yy_start_stack
)
2209 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2212 yyg
->yy_start_stack
[yyg
->yy_start_stack_ptr
++] = YY_START
;
2217 static void yy_pop_state (yyscan_t yyscanner
)
2219 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2220 if ( --yyg
->yy_start_stack_ptr
< 0 )
2221 YY_FATAL_ERROR( "start-condition stack underflow" );
2223 BEGIN(yyg
->yy_start_stack
[yyg
->yy_start_stack_ptr
]);
2226 static int yy_top_state (yyscan_t yyscanner
)
2228 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2229 return yyg
->yy_start_stack
[yyg
->yy_start_stack_ptr
- 1];
2232 #ifndef YY_EXIT_FAILURE
2233 #define YY_EXIT_FAILURE 2
2236 static void yy_fatal_error (yyconst
char* msg
, yyscan_t yyscanner
)
2238 (void) fprintf( stderr
, "%s\n", msg
);
2239 exit( YY_EXIT_FAILURE
);
2242 /* Redefine yyless() so it works in section 3 code. */
2248 /* Undo effects of setting up yytext. */ \
2249 int yyless_macro_arg = (n); \
2250 YY_LESS_LINENO(yyless_macro_arg);\
2251 yytext[yyleng] = yyg->yy_hold_char; \
2252 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2253 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2254 *yyg->yy_c_buf_p = '\0'; \
2255 yyleng = yyless_macro_arg; \
2259 /* Accessor methods (get/set functions) to struct members. */
2261 /** Get the user-defined data for this scanner.
2262 * @param yyscanner The scanner object.
2264 YY_EXTRA_TYPE
glcpp_get_extra (yyscan_t yyscanner
)
2266 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2270 /** Get the current line number.
2271 * @param yyscanner The scanner object.
2273 int glcpp_get_lineno (yyscan_t yyscanner
)
2275 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2277 if (! YY_CURRENT_BUFFER
)
2283 /** Get the current column number.
2284 * @param yyscanner The scanner object.
2286 int glcpp_get_column (yyscan_t yyscanner
)
2288 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2290 if (! YY_CURRENT_BUFFER
)
2296 /** Get the input stream.
2297 * @param yyscanner The scanner object.
2299 FILE *glcpp_get_in (yyscan_t yyscanner
)
2301 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2305 /** Get the output stream.
2306 * @param yyscanner The scanner object.
2308 FILE *glcpp_get_out (yyscan_t yyscanner
)
2310 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2314 /** Get the length of the current token.
2315 * @param yyscanner The scanner object.
2317 int glcpp_get_leng (yyscan_t yyscanner
)
2319 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2323 /** Get the current token.
2324 * @param yyscanner The scanner object.
2327 char *glcpp_get_text (yyscan_t yyscanner
)
2329 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2333 /** Set the user-defined data. This data is never touched by the scanner.
2334 * @param user_defined The data to be associated with this scanner.
2335 * @param yyscanner The scanner object.
2337 void glcpp_set_extra (YY_EXTRA_TYPE user_defined
, yyscan_t yyscanner
)
2339 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2340 yyextra
= user_defined
;
2343 /** Set the current line number.
2344 * @param line_number
2345 * @param yyscanner The scanner object.
2347 void glcpp_set_lineno (int line_number
, yyscan_t yyscanner
)
2349 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2351 /* lineno is only valid if an input buffer exists. */
2352 if (! YY_CURRENT_BUFFER
)
2353 yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner
);
2355 yylineno
= line_number
;
2358 /** Set the current column.
2359 * @param line_number
2360 * @param yyscanner The scanner object.
2362 void glcpp_set_column (int column_no
, yyscan_t yyscanner
)
2364 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2366 /* column is only valid if an input buffer exists. */
2367 if (! YY_CURRENT_BUFFER
)
2368 yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner
);
2370 yycolumn
= column_no
;
2373 /** Set the input stream. This does not discard the current
2375 * @param in_str A readable stream.
2376 * @param yyscanner The scanner object.
2377 * @see glcpp__switch_to_buffer
2379 void glcpp_set_in (FILE * in_str
, yyscan_t yyscanner
)
2381 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2385 void glcpp_set_out (FILE * out_str
, yyscan_t yyscanner
)
2387 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2391 int glcpp_get_debug (yyscan_t yyscanner
)
2393 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2394 return yy_flex_debug
;
2397 void glcpp_set_debug (int bdebug
, yyscan_t yyscanner
)
2399 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2400 yy_flex_debug
= bdebug
;
2403 /* Accessor methods for yylval and yylloc */
2405 YYSTYPE
* glcpp_get_lval (yyscan_t yyscanner
)
2407 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2411 void glcpp_set_lval (YYSTYPE
* yylval_param
, yyscan_t yyscanner
)
2413 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2414 yylval
= yylval_param
;
2417 YYLTYPE
*glcpp_get_lloc (yyscan_t yyscanner
)
2419 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2423 void glcpp_set_lloc (YYLTYPE
* yylloc_param
, yyscan_t yyscanner
)
2425 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2426 yylloc
= yylloc_param
;
2429 /* User-visible API */
2431 /* glcpp_lex_init is special because it creates the scanner itself, so it is
2432 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2433 * That's why we explicitly handle the declaration, instead of using our macros.
2436 int glcpp_lex_init(yyscan_t
* ptr_yy_globals
)
2439 if (ptr_yy_globals
== NULL
){
2444 *ptr_yy_globals
= (yyscan_t
) glcpp_alloc ( sizeof( struct yyguts_t
), NULL
);
2446 if (*ptr_yy_globals
== NULL
){
2451 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2452 memset(*ptr_yy_globals
,0x00,sizeof(struct yyguts_t
));
2454 return yy_init_globals ( *ptr_yy_globals
);
2457 /* glcpp_lex_init_extra has the same functionality as glcpp_lex_init, but follows the
2458 * convention of taking the scanner as the last argument. Note however, that
2459 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2460 * is the reason, too, why this function also must handle its own declaration).
2461 * The user defined value in the first argument will be available to glcpp_alloc in
2462 * the yyextra field.
2465 int glcpp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined
,yyscan_t
* ptr_yy_globals
)
2468 struct yyguts_t dummy_yyguts
;
2470 glcpp_set_extra (yy_user_defined
, &dummy_yyguts
);
2472 if (ptr_yy_globals
== NULL
){
2477 *ptr_yy_globals
= (yyscan_t
) glcpp_alloc ( sizeof( struct yyguts_t
), &dummy_yyguts
);
2479 if (*ptr_yy_globals
== NULL
){
2484 /* By setting to 0xAA, we expose bugs in
2485 yy_init_globals. Leave at 0x00 for releases. */
2486 memset(*ptr_yy_globals
,0x00,sizeof(struct yyguts_t
));
2488 glcpp_set_extra (yy_user_defined
, *ptr_yy_globals
);
2490 return yy_init_globals ( *ptr_yy_globals
);
2493 static int yy_init_globals (yyscan_t yyscanner
)
2495 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2496 /* Initialization is the same as for the non-reentrant scanner.
2497 * This function is called from glcpp_lex_destroy(), so don't allocate here.
2500 yyg
->yy_buffer_stack
= 0;
2501 yyg
->yy_buffer_stack_top
= 0;
2502 yyg
->yy_buffer_stack_max
= 0;
2503 yyg
->yy_c_buf_p
= (char *) 0;
2507 yyg
->yy_start_stack_ptr
= 0;
2508 yyg
->yy_start_stack_depth
= 0;
2509 yyg
->yy_start_stack
= NULL
;
2511 yyg
->yy_state_buf
= 0;
2512 yyg
->yy_state_ptr
= 0;
2513 yyg
->yy_full_match
= 0;
2516 /* Defined in main.c */
2525 /* For future reference: Set errno on error, since we are called by
2531 /* glcpp_lex_destroy is for both reentrant and non-reentrant scanners. */
2532 int glcpp_lex_destroy (yyscan_t yyscanner
)
2534 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2536 /* Pop the buffer stack, destroying each element. */
2537 while(YY_CURRENT_BUFFER
){
2538 glcpp__delete_buffer(YY_CURRENT_BUFFER
,yyscanner
);
2539 YY_CURRENT_BUFFER_LVALUE
= NULL
;
2540 glcpp_pop_buffer_state(yyscanner
);
2543 /* Destroy the stack itself. */
2544 glcpp_free(yyg
->yy_buffer_stack
,yyscanner
);
2545 yyg
->yy_buffer_stack
= NULL
;
2547 /* Destroy the start condition stack. */
2548 glcpp_free(yyg
->yy_start_stack
,yyscanner
);
2549 yyg
->yy_start_stack
= NULL
;
2551 glcpp_free ( yyg
->yy_state_buf
, yyscanner
);
2552 yyg
->yy_state_buf
= NULL
;
2554 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2555 * glcpp_lex() is called, initialization will occur. */
2556 yy_init_globals( yyscanner
);
2558 /* Destroy the main struct (reentrant only). */
2559 glcpp_free ( yyscanner
, yyscanner
);
2565 * Internal utility routines.
2569 static void yy_flex_strncpy (char* s1
, yyconst
char * s2
, int n
, yyscan_t yyscanner
)
2572 for ( i
= 0; i
< n
; ++i
)
2577 #ifdef YY_NEED_STRLEN
2578 static int yy_flex_strlen (yyconst
char * s
, yyscan_t yyscanner
)
2581 for ( n
= 0; s
[n
]; ++n
)
2588 void *glcpp_alloc (yy_size_t size
, yyscan_t yyscanner
)
2590 return (void *) malloc( size
);
2593 void *glcpp_realloc (void * ptr
, yy_size_t size
, yyscan_t yyscanner
)
2595 /* The cast to (char *) in the following accommodates both
2596 * implementations that use char* generic pointers, and those
2597 * that use void* generic pointers. It works with the latter
2598 * because both ANSI C and C++ allow castless assignment from
2599 * any pointer type to void*, and deal with argument conversions
2600 * as though doing an assignment.
2602 return (void *) realloc( (char *) ptr
, size
);
2605 void glcpp_free (void * ptr
, yyscan_t yyscanner
)
2607 free( (char *) ptr
); /* see glcpp_realloc() for (char *) cast */
2610 #define YYTABLES_NAME "yytables"
2612 #line 326 "glcpp/glcpp-lex.l"
2617 glcpp_lex_set_source_string(glcpp_parser_t
*parser
, const char *shader
)
2619 glcpp__scan_string(shader
,parser
->scanner
);