Convert everything from the talloc API to the ralloc API.
[mesa.git] / src / glsl / glcpp / glcpp-lex.c
1 #line 2 "glcpp/glcpp-lex.c"
2
3 #line 4 "glcpp/glcpp-lex.c"
4
5 #define YY_INT_ALIGNED short int
6
7 /* A lexical scanner generated by flex */
8
9 #define FLEX_SCANNER
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
14 #define FLEX_BETA
15 #endif
16
17 /* First, we deal with platform-specific or compiler-specific issues. */
18
19 /* begin standard C headers. */
20 #include <stdio.h>
21 #include <string.h>
22 #include <errno.h>
23 #include <stdlib.h>
24
25 /* end standard C headers. */
26
27 /* flex integer type definitions */
28
29 #ifndef FLEXINT_H
30 #define FLEXINT_H
31
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
38 */
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
41 #endif
42
43 #include <inttypes.h>
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;
50 #else
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;
57 #endif /* ! C99 */
58
59 /* Limits of integral types. */
60 #ifndef INT8_MIN
61 #define INT8_MIN (-128)
62 #endif
63 #ifndef INT16_MIN
64 #define INT16_MIN (-32767-1)
65 #endif
66 #ifndef INT32_MIN
67 #define INT32_MIN (-2147483647-1)
68 #endif
69 #ifndef INT8_MAX
70 #define INT8_MAX (127)
71 #endif
72 #ifndef INT16_MAX
73 #define INT16_MAX (32767)
74 #endif
75 #ifndef INT32_MAX
76 #define INT32_MAX (2147483647)
77 #endif
78 #ifndef UINT8_MAX
79 #define UINT8_MAX (255U)
80 #endif
81 #ifndef UINT16_MAX
82 #define UINT16_MAX (65535U)
83 #endif
84 #ifndef UINT32_MAX
85 #define UINT32_MAX (4294967295U)
86 #endif
87
88 #endif /* ! FLEXINT_H */
89
90 #ifdef __cplusplus
91
92 /* The "const" storage-class-modifier is valid. */
93 #define YY_USE_CONST
94
95 #else /* ! __cplusplus */
96
97 /* C99 requires __STDC__ to be defined as 1. */
98 #if defined (__STDC__)
99
100 #define YY_USE_CONST
101
102 #endif /* defined (__STDC__) */
103 #endif /* ! __cplusplus */
104
105 #ifdef YY_USE_CONST
106 #define yyconst const
107 #else
108 #define yyconst
109 #endif
110
111 /* Returned upon end-of-file. */
112 #define YY_NULL 0
113
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
117 * double cast.
118 */
119 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
120
121 /* An opaque pointer. */
122 #ifndef YY_TYPEDEF_YY_SCANNER_T
123 #define YY_TYPEDEF_YY_SCANNER_T
124 typedef void* yyscan_t;
125 #endif
126
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
137
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.
141 */
142 #define BEGIN yyg->yy_start = 1 + 2 *
143
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
146 * compatibility.
147 */
148 #define YY_START ((yyg->yy_start - 1) / 2)
149 #define YYSTATE YY_START
150
151 /* Action number for EOF rule of a given start state. */
152 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
153
154 /* Special action meaning "start processing a new file". */
155 #define YY_NEW_FILE glcpp_restart(yyin ,yyscanner )
156
157 #define YY_END_OF_BUFFER_CHAR 0
158
159 /* Size of default input buffer. */
160 #ifndef YY_BUF_SIZE
161 #define YY_BUF_SIZE 16384
162 #endif
163
164 /* The state buf must be large enough to hold one state per character in the main buffer.
165 */
166 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
167
168 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
169 #define YY_TYPEDEF_YY_BUFFER_STATE
170 typedef struct yy_buffer_state *YY_BUFFER_STATE;
171 #endif
172
173 #define EOB_ACT_CONTINUE_SCAN 0
174 #define EOB_ACT_END_OF_FILE 1
175 #define EOB_ACT_LAST_MATCH 2
176
177 #define YY_LESS_LINENO(n)
178
179 /* Return all but the first "n" matched characters back to the input stream. */
180 #define yyless(n) \
181 do \
182 { \
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 */ \
190 } \
191 while ( 0 )
192
193 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
194
195 #ifndef YY_TYPEDEF_YY_SIZE_T
196 #define YY_TYPEDEF_YY_SIZE_T
197 typedef size_t yy_size_t;
198 #endif
199
200 #ifndef YY_STRUCT_YY_BUFFER_STATE
201 #define YY_STRUCT_YY_BUFFER_STATE
202 struct yy_buffer_state
203 {
204 FILE *yy_input_file;
205
206 char *yy_ch_buf; /* input buffer */
207 char *yy_buf_pos; /* current position in input buffer */
208
209 /* Size of input buffer in bytes, not including room for EOB
210 * characters.
211 */
212 yy_size_t yy_buf_size;
213
214 /* Number of characters read into yy_ch_buf, not including EOB
215 * characters.
216 */
217 int yy_n_chars;
218
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
221 * delete it.
222 */
223 int yy_is_our_buffer;
224
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
228 * each newline.
229 */
230 int yy_is_interactive;
231
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
234 * not.
235 */
236 int yy_at_bol;
237
238 int yy_bs_lineno; /**< The line count. */
239 int yy_bs_column; /**< The column count. */
240
241 /* Whether to try to fill the input buffer when we reach the
242 * end of it.
243 */
244 int yy_fill_buffer;
245
246 int yy_buffer_status;
247
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.
255 *
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.
259 */
260 #define YY_BUFFER_EOF_PENDING 2
261
262 };
263 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
264
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
267 * "scanner state".
268 *
269 * Returns the top of the stack, or NULL.
270 */
271 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
272 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
273 : NULL)
274
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.
277 */
278 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
279
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 );
287
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 );
291
292 #define YY_FLUSH_BUFFER glcpp__flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
293
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 );
297
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 );
301
302 #define yy_new_buffer glcpp__create_buffer
303
304 #define yy_set_interactive(is_interactive) \
305 { \
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); \
310 } \
311 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
312 }
313
314 #define yy_set_bol(at_bol) \
315 { \
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); \
320 } \
321 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
322 }
323
324 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
325
326 /* Begin user sect3 */
327
328 #define glcpp_wrap(n) 1
329 #define YY_SKIP_YYWRAP
330
331 typedef unsigned char YY_CHAR;
332
333 typedef int yy_state_type;
334
335 #define yytext_ptr yytext_r
336
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 );
341
342 /* Done after the current pattern has been matched and before the
343 * corresponding action - sets up yytext.
344 */
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; \
349 *yy_cp = '\0'; \
350 yyg->yy_c_buf_p = yy_cp;
351
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. */
356 struct yy_trans_info
357 {
358 flex_int32_t yy_verify;
359 flex_int32_t yy_nxt;
360 };
361 static yyconst flex_int16_t yy_acclist[137] =
362 { 0,
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,
373
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
378 } ;
379
380 static yyconst flex_int16_t yy_accept[164] =
381 { 0,
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,
392
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,
399 137, 137, 137
400 } ;
401
402 static yyconst flex_int32_t yy_ec[256] =
403 { 0,
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,
414
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,
425
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,
431 1, 1, 1, 1, 1
432 } ;
433
434 static yyconst flex_int32_t yy_meta[40] =
435 { 0,
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
440 } ;
441
442 static yyconst flex_int16_t yy_base[182] =
443 { 0,
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,
454
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,
463 549
464 } ;
465
466 static yyconst flex_int16_t yy_def[182] =
467 { 0,
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,
478
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,
487 162
488 } ;
489
490 static yyconst flex_int16_t yy_nxt[592] =
491 { 0,
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,
502
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,
513
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,
524
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,
535
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,
546
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,
556 162
557
558 } ;
559
560 static yyconst flex_int16_t yy_chk[592] =
561 { 0,
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,
572
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,
583
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,
594
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,
605
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,
616
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,
626 162
627
628 } ;
629
630 #define YY_TRAILING_MASK 0x2000
631 #define YY_TRAILING_HEAD_MASK 0x4000
632 #define REJECT \
633 { \
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 */ \
639 ++yyg->yy_lp; \
640 goto find_rule; \
641 }
642
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"
648 /*
649 * Copyright © 2010 Intel Corporation
650 *
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:
657 *
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
660 * Software.
661 *
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.
669 */
670
671 #include <stdio.h>
672 #include <string.h>
673 #include <ctype.h>
674
675 #include "glcpp.h"
676 #include "glcpp-parse.h"
677
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);
682
683 #define YY_NO_INPUT
684
685 #define YY_USER_ACTION \
686 do { \
687 yylloc->first_column = yycolumn + 1; \
688 yylloc->first_line = yylineno; \
689 yycolumn += yyleng; \
690 } while(0);
691
692 #define YY_USER_INIT \
693 do { \
694 yylineno = 1; \
695 yycolumn = 1; \
696 yylloc->source = 0; \
697 } while(0)
698
699 #line 700 "glcpp/glcpp-lex.c"
700
701 #define INITIAL 0
702 #define DONE 1
703 #define COMMENT 2
704 #define UNREACHABLE 3
705
706 #define YY_EXTRA_TYPE glcpp_parser_t *
707
708 /* Holds the entire state of the reentrant scanner. */
709 struct yyguts_t
710 {
711
712 /* User-defined. Not touched by flex. */
713 YY_EXTRA_TYPE yyextra_r;
714
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. */
720 char yy_hold_char;
721 int yy_n_chars;
722 int yyleng_r;
723 char *yy_c_buf_p;
724 int yy_init;
725 int yy_start;
726 int yy_did_buffer_switch_on_eof;
727 int yy_start_stack_ptr;
728 int yy_start_stack_depth;
729 int *yy_start_stack;
730 yy_state_type yy_last_accepting_state;
731 char* yy_last_accepting_cpos;
732
733 int yylineno_r;
734 int yy_flex_debug_r;
735
736 yy_state_type *yy_state_buf;
737 yy_state_type *yy_state_ptr;
738 char *yy_full_match;
739 int yy_lp;
740
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;
744 int yy_full_lp;
745 int *yy_full_state;
746
747 char *yytext_r;
748 int yy_more_flag;
749 int yy_more_len;
750
751 YYSTYPE * yylval_r;
752
753 YYLTYPE * yylloc_r;
754
755 }; /* end struct yyguts_t */
756
757 static int yy_init_globals (yyscan_t yyscanner );
758
759 /* This must go here because YYSTYPE and YYLTYPE are included
760 * from bison output in section 1.*/
761 # define yylval yyg->yylval_r
762
763 # define yylloc yyg->yylloc_r
764
765 int glcpp_lex_init (yyscan_t* scanner);
766
767 int glcpp_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
768
769 /* Accessor methods to globals.
770 These are made visible to non-reentrant scanners for convenience. */
771
772 int glcpp_lex_destroy (yyscan_t yyscanner );
773
774 int glcpp_get_debug (yyscan_t yyscanner );
775
776 void glcpp_set_debug (int debug_flag ,yyscan_t yyscanner );
777
778 YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner );
779
780 void glcpp_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
781
782 FILE *glcpp_get_in (yyscan_t yyscanner );
783
784 void glcpp_set_in (FILE * in_str ,yyscan_t yyscanner );
785
786 FILE *glcpp_get_out (yyscan_t yyscanner );
787
788 void glcpp_set_out (FILE * out_str ,yyscan_t yyscanner );
789
790 int glcpp_get_leng (yyscan_t yyscanner );
791
792 char *glcpp_get_text (yyscan_t yyscanner );
793
794 int glcpp_get_lineno (yyscan_t yyscanner );
795
796 void glcpp_set_lineno (int line_number ,yyscan_t yyscanner );
797
798 int glcpp_get_column (yyscan_t yyscanner );
799
800 void glcpp_set_column (int column_no ,yyscan_t yyscanner );
801
802 YYSTYPE * glcpp_get_lval (yyscan_t yyscanner );
803
804 void glcpp_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
805
806 YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner );
807
808 void glcpp_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
809
810 /* Macros after this point can all be overridden by user definitions in
811 * section 1.
812 */
813
814 #ifndef YY_SKIP_YYWRAP
815 #ifdef __cplusplus
816 extern "C" int glcpp_wrap (yyscan_t yyscanner );
817 #else
818 extern int glcpp_wrap (yyscan_t yyscanner );
819 #endif
820 #endif
821
822 static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
823
824 #ifndef yytext_ptr
825 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
826 #endif
827
828 #ifdef YY_NEED_STRLEN
829 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
830 #endif
831
832 #ifndef YY_NO_INPUT
833
834 #ifdef __cplusplus
835 static int yyinput (yyscan_t yyscanner );
836 #else
837 static int input (yyscan_t yyscanner );
838 #endif
839
840 #endif
841
842 static void yy_push_state (int new_state ,yyscan_t yyscanner);
843
844 static void yy_pop_state (yyscan_t yyscanner );
845
846 static int yy_top_state (yyscan_t yyscanner );
847
848 /* Amount of stuff to slurp up with each read. */
849 #ifndef YY_READ_BUF_SIZE
850 #define YY_READ_BUF_SIZE 8192
851 #endif
852
853 /* Copy whatever the last rule matched to the standard output. */
854 #ifndef ECHO
855 /* This used to be an fputs(), but since the string might contain NUL's,
856 * we now use fwrite().
857 */
858 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
859 #endif
860
861 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
862 * is returned in "result".
863 */
864 #ifndef YY_INPUT
865 #define YY_INPUT(buf,result,max_size) \
866 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
867 { \
868 int c = '*'; \
869 unsigned n; \
870 for ( n = 0; n < max_size && \
871 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
872 buf[n] = (char) c; \
873 if ( c == '\n' ) \
874 buf[n++] = (char) c; \
875 if ( c == EOF && ferror( yyin ) ) \
876 YY_FATAL_ERROR( "input in flex scanner failed" ); \
877 result = n; \
878 } \
879 else \
880 { \
881 errno=0; \
882 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
883 { \
884 if( errno != EINTR) \
885 { \
886 YY_FATAL_ERROR( "input in flex scanner failed" ); \
887 break; \
888 } \
889 errno=0; \
890 clearerr(yyin); \
891 } \
892 }\
893 \
894
895 #endif
896
897 /* No semi-colon after return; correct usage is to write "yyterminate();" -
898 * we don't want an extra ';' after the "return" because that will cause
899 * some compilers to complain about unreachable statements.
900 */
901 #ifndef yyterminate
902 #define yyterminate() return YY_NULL
903 #endif
904
905 /* Number of entries by which start-condition stack grows. */
906 #ifndef YY_START_STACK_INCR
907 #define YY_START_STACK_INCR 25
908 #endif
909
910 /* Report a fatal error. */
911 #ifndef YY_FATAL_ERROR
912 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
913 #endif
914
915 /* end tables serialization structures and prototypes */
916
917 /* Default declaration of generated scanner - a define so the user can
918 * easily add parameters.
919 */
920 #ifndef YY_DECL
921 #define YY_DECL_IS_OURS 1
922
923 extern int glcpp_lex \
924 (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
925
926 #define YY_DECL int glcpp_lex \
927 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
928 #endif /* !YY_DECL */
929
930 /* Code executed at the beginning of each rule, after yytext and yyleng
931 * have been set up.
932 */
933 #ifndef YY_USER_ACTION
934 #define YY_USER_ACTION
935 #endif
936
937 /* Code executed at the end of each rule. */
938 #ifndef YY_BREAK
939 #define YY_BREAK break;
940 #endif
941
942 #define YY_RULE_SETUP \
943 if ( yyleng > 0 ) \
944 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
945 (yytext[yyleng - 1] == '\n'); \
946 YY_USER_ACTION
947
948 /** The main scanner function which does all the work.
949 */
950 YY_DECL
951 {
952 register yy_state_type yy_current_state;
953 register char *yy_cp, *yy_bp;
954 register int yy_act;
955 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
956
957 #line 76 "glcpp/glcpp-lex.l"
958
959
960 /* Single-line comments */
961 #line 962 "glcpp/glcpp-lex.c"
962
963 yylval = yylval_param;
964
965 yylloc = yylloc_param;
966
967 if ( !yyg->yy_init )
968 {
969 yyg->yy_init = 1;
970
971 #ifdef YY_USER_INIT
972 YY_USER_INIT;
973 #endif
974
975 /* Create the reject buffer large enough to save one state per allowed character. */
976 if ( ! yyg->yy_state_buf )
977 yyg->yy_state_buf = (yy_state_type *)glcpp_alloc(YY_STATE_BUF_SIZE ,yyscanner);
978 if ( ! yyg->yy_state_buf )
979 YY_FATAL_ERROR( "out of dynamic memory in glcpp_lex()" );
980
981 if ( ! yyg->yy_start )
982 yyg->yy_start = 1; /* first start state */
983
984 if ( ! yyin )
985 yyin = stdin;
986
987 if ( ! yyout )
988 yyout = stdout;
989
990 if ( ! YY_CURRENT_BUFFER ) {
991 glcpp_ensure_buffer_stack (yyscanner);
992 YY_CURRENT_BUFFER_LVALUE =
993 glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
994 }
995
996 glcpp__load_buffer_state(yyscanner );
997 }
998
999 while ( 1 ) /* loops until end-of-file is reached */
1000 {
1001 yy_cp = yyg->yy_c_buf_p;
1002
1003 /* Support of yytext. */
1004 *yy_cp = yyg->yy_hold_char;
1005
1006 /* yy_bp points to the position in yy_ch_buf of the start of
1007 * the current run.
1008 */
1009 yy_bp = yy_cp;
1010
1011 yy_current_state = yyg->yy_start;
1012 yy_current_state += YY_AT_BOL();
1013
1014 yyg->yy_state_ptr = yyg->yy_state_buf;
1015 *yyg->yy_state_ptr++ = yy_current_state;
1016
1017 yy_match:
1018 do
1019 {
1020 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1021 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1022 {
1023 yy_current_state = (int) yy_def[yy_current_state];
1024 if ( yy_current_state >= 163 )
1025 yy_c = yy_meta[(unsigned int) yy_c];
1026 }
1027 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1028 *yyg->yy_state_ptr++ = yy_current_state;
1029 ++yy_cp;
1030 }
1031 while ( yy_current_state != 162 );
1032
1033 yy_find_action:
1034 yy_current_state = *--yyg->yy_state_ptr;
1035 yyg->yy_lp = yy_accept[yy_current_state];
1036 find_rule: /* we branch to this label when backing up */
1037 for ( ; ; ) /* until we find what rule we matched */
1038 {
1039 if ( yyg->yy_lp && yyg->yy_lp < yy_accept[yy_current_state + 1] )
1040 {
1041 yy_act = yy_acclist[yyg->yy_lp];
1042 if ( yy_act & YY_TRAILING_HEAD_MASK ||
1043 yyg->yy_looking_for_trail_begin )
1044 {
1045 if ( yy_act == yyg->yy_looking_for_trail_begin )
1046 {
1047 yyg->yy_looking_for_trail_begin = 0;
1048 yy_act &= ~YY_TRAILING_HEAD_MASK;
1049 break;
1050 }
1051 }
1052 else if ( yy_act & YY_TRAILING_MASK )
1053 {
1054 yyg->yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK;
1055 yyg->yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK;
1056 yyg->yy_full_match = yy_cp;
1057 yyg->yy_full_state = yyg->yy_state_ptr;
1058 yyg->yy_full_lp = yyg->yy_lp;
1059 }
1060 else
1061 {
1062 yyg->yy_full_match = yy_cp;
1063 yyg->yy_full_state = yyg->yy_state_ptr;
1064 yyg->yy_full_lp = yyg->yy_lp;
1065 break;
1066 }
1067 ++yyg->yy_lp;
1068 goto find_rule;
1069 }
1070 --yy_cp;
1071 yy_current_state = *--yyg->yy_state_ptr;
1072 yyg->yy_lp = yy_accept[yy_current_state];
1073 }
1074
1075 YY_DO_BEFORE_ACTION;
1076
1077 do_action: /* This label is used only to access EOF actions. */
1078
1079 switch ( yy_act )
1080 { /* beginning of action switch */
1081 case 1:
1082 YY_RULE_SETUP
1083 #line 79 "glcpp/glcpp-lex.l"
1084 {
1085 }
1086 YY_BREAK
1087 /* Multi-line comments */
1088 case 2:
1089 YY_RULE_SETUP
1090 #line 83 "glcpp/glcpp-lex.l"
1091 { yy_push_state(COMMENT, yyscanner); }
1092 YY_BREAK
1093 case 3:
1094 YY_RULE_SETUP
1095 #line 84 "glcpp/glcpp-lex.l"
1096
1097 YY_BREAK
1098 case 4:
1099 /* rule 4 can match eol */
1100 YY_RULE_SETUP
1101 #line 85 "glcpp/glcpp-lex.l"
1102 { yylineno++; yycolumn = 0; return NEWLINE; }
1103 YY_BREAK
1104 case 5:
1105 YY_RULE_SETUP
1106 #line 86 "glcpp/glcpp-lex.l"
1107
1108 YY_BREAK
1109 case 6:
1110 /* rule 6 can match eol */
1111 YY_RULE_SETUP
1112 #line 87 "glcpp/glcpp-lex.l"
1113 { yylineno++; yycolumn = 0; return NEWLINE; }
1114 YY_BREAK
1115 case 7:
1116 YY_RULE_SETUP
1117 #line 88 "glcpp/glcpp-lex.l"
1118 {
1119 yy_pop_state(yyscanner);
1120 if (yyextra->space_tokens)
1121 return SPACE;
1122 }
1123 YY_BREAK
1124 case 8:
1125 YY_RULE_SETUP
1126 #line 94 "glcpp/glcpp-lex.l"
1127 {
1128 yylval->str = ralloc_strdup (yyextra, yytext);
1129 yyextra->space_tokens = 0;
1130 return HASH_VERSION;
1131 }
1132 YY_BREAK
1133 /* glcpp doesn't handle #extension, #version, or #pragma directives.
1134 * Simply pass them through to the main compiler's lexer/parser. */
1135 case 9:
1136 YY_RULE_SETUP
1137 #line 102 "glcpp/glcpp-lex.l"
1138 {
1139 yylval->str = ralloc_strdup (yyextra, yytext);
1140 yylineno++;
1141 yycolumn = 0;
1142 return OTHER;
1143 }
1144 YY_BREAK
1145 case 10:
1146 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1147 yyg->yy_c_buf_p = yy_cp -= 1;
1148 YY_DO_BEFORE_ACTION; /* set up yytext again */
1149 YY_RULE_SETUP
1150 #line 109 "glcpp/glcpp-lex.l"
1151 {
1152 /* Eat characters until the first digit is
1153 * encountered
1154 */
1155 char *ptr = yytext;
1156 while (!isdigit(*ptr))
1157 ptr++;
1158
1159 /* Subtract one from the line number because
1160 * yylineno is zero-based instead of
1161 * one-based.
1162 */
1163 yylineno = strtol(ptr, &ptr, 0) - 1;
1164 yylloc->source = strtol(ptr, NULL, 0);
1165 }
1166 YY_BREAK
1167 case 11:
1168 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1169 yyg->yy_c_buf_p = yy_cp -= 1;
1170 YY_DO_BEFORE_ACTION; /* set up yytext again */
1171 YY_RULE_SETUP
1172 #line 125 "glcpp/glcpp-lex.l"
1173 {
1174 /* Eat characters until the first digit is
1175 * encountered
1176 */
1177 char *ptr = yytext;
1178 while (!isdigit(*ptr))
1179 ptr++;
1180
1181 /* Subtract one from the line number because
1182 * yylineno is zero-based instead of
1183 * one-based.
1184 */
1185 yylineno = strtol(ptr, &ptr, 0) - 1;
1186 }
1187 YY_BREAK
1188 case 12:
1189 /* rule 12 can match eol */
1190 YY_RULE_SETUP
1191 #line 140 "glcpp/glcpp-lex.l"
1192 {
1193 yyextra->lexing_if = 1;
1194 yyextra->space_tokens = 0;
1195 return HASH_IFDEF;
1196 }
1197 YY_BREAK
1198 case 13:
1199 /* rule 13 can match eol */
1200 YY_RULE_SETUP
1201 #line 146 "glcpp/glcpp-lex.l"
1202 {
1203 yyextra->lexing_if = 1;
1204 yyextra->space_tokens = 0;
1205 return HASH_IFNDEF;
1206 }
1207 YY_BREAK
1208 case 14:
1209 /* rule 14 can match eol */
1210 YY_RULE_SETUP
1211 #line 152 "glcpp/glcpp-lex.l"
1212 {
1213 yyextra->lexing_if = 1;
1214 yyextra->space_tokens = 0;
1215 return HASH_IF;
1216 }
1217 YY_BREAK
1218 case 15:
1219 /* rule 15 can match eol */
1220 YY_RULE_SETUP
1221 #line 158 "glcpp/glcpp-lex.l"
1222 {
1223 yyextra->lexing_if = 1;
1224 yyextra->space_tokens = 0;
1225 return HASH_ELIF;
1226 }
1227 YY_BREAK
1228 case 16:
1229 /* rule 16 can match eol */
1230 YY_RULE_SETUP
1231 #line 164 "glcpp/glcpp-lex.l"
1232 {
1233 yyextra->space_tokens = 0;
1234 return HASH_ELSE;
1235 }
1236 YY_BREAK
1237 case 17:
1238 /* rule 17 can match eol */
1239 YY_RULE_SETUP
1240 #line 169 "glcpp/glcpp-lex.l"
1241 {
1242 yyextra->space_tokens = 0;
1243 return HASH_ENDIF;
1244 }
1245 YY_BREAK
1246 /* When skipping (due to an #if 0 or similar) consume anything
1247 * up to a newline. We do this with less priority than any
1248 * #if-related directive (#if, #elif, #else, #endif), but with
1249 * more priority than any other directive or token to avoid
1250 * any side-effects from skipped content.
1251 *
1252 * We use the lexing_if flag to avoid skipping any part of an
1253 * if conditional expression. */
1254 case 18:
1255 /* rule 18 can match eol */
1256 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1257 yyg->yy_c_buf_p = yy_cp -= 1;
1258 YY_DO_BEFORE_ACTION; /* set up yytext again */
1259 YY_RULE_SETUP
1260 #line 182 "glcpp/glcpp-lex.l"
1261 {
1262 /* Since this rule always matches, YY_USER_ACTION gets called for it,
1263 * wrongly incrementing yycolumn. We undo that effect here. */
1264 yycolumn -= yyleng;
1265 if (yyextra->lexing_if ||
1266 yyextra->skip_stack == NULL ||
1267 yyextra->skip_stack->type == SKIP_NO_SKIP)
1268 {
1269 REJECT;
1270 }
1271 }
1272 YY_BREAK
1273 case 19:
1274 YY_RULE_SETUP
1275 #line 194 "glcpp/glcpp-lex.l"
1276 {
1277 char *p;
1278 for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */
1279 p += 5; /* skip "error" */
1280 glcpp_error(yylloc, yyextra, "#error%s", p);
1281 }
1282 YY_BREAK
1283 case 20:
1284 YY_RULE_SETUP
1285 #line 201 "glcpp/glcpp-lex.l"
1286 {
1287 yyextra->space_tokens = 0;
1288 return HASH_DEFINE_FUNC;
1289 }
1290 YY_BREAK
1291 case 21:
1292 YY_RULE_SETUP
1293 #line 206 "glcpp/glcpp-lex.l"
1294 {
1295 yyextra->space_tokens = 0;
1296 return HASH_DEFINE_OBJ;
1297 }
1298 YY_BREAK
1299 case 22:
1300 YY_RULE_SETUP
1301 #line 211 "glcpp/glcpp-lex.l"
1302 {
1303 yyextra->space_tokens = 0;
1304 return HASH_UNDEF;
1305 }
1306 YY_BREAK
1307 case 23:
1308 YY_RULE_SETUP
1309 #line 216 "glcpp/glcpp-lex.l"
1310 {
1311 yyextra->space_tokens = 0;
1312 return HASH;
1313 }
1314 YY_BREAK
1315 case 24:
1316 YY_RULE_SETUP
1317 #line 221 "glcpp/glcpp-lex.l"
1318 {
1319 yylval->str = ralloc_strdup (yyextra, yytext);
1320 return INTEGER_STRING;
1321 }
1322 YY_BREAK
1323 case 25:
1324 YY_RULE_SETUP
1325 #line 226 "glcpp/glcpp-lex.l"
1326 {
1327 yylval->str = ralloc_strdup (yyextra, yytext);
1328 return INTEGER_STRING;
1329 }
1330 YY_BREAK
1331 case 26:
1332 YY_RULE_SETUP
1333 #line 231 "glcpp/glcpp-lex.l"
1334 {
1335 yylval->str = ralloc_strdup (yyextra, yytext);
1336 return INTEGER_STRING;
1337 }
1338 YY_BREAK
1339 case 27:
1340 YY_RULE_SETUP
1341 #line 236 "glcpp/glcpp-lex.l"
1342 {
1343 return LEFT_SHIFT;
1344 }
1345 YY_BREAK
1346 case 28:
1347 YY_RULE_SETUP
1348 #line 240 "glcpp/glcpp-lex.l"
1349 {
1350 return RIGHT_SHIFT;
1351 }
1352 YY_BREAK
1353 case 29:
1354 YY_RULE_SETUP
1355 #line 244 "glcpp/glcpp-lex.l"
1356 {
1357 return LESS_OR_EQUAL;
1358 }
1359 YY_BREAK
1360 case 30:
1361 YY_RULE_SETUP
1362 #line 248 "glcpp/glcpp-lex.l"
1363 {
1364 return GREATER_OR_EQUAL;
1365 }
1366 YY_BREAK
1367 case 31:
1368 YY_RULE_SETUP
1369 #line 252 "glcpp/glcpp-lex.l"
1370 {
1371 return EQUAL;
1372 }
1373 YY_BREAK
1374 case 32:
1375 YY_RULE_SETUP
1376 #line 256 "glcpp/glcpp-lex.l"
1377 {
1378 return NOT_EQUAL;
1379 }
1380 YY_BREAK
1381 case 33:
1382 YY_RULE_SETUP
1383 #line 260 "glcpp/glcpp-lex.l"
1384 {
1385 return AND;
1386 }
1387 YY_BREAK
1388 case 34:
1389 YY_RULE_SETUP
1390 #line 264 "glcpp/glcpp-lex.l"
1391 {
1392 return OR;
1393 }
1394 YY_BREAK
1395 case 35:
1396 YY_RULE_SETUP
1397 #line 268 "glcpp/glcpp-lex.l"
1398 {
1399 return PASTE;
1400 }
1401 YY_BREAK
1402 case 36:
1403 YY_RULE_SETUP
1404 #line 272 "glcpp/glcpp-lex.l"
1405 {
1406 return DEFINED;
1407 }
1408 YY_BREAK
1409 case 37:
1410 YY_RULE_SETUP
1411 #line 276 "glcpp/glcpp-lex.l"
1412 {
1413 yylval->str = ralloc_strdup (yyextra, yytext);
1414 return IDENTIFIER;
1415 }
1416 YY_BREAK
1417 case 38:
1418 YY_RULE_SETUP
1419 #line 281 "glcpp/glcpp-lex.l"
1420 {
1421 return yytext[0];
1422 }
1423 YY_BREAK
1424 case 39:
1425 YY_RULE_SETUP
1426 #line 285 "glcpp/glcpp-lex.l"
1427 {
1428 yylval->str = ralloc_strdup (yyextra, yytext);
1429 return OTHER;
1430 }
1431 YY_BREAK
1432 case 40:
1433 YY_RULE_SETUP
1434 #line 290 "glcpp/glcpp-lex.l"
1435 {
1436 if (yyextra->space_tokens) {
1437 return SPACE;
1438 }
1439 }
1440 YY_BREAK
1441 case 41:
1442 /* rule 41 can match eol */
1443 YY_RULE_SETUP
1444 #line 296 "glcpp/glcpp-lex.l"
1445 {
1446 yyextra->lexing_if = 0;
1447 yylineno++;
1448 yycolumn = 0;
1449 return NEWLINE;
1450 }
1451 YY_BREAK
1452 /* Handle missing newline at EOF. */
1453 case YY_STATE_EOF(INITIAL):
1454 #line 304 "glcpp/glcpp-lex.l"
1455 {
1456 BEGIN DONE; /* Don't keep matching this rule forever. */
1457 yyextra->lexing_if = 0;
1458 return NEWLINE;
1459 }
1460 YY_BREAK
1461 /* We don't actually use the UNREACHABLE start condition. We
1462 only have this action here so that we can pretend to call some
1463 generated functions, (to avoid "defined but not used"
1464 warnings. */
1465 case 42:
1466 YY_RULE_SETUP
1467 #line 314 "glcpp/glcpp-lex.l"
1468 {
1469 unput('.');
1470 yy_top_state(yyextra);
1471 }
1472 YY_BREAK
1473 case 43:
1474 YY_RULE_SETUP
1475 #line 319 "glcpp/glcpp-lex.l"
1476 ECHO;
1477 YY_BREAK
1478 #line 1479 "glcpp/glcpp-lex.c"
1479 case YY_STATE_EOF(DONE):
1480 case YY_STATE_EOF(COMMENT):
1481 case YY_STATE_EOF(UNREACHABLE):
1482 yyterminate();
1483
1484 case YY_END_OF_BUFFER:
1485 {
1486 /* Amount of text matched not including the EOB char. */
1487 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1488
1489 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1490 *yy_cp = yyg->yy_hold_char;
1491 YY_RESTORE_YY_MORE_OFFSET
1492
1493 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1494 {
1495 /* We're scanning a new file or input source. It's
1496 * possible that this happened because the user
1497 * just pointed yyin at a new source and called
1498 * glcpp_lex(). If so, then we have to assure
1499 * consistency between YY_CURRENT_BUFFER and our
1500 * globals. Here is the right place to do so, because
1501 * this is the first action (other than possibly a
1502 * back-up) that will match for the new input source.
1503 */
1504 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1505 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1506 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1507 }
1508
1509 /* Note that here we test for yy_c_buf_p "<=" to the position
1510 * of the first EOB in the buffer, since yy_c_buf_p will
1511 * already have been incremented past the NUL character
1512 * (since all states make transitions on EOB to the
1513 * end-of-buffer state). Contrast this with the test
1514 * in input().
1515 */
1516 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1517 { /* This was really a NUL. */
1518 yy_state_type yy_next_state;
1519
1520 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1521
1522 yy_current_state = yy_get_previous_state( yyscanner );
1523
1524 /* Okay, we're now positioned to make the NUL
1525 * transition. We couldn't have
1526 * yy_get_previous_state() go ahead and do it
1527 * for us because it doesn't know how to deal
1528 * with the possibility of jamming (and we don't
1529 * want to build jamming into it because then it
1530 * will run more slowly).
1531 */
1532
1533 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1534
1535 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1536
1537 if ( yy_next_state )
1538 {
1539 /* Consume the NUL. */
1540 yy_cp = ++yyg->yy_c_buf_p;
1541 yy_current_state = yy_next_state;
1542 goto yy_match;
1543 }
1544
1545 else
1546 {
1547 yy_cp = yyg->yy_c_buf_p;
1548 goto yy_find_action;
1549 }
1550 }
1551
1552 else switch ( yy_get_next_buffer( yyscanner ) )
1553 {
1554 case EOB_ACT_END_OF_FILE:
1555 {
1556 yyg->yy_did_buffer_switch_on_eof = 0;
1557
1558 if ( glcpp_wrap(yyscanner ) )
1559 {
1560 /* Note: because we've taken care in
1561 * yy_get_next_buffer() to have set up
1562 * yytext, we can now set up
1563 * yy_c_buf_p so that if some total
1564 * hoser (like flex itself) wants to
1565 * call the scanner after we return the
1566 * YY_NULL, it'll still work - another
1567 * YY_NULL will get returned.
1568 */
1569 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1570
1571 yy_act = YY_STATE_EOF(YY_START);
1572 goto do_action;
1573 }
1574
1575 else
1576 {
1577 if ( ! yyg->yy_did_buffer_switch_on_eof )
1578 YY_NEW_FILE;
1579 }
1580 break;
1581 }
1582
1583 case EOB_ACT_CONTINUE_SCAN:
1584 yyg->yy_c_buf_p =
1585 yyg->yytext_ptr + yy_amount_of_matched_text;
1586
1587 yy_current_state = yy_get_previous_state( yyscanner );
1588
1589 yy_cp = yyg->yy_c_buf_p;
1590 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1591 goto yy_match;
1592
1593 case EOB_ACT_LAST_MATCH:
1594 yyg->yy_c_buf_p =
1595 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1596
1597 yy_current_state = yy_get_previous_state( yyscanner );
1598
1599 yy_cp = yyg->yy_c_buf_p;
1600 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1601 goto yy_find_action;
1602 }
1603 break;
1604 }
1605
1606 default:
1607 YY_FATAL_ERROR(
1608 "fatal flex scanner internal error--no action found" );
1609 } /* end of action switch */
1610 } /* end of scanning one token */
1611 } /* end of glcpp_lex */
1612
1613 /* yy_get_next_buffer - try to read in a new buffer
1614 *
1615 * Returns a code representing an action:
1616 * EOB_ACT_LAST_MATCH -
1617 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1618 * EOB_ACT_END_OF_FILE - end of file
1619 */
1620 static int yy_get_next_buffer (yyscan_t yyscanner)
1621 {
1622 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1623 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1624 register char *source = yyg->yytext_ptr;
1625 register int number_to_move, i;
1626 int ret_val;
1627
1628 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1629 YY_FATAL_ERROR(
1630 "fatal flex scanner internal error--end of buffer missed" );
1631
1632 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1633 { /* Don't try to fill the buffer, so this is an EOF. */
1634 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1635 {
1636 /* We matched a single character, the EOB, so
1637 * treat this as a final EOF.
1638 */
1639 return EOB_ACT_END_OF_FILE;
1640 }
1641
1642 else
1643 {
1644 /* We matched some text prior to the EOB, first
1645 * process it.
1646 */
1647 return EOB_ACT_LAST_MATCH;
1648 }
1649 }
1650
1651 /* Try to read more data. */
1652
1653 /* First move last chars to start of buffer. */
1654 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
1655
1656 for ( i = 0; i < number_to_move; ++i )
1657 *(dest++) = *(source++);
1658
1659 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1660 /* don't do the read, it's not guaranteed to return an EOF,
1661 * just force an EOF
1662 */
1663 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1664
1665 else
1666 {
1667 int num_to_read =
1668 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1669
1670 while ( num_to_read <= 0 )
1671 { /* Not enough room in the buffer - grow it. */
1672
1673 YY_FATAL_ERROR(
1674 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1675
1676 }
1677
1678 if ( num_to_read > YY_READ_BUF_SIZE )
1679 num_to_read = YY_READ_BUF_SIZE;
1680
1681 /* Read in more data. */
1682 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1683 yyg->yy_n_chars, (size_t) num_to_read );
1684
1685 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1686 }
1687
1688 if ( yyg->yy_n_chars == 0 )
1689 {
1690 if ( number_to_move == YY_MORE_ADJ )
1691 {
1692 ret_val = EOB_ACT_END_OF_FILE;
1693 glcpp_restart(yyin ,yyscanner);
1694 }
1695
1696 else
1697 {
1698 ret_val = EOB_ACT_LAST_MATCH;
1699 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1700 YY_BUFFER_EOF_PENDING;
1701 }
1702 }
1703
1704 else
1705 ret_val = EOB_ACT_CONTINUE_SCAN;
1706
1707 if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1708 /* Extend the array by 50%, plus the number we really need. */
1709 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1710 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) glcpp_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1711 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1712 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1713 }
1714
1715 yyg->yy_n_chars += number_to_move;
1716 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1717 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1718
1719 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1720
1721 return ret_val;
1722 }
1723
1724 /* yy_get_previous_state - get the state just before the EOB char was reached */
1725
1726 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1727 {
1728 register yy_state_type yy_current_state;
1729 register char *yy_cp;
1730 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1731
1732 yy_current_state = yyg->yy_start;
1733 yy_current_state += YY_AT_BOL();
1734
1735 yyg->yy_state_ptr = yyg->yy_state_buf;
1736 *yyg->yy_state_ptr++ = yy_current_state;
1737
1738 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1739 {
1740 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1741 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1742 {
1743 yy_current_state = (int) yy_def[yy_current_state];
1744 if ( yy_current_state >= 163 )
1745 yy_c = yy_meta[(unsigned int) yy_c];
1746 }
1747 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1748 *yyg->yy_state_ptr++ = yy_current_state;
1749 }
1750
1751 return yy_current_state;
1752 }
1753
1754 /* yy_try_NUL_trans - try to make a transition on the NUL character
1755 *
1756 * synopsis
1757 * next_state = yy_try_NUL_trans( current_state );
1758 */
1759 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
1760 {
1761 register int yy_is_jam;
1762 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1763
1764 register YY_CHAR yy_c = 1;
1765 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1766 {
1767 yy_current_state = (int) yy_def[yy_current_state];
1768 if ( yy_current_state >= 163 )
1769 yy_c = yy_meta[(unsigned int) yy_c];
1770 }
1771 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1772 yy_is_jam = (yy_current_state == 162);
1773 if ( ! yy_is_jam )
1774 *yyg->yy_state_ptr++ = yy_current_state;
1775
1776 return yy_is_jam ? 0 : yy_current_state;
1777 }
1778
1779 static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
1780 {
1781 register char *yy_cp;
1782 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1783
1784 yy_cp = yyg->yy_c_buf_p;
1785
1786 /* undo effects of setting up yytext */
1787 *yy_cp = yyg->yy_hold_char;
1788
1789 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1790 { /* need to shift things up to make room */
1791 /* +2 for EOB chars. */
1792 register int number_to_move = yyg->yy_n_chars + 2;
1793 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1794 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1795 register char *source =
1796 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1797
1798 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1799 *--dest = *--source;
1800
1801 yy_cp += (int) (dest - source);
1802 yy_bp += (int) (dest - source);
1803 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1804 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1805
1806 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1807 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1808 }
1809
1810 *--yy_cp = (char) c;
1811
1812 yyg->yytext_ptr = yy_bp;
1813 yyg->yy_hold_char = *yy_cp;
1814 yyg->yy_c_buf_p = yy_cp;
1815 }
1816
1817 #ifndef YY_NO_INPUT
1818 #ifdef __cplusplus
1819 static int yyinput (yyscan_t yyscanner)
1820 #else
1821 static int input (yyscan_t yyscanner)
1822 #endif
1823
1824 {
1825 int c;
1826 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1827
1828 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1829
1830 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1831 {
1832 /* yy_c_buf_p now points to the character we want to return.
1833 * If this occurs *before* the EOB characters, then it's a
1834 * valid NUL; if not, then we've hit the end of the buffer.
1835 */
1836 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1837 /* This was really a NUL. */
1838 *yyg->yy_c_buf_p = '\0';
1839
1840 else
1841 { /* need more input */
1842 int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1843 ++yyg->yy_c_buf_p;
1844
1845 switch ( yy_get_next_buffer( yyscanner ) )
1846 {
1847 case EOB_ACT_LAST_MATCH:
1848 /* This happens because yy_g_n_b()
1849 * sees that we've accumulated a
1850 * token and flags that we need to
1851 * try matching the token before
1852 * proceeding. But for input(),
1853 * there's no matching to consider.
1854 * So convert the EOB_ACT_LAST_MATCH
1855 * to EOB_ACT_END_OF_FILE.
1856 */
1857
1858 /* Reset buffer status. */
1859 glcpp_restart(yyin ,yyscanner);
1860
1861 /*FALLTHROUGH*/
1862
1863 case EOB_ACT_END_OF_FILE:
1864 {
1865 if ( glcpp_wrap(yyscanner ) )
1866 return EOF;
1867
1868 if ( ! yyg->yy_did_buffer_switch_on_eof )
1869 YY_NEW_FILE;
1870 #ifdef __cplusplus
1871 return yyinput(yyscanner);
1872 #else
1873 return input(yyscanner);
1874 #endif
1875 }
1876
1877 case EOB_ACT_CONTINUE_SCAN:
1878 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1879 break;
1880 }
1881 }
1882 }
1883
1884 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1885 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
1886 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1887
1888 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1889
1890 return c;
1891 }
1892 #endif /* ifndef YY_NO_INPUT */
1893
1894 /** Immediately switch to a different input stream.
1895 * @param input_file A readable stream.
1896 * @param yyscanner The scanner object.
1897 * @note This function does not reset the start condition to @c INITIAL .
1898 */
1899 void glcpp_restart (FILE * input_file , yyscan_t yyscanner)
1900 {
1901 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1902
1903 if ( ! YY_CURRENT_BUFFER ){
1904 glcpp_ensure_buffer_stack (yyscanner);
1905 YY_CURRENT_BUFFER_LVALUE =
1906 glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1907 }
1908
1909 glcpp__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1910 glcpp__load_buffer_state(yyscanner );
1911 }
1912
1913 /** Switch to a different input buffer.
1914 * @param new_buffer The new input buffer.
1915 * @param yyscanner The scanner object.
1916 */
1917 void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1918 {
1919 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1920
1921 /* TODO. We should be able to replace this entire function body
1922 * with
1923 * glcpp_pop_buffer_state();
1924 * glcpp_push_buffer_state(new_buffer);
1925 */
1926 glcpp_ensure_buffer_stack (yyscanner);
1927 if ( YY_CURRENT_BUFFER == new_buffer )
1928 return;
1929
1930 if ( YY_CURRENT_BUFFER )
1931 {
1932 /* Flush out information for old buffer. */
1933 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1934 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1935 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1936 }
1937
1938 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1939 glcpp__load_buffer_state(yyscanner );
1940
1941 /* We don't actually know whether we did this switch during
1942 * EOF (glcpp_wrap()) processing, but the only time this flag
1943 * is looked at is after glcpp_wrap() is called, so it's safe
1944 * to go ahead and always set it.
1945 */
1946 yyg->yy_did_buffer_switch_on_eof = 1;
1947 }
1948
1949 static void glcpp__load_buffer_state (yyscan_t yyscanner)
1950 {
1951 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1952 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1953 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1954 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1955 yyg->yy_hold_char = *yyg->yy_c_buf_p;
1956 }
1957
1958 /** Allocate and initialize an input buffer state.
1959 * @param file A readable stream.
1960 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1961 * @param yyscanner The scanner object.
1962 * @return the allocated buffer state.
1963 */
1964 YY_BUFFER_STATE glcpp__create_buffer (FILE * file, int size , yyscan_t yyscanner)
1965 {
1966 YY_BUFFER_STATE b;
1967
1968 b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1969 if ( ! b )
1970 YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
1971
1972 b->yy_buf_size = size;
1973
1974 /* yy_ch_buf has to be 2 characters longer than the size given because
1975 * we need to put in 2 end-of-buffer characters.
1976 */
1977 b->yy_ch_buf = (char *) glcpp_alloc(b->yy_buf_size + 2 ,yyscanner );
1978 if ( ! b->yy_ch_buf )
1979 YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
1980
1981 b->yy_is_our_buffer = 1;
1982
1983 glcpp__init_buffer(b,file ,yyscanner);
1984
1985 return b;
1986 }
1987
1988 /** Destroy the buffer.
1989 * @param b a buffer created with glcpp__create_buffer()
1990 * @param yyscanner The scanner object.
1991 */
1992 void glcpp__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1993 {
1994 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1995
1996 if ( ! b )
1997 return;
1998
1999 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2000 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2001
2002 if ( b->yy_is_our_buffer )
2003 glcpp_free((void *) b->yy_ch_buf ,yyscanner );
2004
2005 glcpp_free((void *) b ,yyscanner );
2006 }
2007
2008 /* Initializes or reinitializes a buffer.
2009 * This function is sometimes called more than once on the same buffer,
2010 * such as during a glcpp_restart() or at EOF.
2011 */
2012 static void glcpp__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
2013
2014 {
2015 int oerrno = errno;
2016 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2017
2018 glcpp__flush_buffer(b ,yyscanner);
2019
2020 b->yy_input_file = file;
2021 b->yy_fill_buffer = 1;
2022
2023 /* If b is the current buffer, then glcpp__init_buffer was _probably_
2024 * called from glcpp_restart() or through yy_get_next_buffer.
2025 * In that case, we don't want to reset the lineno or column.
2026 */
2027 if (b != YY_CURRENT_BUFFER){
2028 b->yy_bs_lineno = 1;
2029 b->yy_bs_column = 0;
2030 }
2031
2032 b->yy_is_interactive = 0;
2033
2034 errno = oerrno;
2035 }
2036
2037 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2038 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2039 * @param yyscanner The scanner object.
2040 */
2041 void glcpp__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
2042 {
2043 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2044 if ( ! b )
2045 return;
2046
2047 b->yy_n_chars = 0;
2048
2049 /* We always need two end-of-buffer characters. The first causes
2050 * a transition to the end-of-buffer state. The second causes
2051 * a jam in that state.
2052 */
2053 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2054 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2055
2056 b->yy_buf_pos = &b->yy_ch_buf[0];
2057
2058 b->yy_at_bol = 1;
2059 b->yy_buffer_status = YY_BUFFER_NEW;
2060
2061 if ( b == YY_CURRENT_BUFFER )
2062 glcpp__load_buffer_state(yyscanner );
2063 }
2064
2065 /** Pushes the new state onto the stack. The new state becomes
2066 * the current state. This function will allocate the stack
2067 * if necessary.
2068 * @param new_buffer The new state.
2069 * @param yyscanner The scanner object.
2070 */
2071 void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
2072 {
2073 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2074 if (new_buffer == NULL)
2075 return;
2076
2077 glcpp_ensure_buffer_stack(yyscanner);
2078
2079 /* This block is copied from glcpp__switch_to_buffer. */
2080 if ( YY_CURRENT_BUFFER )
2081 {
2082 /* Flush out information for old buffer. */
2083 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2084 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2085 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2086 }
2087
2088 /* Only push if top exists. Otherwise, replace top. */
2089 if (YY_CURRENT_BUFFER)
2090 yyg->yy_buffer_stack_top++;
2091 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2092
2093 /* copied from glcpp__switch_to_buffer. */
2094 glcpp__load_buffer_state(yyscanner );
2095 yyg->yy_did_buffer_switch_on_eof = 1;
2096 }
2097
2098 /** Removes and deletes the top of the stack, if present.
2099 * The next element becomes the new top.
2100 * @param yyscanner The scanner object.
2101 */
2102 void glcpp_pop_buffer_state (yyscan_t yyscanner)
2103 {
2104 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2105 if (!YY_CURRENT_BUFFER)
2106 return;
2107
2108 glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
2109 YY_CURRENT_BUFFER_LVALUE = NULL;
2110 if (yyg->yy_buffer_stack_top > 0)
2111 --yyg->yy_buffer_stack_top;
2112
2113 if (YY_CURRENT_BUFFER) {
2114 glcpp__load_buffer_state(yyscanner );
2115 yyg->yy_did_buffer_switch_on_eof = 1;
2116 }
2117 }
2118
2119 /* Allocates the stack if it does not exist.
2120 * Guarantees space for at least one push.
2121 */
2122 static void glcpp_ensure_buffer_stack (yyscan_t yyscanner)
2123 {
2124 int num_to_alloc;
2125 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2126
2127 if (!yyg->yy_buffer_stack) {
2128
2129 /* First allocation is just for 2 elements, since we don't know if this
2130 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2131 * immediate realloc on the next call.
2132 */
2133 num_to_alloc = 1;
2134 yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_alloc
2135 (num_to_alloc * sizeof(struct yy_buffer_state*)
2136 , yyscanner);
2137 if ( ! yyg->yy_buffer_stack )
2138 YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
2139
2140 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2141
2142 yyg->yy_buffer_stack_max = num_to_alloc;
2143 yyg->yy_buffer_stack_top = 0;
2144 return;
2145 }
2146
2147 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2148
2149 /* Increase the buffer to prepare for a possible push. */
2150 int grow_size = 8 /* arbitrary grow size */;
2151
2152 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
2153 yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_realloc
2154 (yyg->yy_buffer_stack,
2155 num_to_alloc * sizeof(struct yy_buffer_state*)
2156 , yyscanner);
2157 if ( ! yyg->yy_buffer_stack )
2158 YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
2159
2160 /* zero only the new slots.*/
2161 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
2162 yyg->yy_buffer_stack_max = num_to_alloc;
2163 }
2164 }
2165
2166 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2167 * @param base the character buffer
2168 * @param size the size in bytes of the character buffer
2169 * @param yyscanner The scanner object.
2170 * @return the newly allocated buffer state object.
2171 */
2172 YY_BUFFER_STATE glcpp__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
2173 {
2174 YY_BUFFER_STATE b;
2175
2176 if ( size < 2 ||
2177 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2178 base[size-1] != YY_END_OF_BUFFER_CHAR )
2179 /* They forgot to leave room for the EOB's. */
2180 return 0;
2181
2182 b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
2183 if ( ! b )
2184 YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_buffer()" );
2185
2186 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2187 b->yy_buf_pos = b->yy_ch_buf = base;
2188 b->yy_is_our_buffer = 0;
2189 b->yy_input_file = 0;
2190 b->yy_n_chars = b->yy_buf_size;
2191 b->yy_is_interactive = 0;
2192 b->yy_at_bol = 1;
2193 b->yy_fill_buffer = 0;
2194 b->yy_buffer_status = YY_BUFFER_NEW;
2195
2196 glcpp__switch_to_buffer(b ,yyscanner );
2197
2198 return b;
2199 }
2200
2201 /** Setup the input buffer state to scan a string. The next call to glcpp_lex() will
2202 * scan from a @e copy of @a str.
2203 * @param yystr a NUL-terminated string to scan
2204 * @param yyscanner The scanner object.
2205 * @return the newly allocated buffer state object.
2206 * @note If you want to scan bytes that may contain NUL values, then use
2207 * glcpp__scan_bytes() instead.
2208 */
2209 YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner)
2210 {
2211
2212 return glcpp__scan_bytes(yystr,strlen(yystr) ,yyscanner);
2213 }
2214
2215 /** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will
2216 * scan from a @e copy of @a bytes.
2217 * @param bytes the byte buffer to scan
2218 * @param len the number of bytes in the buffer pointed to by @a bytes.
2219 * @param yyscanner The scanner object.
2220 * @return the newly allocated buffer state object.
2221 */
2222 YY_BUFFER_STATE glcpp__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
2223 {
2224 YY_BUFFER_STATE b;
2225 char *buf;
2226 yy_size_t n;
2227 int i;
2228
2229 /* Get memory for full buffer, including space for trailing EOB's. */
2230 n = _yybytes_len + 2;
2231 buf = (char *) glcpp_alloc(n ,yyscanner );
2232 if ( ! buf )
2233 YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_bytes()" );
2234
2235 for ( i = 0; i < _yybytes_len; ++i )
2236 buf[i] = yybytes[i];
2237
2238 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2239
2240 b = glcpp__scan_buffer(buf,n ,yyscanner);
2241 if ( ! b )
2242 YY_FATAL_ERROR( "bad buffer in glcpp__scan_bytes()" );
2243
2244 /* It's okay to grow etc. this buffer, and we should throw it
2245 * away when we're done.
2246 */
2247 b->yy_is_our_buffer = 1;
2248
2249 return b;
2250 }
2251
2252 static void yy_push_state (int new_state , yyscan_t yyscanner)
2253 {
2254 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2255 if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth )
2256 {
2257 yy_size_t new_size;
2258
2259 yyg->yy_start_stack_depth += YY_START_STACK_INCR;
2260 new_size = yyg->yy_start_stack_depth * sizeof( int );
2261
2262 if ( ! yyg->yy_start_stack )
2263 yyg->yy_start_stack = (int *) glcpp_alloc(new_size ,yyscanner );
2264
2265 else
2266 yyg->yy_start_stack = (int *) glcpp_realloc((void *) yyg->yy_start_stack,new_size ,yyscanner );
2267
2268 if ( ! yyg->yy_start_stack )
2269 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2270 }
2271
2272 yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START;
2273
2274 BEGIN(new_state);
2275 }
2276
2277 static void yy_pop_state (yyscan_t yyscanner)
2278 {
2279 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2280 if ( --yyg->yy_start_stack_ptr < 0 )
2281 YY_FATAL_ERROR( "start-condition stack underflow" );
2282
2283 BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]);
2284 }
2285
2286 static int yy_top_state (yyscan_t yyscanner)
2287 {
2288 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2289 return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1];
2290 }
2291
2292 #ifndef YY_EXIT_FAILURE
2293 #define YY_EXIT_FAILURE 2
2294 #endif
2295
2296 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
2297 {
2298 (void) fprintf( stderr, "%s\n", msg );
2299 exit( YY_EXIT_FAILURE );
2300 }
2301
2302 /* Redefine yyless() so it works in section 3 code. */
2303
2304 #undef yyless
2305 #define yyless(n) \
2306 do \
2307 { \
2308 /* Undo effects of setting up yytext. */ \
2309 int yyless_macro_arg = (n); \
2310 YY_LESS_LINENO(yyless_macro_arg);\
2311 yytext[yyleng] = yyg->yy_hold_char; \
2312 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2313 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2314 *yyg->yy_c_buf_p = '\0'; \
2315 yyleng = yyless_macro_arg; \
2316 } \
2317 while ( 0 )
2318
2319 /* Accessor methods (get/set functions) to struct members. */
2320
2321 /** Get the user-defined data for this scanner.
2322 * @param yyscanner The scanner object.
2323 */
2324 YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner)
2325 {
2326 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2327 return yyextra;
2328 }
2329
2330 /** Get the current line number.
2331 * @param yyscanner The scanner object.
2332 */
2333 int glcpp_get_lineno (yyscan_t yyscanner)
2334 {
2335 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2336
2337 if (! YY_CURRENT_BUFFER)
2338 return 0;
2339
2340 return yylineno;
2341 }
2342
2343 /** Get the current column number.
2344 * @param yyscanner The scanner object.
2345 */
2346 int glcpp_get_column (yyscan_t yyscanner)
2347 {
2348 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2349
2350 if (! YY_CURRENT_BUFFER)
2351 return 0;
2352
2353 return yycolumn;
2354 }
2355
2356 /** Get the input stream.
2357 * @param yyscanner The scanner object.
2358 */
2359 FILE *glcpp_get_in (yyscan_t yyscanner)
2360 {
2361 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2362 return yyin;
2363 }
2364
2365 /** Get the output stream.
2366 * @param yyscanner The scanner object.
2367 */
2368 FILE *glcpp_get_out (yyscan_t yyscanner)
2369 {
2370 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2371 return yyout;
2372 }
2373
2374 /** Get the length of the current token.
2375 * @param yyscanner The scanner object.
2376 */
2377 int glcpp_get_leng (yyscan_t yyscanner)
2378 {
2379 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2380 return yyleng;
2381 }
2382
2383 /** Get the current token.
2384 * @param yyscanner The scanner object.
2385 */
2386
2387 char *glcpp_get_text (yyscan_t yyscanner)
2388 {
2389 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2390 return yytext;
2391 }
2392
2393 /** Set the user-defined data. This data is never touched by the scanner.
2394 * @param user_defined The data to be associated with this scanner.
2395 * @param yyscanner The scanner object.
2396 */
2397 void glcpp_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
2398 {
2399 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2400 yyextra = user_defined ;
2401 }
2402
2403 /** Set the current line number.
2404 * @param line_number
2405 * @param yyscanner The scanner object.
2406 */
2407 void glcpp_set_lineno (int line_number , yyscan_t yyscanner)
2408 {
2409 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2410
2411 /* lineno is only valid if an input buffer exists. */
2412 if (! YY_CURRENT_BUFFER )
2413 yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner);
2414
2415 yylineno = line_number;
2416 }
2417
2418 /** Set the current column.
2419 * @param line_number
2420 * @param yyscanner The scanner object.
2421 */
2422 void glcpp_set_column (int column_no , yyscan_t yyscanner)
2423 {
2424 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2425
2426 /* column is only valid if an input buffer exists. */
2427 if (! YY_CURRENT_BUFFER )
2428 yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner);
2429
2430 yycolumn = column_no;
2431 }
2432
2433 /** Set the input stream. This does not discard the current
2434 * input buffer.
2435 * @param in_str A readable stream.
2436 * @param yyscanner The scanner object.
2437 * @see glcpp__switch_to_buffer
2438 */
2439 void glcpp_set_in (FILE * in_str , yyscan_t yyscanner)
2440 {
2441 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2442 yyin = in_str ;
2443 }
2444
2445 void glcpp_set_out (FILE * out_str , yyscan_t yyscanner)
2446 {
2447 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2448 yyout = out_str ;
2449 }
2450
2451 int glcpp_get_debug (yyscan_t yyscanner)
2452 {
2453 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2454 return yy_flex_debug;
2455 }
2456
2457 void glcpp_set_debug (int bdebug , yyscan_t yyscanner)
2458 {
2459 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2460 yy_flex_debug = bdebug ;
2461 }
2462
2463 /* Accessor methods for yylval and yylloc */
2464
2465 YYSTYPE * glcpp_get_lval (yyscan_t yyscanner)
2466 {
2467 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2468 return yylval;
2469 }
2470
2471 void glcpp_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
2472 {
2473 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2474 yylval = yylval_param;
2475 }
2476
2477 YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner)
2478 {
2479 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2480 return yylloc;
2481 }
2482
2483 void glcpp_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
2484 {
2485 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2486 yylloc = yylloc_param;
2487 }
2488
2489 /* User-visible API */
2490
2491 /* glcpp_lex_init is special because it creates the scanner itself, so it is
2492 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2493 * That's why we explicitly handle the declaration, instead of using our macros.
2494 */
2495
2496 int glcpp_lex_init(yyscan_t* ptr_yy_globals)
2497
2498 {
2499 if (ptr_yy_globals == NULL){
2500 errno = EINVAL;
2501 return 1;
2502 }
2503
2504 *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), NULL );
2505
2506 if (*ptr_yy_globals == NULL){
2507 errno = ENOMEM;
2508 return 1;
2509 }
2510
2511 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2512 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2513
2514 return yy_init_globals ( *ptr_yy_globals );
2515 }
2516
2517 /* glcpp_lex_init_extra has the same functionality as glcpp_lex_init, but follows the
2518 * convention of taking the scanner as the last argument. Note however, that
2519 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2520 * is the reason, too, why this function also must handle its own declaration).
2521 * The user defined value in the first argument will be available to glcpp_alloc in
2522 * the yyextra field.
2523 */
2524
2525 int glcpp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
2526
2527 {
2528 struct yyguts_t dummy_yyguts;
2529
2530 glcpp_set_extra (yy_user_defined, &dummy_yyguts);
2531
2532 if (ptr_yy_globals == NULL){
2533 errno = EINVAL;
2534 return 1;
2535 }
2536
2537 *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2538
2539 if (*ptr_yy_globals == NULL){
2540 errno = ENOMEM;
2541 return 1;
2542 }
2543
2544 /* By setting to 0xAA, we expose bugs in
2545 yy_init_globals. Leave at 0x00 for releases. */
2546 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2547
2548 glcpp_set_extra (yy_user_defined, *ptr_yy_globals);
2549
2550 return yy_init_globals ( *ptr_yy_globals );
2551 }
2552
2553 static int yy_init_globals (yyscan_t yyscanner)
2554 {
2555 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2556 /* Initialization is the same as for the non-reentrant scanner.
2557 * This function is called from glcpp_lex_destroy(), so don't allocate here.
2558 */
2559
2560 yyg->yy_buffer_stack = 0;
2561 yyg->yy_buffer_stack_top = 0;
2562 yyg->yy_buffer_stack_max = 0;
2563 yyg->yy_c_buf_p = (char *) 0;
2564 yyg->yy_init = 0;
2565 yyg->yy_start = 0;
2566
2567 yyg->yy_start_stack_ptr = 0;
2568 yyg->yy_start_stack_depth = 0;
2569 yyg->yy_start_stack = NULL;
2570
2571 yyg->yy_state_buf = 0;
2572 yyg->yy_state_ptr = 0;
2573 yyg->yy_full_match = 0;
2574 yyg->yy_lp = 0;
2575
2576 /* Defined in main.c */
2577 #ifdef YY_STDINIT
2578 yyin = stdin;
2579 yyout = stdout;
2580 #else
2581 yyin = (FILE *) 0;
2582 yyout = (FILE *) 0;
2583 #endif
2584
2585 /* For future reference: Set errno on error, since we are called by
2586 * glcpp_lex_init()
2587 */
2588 return 0;
2589 }
2590
2591 /* glcpp_lex_destroy is for both reentrant and non-reentrant scanners. */
2592 int glcpp_lex_destroy (yyscan_t yyscanner)
2593 {
2594 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2595
2596 /* Pop the buffer stack, destroying each element. */
2597 while(YY_CURRENT_BUFFER){
2598 glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
2599 YY_CURRENT_BUFFER_LVALUE = NULL;
2600 glcpp_pop_buffer_state(yyscanner);
2601 }
2602
2603 /* Destroy the stack itself. */
2604 glcpp_free(yyg->yy_buffer_stack ,yyscanner);
2605 yyg->yy_buffer_stack = NULL;
2606
2607 /* Destroy the start condition stack. */
2608 glcpp_free(yyg->yy_start_stack ,yyscanner );
2609 yyg->yy_start_stack = NULL;
2610
2611 glcpp_free ( yyg->yy_state_buf , yyscanner);
2612 yyg->yy_state_buf = NULL;
2613
2614 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2615 * glcpp_lex() is called, initialization will occur. */
2616 yy_init_globals( yyscanner);
2617
2618 /* Destroy the main struct (reentrant only). */
2619 glcpp_free ( yyscanner , yyscanner );
2620 yyscanner = NULL;
2621 return 0;
2622 }
2623
2624 /*
2625 * Internal utility routines.
2626 */
2627
2628 #ifndef yytext_ptr
2629 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2630 {
2631 register int i;
2632 for ( i = 0; i < n; ++i )
2633 s1[i] = s2[i];
2634 }
2635 #endif
2636
2637 #ifdef YY_NEED_STRLEN
2638 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2639 {
2640 register int n;
2641 for ( n = 0; s[n]; ++n )
2642 ;
2643
2644 return n;
2645 }
2646 #endif
2647
2648 void *glcpp_alloc (yy_size_t size , yyscan_t yyscanner)
2649 {
2650 return (void *) malloc( size );
2651 }
2652
2653 void *glcpp_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
2654 {
2655 /* The cast to (char *) in the following accommodates both
2656 * implementations that use char* generic pointers, and those
2657 * that use void* generic pointers. It works with the latter
2658 * because both ANSI C and C++ allow castless assignment from
2659 * any pointer type to void*, and deal with argument conversions
2660 * as though doing an assignment.
2661 */
2662 return (void *) realloc( (char *) ptr, size );
2663 }
2664
2665 void glcpp_free (void * ptr , yyscan_t yyscanner)
2666 {
2667 free( (char *) ptr ); /* see glcpp_realloc() for (char *) cast */
2668 }
2669
2670 #define YYTABLES_NAME "yytables"
2671
2672 #line 319 "glcpp/glcpp-lex.l"
2673
2674
2675
2676 void
2677 glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader)
2678 {
2679 glcpp__scan_string(shader,parser->scanner);
2680 }
2681