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[125] =
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, 3, 43, 4, 43, 5, 43, 42,
368
43, 18, 43, 18, 43, 18, 43, 39, 40, 32,
369
35, 33, 2, 1, 25, 39, 25, 39, 39, 24,
370
39, 24, 39, 27, 29, 31, 30, 28, 37, 39,
371
37, 39, 34, 40, 23, 23, 3, 4, 5, 6,
372
5, 7, 1, 26, 39, 37, 39, 26, 39, 37,
374
39, 14, 37, 39, 15, 16, 37, 39, 17, 19,
375
12, 22, 36, 37, 39, 21, 19, 13,16404, 11,
379
static yyconst flex_int16_t yy_accept[155] =
381
1, 1, 1, 1, 1, 2, 3, 3, 3, 3,
382
3, 4, 6, 8, 10, 11, 13, 14, 16, 18,
383
20, 23, 26, 28, 30, 32, 35, 38, 40, 42,
384
44, 46, 48, 50, 52, 54, 56, 58, 59, 60,
385
61, 62, 63, 64, 65, 67, 69, 70, 72, 74,
386
75, 76, 77, 78, 79, 81, 83, 84, 85, 86,
387
87, 87, 87, 87, 87, 87, 87, 87, 88, 89,
388
90, 91, 92, 93, 93, 93, 93, 93, 94, 96,
389
98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
390
98, 100, 102, 102, 102, 102, 102, 102, 102, 103,
392
103, 103, 103, 103, 103, 103, 105, 105, 106, 107,
393
107, 107, 107, 107, 107, 107, 107, 107, 107, 109,
394
109, 110, 111, 111, 112, 112, 112, 112, 113, 113,
395
116, 117, 118, 118, 119, 119, 119, 119, 120, 120,
396
120, 121, 121, 122, 123, 123, 123, 123, 124, 124,
400
static yyconst flex_int32_t yy_ec[256] =
402
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
403
4, 4, 4, 1, 1, 1, 1, 1, 1, 1,
404
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
405
1, 2, 5, 1, 6, 1, 7, 8, 1, 9,
406
7, 10, 7, 7, 7, 7, 11, 12, 13, 13,
407
13, 13, 13, 13, 13, 14, 14, 1, 7, 15,
408
16, 17, 1, 1, 18, 18, 18, 18, 18, 18,
409
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
410
19, 19, 19, 19, 20, 19, 19, 21, 19, 19,
411
7, 1, 7, 7, 19, 1, 22, 18, 18, 23,
413
24, 25, 26, 19, 27, 19, 19, 28, 29, 30,
414
31, 32, 19, 33, 34, 35, 36, 37, 19, 38,
415
19, 19, 7, 39, 7, 7, 1, 1, 1, 1,
416
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
417
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
418
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
419
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
420
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
421
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
422
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
425
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
426
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
432
static yyconst flex_int32_t yy_meta[40] =
434
1, 2, 3, 4, 4, 4, 4, 4, 5, 6,
435
4, 7, 7, 7, 4, 4, 4, 8, 8, 8,
436
8, 8, 9, 8, 8, 8, 8, 8, 8, 9,
437
8, 8, 8, 8, 8, 8, 8, 8, 4
440
static yyconst flex_int16_t yy_base[168] =
442
0, 38, 0, 0, 38, 39, 328, 327, 326, 44,
443
328, 0, 325, 332, 332, 310, 319, 332, 316, 41,
444
41, 44, 44, 307, 49, 321, 44, 282, 61, 79,
445
317, 332, 72, 332, 332, 67, 68, 0, 317, 332,
446
332, 332, 332, 0, 34, 0, 105, 0, 0, 332,
447
332, 332, 332, 332, 317, 73, 332, 82, 311, 310,
448
291, 61, 289, 286, 279, 281, 286, 306, 332, 90,
449
332, 94, 332, 84, 85, 108, 48, 0, 88, 95,
450
283, 86, 284, 273, 270, 91, 274, 281, 279, 268,
451
0, 124, 273, 274, 274, 270, 265, 271, 332, 267,
453
264, 262, 259, 260, 249, 125, 245, 332, 332, 241,
454
229, 231, 223, 209, 222, 194, 197, 194, 130, 196,
455
332, 0, 181, 332, 189, 131, 191, 332, 181, 210,
456
162, 0, 136, 332, 134, 0, 130, 155, 111, 138,
457
332, 153, 0, 332, 125, 41, 156, 332, 34, 136,
458
332, 159, 332, 173, 182, 191, 200, 209, 218, 227,
459
236, 245, 254, 263, 272, 280, 285
462
static yyconst flex_int16_t yy_def[168] =
464
153, 1, 154, 154, 155, 155, 156, 156, 157, 157,
465
153, 158, 153, 153, 153, 153, 153, 153, 153, 153,
466
158, 158, 153, 153, 153, 159, 159, 153, 153, 153,
467
160, 153, 161, 153, 153, 153, 153, 158, 153, 153,
468
153, 153, 153, 162, 21, 158, 158, 22, 158, 153,
469
153, 153, 153, 153, 159, 159, 153, 153, 30, 30,
470
153, 153, 153, 153, 153, 153, 153, 160, 153, 161,
471
153, 161, 153, 153, 153, 153, 153, 162, 47, 159,
472
153, 153, 153, 153, 153, 163, 153, 153, 153, 153,
473
158, 159, 153, 153, 153, 153, 153, 153, 153, 153,
475
153, 153, 153, 153, 153, 159, 153, 153, 153, 153,
476
153, 153, 153, 153, 153, 153, 153, 153, 159, 153,
477
153, 164, 153, 153, 153, 153, 153, 153, 153, 159,
478
153, 164, 153, 153, 153, 165, 153, 166, 153, 153,
479
153, 153, 165, 153, 167, 153, 153, 153, 167, 153,
480
153, 153, 0, 153, 153, 153, 153, 153, 153, 153,
481
153, 153, 153, 153, 153, 153, 153
484
static yyconst flex_int16_t yy_nxt[372] =
486
12, 13, 14, 15, 16, 17, 18, 19, 18, 18,
487
20, 21, 22, 22, 23, 24, 25, 26, 26, 26,
488
26, 26, 27, 26, 26, 26, 26, 26, 26, 26,
489
26, 26, 26, 26, 26, 26, 26, 26, 28, 29,
490
32, 32, 148, 30, 38, 36, 14, 33, 33, 37,
491
43, 44, 45, 45, 38, 48, 48, 48, 50, 51,
492
46, 47, 58, 49, 53, 54, 59, 56, 74, 76,
493
136, 38, 75, 38, 71, 82, 46, 83, 47, 49,
494
60, 72, 73, 58, 41, 74, 76, 59, 82, 75,
495
83, 77, 71, 84, 63, 38, 71, 80, 85, 153,
497
153, 61, 62, 72, 73, 63, 64, 91, 77, 76,
498
65, 63, 94, 100, 66, 67, 79, 79, 79, 95,
499
101, 92, 79, 91, 38, 38, 79, 79, 79, 79,
500
38, 77, 126, 148, 63, 140, 141, 150, 151, 140,
501
141, 146, 135, 135, 135, 142, 142, 142, 119, 147,
502
147, 147, 130, 106, 140, 141, 138, 150, 151, 144,
503
150, 151, 139, 138, 142, 142, 142, 152, 152, 152,
504
152, 152, 152, 15, 15, 15, 15, 15, 15, 15,
505
15, 15, 31, 31, 31, 31, 31, 31, 31, 31,
506
31, 34, 34, 34, 34, 34, 34, 34, 34, 34,
508
35, 35, 35, 35, 35, 35, 35, 35, 35, 38,
509
38, 137, 136, 134, 133, 38, 38, 38, 55, 131,
510
129, 128, 127, 126, 55, 55, 55, 68, 68, 68,
511
68, 68, 125, 68, 68, 68, 70, 70, 70, 70,
512
70, 70, 70, 70, 70, 78, 78, 124, 78, 78,
513
78, 78, 78, 78, 99, 99, 99, 99, 99, 99,
514
123, 122, 99, 132, 132, 121, 132, 132, 132, 132,
515
132, 132, 143, 143, 120, 143, 143, 143, 143, 143,
516
143, 145, 118, 117, 116, 115, 114, 145, 145, 149,
517
113, 149, 149, 149, 112, 111, 110, 109, 108, 107,
519
105, 104, 103, 102, 98, 97, 96, 93, 69, 90,
520
89, 88, 87, 86, 81, 153, 153, 38, 39, 69,
521
57, 38, 52, 42, 41, 40, 39, 153, 14, 15,
522
15, 11, 153, 153, 153, 153, 153, 153, 153, 153,
523
153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
524
153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
525
153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
529
static yyconst flex_int16_t yy_chk[372] =
531
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
532
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
533
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
534
1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
535
5, 6, 149, 2, 27, 10, 10, 5, 6, 10,
536
20, 20, 21, 21, 45, 22, 22, 22, 23, 23,
537
21, 21, 29, 22, 25, 25, 29, 27, 36, 37,
538
146, 45, 36, 56, 33, 77, 21, 77, 21, 22,
539
30, 33, 33, 58, 30, 74, 75, 58, 62, 74,
540
62, 37, 70, 62, 37, 80, 72, 56, 62, 70,
542
70, 30, 30, 72, 72, 30, 30, 79, 75, 76,
543
30, 75, 82, 86, 30, 30, 47, 47, 47, 82,
544
86, 80, 47, 79, 92, 106, 47, 47, 47, 47,
545
119, 76, 126, 145, 76, 135, 135, 150, 150, 140,
546
140, 139, 126, 126, 126, 135, 135, 135, 106, 140,
547
140, 140, 119, 92, 142, 142, 138, 147, 147, 137,
548
152, 152, 133, 131, 142, 142, 142, 147, 147, 147,
549
152, 152, 152, 154, 154, 154, 154, 154, 154, 154,
550
154, 154, 155, 155, 155, 155, 155, 155, 155, 155,
551
155, 156, 156, 156, 156, 156, 156, 156, 156, 156,
553
157, 157, 157, 157, 157, 157, 157, 157, 157, 158,
554
130, 129, 127, 125, 123, 158, 158, 158, 159, 120,
555
118, 117, 116, 115, 159, 159, 159, 160, 160, 160,
556
160, 160, 114, 160, 160, 160, 161, 161, 161, 161,
557
161, 161, 161, 161, 161, 162, 162, 113, 162, 162,
558
162, 162, 162, 162, 163, 163, 163, 163, 163, 163,
559
112, 111, 163, 164, 164, 110, 164, 164, 164, 164,
560
164, 164, 165, 165, 107, 165, 165, 165, 165, 165,
561
165, 166, 105, 104, 103, 102, 101, 166, 166, 167,
562
100, 167, 167, 167, 98, 97, 96, 95, 94, 93,
564
90, 89, 88, 87, 85, 84, 83, 81, 68, 67,
565
66, 65, 64, 63, 61, 60, 59, 55, 39, 31,
566
28, 26, 24, 19, 17, 16, 13, 11, 9, 8,
567
7, 153, 153, 153, 153, 153, 153, 153, 153, 153,
568
153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
569
153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
570
153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
574
#define YY_TRAILING_MASK 0x2000
575
#define YY_TRAILING_HEAD_MASK 0x4000
578
*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ \
579
yy_cp = yyg->yy_full_match; /* restore poss. backed-over text */ \
580
yyg->yy_lp = yyg->yy_full_lp; /* restore orig. accepting pos. */ \
581
yyg->yy_state_ptr = yyg->yy_full_state; /* restore orig. state */ \
582
yy_current_state = *yyg->yy_state_ptr; /* restore curr. state */ \
587
#define yymore() yymore_used_but_not_detected
588
#define YY_MORE_ADJ 0
589
#define YY_RESTORE_YY_MORE_OFFSET
590
#line 1 "glcpp/glcpp-lex.l"
591
#line 2 "glcpp/glcpp-lex.l"
593
* Copyright © 2010 Intel Corporation
595
* Permission is hereby granted, free of charge, to any person obtaining a
596
* copy of this software and associated documentation files (the "Software"),
597
* to deal in the Software without restriction, including without limitation
598
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
599
* and/or sell copies of the Software, and to permit persons to whom the
600
* Software is furnished to do so, subject to the following conditions:
602
* The above copyright notice and this permission notice (including the next
603
* paragraph) shall be included in all copies or substantial portions of the
606
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
607
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
608
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
609
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
610
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
611
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
612
* DEALINGS IN THE SOFTWARE.
620
#include "glcpp-parse.h"
622
/* Flex annoyingly generates some functions without making them
623
* static. Let's declare them here. */
624
int glcpp_get_column (yyscan_t yyscanner);
625
void glcpp_set_column (int column_no , yyscan_t yyscanner);
628
#define YY_NO_UNISTD_H
633
#define YY_USER_ACTION \
635
yylloc->first_column = yycolumn + 1; \
636
yylloc->first_line = yylineno; \
637
yycolumn += yyleng; \
640
#define YY_USER_INIT \
644
yylloc->source = 0; \
647
#line 648 "glcpp/glcpp-lex.c"
652
#define UNREACHABLE 3
655
#define YY_EXTRA_TYPE glcpp_parser_t *
657
/* Holds the entire state of the reentrant scanner. */
661
/* User-defined. Not touched by flex. */
662
YY_EXTRA_TYPE yyextra_r;
664
/* The rest are the same as the globals declared in the non-reentrant scanner. */
665
FILE *yyin_r, *yyout_r;
666
size_t yy_buffer_stack_top; /**< index of top of stack. */
667
size_t yy_buffer_stack_max; /**< capacity of stack. */
668
YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
675
int yy_did_buffer_switch_on_eof;
676
int yy_start_stack_ptr;
677
int yy_start_stack_depth;
679
yy_state_type yy_last_accepting_state;
680
char* yy_last_accepting_cpos;
685
yy_state_type *yy_state_buf;
686
yy_state_type *yy_state_ptr;
690
/* These are only needed for trailing context rules,
691
* but there's no conditional variable for that yet. */
692
int yy_looking_for_trail_begin;
704
}; /* end struct yyguts_t */
706
static int yy_init_globals (yyscan_t yyscanner );
708
/* This must go here because YYSTYPE and YYLTYPE are included
709
* from bison output in section 1.*/
710
# define yylval yyg->yylval_r
712
# define yylloc yyg->yylloc_r
714
int glcpp_lex_init (yyscan_t* scanner);
716
int glcpp_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
718
/* Accessor methods to globals.
719
These are made visible to non-reentrant scanners for convenience. */
721
int glcpp_lex_destroy (yyscan_t yyscanner );
723
int glcpp_get_debug (yyscan_t yyscanner );
725
void glcpp_set_debug (int debug_flag ,yyscan_t yyscanner );
727
YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner );
729
void glcpp_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
731
FILE *glcpp_get_in (yyscan_t yyscanner );
733
void glcpp_set_in (FILE * in_str ,yyscan_t yyscanner );
735
FILE *glcpp_get_out (yyscan_t yyscanner );
737
void glcpp_set_out (FILE * out_str ,yyscan_t yyscanner );
739
int glcpp_get_leng (yyscan_t yyscanner );
741
char *glcpp_get_text (yyscan_t yyscanner );
743
int glcpp_get_lineno (yyscan_t yyscanner );
745
void glcpp_set_lineno (int line_number ,yyscan_t yyscanner );
747
int glcpp_get_column (yyscan_t yyscanner );
749
void glcpp_set_column (int column_no ,yyscan_t yyscanner );
751
YYSTYPE * glcpp_get_lval (yyscan_t yyscanner );
753
void glcpp_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
755
YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner );
757
void glcpp_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
759
/* Macros after this point can all be overridden by user definitions in
763
#ifndef YY_SKIP_YYWRAP
765
extern "C" int glcpp_wrap (yyscan_t yyscanner );
767
extern int glcpp_wrap (yyscan_t yyscanner );
771
static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
774
static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
777
#ifdef YY_NEED_STRLEN
778
static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
784
static int yyinput (yyscan_t yyscanner );
786
static int input (yyscan_t yyscanner );
791
static void yy_push_state (int new_state ,yyscan_t yyscanner);
793
static void yy_pop_state (yyscan_t yyscanner );
795
static int yy_top_state (yyscan_t yyscanner );
797
/* Amount of stuff to slurp up with each read. */
798
#ifndef YY_READ_BUF_SIZE
799
#define YY_READ_BUF_SIZE 8192
802
/* Copy whatever the last rule matched to the standard output. */
804
/* This used to be an fputs(), but since the string might contain NUL's,
805
* we now use fwrite().
807
#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
810
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
811
* is returned in "result".
814
#define YY_INPUT(buf,result,max_size) \
815
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
819
for ( n = 0; n < max_size && \
820
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
823
buf[n++] = (char) c; \
824
if ( c == EOF && ferror( yyin ) ) \
825
YY_FATAL_ERROR( "input in flex scanner failed" ); \
831
while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
833
if( errno != EINTR) \
835
YY_FATAL_ERROR( "input in flex scanner failed" ); \
846
/* No semi-colon after return; correct usage is to write "yyterminate();" -
847
* we don't want an extra ';' after the "return" because that will cause
848
* some compilers to complain about unreachable statements.
851
#define yyterminate() return YY_NULL
854
/* Number of entries by which start-condition stack grows. */
855
#ifndef YY_START_STACK_INCR
856
#define YY_START_STACK_INCR 25
859
/* Report a fatal error. */
860
#ifndef YY_FATAL_ERROR
861
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
864
/* end tables serialization structures and prototypes */
866
/* Default declaration of generated scanner - a define so the user can
867
* easily add parameters.
870
#define YY_DECL_IS_OURS 1
872
extern int glcpp_lex \
873
(YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
875
#define YY_DECL int glcpp_lex \
876
(YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
877
#endif /* !YY_DECL */
879
/* Code executed at the beginning of each rule, after yytext and yyleng
882
#ifndef YY_USER_ACTION
883
#define YY_USER_ACTION
886
/* Code executed at the end of each rule. */
888
#define YY_BREAK break;
891
#define YY_RULE_SETUP \
893
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
894
(yytext[yyleng - 1] == '\n'); \
897
/** The main scanner function which does all the work.
901
register yy_state_type yy_current_state;
902
register char *yy_cp, *yy_bp;
904
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
906
#line 80 "glcpp/glcpp-lex.l"
908
/* Implicitly switch between SKIP and INITIAL (non-skipping);
909
* don't switch if some other state was explicitly set.
911
glcpp_parser_t *parser = yyextra;
912
if (YY_START == 0 || YY_START == SKIP) {
913
if (parser->lexing_if || parser->skip_stack == NULL || parser->skip_stack->type == SKIP_NO_SKIP) {
920
/* Single-line comments */
921
#line 922 "glcpp/glcpp-lex.c"
923
yylval = yylval_param;
925
yylloc = yylloc_param;
935
/* Create the reject buffer large enough to save one state per allowed character. */
936
if ( ! yyg->yy_state_buf )
937
yyg->yy_state_buf = (yy_state_type *)glcpp_alloc(YY_STATE_BUF_SIZE ,yyscanner);
938
if ( ! yyg->yy_state_buf )
939
YY_FATAL_ERROR( "out of dynamic memory in glcpp_lex()" );
941
if ( ! yyg->yy_start )
942
yyg->yy_start = 1; /* first start state */
950
if ( ! YY_CURRENT_BUFFER ) {
951
glcpp_ensure_buffer_stack (yyscanner);
952
YY_CURRENT_BUFFER_LVALUE =
953
glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
956
glcpp__load_buffer_state(yyscanner );
959
while ( 1 ) /* loops until end-of-file is reached */
961
yy_cp = yyg->yy_c_buf_p;
963
/* Support of yytext. */
964
*yy_cp = yyg->yy_hold_char;
966
/* yy_bp points to the position in yy_ch_buf of the start of
971
yy_current_state = yyg->yy_start;
972
yy_current_state += YY_AT_BOL();
974
yyg->yy_state_ptr = yyg->yy_state_buf;
975
*yyg->yy_state_ptr++ = yy_current_state;
980
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
981
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
983
yy_current_state = (int) yy_def[yy_current_state];
984
if ( yy_current_state >= 154 )
985
yy_c = yy_meta[(unsigned int) yy_c];
987
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
988
*yyg->yy_state_ptr++ = yy_current_state;
991
while ( yy_current_state != 153 );
994
yy_current_state = *--yyg->yy_state_ptr;
995
yyg->yy_lp = yy_accept[yy_current_state];
996
find_rule: /* we branch to this label when backing up */
997
for ( ; ; ) /* until we find what rule we matched */
999
if ( yyg->yy_lp && yyg->yy_lp < yy_accept[yy_current_state + 1] )
1001
yy_act = yy_acclist[yyg->yy_lp];
1002
if ( yy_act & YY_TRAILING_HEAD_MASK ||
1003
yyg->yy_looking_for_trail_begin )
1005
if ( yy_act == yyg->yy_looking_for_trail_begin )
1007
yyg->yy_looking_for_trail_begin = 0;
1008
yy_act &= ~YY_TRAILING_HEAD_MASK;
1012
else if ( yy_act & YY_TRAILING_MASK )
1014
yyg->yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK;
1015
yyg->yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK;
1019
yyg->yy_full_match = yy_cp;
1020
yyg->yy_full_state = yyg->yy_state_ptr;
1021
yyg->yy_full_lp = yyg->yy_lp;
1028
yy_current_state = *--yyg->yy_state_ptr;
1029
yyg->yy_lp = yy_accept[yy_current_state];
1032
YY_DO_BEFORE_ACTION;
1034
do_action: /* This label is used only to access EOF actions. */
1037
{ /* beginning of action switch */
1040
#line 94 "glcpp/glcpp-lex.l"
1044
/* Multi-line comments */
1047
#line 98 "glcpp/glcpp-lex.l"
1048
{ yy_push_state(COMMENT, yyscanner); }
1052
#line 99 "glcpp/glcpp-lex.l"
1056
/* rule 4 can match eol */
1058
#line 100 "glcpp/glcpp-lex.l"
1059
{ yylineno++; yycolumn = 0; return NEWLINE; }
1063
#line 101 "glcpp/glcpp-lex.l"
1067
/* rule 6 can match eol */
1069
#line 102 "glcpp/glcpp-lex.l"
1070
{ yylineno++; yycolumn = 0; return NEWLINE; }
1074
#line 103 "glcpp/glcpp-lex.l"
1076
yy_pop_state(yyscanner);
1077
if (yyextra->space_tokens)
1083
#line 109 "glcpp/glcpp-lex.l"
1085
yylval->str = ralloc_strdup (yyextra, yytext);
1086
yyextra->space_tokens = 0;
1087
return HASH_VERSION;
1090
/* glcpp doesn't handle #extension, #version, or #pragma directives.
1091
* Simply pass them through to the main compiler's lexer/parser. */
1094
#line 117 "glcpp/glcpp-lex.l"
1096
yylval->str = ralloc_strdup (yyextra, yytext);
1103
*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1104
yyg->yy_c_buf_p = yy_cp -= 1;
1105
YY_DO_BEFORE_ACTION; /* set up yytext again */
1107
#line 124 "glcpp/glcpp-lex.l"
1109
/* Eat characters until the first digit is
1113
while (!isdigit(*ptr))
1116
/* Subtract one from the line number because
1117
* yylineno is zero-based instead of
1120
yylineno = strtol(ptr, &ptr, 0) - 1;
1121
yylloc->source = strtol(ptr, NULL, 0);
1125
*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1126
yyg->yy_c_buf_p = yy_cp -= 1;
1127
YY_DO_BEFORE_ACTION; /* set up yytext again */
1129
#line 140 "glcpp/glcpp-lex.l"
1131
/* Eat characters until the first digit is
1135
while (!isdigit(*ptr))
1138
/* Subtract one from the line number because
1139
* yylineno is zero-based instead of
1142
yylineno = strtol(ptr, &ptr, 0) - 1;
1148
#line 156 "glcpp/glcpp-lex.l"
1150
yyextra->lexing_if = 1;
1151
yyextra->space_tokens = 0;
1157
#line 162 "glcpp/glcpp-lex.l"
1159
yyextra->lexing_if = 1;
1160
yyextra->space_tokens = 0;
1165
/* rule 14 can match eol */
1166
*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1167
yyg->yy_c_buf_p = yy_cp -= 1;
1168
YY_DO_BEFORE_ACTION; /* set up yytext again */
1170
#line 168 "glcpp/glcpp-lex.l"
1172
yyextra->lexing_if = 1;
1173
yyextra->space_tokens = 0;
1179
#line 174 "glcpp/glcpp-lex.l"
1181
yyextra->lexing_if = 1;
1182
yyextra->space_tokens = 0;
1188
#line 180 "glcpp/glcpp-lex.l"
1190
yyextra->space_tokens = 0;
1196
#line 185 "glcpp/glcpp-lex.l"
1198
yyextra->space_tokens = 0;
1205
#line 191 "glcpp/glcpp-lex.l"
1210
#line 193 "glcpp/glcpp-lex.l"
1213
for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */
1214
p += 5; /* skip "error" */
1215
glcpp_error(yylloc, yyextra, "#error%s", p);
1220
#line 200 "glcpp/glcpp-lex.l"
1222
yyextra->space_tokens = 0;
1223
return HASH_DEFINE_FUNC;
1228
#line 205 "glcpp/glcpp-lex.l"
1230
yyextra->space_tokens = 0;
1231
return HASH_DEFINE_OBJ;
1236
#line 210 "glcpp/glcpp-lex.l"
1238
yyextra->space_tokens = 0;
1244
#line 215 "glcpp/glcpp-lex.l"
1246
yyextra->space_tokens = 0;
1252
#line 220 "glcpp/glcpp-lex.l"
1254
yylval->str = ralloc_strdup (yyextra, yytext);
1255
return INTEGER_STRING;
1260
#line 225 "glcpp/glcpp-lex.l"
1262
yylval->str = ralloc_strdup (yyextra, yytext);
1263
return INTEGER_STRING;
1268
#line 230 "glcpp/glcpp-lex.l"
1270
yylval->str = ralloc_strdup (yyextra, yytext);
1271
return INTEGER_STRING;
1276
#line 235 "glcpp/glcpp-lex.l"
1283
#line 239 "glcpp/glcpp-lex.l"
1290
#line 243 "glcpp/glcpp-lex.l"
1292
return LESS_OR_EQUAL;
1297
#line 247 "glcpp/glcpp-lex.l"
1299
return GREATER_OR_EQUAL;
1304
#line 251 "glcpp/glcpp-lex.l"
1311
#line 255 "glcpp/glcpp-lex.l"
1318
#line 259 "glcpp/glcpp-lex.l"
1325
#line 263 "glcpp/glcpp-lex.l"
1332
#line 267 "glcpp/glcpp-lex.l"
1339
#line 271 "glcpp/glcpp-lex.l"
1346
#line 275 "glcpp/glcpp-lex.l"
1348
yylval->str = ralloc_strdup (yyextra, yytext);
1354
#line 280 "glcpp/glcpp-lex.l"
1361
#line 284 "glcpp/glcpp-lex.l"
1363
yylval->str = ralloc_strdup (yyextra, yytext);
1369
#line 289 "glcpp/glcpp-lex.l"
1371
if (yyextra->space_tokens) {
1377
/* rule 41 can match eol */
1379
#line 295 "glcpp/glcpp-lex.l"
1381
yyextra->lexing_if = 0;
1387
/* Handle missing newline at EOF. */
1388
case YY_STATE_EOF(INITIAL):
1389
#line 303 "glcpp/glcpp-lex.l"
1391
BEGIN DONE; /* Don't keep matching this rule forever. */
1392
yyextra->lexing_if = 0;
1396
/* We don't actually use the UNREACHABLE start condition. We
1397
only have this action here so that we can pretend to call some
1398
generated functions, (to avoid "defined but not used"
1402
#line 313 "glcpp/glcpp-lex.l"
1405
yy_top_state(yyextra);
1410
#line 318 "glcpp/glcpp-lex.l"
1413
#line 1414 "glcpp/glcpp-lex.c"
1414
case YY_STATE_EOF(DONE):
1415
case YY_STATE_EOF(COMMENT):
1416
case YY_STATE_EOF(UNREACHABLE):
1417
case YY_STATE_EOF(SKIP):
1420
case YY_END_OF_BUFFER:
1422
/* Amount of text matched not including the EOB char. */
1423
int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1425
/* Undo the effects of YY_DO_BEFORE_ACTION. */
1426
*yy_cp = yyg->yy_hold_char;
1427
YY_RESTORE_YY_MORE_OFFSET
1429
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1431
/* We're scanning a new file or input source. It's
1432
* possible that this happened because the user
1433
* just pointed yyin at a new source and called
1434
* glcpp_lex(). If so, then we have to assure
1435
* consistency between YY_CURRENT_BUFFER and our
1436
* globals. Here is the right place to do so, because
1437
* this is the first action (other than possibly a
1438
* back-up) that will match for the new input source.
1440
yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1441
YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1442
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1445
/* Note that here we test for yy_c_buf_p "<=" to the position
1446
* of the first EOB in the buffer, since yy_c_buf_p will
1447
* already have been incremented past the NUL character
1448
* (since all states make transitions on EOB to the
1449
* end-of-buffer state). Contrast this with the test
1452
if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1453
{ /* This was really a NUL. */
1454
yy_state_type yy_next_state;
1456
yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1458
yy_current_state = yy_get_previous_state( yyscanner );
1460
/* Okay, we're now positioned to make the NUL
1461
* transition. We couldn't have
1462
* yy_get_previous_state() go ahead and do it
1463
* for us because it doesn't know how to deal
1464
* with the possibility of jamming (and we don't
1465
* want to build jamming into it because then it
1466
* will run more slowly).
1469
yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1471
yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1473
if ( yy_next_state )
1475
/* Consume the NUL. */
1476
yy_cp = ++yyg->yy_c_buf_p;
1477
yy_current_state = yy_next_state;
1483
yy_cp = yyg->yy_c_buf_p;
1484
goto yy_find_action;
1488
else switch ( yy_get_next_buffer( yyscanner ) )
1490
case EOB_ACT_END_OF_FILE:
1492
yyg->yy_did_buffer_switch_on_eof = 0;
1494
if ( glcpp_wrap(yyscanner ) )
1496
/* Note: because we've taken care in
1497
* yy_get_next_buffer() to have set up
1498
* yytext, we can now set up
1499
* yy_c_buf_p so that if some total
1500
* hoser (like flex itself) wants to
1501
* call the scanner after we return the
1502
* YY_NULL, it'll still work - another
1503
* YY_NULL will get returned.
1505
yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1507
yy_act = YY_STATE_EOF(YY_START);
1513
if ( ! yyg->yy_did_buffer_switch_on_eof )
1519
case EOB_ACT_CONTINUE_SCAN:
1521
yyg->yytext_ptr + yy_amount_of_matched_text;
1523
yy_current_state = yy_get_previous_state( yyscanner );
1525
yy_cp = yyg->yy_c_buf_p;
1526
yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1529
case EOB_ACT_LAST_MATCH:
1531
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1533
yy_current_state = yy_get_previous_state( yyscanner );
1535
yy_cp = yyg->yy_c_buf_p;
1536
yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1537
goto yy_find_action;
1544
"fatal flex scanner internal error--no action found" );
1545
} /* end of action switch */
1546
} /* end of scanning one token */
1547
} /* end of glcpp_lex */
1549
/* yy_get_next_buffer - try to read in a new buffer
1551
* Returns a code representing an action:
1552
* EOB_ACT_LAST_MATCH -
1553
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1554
* EOB_ACT_END_OF_FILE - end of file
1556
static int yy_get_next_buffer (yyscan_t yyscanner)
1558
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1559
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1560
register char *source = yyg->yytext_ptr;
1561
register int number_to_move, i;
1564
if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1566
"fatal flex scanner internal error--end of buffer missed" );
1568
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1569
{ /* Don't try to fill the buffer, so this is an EOF. */
1570
if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1572
/* We matched a single character, the EOB, so
1573
* treat this as a final EOF.
1575
return EOB_ACT_END_OF_FILE;
1580
/* We matched some text prior to the EOB, first
1583
return EOB_ACT_LAST_MATCH;
1587
/* Try to read more data. */
1589
/* First move last chars to start of buffer. */
1590
number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
1592
for ( i = 0; i < number_to_move; ++i )
1593
*(dest++) = *(source++);
1595
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1596
/* don't do the read, it's not guaranteed to return an EOF,
1599
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1604
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1606
while ( num_to_read <= 0 )
1607
{ /* Not enough room in the buffer - grow it. */
1610
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1614
if ( num_to_read > YY_READ_BUF_SIZE )
1615
num_to_read = YY_READ_BUF_SIZE;
1617
/* Read in more data. */
1618
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1619
yyg->yy_n_chars, (size_t) num_to_read );
1621
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1624
if ( yyg->yy_n_chars == 0 )
1626
if ( number_to_move == YY_MORE_ADJ )
1628
ret_val = EOB_ACT_END_OF_FILE;
1629
glcpp_restart(yyin ,yyscanner);
1634
ret_val = EOB_ACT_LAST_MATCH;
1635
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1636
YY_BUFFER_EOF_PENDING;
1641
ret_val = EOB_ACT_CONTINUE_SCAN;
1643
if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1644
/* Extend the array by 50%, plus the number we really need. */
1645
yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1646
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) glcpp_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1647
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1648
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1651
yyg->yy_n_chars += number_to_move;
1652
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1653
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1655
yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1660
/* yy_get_previous_state - get the state just before the EOB char was reached */
1662
static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1664
register yy_state_type yy_current_state;
1665
register char *yy_cp;
1666
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1668
yy_current_state = yyg->yy_start;
1669
yy_current_state += YY_AT_BOL();
1671
yyg->yy_state_ptr = yyg->yy_state_buf;
1672
*yyg->yy_state_ptr++ = yy_current_state;
1674
for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1676
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1677
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1679
yy_current_state = (int) yy_def[yy_current_state];
1680
if ( yy_current_state >= 154 )
1681
yy_c = yy_meta[(unsigned int) yy_c];
1683
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1684
*yyg->yy_state_ptr++ = yy_current_state;
1687
return yy_current_state;
1690
/* yy_try_NUL_trans - try to make a transition on the NUL character
1693
* next_state = yy_try_NUL_trans( current_state );
1695
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
1697
register int yy_is_jam;
1698
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1700
register YY_CHAR yy_c = 1;
1701
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1703
yy_current_state = (int) yy_def[yy_current_state];
1704
if ( yy_current_state >= 154 )
1705
yy_c = yy_meta[(unsigned int) yy_c];
1707
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1708
yy_is_jam = (yy_current_state == 153);
1710
*yyg->yy_state_ptr++ = yy_current_state;
1712
return yy_is_jam ? 0 : yy_current_state;
1715
static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
1717
register char *yy_cp;
1718
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1720
yy_cp = yyg->yy_c_buf_p;
1722
/* undo effects of setting up yytext */
1723
*yy_cp = yyg->yy_hold_char;
1725
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1726
{ /* need to shift things up to make room */
1727
/* +2 for EOB chars. */
1728
register int number_to_move = yyg->yy_n_chars + 2;
1729
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1730
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1731
register char *source =
1732
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1734
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1735
*--dest = *--source;
1737
yy_cp += (int) (dest - source);
1738
yy_bp += (int) (dest - source);
1739
YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1740
yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1742
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1743
YY_FATAL_ERROR( "flex scanner push-back overflow" );
1746
*--yy_cp = (char) c;
1748
yyg->yytext_ptr = yy_bp;
1749
yyg->yy_hold_char = *yy_cp;
1750
yyg->yy_c_buf_p = yy_cp;
1755
static int yyinput (yyscan_t yyscanner)
1757
static int input (yyscan_t yyscanner)
1762
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1764
*yyg->yy_c_buf_p = yyg->yy_hold_char;
1766
if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1768
/* yy_c_buf_p now points to the character we want to return.
1769
* If this occurs *before* the EOB characters, then it's a
1770
* valid NUL; if not, then we've hit the end of the buffer.
1772
if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1773
/* This was really a NUL. */
1774
*yyg->yy_c_buf_p = '\0';
1777
{ /* need more input */
1778
int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1781
switch ( yy_get_next_buffer( yyscanner ) )
1783
case EOB_ACT_LAST_MATCH:
1784
/* This happens because yy_g_n_b()
1785
* sees that we've accumulated a
1786
* token and flags that we need to
1787
* try matching the token before
1788
* proceeding. But for input(),
1789
* there's no matching to consider.
1790
* So convert the EOB_ACT_LAST_MATCH
1791
* to EOB_ACT_END_OF_FILE.
1794
/* Reset buffer status. */
1795
glcpp_restart(yyin ,yyscanner);
1799
case EOB_ACT_END_OF_FILE:
1801
if ( glcpp_wrap(yyscanner ) )
1804
if ( ! yyg->yy_did_buffer_switch_on_eof )
1807
return yyinput(yyscanner);
1809
return input(yyscanner);
1813
case EOB_ACT_CONTINUE_SCAN:
1814
yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1820
c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1821
*yyg->yy_c_buf_p = '\0'; /* preserve yytext */
1822
yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1824
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1828
#endif /* ifndef YY_NO_INPUT */
1830
/** Immediately switch to a different input stream.
1831
* @param input_file A readable stream.
1832
* @param yyscanner The scanner object.
1833
* @note This function does not reset the start condition to @c INITIAL .
1835
void glcpp_restart (FILE * input_file , yyscan_t yyscanner)
1837
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1839
if ( ! YY_CURRENT_BUFFER ){
1840
glcpp_ensure_buffer_stack (yyscanner);
1841
YY_CURRENT_BUFFER_LVALUE =
1842
glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1845
glcpp__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1846
glcpp__load_buffer_state(yyscanner );
1849
/** Switch to a different input buffer.
1850
* @param new_buffer The new input buffer.
1851
* @param yyscanner The scanner object.
1853
void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1855
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1857
/* TODO. We should be able to replace this entire function body
1859
* glcpp_pop_buffer_state();
1860
* glcpp_push_buffer_state(new_buffer);
1862
glcpp_ensure_buffer_stack (yyscanner);
1863
if ( YY_CURRENT_BUFFER == new_buffer )
1866
if ( YY_CURRENT_BUFFER )
1868
/* Flush out information for old buffer. */
1869
*yyg->yy_c_buf_p = yyg->yy_hold_char;
1870
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1871
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1874
YY_CURRENT_BUFFER_LVALUE = new_buffer;
1875
glcpp__load_buffer_state(yyscanner );
1877
/* We don't actually know whether we did this switch during
1878
* EOF (glcpp_wrap()) processing, but the only time this flag
1879
* is looked at is after glcpp_wrap() is called, so it's safe
1880
* to go ahead and always set it.
1882
yyg->yy_did_buffer_switch_on_eof = 1;
1885
static void glcpp__load_buffer_state (yyscan_t yyscanner)
1887
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1888
yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1889
yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1890
yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1891
yyg->yy_hold_char = *yyg->yy_c_buf_p;
1894
/** Allocate and initialize an input buffer state.
1895
* @param file A readable stream.
1896
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1897
* @param yyscanner The scanner object.
1898
* @return the allocated buffer state.
1900
YY_BUFFER_STATE glcpp__create_buffer (FILE * file, int size , yyscan_t yyscanner)
1904
b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1906
YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
1908
b->yy_buf_size = size;
1910
/* yy_ch_buf has to be 2 characters longer than the size given because
1911
* we need to put in 2 end-of-buffer characters.
1913
b->yy_ch_buf = (char *) glcpp_alloc(b->yy_buf_size + 2 ,yyscanner );
1914
if ( ! b->yy_ch_buf )
1915
YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
1917
b->yy_is_our_buffer = 1;
1919
glcpp__init_buffer(b,file ,yyscanner);
1924
/** Destroy the buffer.
1925
* @param b a buffer created with glcpp__create_buffer()
1926
* @param yyscanner The scanner object.
1928
void glcpp__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1930
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1935
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1936
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1938
if ( b->yy_is_our_buffer )
1939
glcpp_free((void *) b->yy_ch_buf ,yyscanner );
1941
glcpp_free((void *) b ,yyscanner );
1944
/* Initializes or reinitializes a buffer.
1945
* This function is sometimes called more than once on the same buffer,
1946
* such as during a glcpp_restart() or at EOF.
1948
static void glcpp__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
1952
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1954
glcpp__flush_buffer(b ,yyscanner);
1956
b->yy_input_file = file;
1957
b->yy_fill_buffer = 1;
1959
/* If b is the current buffer, then glcpp__init_buffer was _probably_
1960
* called from glcpp_restart() or through yy_get_next_buffer.
1961
* In that case, we don't want to reset the lineno or column.
1963
if (b != YY_CURRENT_BUFFER){
1964
b->yy_bs_lineno = 1;
1965
b->yy_bs_column = 0;
1968
b->yy_is_interactive = 0;
1973
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1974
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1975
* @param yyscanner The scanner object.
1977
void glcpp__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1979
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1985
/* We always need two end-of-buffer characters. The first causes
1986
* a transition to the end-of-buffer state. The second causes
1987
* a jam in that state.
1989
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1990
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1992
b->yy_buf_pos = &b->yy_ch_buf[0];
1995
b->yy_buffer_status = YY_BUFFER_NEW;
1997
if ( b == YY_CURRENT_BUFFER )
1998
glcpp__load_buffer_state(yyscanner );
2001
/** Pushes the new state onto the stack. The new state becomes
2002
* the current state. This function will allocate the stack
2004
* @param new_buffer The new state.
2005
* @param yyscanner The scanner object.
2007
void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
2009
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2010
if (new_buffer == NULL)
2013
glcpp_ensure_buffer_stack(yyscanner);
2015
/* This block is copied from glcpp__switch_to_buffer. */
2016
if ( YY_CURRENT_BUFFER )
2018
/* Flush out information for old buffer. */
2019
*yyg->yy_c_buf_p = yyg->yy_hold_char;
2020
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2021
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2024
/* Only push if top exists. Otherwise, replace top. */
2025
if (YY_CURRENT_BUFFER)
2026
yyg->yy_buffer_stack_top++;
2027
YY_CURRENT_BUFFER_LVALUE = new_buffer;
2029
/* copied from glcpp__switch_to_buffer. */
2030
glcpp__load_buffer_state(yyscanner );
2031
yyg->yy_did_buffer_switch_on_eof = 1;
2034
/** Removes and deletes the top of the stack, if present.
2035
* The next element becomes the new top.
2036
* @param yyscanner The scanner object.
2038
void glcpp_pop_buffer_state (yyscan_t yyscanner)
2040
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2041
if (!YY_CURRENT_BUFFER)
2044
glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
2045
YY_CURRENT_BUFFER_LVALUE = NULL;
2046
if (yyg->yy_buffer_stack_top > 0)
2047
--yyg->yy_buffer_stack_top;
2049
if (YY_CURRENT_BUFFER) {
2050
glcpp__load_buffer_state(yyscanner );
2051
yyg->yy_did_buffer_switch_on_eof = 1;
2055
/* Allocates the stack if it does not exist.
2056
* Guarantees space for at least one push.
2058
static void glcpp_ensure_buffer_stack (yyscan_t yyscanner)
2061
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2063
if (!yyg->yy_buffer_stack) {
2065
/* First allocation is just for 2 elements, since we don't know if this
2066
* scanner will even need a stack. We use 2 instead of 1 to avoid an
2067
* immediate realloc on the next call.
2070
yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_alloc
2071
(num_to_alloc * sizeof(struct yy_buffer_state*)
2073
if ( ! yyg->yy_buffer_stack )
2074
YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
2076
memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2078
yyg->yy_buffer_stack_max = num_to_alloc;
2079
yyg->yy_buffer_stack_top = 0;
2083
if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2085
/* Increase the buffer to prepare for a possible push. */
2086
int grow_size = 8 /* arbitrary grow size */;
2088
num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
2089
yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_realloc
2090
(yyg->yy_buffer_stack,
2091
num_to_alloc * sizeof(struct yy_buffer_state*)
2093
if ( ! yyg->yy_buffer_stack )
2094
YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
2096
/* zero only the new slots.*/
2097
memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
2098
yyg->yy_buffer_stack_max = num_to_alloc;
2102
/** Setup the input buffer state to scan directly from a user-specified character buffer.
2103
* @param base the character buffer
2104
* @param size the size in bytes of the character buffer
2105
* @param yyscanner The scanner object.
2106
* @return the newly allocated buffer state object.
2108
YY_BUFFER_STATE glcpp__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
2113
base[size-2] != YY_END_OF_BUFFER_CHAR ||
2114
base[size-1] != YY_END_OF_BUFFER_CHAR )
2115
/* They forgot to leave room for the EOB's. */
2118
b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
2120
YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_buffer()" );
2122
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2123
b->yy_buf_pos = b->yy_ch_buf = base;
2124
b->yy_is_our_buffer = 0;
2125
b->yy_input_file = 0;
2126
b->yy_n_chars = b->yy_buf_size;
2127
b->yy_is_interactive = 0;
2129
b->yy_fill_buffer = 0;
2130
b->yy_buffer_status = YY_BUFFER_NEW;
2132
glcpp__switch_to_buffer(b ,yyscanner );
2137
/** Setup the input buffer state to scan a string. The next call to glcpp_lex() will
2138
* scan from a @e copy of @a str.
2139
* @param yystr a NUL-terminated string to scan
2140
* @param yyscanner The scanner object.
2141
* @return the newly allocated buffer state object.
2142
* @note If you want to scan bytes that may contain NUL values, then use
2143
* glcpp__scan_bytes() instead.
2145
YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner)
2148
return glcpp__scan_bytes(yystr,strlen(yystr) ,yyscanner);
2151
/** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will
2152
* scan from a @e copy of @a bytes.
2153
* @param bytes the byte buffer to scan
2154
* @param len the number of bytes in the buffer pointed to by @a bytes.
2155
* @param yyscanner The scanner object.
2156
* @return the newly allocated buffer state object.
2158
YY_BUFFER_STATE glcpp__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
2165
/* Get memory for full buffer, including space for trailing EOB's. */
2166
n = _yybytes_len + 2;
2167
buf = (char *) glcpp_alloc(n ,yyscanner );
2169
YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_bytes()" );
2171
for ( i = 0; i < _yybytes_len; ++i )
2172
buf[i] = yybytes[i];
2174
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2176
b = glcpp__scan_buffer(buf,n ,yyscanner);
2178
YY_FATAL_ERROR( "bad buffer in glcpp__scan_bytes()" );
2180
/* It's okay to grow etc. this buffer, and we should throw it
2181
* away when we're done.
2183
b->yy_is_our_buffer = 1;
2188
static void yy_push_state (int new_state , yyscan_t yyscanner)
2190
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2191
if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth )
2195
yyg->yy_start_stack_depth += YY_START_STACK_INCR;
2196
new_size = yyg->yy_start_stack_depth * sizeof( int );
2198
if ( ! yyg->yy_start_stack )
2199
yyg->yy_start_stack = (int *) glcpp_alloc(new_size ,yyscanner );
2202
yyg->yy_start_stack = (int *) glcpp_realloc((void *) yyg->yy_start_stack,new_size ,yyscanner );
2204
if ( ! yyg->yy_start_stack )
2205
YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2208
yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START;
2213
static void yy_pop_state (yyscan_t yyscanner)
2215
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2216
if ( --yyg->yy_start_stack_ptr < 0 )
2217
YY_FATAL_ERROR( "start-condition stack underflow" );
2219
BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]);
2222
static int yy_top_state (yyscan_t yyscanner)
2224
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2225
return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1];
2228
#ifndef YY_EXIT_FAILURE
2229
#define YY_EXIT_FAILURE 2
2232
static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
2234
(void) fprintf( stderr, "%s\n", msg );
2235
exit( YY_EXIT_FAILURE );
2238
/* Redefine yyless() so it works in section 3 code. */
2244
/* Undo effects of setting up yytext. */ \
2245
int yyless_macro_arg = (n); \
2246
YY_LESS_LINENO(yyless_macro_arg);\
2247
yytext[yyleng] = yyg->yy_hold_char; \
2248
yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2249
yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2250
*yyg->yy_c_buf_p = '\0'; \
2251
yyleng = yyless_macro_arg; \
2255
/* Accessor methods (get/set functions) to struct members. */
2257
/** Get the user-defined data for this scanner.
2258
* @param yyscanner The scanner object.
2260
YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner)
2262
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2266
/** Get the current line number.
2267
* @param yyscanner The scanner object.
2269
int glcpp_get_lineno (yyscan_t yyscanner)
2271
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2273
if (! YY_CURRENT_BUFFER)
2279
/** Get the current column number.
2280
* @param yyscanner The scanner object.
2282
int glcpp_get_column (yyscan_t yyscanner)
2284
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2286
if (! YY_CURRENT_BUFFER)
2292
/** Get the input stream.
2293
* @param yyscanner The scanner object.
2295
FILE *glcpp_get_in (yyscan_t yyscanner)
2297
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2301
/** Get the output stream.
2302
* @param yyscanner The scanner object.
2304
FILE *glcpp_get_out (yyscan_t yyscanner)
2306
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2310
/** Get the length of the current token.
2311
* @param yyscanner The scanner object.
2313
int glcpp_get_leng (yyscan_t yyscanner)
2315
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2319
/** Get the current token.
2320
* @param yyscanner The scanner object.
2323
char *glcpp_get_text (yyscan_t yyscanner)
2325
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2329
/** Set the user-defined data. This data is never touched by the scanner.
2330
* @param user_defined The data to be associated with this scanner.
2331
* @param yyscanner The scanner object.
2333
void glcpp_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
2335
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2336
yyextra = user_defined ;
2339
/** Set the current line number.
2340
* @param line_number
2341
* @param yyscanner The scanner object.
2343
void glcpp_set_lineno (int line_number , yyscan_t yyscanner)
2345
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2347
/* lineno is only valid if an input buffer exists. */
2348
if (! YY_CURRENT_BUFFER )
2349
yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner);
2351
yylineno = line_number;
2354
/** Set the current column.
2355
* @param line_number
2356
* @param yyscanner The scanner object.
2358
void glcpp_set_column (int column_no , yyscan_t yyscanner)
2360
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2362
/* column is only valid if an input buffer exists. */
2363
if (! YY_CURRENT_BUFFER )
2364
yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner);
2366
yycolumn = column_no;
2369
/** Set the input stream. This does not discard the current
2371
* @param in_str A readable stream.
2372
* @param yyscanner The scanner object.
2373
* @see glcpp__switch_to_buffer
2375
void glcpp_set_in (FILE * in_str , yyscan_t yyscanner)
2377
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2381
void glcpp_set_out (FILE * out_str , yyscan_t yyscanner)
2383
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2387
int glcpp_get_debug (yyscan_t yyscanner)
2389
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2390
return yy_flex_debug;
2393
void glcpp_set_debug (int bdebug , yyscan_t yyscanner)
2395
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2396
yy_flex_debug = bdebug ;
2399
/* Accessor methods for yylval and yylloc */
2401
YYSTYPE * glcpp_get_lval (yyscan_t yyscanner)
2403
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2407
void glcpp_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
2409
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2410
yylval = yylval_param;
2413
YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner)
2415
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2419
void glcpp_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
2421
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2422
yylloc = yylloc_param;
2425
/* User-visible API */
2427
/* glcpp_lex_init is special because it creates the scanner itself, so it is
2428
* the ONLY reentrant function that doesn't take the scanner as the last argument.
2429
* That's why we explicitly handle the declaration, instead of using our macros.
2432
int glcpp_lex_init(yyscan_t* ptr_yy_globals)
2435
if (ptr_yy_globals == NULL){
2440
*ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), NULL );
2442
if (*ptr_yy_globals == NULL){
2447
/* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2448
memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2450
return yy_init_globals ( *ptr_yy_globals );
2453
/* glcpp_lex_init_extra has the same functionality as glcpp_lex_init, but follows the
2454
* convention of taking the scanner as the last argument. Note however, that
2455
* this is a *pointer* to a scanner, as it will be allocated by this call (and
2456
* is the reason, too, why this function also must handle its own declaration).
2457
* The user defined value in the first argument will be available to glcpp_alloc in
2458
* the yyextra field.
2461
int glcpp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
2464
struct yyguts_t dummy_yyguts;
2466
glcpp_set_extra (yy_user_defined, &dummy_yyguts);
2468
if (ptr_yy_globals == NULL){
2473
*ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2475
if (*ptr_yy_globals == NULL){
2480
/* By setting to 0xAA, we expose bugs in
2481
yy_init_globals. Leave at 0x00 for releases. */
2482
memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2484
glcpp_set_extra (yy_user_defined, *ptr_yy_globals);
2486
return yy_init_globals ( *ptr_yy_globals );
2489
static int yy_init_globals (yyscan_t yyscanner)
2491
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2492
/* Initialization is the same as for the non-reentrant scanner.
2493
* This function is called from glcpp_lex_destroy(), so don't allocate here.
2496
yyg->yy_buffer_stack = 0;
2497
yyg->yy_buffer_stack_top = 0;
2498
yyg->yy_buffer_stack_max = 0;
2499
yyg->yy_c_buf_p = (char *) 0;
2503
yyg->yy_start_stack_ptr = 0;
2504
yyg->yy_start_stack_depth = 0;
2505
yyg->yy_start_stack = NULL;
2507
yyg->yy_state_buf = 0;
2508
yyg->yy_state_ptr = 0;
2509
yyg->yy_full_match = 0;
2512
/* Defined in main.c */
2521
/* For future reference: Set errno on error, since we are called by
2527
/* glcpp_lex_destroy is for both reentrant and non-reentrant scanners. */
2528
int glcpp_lex_destroy (yyscan_t yyscanner)
2530
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2532
/* Pop the buffer stack, destroying each element. */
2533
while(YY_CURRENT_BUFFER){
2534
glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
2535
YY_CURRENT_BUFFER_LVALUE = NULL;
2536
glcpp_pop_buffer_state(yyscanner);
2539
/* Destroy the stack itself. */
2540
glcpp_free(yyg->yy_buffer_stack ,yyscanner);
2541
yyg->yy_buffer_stack = NULL;
2543
/* Destroy the start condition stack. */
2544
glcpp_free(yyg->yy_start_stack ,yyscanner );
2545
yyg->yy_start_stack = NULL;
2547
glcpp_free ( yyg->yy_state_buf , yyscanner);
2548
yyg->yy_state_buf = NULL;
2550
/* Reset the globals. This is important in a non-reentrant scanner so the next time
2551
* glcpp_lex() is called, initialization will occur. */
2552
yy_init_globals( yyscanner);
2554
/* Destroy the main struct (reentrant only). */
2555
glcpp_free ( yyscanner , yyscanner );
2561
* Internal utility routines.
2565
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2568
for ( i = 0; i < n; ++i )
2573
#ifdef YY_NEED_STRLEN
2574
static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2577
for ( n = 0; s[n]; ++n )
2584
void *glcpp_alloc (yy_size_t size , yyscan_t yyscanner)
2586
return (void *) malloc( size );
2589
void *glcpp_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
2591
/* The cast to (char *) in the following accommodates both
2592
* implementations that use char* generic pointers, and those
2593
* that use void* generic pointers. It works with the latter
2594
* because both ANSI C and C++ allow castless assignment from
2595
* any pointer type to void*, and deal with argument conversions
2596
* as though doing an assignment.
2598
return (void *) realloc( (char *) ptr, size );
2601
void glcpp_free (void * ptr , yyscan_t yyscanner)
2603
free( (char *) ptr ); /* see glcpp_realloc() for (char *) cast */
2606
#define YYTABLES_NAME "yytables"
2608
#line 318 "glcpp/glcpp-lex.l"
2613
glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader)
2615
glcpp__scan_string(shader,parser->scanner);