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