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 YYSTYPE
* glcpp_get_lval (yyscan_t yyscanner
);
800 void glcpp_set_lval (YYSTYPE
* yylval_param
,yyscan_t yyscanner
);
802 YYLTYPE
*glcpp_get_lloc (yyscan_t yyscanner
);
804 void glcpp_set_lloc (YYLTYPE
* yylloc_param
,yyscan_t yyscanner
);
806 /* Macros after this point can all be overridden by user definitions in
810 #ifndef YY_SKIP_YYWRAP
812 extern "C" int glcpp_wrap (yyscan_t yyscanner
);
814 extern int glcpp_wrap (yyscan_t yyscanner
);
818 static void yyunput (int c
,char *buf_ptr
,yyscan_t yyscanner
);
821 static void yy_flex_strncpy (char *,yyconst
char *,int ,yyscan_t yyscanner
);
824 #ifdef YY_NEED_STRLEN
825 static int yy_flex_strlen (yyconst
char * ,yyscan_t yyscanner
);
831 static int yyinput (yyscan_t yyscanner
);
833 static int input (yyscan_t yyscanner
);
838 static void yy_push_state (int new_state
,yyscan_t yyscanner
);
840 static void yy_pop_state (yyscan_t yyscanner
);
842 static int yy_top_state (yyscan_t yyscanner
);
844 /* Amount of stuff to slurp up with each read. */
845 #ifndef YY_READ_BUF_SIZE
846 #define YY_READ_BUF_SIZE 8192
849 /* Copy whatever the last rule matched to the standard output. */
851 /* This used to be an fputs(), but since the string might contain NUL's,
852 * we now use fwrite().
854 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
857 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
858 * is returned in "result".
861 #define YY_INPUT(buf,result,max_size) \
862 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
866 for ( n = 0; n < max_size && \
867 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
870 buf[n++] = (char) c; \
871 if ( c == EOF && ferror( yyin ) ) \
872 YY_FATAL_ERROR( "input in flex scanner failed" ); \
878 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
880 if( errno != EINTR) \
882 YY_FATAL_ERROR( "input in flex scanner failed" ); \
893 /* No semi-colon after return; correct usage is to write "yyterminate();" -
894 * we don't want an extra ';' after the "return" because that will cause
895 * some compilers to complain about unreachable statements.
898 #define yyterminate() return YY_NULL
901 /* Number of entries by which start-condition stack grows. */
902 #ifndef YY_START_STACK_INCR
903 #define YY_START_STACK_INCR 25
906 /* Report a fatal error. */
907 #ifndef YY_FATAL_ERROR
908 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
911 /* end tables serialization structures and prototypes */
913 /* Default declaration of generated scanner - a define so the user can
914 * easily add parameters.
917 #define YY_DECL_IS_OURS 1
919 extern int glcpp_lex \
920 (YYSTYPE
* yylval_param
,YYLTYPE
* yylloc_param
,yyscan_t yyscanner
);
922 #define YY_DECL int glcpp_lex \
923 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
924 #endif /* !YY_DECL */
926 /* Code executed at the beginning of each rule, after yytext and yyleng
929 #ifndef YY_USER_ACTION
930 #define YY_USER_ACTION
933 /* Code executed at the end of each rule. */
935 #define YY_BREAK break;
938 #define YY_RULE_SETUP \
940 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
941 (yytext[yyleng - 1] == '\n'); \
944 /** The main scanner function which does all the work.
948 register yy_state_type yy_current_state
;
949 register char *yy_cp
, *yy_bp
;
951 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
953 #line 76 "glcpp/glcpp-lex.l"
956 /* Single-line comments */
957 #line 958 "glcpp/glcpp-lex.c"
959 yylval
= yylval_param
;
961 yylloc
= yylloc_param
;
971 /* Create the reject buffer large enough to save one state per allowed character. */
972 if ( ! yyg
->yy_state_buf
)
973 yyg
->yy_state_buf
= (yy_state_type
*)glcpp_alloc(YY_STATE_BUF_SIZE
,yyscanner
);
974 if ( ! yyg
->yy_state_buf
)
975 YY_FATAL_ERROR( "out of dynamic memory in glcpp_lex()" );
977 if ( ! yyg
->yy_start
)
978 yyg
->yy_start
= 1; /* first start state */
986 if ( ! YY_CURRENT_BUFFER
) {
987 glcpp_ensure_buffer_stack (yyscanner
);
988 YY_CURRENT_BUFFER_LVALUE
=
989 glcpp__create_buffer(yyin
,YY_BUF_SIZE
,yyscanner
);
992 glcpp__load_buffer_state(yyscanner
);
995 while ( 1 ) /* loops until end-of-file is reached */
997 yy_cp
= yyg
->yy_c_buf_p
;
999 /* Support of yytext. */
1000 *yy_cp
= yyg
->yy_hold_char
;
1002 /* yy_bp points to the position in yy_ch_buf of the start of
1007 yy_current_state
= yyg
->yy_start
;
1008 yy_current_state
+= YY_AT_BOL();
1010 yyg
->yy_state_ptr
= yyg
->yy_state_buf
;
1011 *yyg
->yy_state_ptr
++ = yy_current_state
;
1016 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
1017 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1019 yy_current_state
= (int) yy_def
[yy_current_state
];
1020 if ( yy_current_state
>= 163 )
1021 yy_c
= yy_meta
[(unsigned int) yy_c
];
1023 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1024 *yyg
->yy_state_ptr
++ = yy_current_state
;
1027 while ( yy_current_state
!= 162 );
1030 yy_current_state
= *--yyg
->yy_state_ptr
;
1031 yyg
->yy_lp
= yy_accept
[yy_current_state
];
1032 find_rule
: /* we branch to this label when backing up */
1033 for ( ; ; ) /* until we find what rule we matched */
1035 if ( yyg
->yy_lp
&& yyg
->yy_lp
< yy_accept
[yy_current_state
+ 1] )
1037 yy_act
= yy_acclist
[yyg
->yy_lp
];
1038 if ( yy_act
& YY_TRAILING_HEAD_MASK
||
1039 yyg
->yy_looking_for_trail_begin
)
1041 if ( yy_act
== yyg
->yy_looking_for_trail_begin
)
1043 yyg
->yy_looking_for_trail_begin
= 0;
1044 yy_act
&= ~YY_TRAILING_HEAD_MASK
;
1048 else if ( yy_act
& YY_TRAILING_MASK
)
1050 yyg
->yy_looking_for_trail_begin
= yy_act
& ~YY_TRAILING_MASK
;
1051 yyg
->yy_looking_for_trail_begin
|= YY_TRAILING_HEAD_MASK
;
1052 yyg
->yy_full_match
= yy_cp
;
1053 yyg
->yy_full_state
= yyg
->yy_state_ptr
;
1054 yyg
->yy_full_lp
= yyg
->yy_lp
;
1058 yyg
->yy_full_match
= yy_cp
;
1059 yyg
->yy_full_state
= yyg
->yy_state_ptr
;
1060 yyg
->yy_full_lp
= yyg
->yy_lp
;
1067 yy_current_state
= *--yyg
->yy_state_ptr
;
1068 yyg
->yy_lp
= yy_accept
[yy_current_state
];
1071 YY_DO_BEFORE_ACTION
;
1073 do_action
: /* This label is used only to access EOF actions. */
1076 { /* beginning of action switch */
1079 #line 79 "glcpp/glcpp-lex.l"
1083 /* Multi-line comments */
1086 #line 83 "glcpp/glcpp-lex.l"
1087 { yy_push_state(COMMENT
, yyscanner
); }
1091 #line 84 "glcpp/glcpp-lex.l"
1095 /* rule 4 can match eol */
1097 #line 85 "glcpp/glcpp-lex.l"
1098 { yylineno
++; yycolumn
= 0; return NEWLINE
; }
1102 #line 86 "glcpp/glcpp-lex.l"
1106 /* rule 6 can match eol */
1108 #line 87 "glcpp/glcpp-lex.l"
1109 { yylineno
++; yycolumn
= 0; return NEWLINE
; }
1113 #line 88 "glcpp/glcpp-lex.l"
1115 yy_pop_state(yyscanner
);
1116 if (yyextra
->space_tokens
)
1122 #line 94 "glcpp/glcpp-lex.l"
1124 yylval
->str
= talloc_strdup (yyextra
, yytext
);
1125 yyextra
->space_tokens
= 0;
1126 return HASH_VERSION
;
1129 /* glcpp doesn't handle #extension, #version, or #pragma directives.
1130 * Simply pass them through to the main compiler's lexer/parser. */
1133 #line 102 "glcpp/glcpp-lex.l"
1135 yylval
->str
= talloc_strdup (yyextra
, yytext
);
1142 *yy_cp
= yyg
->yy_hold_char
; /* undo effects of setting up yytext */
1143 yyg
->yy_c_buf_p
= yy_cp
-= 1;
1144 YY_DO_BEFORE_ACTION
; /* set up yytext again */
1146 #line 109 "glcpp/glcpp-lex.l"
1148 /* Eat characters until the first digit is
1152 while (!isdigit(*ptr
))
1155 /* Subtract one from the line number because
1156 * yylineno is zero-based instead of
1159 yylineno
= strtol(ptr
, &ptr
, 0) - 1;
1160 yylloc
->source
= strtol(ptr
, NULL
, 0);
1164 *yy_cp
= yyg
->yy_hold_char
; /* undo effects of setting up yytext */
1165 yyg
->yy_c_buf_p
= yy_cp
-= 1;
1166 YY_DO_BEFORE_ACTION
; /* set up yytext again */
1168 #line 125 "glcpp/glcpp-lex.l"
1170 /* Eat characters until the first digit is
1174 while (!isdigit(*ptr
))
1177 /* Subtract one from the line number because
1178 * yylineno is zero-based instead of
1181 yylineno
= strtol(ptr
, &ptr
, 0) - 1;
1185 /* rule 12 can match eol */
1187 #line 140 "glcpp/glcpp-lex.l"
1189 yyextra
->lexing_if
= 1;
1190 yyextra
->space_tokens
= 0;
1195 /* rule 13 can match eol */
1197 #line 146 "glcpp/glcpp-lex.l"
1199 yyextra
->lexing_if
= 1;
1200 yyextra
->space_tokens
= 0;
1205 /* rule 14 can match eol */
1207 #line 152 "glcpp/glcpp-lex.l"
1209 yyextra
->lexing_if
= 1;
1210 yyextra
->space_tokens
= 0;
1215 /* rule 15 can match eol */
1217 #line 158 "glcpp/glcpp-lex.l"
1219 yyextra
->lexing_if
= 1;
1220 yyextra
->space_tokens
= 0;
1225 /* rule 16 can match eol */
1227 #line 164 "glcpp/glcpp-lex.l"
1229 yyextra
->space_tokens
= 0;
1234 /* rule 17 can match eol */
1236 #line 169 "glcpp/glcpp-lex.l"
1238 yyextra
->space_tokens
= 0;
1242 /* When skipping (due to an #if 0 or similar) consume anything
1243 * up to a newline. We do this with less priority than any
1244 * #if-related directive (#if, #elif, #else, #endif), but with
1245 * more priority than any other directive or token to avoid
1246 * any side-effects from skipped content.
1248 * We use the lexing_if flag to avoid skipping any part of an
1249 * if conditional expression. */
1251 /* rule 18 can match eol */
1252 *yy_cp
= yyg
->yy_hold_char
; /* undo effects of setting up yytext */
1253 yyg
->yy_c_buf_p
= yy_cp
-= 1;
1254 YY_DO_BEFORE_ACTION
; /* set up yytext again */
1256 #line 182 "glcpp/glcpp-lex.l"
1258 /* Since this rule always matches, YY_USER_ACTION gets called for it,
1259 * wrongly incrementing yycolumn. We undo that effect here. */
1261 if (yyextra
->lexing_if
||
1262 yyextra
->skip_stack
== NULL
||
1263 yyextra
->skip_stack
->type
== SKIP_NO_SKIP
)
1271 #line 194 "glcpp/glcpp-lex.l"
1274 for (p
= yytext
; !isalpha(p
[0]); p
++); /* skip " # " */
1275 p
+= 5; /* skip "error" */
1276 glcpp_error(yylloc
, yyextra
, "#error%s", p
);
1281 #line 201 "glcpp/glcpp-lex.l"
1283 yyextra
->space_tokens
= 0;
1284 return HASH_DEFINE_FUNC
;
1289 #line 206 "glcpp/glcpp-lex.l"
1291 yyextra
->space_tokens
= 0;
1292 return HASH_DEFINE_OBJ
;
1297 #line 211 "glcpp/glcpp-lex.l"
1299 yyextra
->space_tokens
= 0;
1305 #line 216 "glcpp/glcpp-lex.l"
1307 yyextra
->space_tokens
= 0;
1313 #line 221 "glcpp/glcpp-lex.l"
1315 yylval
->str
= talloc_strdup (yyextra
, yytext
);
1316 return INTEGER_STRING
;
1321 #line 226 "glcpp/glcpp-lex.l"
1323 yylval
->str
= talloc_strdup (yyextra
, yytext
);
1324 return INTEGER_STRING
;
1329 #line 231 "glcpp/glcpp-lex.l"
1331 yylval
->str
= talloc_strdup (yyextra
, yytext
);
1332 return INTEGER_STRING
;
1337 #line 236 "glcpp/glcpp-lex.l"
1344 #line 240 "glcpp/glcpp-lex.l"
1351 #line 244 "glcpp/glcpp-lex.l"
1353 return LESS_OR_EQUAL
;
1358 #line 248 "glcpp/glcpp-lex.l"
1360 return GREATER_OR_EQUAL
;
1365 #line 252 "glcpp/glcpp-lex.l"
1372 #line 256 "glcpp/glcpp-lex.l"
1379 #line 260 "glcpp/glcpp-lex.l"
1386 #line 264 "glcpp/glcpp-lex.l"
1393 #line 268 "glcpp/glcpp-lex.l"
1400 #line 272 "glcpp/glcpp-lex.l"
1407 #line 276 "glcpp/glcpp-lex.l"
1409 yylval
->str
= talloc_strdup (yyextra
, yytext
);
1415 #line 281 "glcpp/glcpp-lex.l"
1422 #line 285 "glcpp/glcpp-lex.l"
1424 yylval
->str
= talloc_strdup (yyextra
, yytext
);
1430 #line 290 "glcpp/glcpp-lex.l"
1432 if (yyextra
->space_tokens
) {
1438 /* rule 41 can match eol */
1440 #line 296 "glcpp/glcpp-lex.l"
1442 yyextra
->lexing_if
= 0;
1448 /* Handle missing newline at EOF. */
1449 case YY_STATE_EOF(INITIAL
):
1450 #line 304 "glcpp/glcpp-lex.l"
1452 BEGIN DONE
; /* Don't keep matching this rule forever. */
1453 yyextra
->lexing_if
= 0;
1457 /* We don't actually use the UNREACHABLE start condition. We
1458 only have this action here so that we can pretend to call some
1459 generated functions, (to avoid "defined but not used"
1463 #line 314 "glcpp/glcpp-lex.l"
1466 yy_top_state(yyextra
);
1471 #line 319 "glcpp/glcpp-lex.l"
1474 #line 1475 "glcpp/glcpp-lex.c"
1475 case YY_STATE_EOF(DONE
):
1476 case YY_STATE_EOF(COMMENT
):
1477 case YY_STATE_EOF(UNREACHABLE
):
1480 case YY_END_OF_BUFFER
:
1482 /* Amount of text matched not including the EOB char. */
1483 int yy_amount_of_matched_text
= (int) (yy_cp
- yyg
->yytext_ptr
) - 1;
1485 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1486 *yy_cp
= yyg
->yy_hold_char
;
1487 YY_RESTORE_YY_MORE_OFFSET
1489 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_NEW
)
1491 /* We're scanning a new file or input source. It's
1492 * possible that this happened because the user
1493 * just pointed yyin at a new source and called
1494 * glcpp_lex(). If so, then we have to assure
1495 * consistency between YY_CURRENT_BUFFER and our
1496 * globals. Here is the right place to do so, because
1497 * this is the first action (other than possibly a
1498 * back-up) that will match for the new input source.
1500 yyg
->yy_n_chars
= YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1501 YY_CURRENT_BUFFER_LVALUE
->yy_input_file
= yyin
;
1502 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
= YY_BUFFER_NORMAL
;
1505 /* Note that here we test for yy_c_buf_p "<=" to the position
1506 * of the first EOB in the buffer, since yy_c_buf_p will
1507 * already have been incremented past the NUL character
1508 * (since all states make transitions on EOB to the
1509 * end-of-buffer state). Contrast this with the test
1512 if ( yyg
->yy_c_buf_p
<= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] )
1513 { /* This was really a NUL. */
1514 yy_state_type yy_next_state
;
1516 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ yy_amount_of_matched_text
;
1518 yy_current_state
= yy_get_previous_state( yyscanner
);
1520 /* Okay, we're now positioned to make the NUL
1521 * transition. We couldn't have
1522 * yy_get_previous_state() go ahead and do it
1523 * for us because it doesn't know how to deal
1524 * with the possibility of jamming (and we don't
1525 * want to build jamming into it because then it
1526 * will run more slowly).
1529 yy_next_state
= yy_try_NUL_trans( yy_current_state
, yyscanner
);
1531 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1533 if ( yy_next_state
)
1535 /* Consume the NUL. */
1536 yy_cp
= ++yyg
->yy_c_buf_p
;
1537 yy_current_state
= yy_next_state
;
1543 yy_cp
= yyg
->yy_c_buf_p
;
1544 goto yy_find_action
;
1548 else switch ( yy_get_next_buffer( yyscanner
) )
1550 case EOB_ACT_END_OF_FILE
:
1552 yyg
->yy_did_buffer_switch_on_eof
= 0;
1554 if ( glcpp_wrap(yyscanner
) )
1556 /* Note: because we've taken care in
1557 * yy_get_next_buffer() to have set up
1558 * yytext, we can now set up
1559 * yy_c_buf_p so that if some total
1560 * hoser (like flex itself) wants to
1561 * call the scanner after we return the
1562 * YY_NULL, it'll still work - another
1563 * YY_NULL will get returned.
1565 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1567 yy_act
= YY_STATE_EOF(YY_START
);
1573 if ( ! yyg
->yy_did_buffer_switch_on_eof
)
1579 case EOB_ACT_CONTINUE_SCAN
:
1581 yyg
->yytext_ptr
+ yy_amount_of_matched_text
;
1583 yy_current_state
= yy_get_previous_state( yyscanner
);
1585 yy_cp
= yyg
->yy_c_buf_p
;
1586 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1589 case EOB_ACT_LAST_MATCH
:
1591 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
];
1593 yy_current_state
= yy_get_previous_state( yyscanner
);
1595 yy_cp
= yyg
->yy_c_buf_p
;
1596 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
1597 goto yy_find_action
;
1604 "fatal flex scanner internal error--no action found" );
1605 } /* end of action switch */
1606 } /* end of scanning one token */
1607 } /* end of glcpp_lex */
1609 /* yy_get_next_buffer - try to read in a new buffer
1611 * Returns a code representing an action:
1612 * EOB_ACT_LAST_MATCH -
1613 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1614 * EOB_ACT_END_OF_FILE - end of file
1616 static int yy_get_next_buffer (yyscan_t yyscanner
)
1618 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1619 register char *dest
= YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
;
1620 register char *source
= yyg
->yytext_ptr
;
1621 register int number_to_move
, i
;
1624 if ( yyg
->yy_c_buf_p
> &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
+ 1] )
1626 "fatal flex scanner internal error--end of buffer missed" );
1628 if ( YY_CURRENT_BUFFER_LVALUE
->yy_fill_buffer
== 0 )
1629 { /* Don't try to fill the buffer, so this is an EOF. */
1630 if ( yyg
->yy_c_buf_p
- yyg
->yytext_ptr
- YY_MORE_ADJ
== 1 )
1632 /* We matched a single character, the EOB, so
1633 * treat this as a final EOF.
1635 return EOB_ACT_END_OF_FILE
;
1640 /* We matched some text prior to the EOB, first
1643 return EOB_ACT_LAST_MATCH
;
1647 /* Try to read more data. */
1649 /* First move last chars to start of buffer. */
1650 number_to_move
= (int) (yyg
->yy_c_buf_p
- yyg
->yytext_ptr
) - 1;
1652 for ( i
= 0; i
< number_to_move
; ++i
)
1653 *(dest
++) = *(source
++);
1655 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
1656 /* don't do the read, it's not guaranteed to return an EOF,
1659 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
= 0;
1664 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
- number_to_move
- 1;
1666 while ( num_to_read
<= 0 )
1667 { /* Not enough room in the buffer - grow it. */
1670 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1674 if ( num_to_read
> YY_READ_BUF_SIZE
)
1675 num_to_read
= YY_READ_BUF_SIZE
;
1677 /* Read in more data. */
1678 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
]),
1679 yyg
->yy_n_chars
, (size_t) num_to_read
);
1681 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
1684 if ( yyg
->yy_n_chars
== 0 )
1686 if ( number_to_move
== YY_MORE_ADJ
)
1688 ret_val
= EOB_ACT_END_OF_FILE
;
1689 glcpp_restart(yyin
,yyscanner
);
1694 ret_val
= EOB_ACT_LAST_MATCH
;
1695 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
=
1696 YY_BUFFER_EOF_PENDING
;
1701 ret_val
= EOB_ACT_CONTINUE_SCAN
;
1703 if ((yy_size_t
) (yyg
->yy_n_chars
+ number_to_move
) > YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
) {
1704 /* Extend the array by 50%, plus the number we really need. */
1705 yy_size_t new_size
= yyg
->yy_n_chars
+ number_to_move
+ (yyg
->yy_n_chars
>> 1);
1706 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
= (char *) glcpp_realloc((void *) YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
,new_size
,yyscanner
);
1707 if ( ! YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
1708 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1711 yyg
->yy_n_chars
+= number_to_move
;
1712 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] = YY_END_OF_BUFFER_CHAR
;
1713 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
+ 1] = YY_END_OF_BUFFER_CHAR
;
1715 yyg
->yytext_ptr
= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[0];
1720 /* yy_get_previous_state - get the state just before the EOB char was reached */
1722 static yy_state_type
yy_get_previous_state (yyscan_t yyscanner
)
1724 register yy_state_type yy_current_state
;
1725 register char *yy_cp
;
1726 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1728 yy_current_state
= yyg
->yy_start
;
1729 yy_current_state
+= YY_AT_BOL();
1731 yyg
->yy_state_ptr
= yyg
->yy_state_buf
;
1732 *yyg
->yy_state_ptr
++ = yy_current_state
;
1734 for ( yy_cp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
; yy_cp
< yyg
->yy_c_buf_p
; ++yy_cp
)
1736 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
1737 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1739 yy_current_state
= (int) yy_def
[yy_current_state
];
1740 if ( yy_current_state
>= 163 )
1741 yy_c
= yy_meta
[(unsigned int) yy_c
];
1743 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1744 *yyg
->yy_state_ptr
++ = yy_current_state
;
1747 return yy_current_state
;
1750 /* yy_try_NUL_trans - try to make a transition on the NUL character
1753 * next_state = yy_try_NUL_trans( current_state );
1755 static yy_state_type
yy_try_NUL_trans (yy_state_type yy_current_state
, yyscan_t yyscanner
)
1757 register int yy_is_jam
;
1758 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
; /* This var may be unused depending upon options. */
1760 register YY_CHAR yy_c
= 1;
1761 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1763 yy_current_state
= (int) yy_def
[yy_current_state
];
1764 if ( yy_current_state
>= 163 )
1765 yy_c
= yy_meta
[(unsigned int) yy_c
];
1767 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1768 yy_is_jam
= (yy_current_state
== 162);
1770 *yyg
->yy_state_ptr
++ = yy_current_state
;
1772 return yy_is_jam
? 0 : yy_current_state
;
1775 static void yyunput (int c
, register char * yy_bp
, yyscan_t yyscanner
)
1777 register char *yy_cp
;
1778 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1780 yy_cp
= yyg
->yy_c_buf_p
;
1782 /* undo effects of setting up yytext */
1783 *yy_cp
= yyg
->yy_hold_char
;
1785 if ( yy_cp
< YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
+ 2 )
1786 { /* need to shift things up to make room */
1787 /* +2 for EOB chars. */
1788 register int number_to_move
= yyg
->yy_n_chars
+ 2;
1789 register char *dest
= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[
1790 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
+ 2];
1791 register char *source
=
1792 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
];
1794 while ( source
> YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
1795 *--dest
= *--source
;
1797 yy_cp
+= (int) (dest
- source
);
1798 yy_bp
+= (int) (dest
- source
);
1799 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
=
1800 yyg
->yy_n_chars
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
;
1802 if ( yy_cp
< YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
+ 2 )
1803 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1806 *--yy_cp
= (char) c
;
1808 yyg
->yytext_ptr
= yy_bp
;
1809 yyg
->yy_hold_char
= *yy_cp
;
1810 yyg
->yy_c_buf_p
= yy_cp
;
1815 static int yyinput (yyscan_t yyscanner
)
1817 static int input (yyscan_t yyscanner
)
1822 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1824 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
1826 if ( *yyg
->yy_c_buf_p
== YY_END_OF_BUFFER_CHAR
)
1828 /* yy_c_buf_p now points to the character we want to return.
1829 * If this occurs *before* the EOB characters, then it's a
1830 * valid NUL; if not, then we've hit the end of the buffer.
1832 if ( yyg
->yy_c_buf_p
< &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] )
1833 /* This was really a NUL. */
1834 *yyg
->yy_c_buf_p
= '\0';
1837 { /* need more input */
1838 int offset
= yyg
->yy_c_buf_p
- yyg
->yytext_ptr
;
1841 switch ( yy_get_next_buffer( yyscanner
) )
1843 case EOB_ACT_LAST_MATCH
:
1844 /* This happens because yy_g_n_b()
1845 * sees that we've accumulated a
1846 * token and flags that we need to
1847 * try matching the token before
1848 * proceeding. But for input(),
1849 * there's no matching to consider.
1850 * So convert the EOB_ACT_LAST_MATCH
1851 * to EOB_ACT_END_OF_FILE.
1854 /* Reset buffer status. */
1855 glcpp_restart(yyin
,yyscanner
);
1859 case EOB_ACT_END_OF_FILE
:
1861 if ( glcpp_wrap(yyscanner
) )
1864 if ( ! yyg
->yy_did_buffer_switch_on_eof
)
1867 return yyinput(yyscanner
);
1869 return input(yyscanner
);
1873 case EOB_ACT_CONTINUE_SCAN
:
1874 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ offset
;
1880 c
= *(unsigned char *) yyg
->yy_c_buf_p
; /* cast for 8-bit char's */
1881 *yyg
->yy_c_buf_p
= '\0'; /* preserve yytext */
1882 yyg
->yy_hold_char
= *++yyg
->yy_c_buf_p
;
1884 YY_CURRENT_BUFFER_LVALUE
->yy_at_bol
= (c
== '\n');
1888 #endif /* ifndef YY_NO_INPUT */
1890 /** Immediately switch to a different input stream.
1891 * @param input_file A readable stream.
1892 * @param yyscanner The scanner object.
1893 * @note This function does not reset the start condition to @c INITIAL .
1895 void glcpp_restart (FILE * input_file
, yyscan_t yyscanner
)
1897 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1899 if ( ! YY_CURRENT_BUFFER
){
1900 glcpp_ensure_buffer_stack (yyscanner
);
1901 YY_CURRENT_BUFFER_LVALUE
=
1902 glcpp__create_buffer(yyin
,YY_BUF_SIZE
,yyscanner
);
1905 glcpp__init_buffer(YY_CURRENT_BUFFER
,input_file
,yyscanner
);
1906 glcpp__load_buffer_state(yyscanner
);
1909 /** Switch to a different input buffer.
1910 * @param new_buffer The new input buffer.
1911 * @param yyscanner The scanner object.
1913 void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
)
1915 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1917 /* TODO. We should be able to replace this entire function body
1919 * glcpp_pop_buffer_state();
1920 * glcpp_push_buffer_state(new_buffer);
1922 glcpp_ensure_buffer_stack (yyscanner
);
1923 if ( YY_CURRENT_BUFFER
== new_buffer
)
1926 if ( YY_CURRENT_BUFFER
)
1928 /* Flush out information for old buffer. */
1929 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
1930 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= yyg
->yy_c_buf_p
;
1931 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
1934 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1935 glcpp__load_buffer_state(yyscanner
);
1937 /* We don't actually know whether we did this switch during
1938 * EOF (glcpp_wrap()) processing, but the only time this flag
1939 * is looked at is after glcpp_wrap() is called, so it's safe
1940 * to go ahead and always set it.
1942 yyg
->yy_did_buffer_switch_on_eof
= 1;
1945 static void glcpp__load_buffer_state (yyscan_t yyscanner
)
1947 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1948 yyg
->yy_n_chars
= YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1949 yyg
->yytext_ptr
= yyg
->yy_c_buf_p
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
;
1950 yyin
= YY_CURRENT_BUFFER_LVALUE
->yy_input_file
;
1951 yyg
->yy_hold_char
= *yyg
->yy_c_buf_p
;
1954 /** Allocate and initialize an input buffer state.
1955 * @param file A readable stream.
1956 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1957 * @param yyscanner The scanner object.
1958 * @return the allocated buffer state.
1960 YY_BUFFER_STATE
glcpp__create_buffer (FILE * file
, int size
, yyscan_t yyscanner
)
1964 b
= (YY_BUFFER_STATE
) glcpp_alloc(sizeof( struct yy_buffer_state
) ,yyscanner
);
1966 YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
1968 b
->yy_buf_size
= size
;
1970 /* yy_ch_buf has to be 2 characters longer than the size given because
1971 * we need to put in 2 end-of-buffer characters.
1973 b
->yy_ch_buf
= (char *) glcpp_alloc(b
->yy_buf_size
+ 2 ,yyscanner
);
1974 if ( ! b
->yy_ch_buf
)
1975 YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
1977 b
->yy_is_our_buffer
= 1;
1979 glcpp__init_buffer(b
,file
,yyscanner
);
1984 /** Destroy the buffer.
1985 * @param b a buffer created with glcpp__create_buffer()
1986 * @param yyscanner The scanner object.
1988 void glcpp__delete_buffer (YY_BUFFER_STATE b
, yyscan_t yyscanner
)
1990 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1995 if ( b
== YY_CURRENT_BUFFER
) /* Not sure if we should pop here. */
1996 YY_CURRENT_BUFFER_LVALUE
= (YY_BUFFER_STATE
) 0;
1998 if ( b
->yy_is_our_buffer
)
1999 glcpp_free((void *) b
->yy_ch_buf
,yyscanner
);
2001 glcpp_free((void *) b
,yyscanner
);
2004 /* Initializes or reinitializes a buffer.
2005 * This function is sometimes called more than once on the same buffer,
2006 * such as during a glcpp_restart() or at EOF.
2008 static void glcpp__init_buffer (YY_BUFFER_STATE b
, FILE * file
, yyscan_t yyscanner
)
2012 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2014 glcpp__flush_buffer(b
,yyscanner
);
2016 b
->yy_input_file
= file
;
2017 b
->yy_fill_buffer
= 1;
2019 /* If b is the current buffer, then glcpp__init_buffer was _probably_
2020 * called from glcpp_restart() or through yy_get_next_buffer.
2021 * In that case, we don't want to reset the lineno or column.
2023 if (b
!= YY_CURRENT_BUFFER
){
2024 b
->yy_bs_lineno
= 1;
2025 b
->yy_bs_column
= 0;
2028 b
->yy_is_interactive
= 0;
2033 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2034 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2035 * @param yyscanner The scanner object.
2037 void glcpp__flush_buffer (YY_BUFFER_STATE b
, yyscan_t yyscanner
)
2039 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2045 /* We always need two end-of-buffer characters. The first causes
2046 * a transition to the end-of-buffer state. The second causes
2047 * a jam in that state.
2049 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
2050 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
2052 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
2055 b
->yy_buffer_status
= YY_BUFFER_NEW
;
2057 if ( b
== YY_CURRENT_BUFFER
)
2058 glcpp__load_buffer_state(yyscanner
);
2061 /** Pushes the new state onto the stack. The new state becomes
2062 * the current state. This function will allocate the stack
2064 * @param new_buffer The new state.
2065 * @param yyscanner The scanner object.
2067 void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
)
2069 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2070 if (new_buffer
== NULL
)
2073 glcpp_ensure_buffer_stack(yyscanner
);
2075 /* This block is copied from glcpp__switch_to_buffer. */
2076 if ( YY_CURRENT_BUFFER
)
2078 /* Flush out information for old buffer. */
2079 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
2080 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= yyg
->yy_c_buf_p
;
2081 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
2084 /* Only push if top exists. Otherwise, replace top. */
2085 if (YY_CURRENT_BUFFER
)
2086 yyg
->yy_buffer_stack_top
++;
2087 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
2089 /* copied from glcpp__switch_to_buffer. */
2090 glcpp__load_buffer_state(yyscanner
);
2091 yyg
->yy_did_buffer_switch_on_eof
= 1;
2094 /** Removes and deletes the top of the stack, if present.
2095 * The next element becomes the new top.
2096 * @param yyscanner The scanner object.
2098 void glcpp_pop_buffer_state (yyscan_t yyscanner
)
2100 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2101 if (!YY_CURRENT_BUFFER
)
2104 glcpp__delete_buffer(YY_CURRENT_BUFFER
,yyscanner
);
2105 YY_CURRENT_BUFFER_LVALUE
= NULL
;
2106 if (yyg
->yy_buffer_stack_top
> 0)
2107 --yyg
->yy_buffer_stack_top
;
2109 if (YY_CURRENT_BUFFER
) {
2110 glcpp__load_buffer_state(yyscanner
);
2111 yyg
->yy_did_buffer_switch_on_eof
= 1;
2115 /* Allocates the stack if it does not exist.
2116 * Guarantees space for at least one push.
2118 static void glcpp_ensure_buffer_stack (yyscan_t yyscanner
)
2121 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2123 if (!yyg
->yy_buffer_stack
) {
2125 /* First allocation is just for 2 elements, since we don't know if this
2126 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2127 * immediate realloc on the next call.
2130 yyg
->yy_buffer_stack
= (struct yy_buffer_state
**)glcpp_alloc
2131 (num_to_alloc
* sizeof(struct yy_buffer_state
*)
2133 if ( ! yyg
->yy_buffer_stack
)
2134 YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
2136 memset(yyg
->yy_buffer_stack
, 0, num_to_alloc
* sizeof(struct yy_buffer_state
*));
2138 yyg
->yy_buffer_stack_max
= num_to_alloc
;
2139 yyg
->yy_buffer_stack_top
= 0;
2143 if (yyg
->yy_buffer_stack_top
>= (yyg
->yy_buffer_stack_max
) - 1){
2145 /* Increase the buffer to prepare for a possible push. */
2146 int grow_size
= 8 /* arbitrary grow size */;
2148 num_to_alloc
= yyg
->yy_buffer_stack_max
+ grow_size
;
2149 yyg
->yy_buffer_stack
= (struct yy_buffer_state
**)glcpp_realloc
2150 (yyg
->yy_buffer_stack
,
2151 num_to_alloc
* sizeof(struct yy_buffer_state
*)
2153 if ( ! yyg
->yy_buffer_stack
)
2154 YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
2156 /* zero only the new slots.*/
2157 memset(yyg
->yy_buffer_stack
+ yyg
->yy_buffer_stack_max
, 0, grow_size
* sizeof(struct yy_buffer_state
*));
2158 yyg
->yy_buffer_stack_max
= num_to_alloc
;
2162 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2163 * @param base the character buffer
2164 * @param size the size in bytes of the character buffer
2165 * @param yyscanner The scanner object.
2166 * @return the newly allocated buffer state object.
2168 YY_BUFFER_STATE
glcpp__scan_buffer (char * base
, yy_size_t size
, yyscan_t yyscanner
)
2173 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
2174 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
2175 /* They forgot to leave room for the EOB's. */
2178 b
= (YY_BUFFER_STATE
) glcpp_alloc(sizeof( struct yy_buffer_state
) ,yyscanner
);
2180 YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_buffer()" );
2182 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
2183 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
2184 b
->yy_is_our_buffer
= 0;
2185 b
->yy_input_file
= 0;
2186 b
->yy_n_chars
= b
->yy_buf_size
;
2187 b
->yy_is_interactive
= 0;
2189 b
->yy_fill_buffer
= 0;
2190 b
->yy_buffer_status
= YY_BUFFER_NEW
;
2192 glcpp__switch_to_buffer(b
,yyscanner
);
2197 /** Setup the input buffer state to scan a string. The next call to glcpp_lex() will
2198 * scan from a @e copy of @a str.
2199 * @param yystr a NUL-terminated string to scan
2200 * @param yyscanner The scanner object.
2201 * @return the newly allocated buffer state object.
2202 * @note If you want to scan bytes that may contain NUL values, then use
2203 * glcpp__scan_bytes() instead.
2205 YY_BUFFER_STATE
glcpp__scan_string (yyconst
char * yystr
, yyscan_t yyscanner
)
2208 return glcpp__scan_bytes(yystr
,strlen(yystr
) ,yyscanner
);
2211 /** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will
2212 * scan from a @e copy of @a bytes.
2213 * @param bytes the byte buffer to scan
2214 * @param len the number of bytes in the buffer pointed to by @a bytes.
2215 * @param yyscanner The scanner object.
2216 * @return the newly allocated buffer state object.
2218 YY_BUFFER_STATE
glcpp__scan_bytes (yyconst
char * yybytes
, int _yybytes_len
, yyscan_t yyscanner
)
2225 /* Get memory for full buffer, including space for trailing EOB's. */
2226 n
= _yybytes_len
+ 2;
2227 buf
= (char *) glcpp_alloc(n
,yyscanner
);
2229 YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_bytes()" );
2231 for ( i
= 0; i
< _yybytes_len
; ++i
)
2232 buf
[i
] = yybytes
[i
];
2234 buf
[_yybytes_len
] = buf
[_yybytes_len
+1] = YY_END_OF_BUFFER_CHAR
;
2236 b
= glcpp__scan_buffer(buf
,n
,yyscanner
);
2238 YY_FATAL_ERROR( "bad buffer in glcpp__scan_bytes()" );
2240 /* It's okay to grow etc. this buffer, and we should throw it
2241 * away when we're done.
2243 b
->yy_is_our_buffer
= 1;
2248 static void yy_push_state (int new_state
, yyscan_t yyscanner
)
2250 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2251 if ( yyg
->yy_start_stack_ptr
>= yyg
->yy_start_stack_depth
)
2255 yyg
->yy_start_stack_depth
+= YY_START_STACK_INCR
;
2256 new_size
= yyg
->yy_start_stack_depth
* sizeof( int );
2258 if ( ! yyg
->yy_start_stack
)
2259 yyg
->yy_start_stack
= (int *) glcpp_alloc(new_size
,yyscanner
);
2262 yyg
->yy_start_stack
= (int *) glcpp_realloc((void *) yyg
->yy_start_stack
,new_size
,yyscanner
);
2264 if ( ! yyg
->yy_start_stack
)
2265 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2268 yyg
->yy_start_stack
[yyg
->yy_start_stack_ptr
++] = YY_START
;
2273 static void yy_pop_state (yyscan_t yyscanner
)
2275 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2276 if ( --yyg
->yy_start_stack_ptr
< 0 )
2277 YY_FATAL_ERROR( "start-condition stack underflow" );
2279 BEGIN(yyg
->yy_start_stack
[yyg
->yy_start_stack_ptr
]);
2282 static int yy_top_state (yyscan_t yyscanner
)
2284 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2285 return yyg
->yy_start_stack
[yyg
->yy_start_stack_ptr
- 1];
2288 #ifndef YY_EXIT_FAILURE
2289 #define YY_EXIT_FAILURE 2
2292 static void yy_fatal_error (yyconst
char* msg
, yyscan_t yyscanner
)
2294 (void) fprintf( stderr
, "%s\n", msg
);
2295 exit( YY_EXIT_FAILURE
);
2298 /* Redefine yyless() so it works in section 3 code. */
2304 /* Undo effects of setting up yytext. */ \
2305 int yyless_macro_arg = (n); \
2306 YY_LESS_LINENO(yyless_macro_arg);\
2307 yytext[yyleng] = yyg->yy_hold_char; \
2308 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2309 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2310 *yyg->yy_c_buf_p = '\0'; \
2311 yyleng = yyless_macro_arg; \
2315 /* Accessor methods (get/set functions) to struct members. */
2317 /** Get the user-defined data for this scanner.
2318 * @param yyscanner The scanner object.
2320 YY_EXTRA_TYPE
glcpp_get_extra (yyscan_t yyscanner
)
2322 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2326 /** Get the current line number.
2327 * @param yyscanner The scanner object.
2329 int glcpp_get_lineno (yyscan_t yyscanner
)
2331 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2333 if (! YY_CURRENT_BUFFER
)
2339 /** Get the current column number.
2340 * @param yyscanner The scanner object.
2342 int glcpp_get_column (yyscan_t yyscanner
)
2344 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2346 if (! YY_CURRENT_BUFFER
)
2352 /** Get the input stream.
2353 * @param yyscanner The scanner object.
2355 FILE *glcpp_get_in (yyscan_t yyscanner
)
2357 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2361 /** Get the output stream.
2362 * @param yyscanner The scanner object.
2364 FILE *glcpp_get_out (yyscan_t yyscanner
)
2366 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2370 /** Get the length of the current token.
2371 * @param yyscanner The scanner object.
2373 int glcpp_get_leng (yyscan_t yyscanner
)
2375 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2379 /** Get the current token.
2380 * @param yyscanner The scanner object.
2383 char *glcpp_get_text (yyscan_t yyscanner
)
2385 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2389 /** Set the user-defined data. This data is never touched by the scanner.
2390 * @param user_defined The data to be associated with this scanner.
2391 * @param yyscanner The scanner object.
2393 void glcpp_set_extra (YY_EXTRA_TYPE user_defined
, yyscan_t yyscanner
)
2395 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2396 yyextra
= user_defined
;
2399 /** Set the current line number.
2400 * @param line_number
2401 * @param yyscanner The scanner object.
2403 void glcpp_set_lineno (int line_number
, yyscan_t yyscanner
)
2405 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2407 /* lineno is only valid if an input buffer exists. */
2408 if (! YY_CURRENT_BUFFER
)
2409 yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner
);
2411 yylineno
= line_number
;
2414 /** Set the current column.
2415 * @param line_number
2416 * @param yyscanner The scanner object.
2418 void glcpp_set_column (int column_no
, yyscan_t yyscanner
)
2420 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2422 /* column is only valid if an input buffer exists. */
2423 if (! YY_CURRENT_BUFFER
)
2424 yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner
);
2426 yycolumn
= column_no
;
2429 /** Set the input stream. This does not discard the current
2431 * @param in_str A readable stream.
2432 * @param yyscanner The scanner object.
2433 * @see glcpp__switch_to_buffer
2435 void glcpp_set_in (FILE * in_str
, yyscan_t yyscanner
)
2437 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2441 void glcpp_set_out (FILE * out_str
, yyscan_t yyscanner
)
2443 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2447 int glcpp_get_debug (yyscan_t yyscanner
)
2449 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2450 return yy_flex_debug
;
2453 void glcpp_set_debug (int bdebug
, yyscan_t yyscanner
)
2455 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2456 yy_flex_debug
= bdebug
;
2459 /* Accessor methods for yylval and yylloc */
2461 YYSTYPE
* glcpp_get_lval (yyscan_t yyscanner
)
2463 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2467 void glcpp_set_lval (YYSTYPE
* yylval_param
, yyscan_t yyscanner
)
2469 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2470 yylval
= yylval_param
;
2473 YYLTYPE
*glcpp_get_lloc (yyscan_t yyscanner
)
2475 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2479 void glcpp_set_lloc (YYLTYPE
* yylloc_param
, yyscan_t yyscanner
)
2481 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2482 yylloc
= yylloc_param
;
2485 /* User-visible API */
2487 /* glcpp_lex_init is special because it creates the scanner itself, so it is
2488 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2489 * That's why we explicitly handle the declaration, instead of using our macros.
2492 int glcpp_lex_init(yyscan_t
* ptr_yy_globals
)
2495 if (ptr_yy_globals
== NULL
){
2500 *ptr_yy_globals
= (yyscan_t
) glcpp_alloc ( sizeof( struct yyguts_t
), NULL
);
2502 if (*ptr_yy_globals
== NULL
){
2507 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2508 memset(*ptr_yy_globals
,0x00,sizeof(struct yyguts_t
));
2510 return yy_init_globals ( *ptr_yy_globals
);
2513 /* glcpp_lex_init_extra has the same functionality as glcpp_lex_init, but follows the
2514 * convention of taking the scanner as the last argument. Note however, that
2515 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2516 * is the reason, too, why this function also must handle its own declaration).
2517 * The user defined value in the first argument will be available to glcpp_alloc in
2518 * the yyextra field.
2521 int glcpp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined
,yyscan_t
* ptr_yy_globals
)
2524 struct yyguts_t dummy_yyguts
;
2526 glcpp_set_extra (yy_user_defined
, &dummy_yyguts
);
2528 if (ptr_yy_globals
== NULL
){
2533 *ptr_yy_globals
= (yyscan_t
) glcpp_alloc ( sizeof( struct yyguts_t
), &dummy_yyguts
);
2535 if (*ptr_yy_globals
== NULL
){
2540 /* By setting to 0xAA, we expose bugs in
2541 yy_init_globals. Leave at 0x00 for releases. */
2542 memset(*ptr_yy_globals
,0x00,sizeof(struct yyguts_t
));
2544 glcpp_set_extra (yy_user_defined
, *ptr_yy_globals
);
2546 return yy_init_globals ( *ptr_yy_globals
);
2549 static int yy_init_globals (yyscan_t yyscanner
)
2551 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2552 /* Initialization is the same as for the non-reentrant scanner.
2553 * This function is called from glcpp_lex_destroy(), so don't allocate here.
2556 yyg
->yy_buffer_stack
= 0;
2557 yyg
->yy_buffer_stack_top
= 0;
2558 yyg
->yy_buffer_stack_max
= 0;
2559 yyg
->yy_c_buf_p
= (char *) 0;
2563 yyg
->yy_start_stack_ptr
= 0;
2564 yyg
->yy_start_stack_depth
= 0;
2565 yyg
->yy_start_stack
= NULL
;
2567 yyg
->yy_state_buf
= 0;
2568 yyg
->yy_state_ptr
= 0;
2569 yyg
->yy_full_match
= 0;
2572 /* Defined in main.c */
2581 /* For future reference: Set errno on error, since we are called by
2587 /* glcpp_lex_destroy is for both reentrant and non-reentrant scanners. */
2588 int glcpp_lex_destroy (yyscan_t yyscanner
)
2590 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2592 /* Pop the buffer stack, destroying each element. */
2593 while(YY_CURRENT_BUFFER
){
2594 glcpp__delete_buffer(YY_CURRENT_BUFFER
,yyscanner
);
2595 YY_CURRENT_BUFFER_LVALUE
= NULL
;
2596 glcpp_pop_buffer_state(yyscanner
);
2599 /* Destroy the stack itself. */
2600 glcpp_free(yyg
->yy_buffer_stack
,yyscanner
);
2601 yyg
->yy_buffer_stack
= NULL
;
2603 /* Destroy the start condition stack. */
2604 glcpp_free(yyg
->yy_start_stack
,yyscanner
);
2605 yyg
->yy_start_stack
= NULL
;
2607 glcpp_free ( yyg
->yy_state_buf
, yyscanner
);
2608 yyg
->yy_state_buf
= NULL
;
2610 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2611 * glcpp_lex() is called, initialization will occur. */
2612 yy_init_globals( yyscanner
);
2614 /* Destroy the main struct (reentrant only). */
2615 glcpp_free ( yyscanner
, yyscanner
);
2621 * Internal utility routines.
2625 static void yy_flex_strncpy (char* s1
, yyconst
char * s2
, int n
, yyscan_t yyscanner
)
2628 for ( i
= 0; i
< n
; ++i
)
2633 #ifdef YY_NEED_STRLEN
2634 static int yy_flex_strlen (yyconst
char * s
, yyscan_t yyscanner
)
2637 for ( n
= 0; s
[n
]; ++n
)
2644 void *glcpp_alloc (yy_size_t size
, yyscan_t yyscanner
)
2646 return (void *) malloc( size
);
2649 void *glcpp_realloc (void * ptr
, yy_size_t size
, yyscan_t yyscanner
)
2651 /* The cast to (char *) in the following accommodates both
2652 * implementations that use char* generic pointers, and those
2653 * that use void* generic pointers. It works with the latter
2654 * because both ANSI C and C++ allow castless assignment from
2655 * any pointer type to void*, and deal with argument conversions
2656 * as though doing an assignment.
2658 return (void *) realloc( (char *) ptr
, size
);
2661 void glcpp_free (void * ptr
, yyscan_t yyscanner
)
2663 free( (char *) ptr
); /* see glcpp_realloc() for (char *) cast */
2666 #define YYTABLES_NAME "yytables"
2668 #line 319 "glcpp/glcpp-lex.l"
2673 glcpp_lex_set_source_string(glcpp_parser_t
*parser
, const char *shader
)
2675 glcpp__scan_string(shader
,parser
->scanner
);