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[137] =
363 3, 3, 44, 39, 43, 40, 43, 41, 43, 43,
364 38, 43, 43, 38, 43, 38, 43, 38, 43, 25,
365 39, 43, 24, 39, 43, 38, 43, 38, 43, 38,
366 43, 37, 39, 43, 37, 39, 43, 38, 43, 40,
367 43, 23, 43, 43, 3, 43, 4, 43, 5, 43,
368 42, 43, 39, 18, 40, 32, 35, 33, 2, 1,
369 25, 39, 25, 39, 39, 24, 39, 24, 39, 27,
370 29, 31, 30, 28, 37, 39, 37, 39, 34, 40,
371 23, 23, 3, 4, 5, 6, 5, 7, 1, 26,
372 39, 37, 39,16398, 26, 39, 37, 39, 18, 37,
374 39,16399,16400, 8206, 18, 8206, 37, 39, 8207, 18,
375 8208, 18,16401, 19,16396, 22, 36, 37, 39, 21,
376 8209, 18, 19, 8204, 18,16397,16404, 8205, 18, 11,
377 18, 9, 8, 8212, 10, 18
380 static yyconst flex_int16_t yy_accept[164] =
382 1, 1, 1, 1, 1, 2, 3, 3, 3, 4,
383 6, 8, 10, 11, 13, 14, 16, 18, 20, 23,
384 26, 28, 30, 32, 35, 38, 40, 42, 44, 45,
385 47, 49, 51, 53, 54, 54, 55, 56, 57, 58,
386 59, 60, 61, 63, 65, 66, 68, 70, 71, 72,
387 73, 74, 75, 77, 79, 80, 81, 82, 83, 83,
388 83, 83, 83, 83, 83, 83, 84, 85, 86, 87,
389 88, 89, 90, 92, 94, 94, 94, 94, 94, 94,
390 95, 95, 95, 95, 95, 97, 99, 99, 99, 99,
391 99, 99, 99, 99, 100, 100, 100, 100, 100, 100,
393 100, 102, 102, 103, 104, 104, 104, 104, 104, 106,
394 106, 107, 107, 107, 107, 107, 107, 107, 109, 109,
395 109, 111, 111, 113, 114, 115, 115, 116, 116, 116,
396 116, 117, 117, 120, 121, 121, 123, 124, 124, 124,
397 126, 127, 127, 127, 127, 128, 128, 128, 130, 130,
398 132, 132, 133, 134, 134, 134, 134, 135, 135, 135,
402 static yyconst flex_int32_t yy_ec[256] =
404 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
405 4, 4, 4, 1, 1, 1, 1, 1, 1, 1,
406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407 1, 2, 5, 1, 6, 1, 7, 8, 1, 9,
408 7, 10, 7, 7, 7, 7, 11, 12, 13, 13,
409 13, 13, 13, 13, 13, 14, 14, 1, 7, 15,
410 16, 17, 1, 1, 18, 18, 18, 18, 18, 18,
411 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
412 19, 19, 19, 19, 20, 19, 19, 21, 19, 19,
413 7, 1, 7, 7, 19, 1, 22, 18, 18, 23,
415 24, 25, 26, 19, 27, 19, 19, 28, 29, 30,
416 31, 32, 19, 33, 34, 35, 36, 37, 19, 38,
417 19, 19, 7, 39, 7, 7, 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,
421 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,
426 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
434 static yyconst flex_int32_t yy_meta[40] =
436 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
437 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
438 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
439 1, 1, 1, 1, 1, 1, 1, 1, 1
442 static yyconst flex_int16_t yy_base[182] =
444 0, 38, 0, 0, 38, 39, 499, 498, 500, 48,
445 43, 552, 496, 44, 63, 495, 59, 65, 87, 125,
446 58, 67, 68, 164, 203, 40, 75, 241, 552, 494,
447 552, 140, 552, 140, 493, 552, 144, 492, 491, 487,
448 486, 485, 156, 179, 267, 0, 209, 472, 471, 470,
449 469, 468, 446, 124, 466, 153, 462, 458, 154, 198,
450 159, 155, 183, 160, 193, 460, 552, 222, 552, 227,
451 552, 459, 204, 161, 231, 232, 238, 243, 236, 303,
452 245, 180, 247, 249, 281, 56, 257, 271, 248, 259,
453 252, 264, 455, 454, 297, 299, 312, 313, 320, 294,
455 407, 295, 427, 426, 321, 296, 324, 425, 552, 424,
456 552, 327, 329, 195, 328, 331, 332, 230, 334, 378,
457 552, 377, 552, 371, 370, 335, 365, 337, 358, 342,
458 360, 344, 326, 255, 340, 552, 260, 338, 246, 552,
459 197, 364, 192, 352, 382, 348, 186, 552, 420, 552,
460 423, 184, 141, 437, 421, 447, 79, 476, 346, 552,
461 453, 552, 515, 517, 519, 521, 523, 525, 71, 527,
462 529, 531, 533, 535, 537, 539, 541, 543, 545, 547,
466 static yyconst flex_int16_t yy_def[182] =
468 162, 1, 163, 163, 164, 164, 165, 165, 162, 166,
469 167, 162, 167, 167, 167, 167, 167, 167, 162, 166,
470 167, 167, 167, 168, 168, 167, 167, 167, 162, 169,
471 162, 170, 162, 20, 167, 162, 167, 167, 167, 167,
472 167, 171, 19, 20, 20, 20, 20, 167, 167, 167,
473 167, 167, 25, 25, 167, 167, 28, 28, 167, 167,
474 167, 167, 167, 167, 167, 169, 162, 170, 162, 170,
475 162, 171, 45, 25, 167, 167, 167, 167, 167, 167,
476 167, 167, 167, 167, 20, 25, 167, 167, 167, 167,
477 167, 167, 172, 173, 167, 167, 167, 167, 167, 167,
479 25, 167, 174, 175, 167, 167, 167, 172, 162, 173,
480 162, 167, 167, 167, 167, 167, 167, 25, 167, 174,
481 162, 175, 162, 176, 177, 167, 178, 167, 167, 167,
482 167, 167, 25, 167, 176, 162, 177, 167, 178, 162,
483 179, 167, 180, 167, 162, 167, 179, 162, 167, 162,
484 167, 180, 167, 181, 167, 167, 167, 181, 167, 162,
485 167, 0, 162, 162, 162, 162, 162, 162, 162, 162,
486 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
490 static yyconst flex_int16_t yy_nxt[592] =
492 10, 11, 12, 13, 14, 15, 16, 17, 16, 16,
493 18, 19, 20, 20, 21, 22, 23, 24, 24, 24,
494 24, 24, 25, 24, 24, 24, 24, 24, 24, 24,
495 24, 24, 24, 24, 24, 24, 24, 24, 26, 27,
496 31, 31, 36, 28, 37, 36, 36, 32, 32, 35,
497 36, 35, 35, 35, 35, 35, 35, 35, 35, 38,
498 36, 36, 35, 35, 35, 36, 40, 36, 39, 36,
499 36, 66, 48, 49, 41, 42, 56, 36, 55, 53,
500 57, 36, 50, 51, 52, 101, 35, 34, 35, 36,
501 35, 35, 35, 35, 35, 35, 35, 35, 43, 43,
503 34, 35, 35, 35, 34, 34, 44, 45, 34, 34,
504 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
505 34, 34, 44, 34, 45, 35, 35, 36, 35, 35,
506 35, 35, 35, 35, 35, 35, 46, 46, 46, 35,
507 35, 35, 69, 36, 47, 37, 36, 53, 74, 70,
508 71, 34, 34, 34, 56, 36, 36, 36, 57, 34,
509 47, 36, 36, 35, 34, 35, 36, 35, 35, 35,
510 35, 35, 35, 35, 35, 34, 34, 75, 35, 35,
511 35, 81, 36, 80, 53, 36, 36, 86, 148, 83,
512 34, 34, 34, 34, 36, 36, 129, 36, 34, 148,
514 36, 98, 35, 34, 35, 36, 35, 35, 35, 35,
515 35, 35, 35, 35, 34, 82, 84, 35, 35, 35,
516 34, 34, 34, 85, 69, 76, 54, 77, 34, 69,
517 78, 162, 162, 36, 36, 79, 70, 71, 36, 85,
518 36, 35, 58, 36, 34, 36, 39, 36, 140, 36,
519 36, 36, 133, 53, 36, 87, 145, 36, 88, 36,
520 90, 36, 36, 59, 60, 89, 36, 61, 62, 99,
521 92, 104, 63, 36, 97, 91, 64, 65, 73, 73,
522 73, 100, 106, 102, 73, 105, 34, 107, 73, 73,
523 73, 73, 34, 34, 34, 103, 36, 36, 36, 36,
525 34, 36, 34, 93, 93, 94, 93, 93, 93, 93,
526 93, 93, 93, 93, 36, 36, 34, 93, 93, 93,
527 112, 113, 36, 36, 119, 95, 36, 117, 125, 36,
528 36, 36, 96, 36, 36, 114, 36, 36, 115, 36,
529 36, 93, 136, 116, 36, 124, 36, 159, 160, 53,
530 36, 127, 128, 126, 36, 131, 130, 134, 132, 129,
531 36, 141, 36, 143, 146, 149, 150, 140, 138, 142,
532 142, 142, 36, 136, 144, 151, 151, 151, 155, 123,
533 121, 153, 35, 145, 36, 35, 35, 35, 35, 35,
534 35, 35, 35, 35, 35, 35, 35, 35, 35, 154,
536 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,
537 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,
538 35, 149, 150, 36, 149, 150, 111, 109, 123, 121,
539 118, 156, 156, 156, 151, 151, 151, 35, 35, 36,
540 35, 35, 35, 35, 35, 157, 35, 35, 159, 160,
541 143, 35, 35, 35, 159, 160, 111, 109, 161, 161,
542 161, 36, 67, 35, 161, 161, 161, 35, 36, 53,
543 36, 36, 36, 36, 36, 35, 35, 35, 36, 35,
544 35, 35, 35, 35, 157, 35, 35, 36, 36, 36,
545 35, 35, 35, 36, 36, 36, 67, 36, 36, 162,
547 29, 29, 162, 162, 162, 162, 162, 162, 162, 162,
548 162, 162, 162, 162, 35, 29, 29, 30, 30, 33,
549 33, 34, 34, 35, 35, 53, 53, 68, 68, 72,
550 72, 108, 108, 110, 110, 120, 120, 122, 122, 135,
551 135, 137, 137, 139, 139, 147, 147, 152, 152, 158,
552 158, 9, 162, 162, 162, 162, 162, 162, 162, 162,
553 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
554 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
555 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
560 static yyconst flex_int16_t yy_chk[592] =
562 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
563 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
564 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
565 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
566 5, 6, 26, 2, 11, 11, 14, 5, 6, 10,
567 10, 10, 10, 10, 10, 10, 10, 10, 10, 14,
568 21, 17, 10, 10, 10, 15, 17, 18, 15, 22,
569 23, 169, 21, 21, 18, 18, 27, 27, 26, 86,
570 27, 157, 22, 23, 23, 86, 10, 19, 19, 19,
571 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
573 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
574 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
575 19, 19, 19, 19, 19, 19, 20, 20, 20, 20,
576 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
577 20, 20, 32, 153, 20, 37, 37, 54, 54, 32,
578 32, 34, 34, 34, 56, 56, 59, 62, 56, 34,
579 20, 61, 64, 20, 24, 24, 24, 24, 24, 24,
580 24, 24, 24, 24, 24, 34, 43, 59, 24, 24,
581 24, 62, 82, 61, 74, 63, 152, 74, 147, 64,
582 44, 44, 44, 43, 143, 65, 114, 114, 44, 141,
584 60, 82, 24, 25, 25, 25, 25, 25, 25, 25,
585 25, 25, 25, 25, 44, 63, 65, 25, 25, 25,
586 47, 47, 47, 73, 68, 60, 25, 60, 47, 70,
587 60, 68, 68, 75, 76, 60, 70, 70, 79, 73,
588 77, 25, 28, 28, 47, 78, 28, 81, 139, 83,
589 89, 84, 118, 118, 91, 75, 134, 134, 76, 87,
590 77, 90, 137, 28, 28, 76, 92, 28, 28, 83,
591 79, 89, 28, 88, 81, 78, 28, 28, 45, 45,
592 45, 84, 91, 87, 45, 90, 45, 92, 45, 45,
593 45, 45, 85, 85, 85, 88, 100, 102, 106, 95,
595 85, 96, 45, 80, 80, 80, 80, 80, 80, 80,
596 80, 80, 80, 80, 97, 98, 85, 80, 80, 80,
597 95, 96, 99, 105, 102, 80, 107, 100, 106, 112,
598 115, 113, 80, 116, 117, 97, 119, 126, 98, 128,
599 138, 80, 135, 99, 130, 105, 132, 159, 159, 133,
600 146, 112, 113, 107, 144, 116, 115, 119, 117, 129,
601 129, 128, 131, 130, 138, 142, 142, 127, 126, 129,
602 129, 129, 125, 124, 132, 142, 142, 142, 146, 122,
603 120, 144, 145, 145, 145, 145, 145, 145, 145, 145,
604 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
606 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
607 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
608 145, 149, 149, 155, 151, 151, 110, 108, 104, 103,
609 101, 149, 149, 149, 151, 151, 151, 154, 154, 154,
610 154, 154, 154, 154, 154, 154, 154, 154, 156, 156,
611 155, 154, 154, 154, 161, 161, 94, 93, 156, 156,
612 156, 72, 66, 58, 161, 161, 161, 57, 55, 53,
613 52, 51, 50, 49, 48, 154, 158, 158, 158, 158,
614 158, 158, 158, 158, 158, 158, 158, 42, 41, 40,
615 158, 158, 158, 39, 38, 35, 30, 16, 13, 9,
617 8, 7, 0, 0, 0, 0, 0, 0, 0, 0,
618 0, 0, 0, 0, 158, 163, 163, 164, 164, 165,
619 165, 166, 166, 167, 167, 168, 168, 170, 170, 171,
620 171, 172, 172, 173, 173, 174, 174, 175, 175, 176,
621 176, 177, 177, 178, 178, 179, 179, 180, 180, 181,
622 181, 162, 162, 162, 162, 162, 162, 162, 162, 162,
623 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
624 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
625 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
630 #define YY_TRAILING_MASK 0x2000
631 #define YY_TRAILING_HEAD_MASK 0x4000
634 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ \
635 yy_cp = yyg->yy_full_match; /* restore poss. backed-over text */ \
636 yyg->yy_lp = yyg->yy_full_lp; /* restore orig. accepting pos. */ \
637 yyg->yy_state_ptr = yyg->yy_full_state; /* restore orig. state */ \
638 yy_current_state = *yyg->yy_state_ptr; /* restore curr. state */ \
643 #define yymore() yymore_used_but_not_detected
644 #define YY_MORE_ADJ 0
645 #define YY_RESTORE_YY_MORE_OFFSET
646 #line 1 "glcpp/glcpp-lex.l"
647 #line 2 "glcpp/glcpp-lex.l"
649 * Copyright © 2010 Intel Corporation
651 * Permission is hereby granted, free of charge, to any person obtaining a
652 * copy of this software and associated documentation files (the "Software"),
653 * to deal in the Software without restriction, including without limitation
654 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
655 * and/or sell copies of the Software, and to permit persons to whom the
656 * Software is furnished to do so, subject to the following conditions:
658 * The above copyright notice and this permission notice (including the next
659 * paragraph) shall be included in all copies or substantial portions of the
662 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
663 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
664 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
665 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
666 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
667 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
668 * DEALINGS IN THE SOFTWARE.
676 #include "glcpp-parse.h"
678 /* Flex annoyingly generates some functions without making them
679 * static. Let's declare them here. */
680 int glcpp_get_column (yyscan_t yyscanner);
681 void glcpp_set_column (int column_no , yyscan_t yyscanner);
685 #define YY_USER_ACTION \
687 yylloc->first_column = yycolumn + 1; \
688 yylloc->first_line = yylineno; \
689 yycolumn += yyleng; \
692 #define YY_USER_INIT \
696 yylloc->source = 0; \
699 #line 700 "glcpp/glcpp-lex.c"
704 #define UNREACHABLE 3
706 #define YY_EXTRA_TYPE glcpp_parser_t *
708 /* Holds the entire state of the reentrant scanner. */
712 /* User-defined. Not touched by flex. */
713 YY_EXTRA_TYPE yyextra_r;
715 /* The rest are the same as the globals declared in the non-reentrant scanner. */
716 FILE *yyin_r, *yyout_r;
717 size_t yy_buffer_stack_top; /**< index of top of stack. */
718 size_t yy_buffer_stack_max; /**< capacity of stack. */
719 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
726 int yy_did_buffer_switch_on_eof;
727 int yy_start_stack_ptr;
728 int yy_start_stack_depth;
730 yy_state_type yy_last_accepting_state;
731 char* yy_last_accepting_cpos;
736 yy_state_type *yy_state_buf;
737 yy_state_type *yy_state_ptr;
741 /* These are only needed for trailing context rules,
742 * but there's no conditional variable for that yet. */
743 int yy_looking_for_trail_begin;
755 }; /* end struct yyguts_t */
757 static int yy_init_globals (yyscan_t yyscanner );
759 /* This must go here because YYSTYPE and YYLTYPE are included
760 * from bison output in section 1.*/
761 # define yylval yyg->yylval_r
763 # define yylloc yyg->yylloc_r
765 int glcpp_lex_init (yyscan_t* scanner);
767 int glcpp_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
769 /* Accessor methods to globals.
770 These are made visible to non-reentrant scanners for convenience. */
772 int glcpp_lex_destroy (yyscan_t yyscanner );
774 int glcpp_get_debug (yyscan_t yyscanner );
776 void glcpp_set_debug (int debug_flag ,yyscan_t yyscanner );
778 YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner );
780 void glcpp_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
782 FILE *glcpp_get_in (yyscan_t yyscanner );
784 void glcpp_set_in (FILE * in_str ,yyscan_t yyscanner );
786 FILE *glcpp_get_out (yyscan_t yyscanner );
788 void glcpp_set_out (FILE * out_str ,yyscan_t yyscanner );
790 int glcpp_get_leng (yyscan_t yyscanner );
792 char *glcpp_get_text (yyscan_t yyscanner );
794 int glcpp_get_lineno (yyscan_t yyscanner );
796 void glcpp_set_lineno (int line_number ,yyscan_t yyscanner );
798 int glcpp_get_column (yyscan_t yyscanner );
800 void glcpp_set_column (int column_no ,yyscan_t yyscanner );
802 YYSTYPE * glcpp_get_lval (yyscan_t yyscanner );
804 void glcpp_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
806 YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner );
808 void glcpp_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
810 /* Macros after this point can all be overridden by user definitions in
814 #ifndef YY_SKIP_YYWRAP
816 extern "C" int glcpp_wrap (yyscan_t yyscanner );
818 extern int glcpp_wrap (yyscan_t yyscanner );
822 static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
825 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
828 #ifdef YY_NEED_STRLEN
829 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
835 static int yyinput (yyscan_t yyscanner );
837 static int input (yyscan_t yyscanner );
842 static void yy_push_state (int new_state ,yyscan_t yyscanner);
844 static void yy_pop_state (yyscan_t yyscanner );
846 static int yy_top_state (yyscan_t yyscanner );
848 /* Amount of stuff to slurp up with each read. */
849 #ifndef YY_READ_BUF_SIZE
850 #define YY_READ_BUF_SIZE 8192
853 /* Copy whatever the last rule matched to the standard output. */
855 /* This used to be an fputs(), but since the string might contain NUL's,
856 * we now use fwrite().
858 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
861 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
862 * is returned in "result".
865 #define YY_INPUT(buf,result,max_size) \
866 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
870 for ( n = 0; n < max_size && \
871 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
874 buf[n++] = (char) c; \
875 if ( c == EOF && ferror( yyin ) ) \
876 YY_FATAL_ERROR( "input in flex scanner failed" ); \
882 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
884 if( errno != EINTR) \
886 YY_FATAL_ERROR( "input in flex scanner failed" ); \
897 /* No semi-colon after return; correct usage is to write "yyterminate();" -
898 * we don't want an extra ';' after the "return" because that will cause
899 * some compilers to complain about unreachable statements.
902 #define yyterminate() return YY_NULL
905 /* Number of entries by which start-condition stack grows. */
906 #ifndef YY_START_STACK_INCR
907 #define YY_START_STACK_INCR 25
910 /* Report a fatal error. */
911 #ifndef YY_FATAL_ERROR
912 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
915 /* end tables serialization structures and prototypes */
917 /* Default declaration of generated scanner - a define so the user can
918 * easily add parameters.
921 #define YY_DECL_IS_OURS 1
923 extern int glcpp_lex \
924 (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
926 #define YY_DECL int glcpp_lex \
927 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
928 #endif /* !YY_DECL */
930 /* Code executed at the beginning of each rule, after yytext and yyleng
933 #ifndef YY_USER_ACTION
934 #define YY_USER_ACTION
937 /* Code executed at the end of each rule. */
939 #define YY_BREAK break;
942 #define YY_RULE_SETUP \
944 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
945 (yytext[yyleng - 1] == '\n'); \
948 /** The main scanner function which does all the work.
952 register yy_state_type yy_current_state;
953 register char *yy_cp, *yy_bp;
955 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
957 #line 76 "glcpp/glcpp-lex.l"
960 /* Single-line comments */
961 #line 962 "glcpp/glcpp-lex.c"
963 yylval = yylval_param;
965 yylloc = yylloc_param;
975 /* Create the reject buffer large enough to save one state per allowed character. */
976 if ( ! yyg->yy_state_buf )
977 yyg->yy_state_buf = (yy_state_type *)glcpp_alloc(YY_STATE_BUF_SIZE ,yyscanner);
978 if ( ! yyg->yy_state_buf )
979 YY_FATAL_ERROR( "out of dynamic memory in glcpp_lex()" );
981 if ( ! yyg->yy_start )
982 yyg->yy_start = 1; /* first start state */
990 if ( ! YY_CURRENT_BUFFER ) {
991 glcpp_ensure_buffer_stack (yyscanner);
992 YY_CURRENT_BUFFER_LVALUE =
993 glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
996 glcpp__load_buffer_state(yyscanner );
999 while ( 1 ) /* loops until end-of-file is reached */
1001 yy_cp = yyg->yy_c_buf_p;
1003 /* Support of yytext. */
1004 *yy_cp = yyg->yy_hold_char;
1006 /* yy_bp points to the position in yy_ch_buf of the start of
1011 yy_current_state = yyg->yy_start;
1012 yy_current_state += YY_AT_BOL();
1014 yyg->yy_state_ptr = yyg->yy_state_buf;
1015 *yyg->yy_state_ptr++ = yy_current_state;
1020 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1021 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1023 yy_current_state = (int) yy_def[yy_current_state];
1024 if ( yy_current_state >= 163 )
1025 yy_c = yy_meta[(unsigned int) yy_c];
1027 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1028 *yyg->yy_state_ptr++ = yy_current_state;
1031 while ( yy_current_state != 162 );
1034 yy_current_state = *--yyg->yy_state_ptr;
1035 yyg->yy_lp = yy_accept[yy_current_state];
1036 find_rule: /* we branch to this label when backing up */
1037 for ( ; ; ) /* until we find what rule we matched */
1039 if ( yyg->yy_lp && yyg->yy_lp < yy_accept[yy_current_state + 1] )
1041 yy_act = yy_acclist[yyg->yy_lp];
1042 if ( yy_act & YY_TRAILING_HEAD_MASK ||
1043 yyg->yy_looking_for_trail_begin )
1045 if ( yy_act == yyg->yy_looking_for_trail_begin )
1047 yyg->yy_looking_for_trail_begin = 0;
1048 yy_act &= ~YY_TRAILING_HEAD_MASK;
1052 else if ( yy_act & YY_TRAILING_MASK )
1054 yyg->yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK;
1055 yyg->yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK;
1056 yyg->yy_full_match = yy_cp;
1057 yyg->yy_full_state = yyg->yy_state_ptr;
1058 yyg->yy_full_lp = yyg->yy_lp;
1062 yyg->yy_full_match = yy_cp;
1063 yyg->yy_full_state = yyg->yy_state_ptr;
1064 yyg->yy_full_lp = yyg->yy_lp;
1071 yy_current_state = *--yyg->yy_state_ptr;
1072 yyg->yy_lp = yy_accept[yy_current_state];
1075 YY_DO_BEFORE_ACTION;
1077 do_action: /* This label is used only to access EOF actions. */
1080 { /* beginning of action switch */
1083 #line 79 "glcpp/glcpp-lex.l"
1087 /* Multi-line comments */
1090 #line 83 "glcpp/glcpp-lex.l"
1091 { yy_push_state(COMMENT, yyscanner); }
1095 #line 84 "glcpp/glcpp-lex.l"
1099 /* rule 4 can match eol */
1101 #line 85 "glcpp/glcpp-lex.l"
1102 { yylineno++; yycolumn = 0; return NEWLINE; }
1106 #line 86 "glcpp/glcpp-lex.l"
1110 /* rule 6 can match eol */
1112 #line 87 "glcpp/glcpp-lex.l"
1113 { yylineno++; yycolumn = 0; return NEWLINE; }
1117 #line 88 "glcpp/glcpp-lex.l"
1119 yy_pop_state(yyscanner);
1120 if (yyextra->space_tokens)
1126 #line 94 "glcpp/glcpp-lex.l"
1128 yylval->str = talloc_strdup (yyextra, yytext);
1129 yyextra->space_tokens = 0;
1130 return HASH_VERSION;
1133 /* glcpp doesn't handle #extension, #version, or #pragma directives.
1134 * Simply pass them through to the main compiler's lexer/parser. */
1137 #line 102 "glcpp/glcpp-lex.l"
1139 yylval->str = talloc_strdup (yyextra, yytext);
1146 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1147 yyg->yy_c_buf_p = yy_cp -= 1;
1148 YY_DO_BEFORE_ACTION; /* set up yytext again */
1150 #line 109 "glcpp/glcpp-lex.l"
1152 /* Eat characters until the first digit is
1156 while (!isdigit(*ptr))
1159 /* Subtract one from the line number because
1160 * yylineno is zero-based instead of
1163 yylineno = strtol(ptr, &ptr, 0) - 1;
1164 yylloc->source = strtol(ptr, NULL, 0);
1168 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1169 yyg->yy_c_buf_p = yy_cp -= 1;
1170 YY_DO_BEFORE_ACTION; /* set up yytext again */
1172 #line 125 "glcpp/glcpp-lex.l"
1174 /* Eat characters until the first digit is
1178 while (!isdigit(*ptr))
1181 /* Subtract one from the line number because
1182 * yylineno is zero-based instead of
1185 yylineno = strtol(ptr, &ptr, 0) - 1;
1189 /* rule 12 can match eol */
1191 #line 140 "glcpp/glcpp-lex.l"
1193 yyextra->lexing_if = 1;
1194 yyextra->space_tokens = 0;
1199 /* rule 13 can match eol */
1201 #line 146 "glcpp/glcpp-lex.l"
1203 yyextra->lexing_if = 1;
1204 yyextra->space_tokens = 0;
1209 /* rule 14 can match eol */
1211 #line 152 "glcpp/glcpp-lex.l"
1213 yyextra->lexing_if = 1;
1214 yyextra->space_tokens = 0;
1219 /* rule 15 can match eol */
1221 #line 158 "glcpp/glcpp-lex.l"
1223 yyextra->lexing_if = 1;
1224 yyextra->space_tokens = 0;
1229 /* rule 16 can match eol */
1231 #line 164 "glcpp/glcpp-lex.l"
1233 yyextra->space_tokens = 0;
1238 /* rule 17 can match eol */
1240 #line 169 "glcpp/glcpp-lex.l"
1242 yyextra->space_tokens = 0;
1246 /* When skipping (due to an #if 0 or similar) consume anything
1247 * up to a newline. We do this with less priority than any
1248 * #if-related directive (#if, #elif, #else, #endif), but with
1249 * more priority than any other directive or token to avoid
1250 * any side-effects from skipped content.
1252 * We use the lexing_if flag to avoid skipping any part of an
1253 * if conditional expression. */
1255 /* rule 18 can match eol */
1256 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1257 yyg->yy_c_buf_p = yy_cp -= 1;
1258 YY_DO_BEFORE_ACTION; /* set up yytext again */
1260 #line 182 "glcpp/glcpp-lex.l"
1262 /* Since this rule always matches, YY_USER_ACTION gets called for it,
1263 * wrongly incrementing yycolumn. We undo that effect here. */
1265 if (yyextra->lexing_if ||
1266 yyextra->skip_stack == NULL ||
1267 yyextra->skip_stack->type == SKIP_NO_SKIP)
1275 #line 194 "glcpp/glcpp-lex.l"
1278 for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */
1279 p += 5; /* skip "error" */
1280 glcpp_error(yylloc, yyextra, "#error%s", p);
1285 #line 201 "glcpp/glcpp-lex.l"
1287 yyextra->space_tokens = 0;
1288 return HASH_DEFINE_FUNC;
1293 #line 206 "glcpp/glcpp-lex.l"
1295 yyextra->space_tokens = 0;
1296 return HASH_DEFINE_OBJ;
1301 #line 211 "glcpp/glcpp-lex.l"
1303 yyextra->space_tokens = 0;
1309 #line 216 "glcpp/glcpp-lex.l"
1311 yyextra->space_tokens = 0;
1317 #line 221 "glcpp/glcpp-lex.l"
1319 yylval->str = talloc_strdup (yyextra, yytext);
1320 return INTEGER_STRING;
1325 #line 226 "glcpp/glcpp-lex.l"
1327 yylval->str = talloc_strdup (yyextra, yytext);
1328 return INTEGER_STRING;
1333 #line 231 "glcpp/glcpp-lex.l"
1335 yylval->str = talloc_strdup (yyextra, yytext);
1336 return INTEGER_STRING;
1341 #line 236 "glcpp/glcpp-lex.l"
1348 #line 240 "glcpp/glcpp-lex.l"
1355 #line 244 "glcpp/glcpp-lex.l"
1357 return LESS_OR_EQUAL;
1362 #line 248 "glcpp/glcpp-lex.l"
1364 return GREATER_OR_EQUAL;
1369 #line 252 "glcpp/glcpp-lex.l"
1376 #line 256 "glcpp/glcpp-lex.l"
1383 #line 260 "glcpp/glcpp-lex.l"
1390 #line 264 "glcpp/glcpp-lex.l"
1397 #line 268 "glcpp/glcpp-lex.l"
1404 #line 272 "glcpp/glcpp-lex.l"
1411 #line 276 "glcpp/glcpp-lex.l"
1413 yylval->str = talloc_strdup (yyextra, yytext);
1419 #line 281 "glcpp/glcpp-lex.l"
1426 #line 285 "glcpp/glcpp-lex.l"
1428 yylval->str = talloc_strdup (yyextra, yytext);
1434 #line 290 "glcpp/glcpp-lex.l"
1436 if (yyextra->space_tokens) {
1442 /* rule 41 can match eol */
1444 #line 296 "glcpp/glcpp-lex.l"
1446 yyextra->lexing_if = 0;
1452 /* Handle missing newline at EOF. */
1453 case YY_STATE_EOF(INITIAL):
1454 #line 304 "glcpp/glcpp-lex.l"
1456 BEGIN DONE; /* Don't keep matching this rule forever. */
1457 yyextra->lexing_if = 0;
1461 /* We don't actually use the UNREACHABLE start condition. We
1462 only have this action here so that we can pretend to call some
1463 generated functions, (to avoid "defined but not used"
1467 #line 314 "glcpp/glcpp-lex.l"
1470 yy_top_state(yyextra);
1475 #line 319 "glcpp/glcpp-lex.l"
1478 #line 1479 "glcpp/glcpp-lex.c"
1479 case YY_STATE_EOF(DONE):
1480 case YY_STATE_EOF(COMMENT):
1481 case YY_STATE_EOF(UNREACHABLE):
1484 case YY_END_OF_BUFFER:
1486 /* Amount of text matched not including the EOB char. */
1487 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1489 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1490 *yy_cp = yyg->yy_hold_char;
1491 YY_RESTORE_YY_MORE_OFFSET
1493 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1495 /* We're scanning a new file or input source. It's
1496 * possible that this happened because the user
1497 * just pointed yyin at a new source and called
1498 * glcpp_lex(). If so, then we have to assure
1499 * consistency between YY_CURRENT_BUFFER and our
1500 * globals. Here is the right place to do so, because
1501 * this is the first action (other than possibly a
1502 * back-up) that will match for the new input source.
1504 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1505 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1506 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1509 /* Note that here we test for yy_c_buf_p "<=" to the position
1510 * of the first EOB in the buffer, since yy_c_buf_p will
1511 * already have been incremented past the NUL character
1512 * (since all states make transitions on EOB to the
1513 * end-of-buffer state). Contrast this with the test
1516 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1517 { /* This was really a NUL. */
1518 yy_state_type yy_next_state;
1520 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1522 yy_current_state = yy_get_previous_state( yyscanner );
1524 /* Okay, we're now positioned to make the NUL
1525 * transition. We couldn't have
1526 * yy_get_previous_state() go ahead and do it
1527 * for us because it doesn't know how to deal
1528 * with the possibility of jamming (and we don't
1529 * want to build jamming into it because then it
1530 * will run more slowly).
1533 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1535 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1537 if ( yy_next_state )
1539 /* Consume the NUL. */
1540 yy_cp = ++yyg->yy_c_buf_p;
1541 yy_current_state = yy_next_state;
1547 yy_cp = yyg->yy_c_buf_p;
1548 goto yy_find_action;
1552 else switch ( yy_get_next_buffer( yyscanner ) )
1554 case EOB_ACT_END_OF_FILE:
1556 yyg->yy_did_buffer_switch_on_eof = 0;
1558 if ( glcpp_wrap(yyscanner ) )
1560 /* Note: because we've taken care in
1561 * yy_get_next_buffer() to have set up
1562 * yytext, we can now set up
1563 * yy_c_buf_p so that if some total
1564 * hoser (like flex itself) wants to
1565 * call the scanner after we return the
1566 * YY_NULL, it'll still work - another
1567 * YY_NULL will get returned.
1569 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1571 yy_act = YY_STATE_EOF(YY_START);
1577 if ( ! yyg->yy_did_buffer_switch_on_eof )
1583 case EOB_ACT_CONTINUE_SCAN:
1585 yyg->yytext_ptr + yy_amount_of_matched_text;
1587 yy_current_state = yy_get_previous_state( yyscanner );
1589 yy_cp = yyg->yy_c_buf_p;
1590 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1593 case EOB_ACT_LAST_MATCH:
1595 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1597 yy_current_state = yy_get_previous_state( yyscanner );
1599 yy_cp = yyg->yy_c_buf_p;
1600 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1601 goto yy_find_action;
1608 "fatal flex scanner internal error--no action found" );
1609 } /* end of action switch */
1610 } /* end of scanning one token */
1611 } /* end of glcpp_lex */
1613 /* yy_get_next_buffer - try to read in a new buffer
1615 * Returns a code representing an action:
1616 * EOB_ACT_LAST_MATCH -
1617 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1618 * EOB_ACT_END_OF_FILE - end of file
1620 static int yy_get_next_buffer (yyscan_t yyscanner)
1622 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1623 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1624 register char *source = yyg->yytext_ptr;
1625 register int number_to_move, i;
1628 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1630 "fatal flex scanner internal error--end of buffer missed" );
1632 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1633 { /* Don't try to fill the buffer, so this is an EOF. */
1634 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1636 /* We matched a single character, the EOB, so
1637 * treat this as a final EOF.
1639 return EOB_ACT_END_OF_FILE;
1644 /* We matched some text prior to the EOB, first
1647 return EOB_ACT_LAST_MATCH;
1651 /* Try to read more data. */
1653 /* First move last chars to start of buffer. */
1654 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
1656 for ( i = 0; i < number_to_move; ++i )
1657 *(dest++) = *(source++);
1659 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1660 /* don't do the read, it's not guaranteed to return an EOF,
1663 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1668 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1670 while ( num_to_read <= 0 )
1671 { /* Not enough room in the buffer - grow it. */
1674 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1678 if ( num_to_read > YY_READ_BUF_SIZE )
1679 num_to_read = YY_READ_BUF_SIZE;
1681 /* Read in more data. */
1682 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1683 yyg->yy_n_chars, (size_t) num_to_read );
1685 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1688 if ( yyg->yy_n_chars == 0 )
1690 if ( number_to_move == YY_MORE_ADJ )
1692 ret_val = EOB_ACT_END_OF_FILE;
1693 glcpp_restart(yyin ,yyscanner);
1698 ret_val = EOB_ACT_LAST_MATCH;
1699 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1700 YY_BUFFER_EOF_PENDING;
1705 ret_val = EOB_ACT_CONTINUE_SCAN;
1707 if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1708 /* Extend the array by 50%, plus the number we really need. */
1709 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1710 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) glcpp_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1711 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1712 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1715 yyg->yy_n_chars += number_to_move;
1716 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1717 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1719 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1724 /* yy_get_previous_state - get the state just before the EOB char was reached */
1726 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1728 register yy_state_type yy_current_state;
1729 register char *yy_cp;
1730 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1732 yy_current_state = yyg->yy_start;
1733 yy_current_state += YY_AT_BOL();
1735 yyg->yy_state_ptr = yyg->yy_state_buf;
1736 *yyg->yy_state_ptr++ = yy_current_state;
1738 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1740 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1741 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1743 yy_current_state = (int) yy_def[yy_current_state];
1744 if ( yy_current_state >= 163 )
1745 yy_c = yy_meta[(unsigned int) yy_c];
1747 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1748 *yyg->yy_state_ptr++ = yy_current_state;
1751 return yy_current_state;
1754 /* yy_try_NUL_trans - try to make a transition on the NUL character
1757 * next_state = yy_try_NUL_trans( current_state );
1759 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
1761 register int yy_is_jam;
1762 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1764 register YY_CHAR yy_c = 1;
1765 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1767 yy_current_state = (int) yy_def[yy_current_state];
1768 if ( yy_current_state >= 163 )
1769 yy_c = yy_meta[(unsigned int) yy_c];
1771 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1772 yy_is_jam = (yy_current_state == 162);
1774 *yyg->yy_state_ptr++ = yy_current_state;
1776 return yy_is_jam ? 0 : yy_current_state;
1779 static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
1781 register char *yy_cp;
1782 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1784 yy_cp = yyg->yy_c_buf_p;
1786 /* undo effects of setting up yytext */
1787 *yy_cp = yyg->yy_hold_char;
1789 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1790 { /* need to shift things up to make room */
1791 /* +2 for EOB chars. */
1792 register int number_to_move = yyg->yy_n_chars + 2;
1793 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1794 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1795 register char *source =
1796 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1798 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1799 *--dest = *--source;
1801 yy_cp += (int) (dest - source);
1802 yy_bp += (int) (dest - source);
1803 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1804 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1806 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1807 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1810 *--yy_cp = (char) c;
1812 yyg->yytext_ptr = yy_bp;
1813 yyg->yy_hold_char = *yy_cp;
1814 yyg->yy_c_buf_p = yy_cp;
1819 static int yyinput (yyscan_t yyscanner)
1821 static int input (yyscan_t yyscanner)
1826 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1828 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1830 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1832 /* yy_c_buf_p now points to the character we want to return.
1833 * If this occurs *before* the EOB characters, then it's a
1834 * valid NUL; if not, then we've hit the end of the buffer.
1836 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1837 /* This was really a NUL. */
1838 *yyg->yy_c_buf_p = '\0';
1841 { /* need more input */
1842 int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1845 switch ( yy_get_next_buffer( yyscanner ) )
1847 case EOB_ACT_LAST_MATCH:
1848 /* This happens because yy_g_n_b()
1849 * sees that we've accumulated a
1850 * token and flags that we need to
1851 * try matching the token before
1852 * proceeding. But for input(),
1853 * there's no matching to consider.
1854 * So convert the EOB_ACT_LAST_MATCH
1855 * to EOB_ACT_END_OF_FILE.
1858 /* Reset buffer status. */
1859 glcpp_restart(yyin ,yyscanner);
1863 case EOB_ACT_END_OF_FILE:
1865 if ( glcpp_wrap(yyscanner ) )
1868 if ( ! yyg->yy_did_buffer_switch_on_eof )
1871 return yyinput(yyscanner);
1873 return input(yyscanner);
1877 case EOB_ACT_CONTINUE_SCAN:
1878 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1884 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1885 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
1886 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1888 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1892 #endif /* ifndef YY_NO_INPUT */
1894 /** Immediately switch to a different input stream.
1895 * @param input_file A readable stream.
1896 * @param yyscanner The scanner object.
1897 * @note This function does not reset the start condition to @c INITIAL .
1899 void glcpp_restart (FILE * input_file , yyscan_t yyscanner)
1901 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1903 if ( ! YY_CURRENT_BUFFER ){
1904 glcpp_ensure_buffer_stack (yyscanner);
1905 YY_CURRENT_BUFFER_LVALUE =
1906 glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1909 glcpp__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1910 glcpp__load_buffer_state(yyscanner );
1913 /** Switch to a different input buffer.
1914 * @param new_buffer The new input buffer.
1915 * @param yyscanner The scanner object.
1917 void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1919 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1921 /* TODO. We should be able to replace this entire function body
1923 * glcpp_pop_buffer_state();
1924 * glcpp_push_buffer_state(new_buffer);
1926 glcpp_ensure_buffer_stack (yyscanner);
1927 if ( YY_CURRENT_BUFFER == new_buffer )
1930 if ( YY_CURRENT_BUFFER )
1932 /* Flush out information for old buffer. */
1933 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1934 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1935 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1938 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1939 glcpp__load_buffer_state(yyscanner );
1941 /* We don't actually know whether we did this switch during
1942 * EOF (glcpp_wrap()) processing, but the only time this flag
1943 * is looked at is after glcpp_wrap() is called, so it's safe
1944 * to go ahead and always set it.
1946 yyg->yy_did_buffer_switch_on_eof = 1;
1949 static void glcpp__load_buffer_state (yyscan_t yyscanner)
1951 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1952 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1953 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1954 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1955 yyg->yy_hold_char = *yyg->yy_c_buf_p;
1958 /** Allocate and initialize an input buffer state.
1959 * @param file A readable stream.
1960 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1961 * @param yyscanner The scanner object.
1962 * @return the allocated buffer state.
1964 YY_BUFFER_STATE glcpp__create_buffer (FILE * file, int size , yyscan_t yyscanner)
1968 b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1970 YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
1972 b->yy_buf_size = size;
1974 /* yy_ch_buf has to be 2 characters longer than the size given because
1975 * we need to put in 2 end-of-buffer characters.
1977 b->yy_ch_buf = (char *) glcpp_alloc(b->yy_buf_size + 2 ,yyscanner );
1978 if ( ! b->yy_ch_buf )
1979 YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
1981 b->yy_is_our_buffer = 1;
1983 glcpp__init_buffer(b,file ,yyscanner);
1988 /** Destroy the buffer.
1989 * @param b a buffer created with glcpp__create_buffer()
1990 * @param yyscanner The scanner object.
1992 void glcpp__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1994 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1999 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2000 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2002 if ( b->yy_is_our_buffer )
2003 glcpp_free((void *) b->yy_ch_buf ,yyscanner );
2005 glcpp_free((void *) b ,yyscanner );
2008 /* Initializes or reinitializes a buffer.
2009 * This function is sometimes called more than once on the same buffer,
2010 * such as during a glcpp_restart() or at EOF.
2012 static void glcpp__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
2016 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2018 glcpp__flush_buffer(b ,yyscanner);
2020 b->yy_input_file = file;
2021 b->yy_fill_buffer = 1;
2023 /* If b is the current buffer, then glcpp__init_buffer was _probably_
2024 * called from glcpp_restart() or through yy_get_next_buffer.
2025 * In that case, we don't want to reset the lineno or column.
2027 if (b != YY_CURRENT_BUFFER){
2028 b->yy_bs_lineno = 1;
2029 b->yy_bs_column = 0;
2032 b->yy_is_interactive = 0;
2037 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2038 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2039 * @param yyscanner The scanner object.
2041 void glcpp__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
2043 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2049 /* We always need two end-of-buffer characters. The first causes
2050 * a transition to the end-of-buffer state. The second causes
2051 * a jam in that state.
2053 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2054 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2056 b->yy_buf_pos = &b->yy_ch_buf[0];
2059 b->yy_buffer_status = YY_BUFFER_NEW;
2061 if ( b == YY_CURRENT_BUFFER )
2062 glcpp__load_buffer_state(yyscanner );
2065 /** Pushes the new state onto the stack. The new state becomes
2066 * the current state. This function will allocate the stack
2068 * @param new_buffer The new state.
2069 * @param yyscanner The scanner object.
2071 void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
2073 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2074 if (new_buffer == NULL)
2077 glcpp_ensure_buffer_stack(yyscanner);
2079 /* This block is copied from glcpp__switch_to_buffer. */
2080 if ( YY_CURRENT_BUFFER )
2082 /* Flush out information for old buffer. */
2083 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2084 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2085 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2088 /* Only push if top exists. Otherwise, replace top. */
2089 if (YY_CURRENT_BUFFER)
2090 yyg->yy_buffer_stack_top++;
2091 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2093 /* copied from glcpp__switch_to_buffer. */
2094 glcpp__load_buffer_state(yyscanner );
2095 yyg->yy_did_buffer_switch_on_eof = 1;
2098 /** Removes and deletes the top of the stack, if present.
2099 * The next element becomes the new top.
2100 * @param yyscanner The scanner object.
2102 void glcpp_pop_buffer_state (yyscan_t yyscanner)
2104 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2105 if (!YY_CURRENT_BUFFER)
2108 glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
2109 YY_CURRENT_BUFFER_LVALUE = NULL;
2110 if (yyg->yy_buffer_stack_top > 0)
2111 --yyg->yy_buffer_stack_top;
2113 if (YY_CURRENT_BUFFER) {
2114 glcpp__load_buffer_state(yyscanner );
2115 yyg->yy_did_buffer_switch_on_eof = 1;
2119 /* Allocates the stack if it does not exist.
2120 * Guarantees space for at least one push.
2122 static void glcpp_ensure_buffer_stack (yyscan_t yyscanner)
2125 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2127 if (!yyg->yy_buffer_stack) {
2129 /* First allocation is just for 2 elements, since we don't know if this
2130 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2131 * immediate realloc on the next call.
2134 yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_alloc
2135 (num_to_alloc * sizeof(struct yy_buffer_state*)
2137 if ( ! yyg->yy_buffer_stack )
2138 YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
2140 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2142 yyg->yy_buffer_stack_max = num_to_alloc;
2143 yyg->yy_buffer_stack_top = 0;
2147 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2149 /* Increase the buffer to prepare for a possible push. */
2150 int grow_size = 8 /* arbitrary grow size */;
2152 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
2153 yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_realloc
2154 (yyg->yy_buffer_stack,
2155 num_to_alloc * sizeof(struct yy_buffer_state*)
2157 if ( ! yyg->yy_buffer_stack )
2158 YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
2160 /* zero only the new slots.*/
2161 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
2162 yyg->yy_buffer_stack_max = num_to_alloc;
2166 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2167 * @param base the character buffer
2168 * @param size the size in bytes of the character buffer
2169 * @param yyscanner The scanner object.
2170 * @return the newly allocated buffer state object.
2172 YY_BUFFER_STATE glcpp__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
2177 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2178 base[size-1] != YY_END_OF_BUFFER_CHAR )
2179 /* They forgot to leave room for the EOB's. */
2182 b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
2184 YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_buffer()" );
2186 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2187 b->yy_buf_pos = b->yy_ch_buf = base;
2188 b->yy_is_our_buffer = 0;
2189 b->yy_input_file = 0;
2190 b->yy_n_chars = b->yy_buf_size;
2191 b->yy_is_interactive = 0;
2193 b->yy_fill_buffer = 0;
2194 b->yy_buffer_status = YY_BUFFER_NEW;
2196 glcpp__switch_to_buffer(b ,yyscanner );
2201 /** Setup the input buffer state to scan a string. The next call to glcpp_lex() will
2202 * scan from a @e copy of @a str.
2203 * @param yystr a NUL-terminated string to scan
2204 * @param yyscanner The scanner object.
2205 * @return the newly allocated buffer state object.
2206 * @note If you want to scan bytes that may contain NUL values, then use
2207 * glcpp__scan_bytes() instead.
2209 YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner)
2212 return glcpp__scan_bytes(yystr,strlen(yystr) ,yyscanner);
2215 /** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will
2216 * scan from a @e copy of @a bytes.
2217 * @param bytes the byte buffer to scan
2218 * @param len the number of bytes in the buffer pointed to by @a bytes.
2219 * @param yyscanner The scanner object.
2220 * @return the newly allocated buffer state object.
2222 YY_BUFFER_STATE glcpp__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
2229 /* Get memory for full buffer, including space for trailing EOB's. */
2230 n = _yybytes_len + 2;
2231 buf = (char *) glcpp_alloc(n ,yyscanner );
2233 YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_bytes()" );
2235 for ( i = 0; i < _yybytes_len; ++i )
2236 buf[i] = yybytes[i];
2238 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2240 b = glcpp__scan_buffer(buf,n ,yyscanner);
2242 YY_FATAL_ERROR( "bad buffer in glcpp__scan_bytes()" );
2244 /* It's okay to grow etc. this buffer, and we should throw it
2245 * away when we're done.
2247 b->yy_is_our_buffer = 1;
2252 static void yy_push_state (int new_state , yyscan_t yyscanner)
2254 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2255 if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth )
2259 yyg->yy_start_stack_depth += YY_START_STACK_INCR;
2260 new_size = yyg->yy_start_stack_depth * sizeof( int );
2262 if ( ! yyg->yy_start_stack )
2263 yyg->yy_start_stack = (int *) glcpp_alloc(new_size ,yyscanner );
2266 yyg->yy_start_stack = (int *) glcpp_realloc((void *) yyg->yy_start_stack,new_size ,yyscanner );
2268 if ( ! yyg->yy_start_stack )
2269 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2272 yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START;
2277 static void yy_pop_state (yyscan_t yyscanner)
2279 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2280 if ( --yyg->yy_start_stack_ptr < 0 )
2281 YY_FATAL_ERROR( "start-condition stack underflow" );
2283 BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]);
2286 static int yy_top_state (yyscan_t yyscanner)
2288 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2289 return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1];
2292 #ifndef YY_EXIT_FAILURE
2293 #define YY_EXIT_FAILURE 2
2296 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
2298 (void) fprintf( stderr, "%s\n", msg );
2299 exit( YY_EXIT_FAILURE );
2302 /* Redefine yyless() so it works in section 3 code. */
2308 /* Undo effects of setting up yytext. */ \
2309 int yyless_macro_arg = (n); \
2310 YY_LESS_LINENO(yyless_macro_arg);\
2311 yytext[yyleng] = yyg->yy_hold_char; \
2312 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2313 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2314 *yyg->yy_c_buf_p = '\0'; \
2315 yyleng = yyless_macro_arg; \
2319 /* Accessor methods (get/set functions) to struct members. */
2321 /** Get the user-defined data for this scanner.
2322 * @param yyscanner The scanner object.
2324 YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner)
2326 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2330 /** Get the current line number.
2331 * @param yyscanner The scanner object.
2333 int glcpp_get_lineno (yyscan_t yyscanner)
2335 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2337 if (! YY_CURRENT_BUFFER)
2343 /** Get the current column number.
2344 * @param yyscanner The scanner object.
2346 int glcpp_get_column (yyscan_t yyscanner)
2348 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2350 if (! YY_CURRENT_BUFFER)
2356 /** Get the input stream.
2357 * @param yyscanner The scanner object.
2359 FILE *glcpp_get_in (yyscan_t yyscanner)
2361 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2365 /** Get the output stream.
2366 * @param yyscanner The scanner object.
2368 FILE *glcpp_get_out (yyscan_t yyscanner)
2370 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2374 /** Get the length of the current token.
2375 * @param yyscanner The scanner object.
2377 int glcpp_get_leng (yyscan_t yyscanner)
2379 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2383 /** Get the current token.
2384 * @param yyscanner The scanner object.
2387 char *glcpp_get_text (yyscan_t yyscanner)
2389 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2393 /** Set the user-defined data. This data is never touched by the scanner.
2394 * @param user_defined The data to be associated with this scanner.
2395 * @param yyscanner The scanner object.
2397 void glcpp_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
2399 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2400 yyextra = user_defined ;
2403 /** Set the current line number.
2404 * @param line_number
2405 * @param yyscanner The scanner object.
2407 void glcpp_set_lineno (int line_number , yyscan_t yyscanner)
2409 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2411 /* lineno is only valid if an input buffer exists. */
2412 if (! YY_CURRENT_BUFFER )
2413 yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner);
2415 yylineno = line_number;
2418 /** Set the current column.
2419 * @param line_number
2420 * @param yyscanner The scanner object.
2422 void glcpp_set_column (int column_no , yyscan_t yyscanner)
2424 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2426 /* column is only valid if an input buffer exists. */
2427 if (! YY_CURRENT_BUFFER )
2428 yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner);
2430 yycolumn = column_no;
2433 /** Set the input stream. This does not discard the current
2435 * @param in_str A readable stream.
2436 * @param yyscanner The scanner object.
2437 * @see glcpp__switch_to_buffer
2439 void glcpp_set_in (FILE * in_str , yyscan_t yyscanner)
2441 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2445 void glcpp_set_out (FILE * out_str , yyscan_t yyscanner)
2447 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2451 int glcpp_get_debug (yyscan_t yyscanner)
2453 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2454 return yy_flex_debug;
2457 void glcpp_set_debug (int bdebug , yyscan_t yyscanner)
2459 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2460 yy_flex_debug = bdebug ;
2463 /* Accessor methods for yylval and yylloc */
2465 YYSTYPE * glcpp_get_lval (yyscan_t yyscanner)
2467 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2471 void glcpp_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
2473 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2474 yylval = yylval_param;
2477 YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner)
2479 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2483 void glcpp_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
2485 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2486 yylloc = yylloc_param;
2489 /* User-visible API */
2491 /* glcpp_lex_init is special because it creates the scanner itself, so it is
2492 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2493 * That's why we explicitly handle the declaration, instead of using our macros.
2496 int glcpp_lex_init(yyscan_t* ptr_yy_globals)
2499 if (ptr_yy_globals == NULL){
2504 *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), NULL );
2506 if (*ptr_yy_globals == NULL){
2511 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2512 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2514 return yy_init_globals ( *ptr_yy_globals );
2517 /* glcpp_lex_init_extra has the same functionality as glcpp_lex_init, but follows the
2518 * convention of taking the scanner as the last argument. Note however, that
2519 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2520 * is the reason, too, why this function also must handle its own declaration).
2521 * The user defined value in the first argument will be available to glcpp_alloc in
2522 * the yyextra field.
2525 int glcpp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
2528 struct yyguts_t dummy_yyguts;
2530 glcpp_set_extra (yy_user_defined, &dummy_yyguts);
2532 if (ptr_yy_globals == NULL){
2537 *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2539 if (*ptr_yy_globals == NULL){
2544 /* By setting to 0xAA, we expose bugs in
2545 yy_init_globals. Leave at 0x00 for releases. */
2546 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2548 glcpp_set_extra (yy_user_defined, *ptr_yy_globals);
2550 return yy_init_globals ( *ptr_yy_globals );
2553 static int yy_init_globals (yyscan_t yyscanner)
2555 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2556 /* Initialization is the same as for the non-reentrant scanner.
2557 * This function is called from glcpp_lex_destroy(), so don't allocate here.
2560 yyg->yy_buffer_stack = 0;
2561 yyg->yy_buffer_stack_top = 0;
2562 yyg->yy_buffer_stack_max = 0;
2563 yyg->yy_c_buf_p = (char *) 0;
2567 yyg->yy_start_stack_ptr = 0;
2568 yyg->yy_start_stack_depth = 0;
2569 yyg->yy_start_stack = NULL;
2571 yyg->yy_state_buf = 0;
2572 yyg->yy_state_ptr = 0;
2573 yyg->yy_full_match = 0;
2576 /* Defined in main.c */
2585 /* For future reference: Set errno on error, since we are called by
2591 /* glcpp_lex_destroy is for both reentrant and non-reentrant scanners. */
2592 int glcpp_lex_destroy (yyscan_t yyscanner)
2594 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2596 /* Pop the buffer stack, destroying each element. */
2597 while(YY_CURRENT_BUFFER){
2598 glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
2599 YY_CURRENT_BUFFER_LVALUE = NULL;
2600 glcpp_pop_buffer_state(yyscanner);
2603 /* Destroy the stack itself. */
2604 glcpp_free(yyg->yy_buffer_stack ,yyscanner);
2605 yyg->yy_buffer_stack = NULL;
2607 /* Destroy the start condition stack. */
2608 glcpp_free(yyg->yy_start_stack ,yyscanner );
2609 yyg->yy_start_stack = NULL;
2611 glcpp_free ( yyg->yy_state_buf , yyscanner);
2612 yyg->yy_state_buf = NULL;
2614 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2615 * glcpp_lex() is called, initialization will occur. */
2616 yy_init_globals( yyscanner);
2618 /* Destroy the main struct (reentrant only). */
2619 glcpp_free ( yyscanner , yyscanner );
2625 * Internal utility routines.
2629 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2632 for ( i = 0; i < n; ++i )
2637 #ifdef YY_NEED_STRLEN
2638 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2641 for ( n = 0; s[n]; ++n )
2648 void *glcpp_alloc (yy_size_t size , yyscan_t yyscanner)
2650 return (void *) malloc( size );
2653 void *glcpp_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
2655 /* The cast to (char *) in the following accommodates both
2656 * implementations that use char* generic pointers, and those
2657 * that use void* generic pointers. It works with the latter
2658 * because both ANSI C and C++ allow castless assignment from
2659 * any pointer type to void*, and deal with argument conversions
2660 * as though doing an assignment.
2662 return (void *) realloc( (char *) ptr, size );
2665 void glcpp_free (void * ptr , yyscan_t yyscanner)
2667 free( (char *) ptr ); /* see glcpp_realloc() for (char *) cast */
2670 #define YYTABLES_NAME "yytables"
2672 #line 319 "glcpp/glcpp-lex.l"
2677 glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader)
2679 glcpp__scan_string(shader,parser->scanner);