blob: 6b6aa12d8f7c681cbcfedcba623eeee9df44dd22 [file] [log] [blame]
Carl Worth667173e2010-07-28 12:33:56 -07001#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>
44typedef int8_t flex_int8_t;
45typedef uint8_t flex_uint8_t;
46typedef int16_t flex_int16_t;
47typedef uint16_t flex_uint16_t;
48typedef int32_t flex_int32_t;
49typedef uint32_t flex_uint32_t;
50#else
51typedef signed char flex_int8_t;
52typedef short int flex_int16_t;
53typedef int flex_int32_t;
54typedef unsigned char flex_uint8_t;
55typedef unsigned short int flex_uint16_t;
56typedef unsigned int flex_uint32_t;
57
58/* Limits of integral types. */
59#ifndef INT8_MIN
60#define INT8_MIN (-128)
61#endif
62#ifndef INT16_MIN
63#define INT16_MIN (-32767-1)
64#endif
65#ifndef INT32_MIN
66#define INT32_MIN (-2147483647-1)
67#endif
68#ifndef INT8_MAX
69#define INT8_MAX (127)
70#endif
71#ifndef INT16_MAX
72#define INT16_MAX (32767)
73#endif
74#ifndef INT32_MAX
75#define INT32_MAX (2147483647)
76#endif
77#ifndef UINT8_MAX
78#define UINT8_MAX (255U)
79#endif
80#ifndef UINT16_MAX
81#define UINT16_MAX (65535U)
82#endif
83#ifndef UINT32_MAX
84#define UINT32_MAX (4294967295U)
85#endif
86
Carl Worth5a6285c2010-08-11 13:13:41 -070087#endif /* ! C99 */
88
Carl Worth667173e2010-07-28 12:33:56 -070089#endif /* ! FLEXINT_H */
90
91#ifdef __cplusplus
92
93/* The "const" storage-class-modifier is valid. */
94#define YY_USE_CONST
95
96#else /* ! __cplusplus */
97
98/* C99 requires __STDC__ to be defined as 1. */
99#if defined (__STDC__)
100
101#define YY_USE_CONST
102
103#endif /* defined (__STDC__) */
104#endif /* ! __cplusplus */
105
106#ifdef YY_USE_CONST
107#define yyconst const
108#else
109#define yyconst
110#endif
111
112/* Returned upon end-of-file. */
113#define YY_NULL 0
114
115/* Promotes a possibly negative, possibly signed char to an unsigned
116 * integer for use as an array index. If the signed char is negative,
117 * we want to instead treat it as an 8-bit unsigned char, hence the
118 * double cast.
119 */
120#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
121
122/* An opaque pointer. */
123#ifndef YY_TYPEDEF_YY_SCANNER_T
124#define YY_TYPEDEF_YY_SCANNER_T
125typedef void* yyscan_t;
126#endif
127
128/* For convenience, these vars (plus the bison vars far below)
129 are macros in the reentrant scanner. */
130#define yyin yyg->yyin_r
131#define yyout yyg->yyout_r
132#define yyextra yyg->yyextra_r
133#define yyleng yyg->yyleng_r
134#define yytext yyg->yytext_r
135#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
136#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
137#define yy_flex_debug yyg->yy_flex_debug_r
138
139/* Enter a start condition. This macro really ought to take a parameter,
140 * but we do it the disgusting crufty way forced on us by the ()-less
141 * definition of BEGIN.
142 */
143#define BEGIN yyg->yy_start = 1 + 2 *
144
145/* Translate the current start state into a value that can be later handed
146 * to BEGIN to return to the state. The YYSTATE alias is for lex
147 * compatibility.
148 */
149#define YY_START ((yyg->yy_start - 1) / 2)
150#define YYSTATE YY_START
151
152/* Action number for EOF rule of a given start state. */
153#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
154
155/* Special action meaning "start processing a new file". */
156#define YY_NEW_FILE glcpp_restart(yyin ,yyscanner )
157
158#define YY_END_OF_BUFFER_CHAR 0
159
160/* Size of default input buffer. */
161#ifndef YY_BUF_SIZE
Carl Worth5a6285c2010-08-11 13:13:41 -0700162#ifdef __ia64__
163/* On IA-64, the buffer size is 16k, not 8k.
164 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
165 * Ditto for the __ia64__ case accordingly.
166 */
167#define YY_BUF_SIZE 32768
168#else
Carl Worth667173e2010-07-28 12:33:56 -0700169#define YY_BUF_SIZE 16384
Carl Worth5a6285c2010-08-11 13:13:41 -0700170#endif /* __ia64__ */
Carl Worth667173e2010-07-28 12:33:56 -0700171#endif
172
173/* The state buf must be large enough to hold one state per character in the main buffer.
174 */
175#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
176
177#ifndef YY_TYPEDEF_YY_BUFFER_STATE
178#define YY_TYPEDEF_YY_BUFFER_STATE
179typedef struct yy_buffer_state *YY_BUFFER_STATE;
180#endif
181
182#define EOB_ACT_CONTINUE_SCAN 0
183#define EOB_ACT_END_OF_FILE 1
184#define EOB_ACT_LAST_MATCH 2
185
186 #define YY_LESS_LINENO(n)
187
188/* Return all but the first "n" matched characters back to the input stream. */
189#define yyless(n) \
190 do \
191 { \
192 /* Undo effects of setting up yytext. */ \
193 int yyless_macro_arg = (n); \
194 YY_LESS_LINENO(yyless_macro_arg);\
195 *yy_cp = yyg->yy_hold_char; \
196 YY_RESTORE_YY_MORE_OFFSET \
197 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
198 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
199 } \
200 while ( 0 )
201
202#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
203
204#ifndef YY_TYPEDEF_YY_SIZE_T
205#define YY_TYPEDEF_YY_SIZE_T
206typedef size_t yy_size_t;
207#endif
208
209#ifndef YY_STRUCT_YY_BUFFER_STATE
210#define YY_STRUCT_YY_BUFFER_STATE
211struct yy_buffer_state
212 {
213 FILE *yy_input_file;
214
215 char *yy_ch_buf; /* input buffer */
216 char *yy_buf_pos; /* current position in input buffer */
217
218 /* Size of input buffer in bytes, not including room for EOB
219 * characters.
220 */
221 yy_size_t yy_buf_size;
222
223 /* Number of characters read into yy_ch_buf, not including EOB
224 * characters.
225 */
226 int yy_n_chars;
227
228 /* Whether we "own" the buffer - i.e., we know we created it,
229 * and can realloc() it to grow it, and should free() it to
230 * delete it.
231 */
232 int yy_is_our_buffer;
233
234 /* Whether this is an "interactive" input source; if so, and
235 * if we're using stdio for input, then we want to use getc()
236 * instead of fread(), to make sure we stop fetching input after
237 * each newline.
238 */
239 int yy_is_interactive;
240
241 /* Whether we're considered to be at the beginning of a line.
242 * If so, '^' rules will be active on the next match, otherwise
243 * not.
244 */
245 int yy_at_bol;
246
247 int yy_bs_lineno; /**< The line count. */
248 int yy_bs_column; /**< The column count. */
249
250 /* Whether to try to fill the input buffer when we reach the
251 * end of it.
252 */
253 int yy_fill_buffer;
254
255 int yy_buffer_status;
256
257#define YY_BUFFER_NEW 0
258#define YY_BUFFER_NORMAL 1
259 /* When an EOF's been seen but there's still some text to process
260 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
261 * shouldn't try reading from the input source any more. We might
262 * still have a bunch of tokens to match, though, because of
263 * possible backing-up.
264 *
265 * When we actually see the EOF, we change the status to "new"
266 * (via glcpp_restart()), so that the user can continue scanning by
267 * just pointing yyin at a new input file.
268 */
269#define YY_BUFFER_EOF_PENDING 2
270
271 };
272#endif /* !YY_STRUCT_YY_BUFFER_STATE */
273
274/* We provide macros for accessing buffer states in case in the
275 * future we want to put the buffer states in a more general
276 * "scanner state".
277 *
278 * Returns the top of the stack, or NULL.
279 */
280#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
281 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
282 : NULL)
283
284/* Same as previous macro, but useful when we know that the buffer stack is not
285 * NULL or when we need an lvalue. For internal use only.
286 */
287#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
288
289void glcpp_restart (FILE *input_file ,yyscan_t yyscanner );
290void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
291YY_BUFFER_STATE glcpp__create_buffer (FILE *file,int size ,yyscan_t yyscanner );
292void glcpp__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
293void glcpp__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
294void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
295void glcpp_pop_buffer_state (yyscan_t yyscanner );
296
297static void glcpp_ensure_buffer_stack (yyscan_t yyscanner );
298static void glcpp__load_buffer_state (yyscan_t yyscanner );
299static void glcpp__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
300
301#define YY_FLUSH_BUFFER glcpp__flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
302
303YY_BUFFER_STATE glcpp__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
304YY_BUFFER_STATE glcpp__scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
305YY_BUFFER_STATE glcpp__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
306
307void *glcpp_alloc (yy_size_t ,yyscan_t yyscanner );
308void *glcpp_realloc (void *,yy_size_t ,yyscan_t yyscanner );
309void glcpp_free (void * ,yyscan_t yyscanner );
310
311#define yy_new_buffer glcpp__create_buffer
312
313#define yy_set_interactive(is_interactive) \
314 { \
315 if ( ! YY_CURRENT_BUFFER ){ \
316 glcpp_ensure_buffer_stack (yyscanner); \
317 YY_CURRENT_BUFFER_LVALUE = \
318 glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
319 } \
320 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
321 }
322
323#define yy_set_bol(at_bol) \
324 { \
325 if ( ! YY_CURRENT_BUFFER ){\
326 glcpp_ensure_buffer_stack (yyscanner); \
327 YY_CURRENT_BUFFER_LVALUE = \
328 glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
329 } \
330 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
331 }
332
333#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
334
335/* Begin user sect3 */
336
337#define glcpp_wrap(n) 1
338#define YY_SKIP_YYWRAP
339
340typedef unsigned char YY_CHAR;
341
342typedef int yy_state_type;
343
344#define yytext_ptr yytext_r
345
346static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
347static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
348static int yy_get_next_buffer (yyscan_t yyscanner );
349static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
350
351/* Done after the current pattern has been matched and before the
352 * corresponding action - sets up yytext.
353 */
354#define YY_DO_BEFORE_ACTION \
355 yyg->yytext_ptr = yy_bp; \
356 yyleng = (size_t) (yy_cp - yy_bp); \
357 yyg->yy_hold_char = *yy_cp; \
358 *yy_cp = '\0'; \
359 yyg->yy_c_buf_p = yy_cp;
360
Eric Anholtd4a04f32010-07-28 16:58:39 -0700361#define YY_NUM_RULES 41
362#define YY_END_OF_BUFFER 42
Carl Worth667173e2010-07-28 12:33:56 -0700363/* This struct is not used in this scanner,
364 but its presence is necessary. */
365struct yy_trans_info
366 {
367 flex_int32_t yy_verify;
368 flex_int32_t yy_nxt;
369 };
Eric Anholtd4a04f32010-07-28 16:58:39 -0700370static yyconst flex_int16_t yy_acclist[133] =
Carl Worth667173e2010-07-28 12:33:56 -0700371 { 0,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700372 3, 3, 42, 37, 41, 38, 41, 39, 41, 41,
373 36, 41, 41, 36, 41, 36, 41, 36, 41, 23,
374 37, 41, 22, 37, 41, 36, 41, 36, 41, 36,
375 41, 35, 37, 41, 35, 37, 41, 36, 41, 38,
376 41, 21, 41, 41, 3, 41, 4, 41, 5, 41,
377 40, 41, 37, 16, 38, 30, 33, 31, 2, 23,
378 37, 23, 37, 37, 22, 37, 22, 37, 25, 27,
379 29, 28, 26, 35, 37, 35, 37, 32, 38, 21,
380 21, 3, 4, 5, 6, 5, 7, 1, 16, 24,
381 37, 35, 37,16396, 24, 37, 35, 37, 16, 35,
Carl Worth667173e2010-07-28 12:33:56 -0700382
Eric Anholtd4a04f32010-07-28 16:58:39 -0700383 37,16397,16398, 8204, 16, 8204, 35, 37, 8205, 16,
384 8206, 16,16399, 17,16394, 20, 34, 35, 37, 19,
385 8207, 16, 17, 8202, 16,16395,16402, 8203, 16, 9,
386 8, 8210
Carl Worth667173e2010-07-28 12:33:56 -0700387 } ;
388
Eric Anholtd4a04f32010-07-28 16:58:39 -0700389static yyconst flex_int16_t yy_accept[152] =
Carl Worth667173e2010-07-28 12:33:56 -0700390 { 0,
391 1, 1, 1, 1, 1, 2, 3, 3, 3, 4,
392 6, 8, 10, 11, 13, 14, 16, 18, 20, 23,
393 26, 28, 30, 32, 35, 38, 40, 42, 44, 45,
394 47, 49, 51, 53, 54, 54, 55, 56, 57, 58,
395 59, 60, 60, 62, 64, 65, 67, 69, 70, 71,
396 72, 73, 74, 76, 78, 79, 80, 81, 82, 82,
397 82, 82, 82, 82, 82, 83, 84, 85, 86, 87,
398 88, 88, 90, 92, 94, 94, 94, 94, 94, 94,
399 95, 95, 95, 95, 97, 99, 99, 99, 99, 99,
400 99, 99, 99, 100, 100, 100, 100, 100, 100, 102,
401
402 102, 103, 104, 104, 104, 104, 104, 106, 106, 107,
403 107, 107, 107, 107, 107, 109, 109, 109, 111, 111,
404 113, 114, 115, 115, 116, 116, 116, 117, 117, 120,
405 121, 121, 123, 124, 124, 124, 126, 127, 127, 127,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700406 128, 128, 128, 130, 131, 132, 132, 132, 133, 133,
407 133
Carl Worth667173e2010-07-28 12:33:56 -0700408 } ;
409
410static yyconst flex_int32_t yy_ec[256] =
411 { 0,
412 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
413 4, 4, 4, 1, 1, 1, 1, 1, 1, 1,
414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
415 1, 2, 5, 1, 6, 1, 7, 8, 1, 9,
416 7, 10, 7, 7, 7, 7, 11, 12, 13, 13,
417 13, 13, 13, 13, 13, 14, 14, 1, 7, 15,
418 16, 17, 1, 1, 18, 18, 18, 18, 18, 18,
419 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
420 19, 19, 19, 19, 20, 19, 19, 21, 19, 19,
421 7, 1, 7, 7, 19, 1, 22, 18, 18, 23,
422
423 24, 25, 26, 19, 27, 19, 19, 28, 29, 30,
424 31, 32, 19, 33, 34, 35, 36, 37, 19, 38,
425 19, 19, 7, 39, 7, 7, 1, 1, 1, 1,
426 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
432 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
433
434 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
435 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
436 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
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
440 } ;
441
442static yyconst flex_int32_t yy_meta[40] =
443 { 0,
444 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
445 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
446 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
447 1, 1, 1, 1, 1, 1, 1, 1, 1
448 } ;
449
Eric Anholtd4a04f32010-07-28 16:58:39 -0700450static yyconst flex_int16_t yy_base[170] =
Carl Worth667173e2010-07-28 12:33:56 -0700451 { 0,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700452 0, 38, 0, 0, 38, 39, 427, 426, 428, 48,
453 43, 549, 424, 44, 63, 423, 59, 65, 87, 125,
454 58, 67, 68, 164, 203, 40, 75, 241, 549, 422,
455 549, 140, 549, 140, 421, 549, 144, 420, 419, 418,
456 417, 415, 156, 179, 267, 0, 209, 414, 413, 412,
457 411, 410, 388, 124, 408, 153, 404, 403, 154, 198,
458 159, 155, 160, 192, 405, 549, 186, 549, 214, 549,
459 404, 549, 162, 159, 227, 229, 230, 234, 199, 303,
Carl Worth667173e2010-07-28 12:33:56 -0700460 232, 235, 236, 262, 56, 243, 237, 247, 245, 252,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700461 291, 359, 358, 292, 238, 296, 293, 254, 336, 256,
Carl Worth667173e2010-07-28 12:33:56 -0700462
Eric Anholtd4a04f32010-07-28 16:58:39 -0700463 356, 355, 298, 294, 263, 354, 549, 352, 549, 299,
464 297, 322, 325, 257, 306, 328, 350, 549, 346, 549,
465 345, 344, 329, 343, 331, 332, 342, 333, 320, 335,
466 340, 549, 337, 338, 248, 549, 246, 197, 336, 366,
467 403, 184, 549, 182, 141, 434, 416, 79, 473, 549,
468 512, 514, 516, 518, 520, 522, 71, 524, 526, 528,
469 530, 532, 534, 536, 538, 540, 542, 544, 546
Carl Worth667173e2010-07-28 12:33:56 -0700470 } ;
471
Eric Anholtd4a04f32010-07-28 16:58:39 -0700472static yyconst flex_int16_t yy_def[170] =
Carl Worth667173e2010-07-28 12:33:56 -0700473 { 0,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700474 150, 1, 151, 151, 152, 152, 153, 153, 150, 154,
475 155, 150, 155, 155, 155, 155, 155, 155, 150, 154,
476 155, 155, 155, 156, 156, 155, 155, 155, 150, 157,
477 150, 158, 150, 20, 155, 150, 155, 155, 155, 155,
478 155, 159, 19, 20, 20, 20, 20, 155, 155, 155,
479 155, 155, 25, 25, 155, 155, 28, 28, 155, 155,
480 155, 155, 155, 155, 157, 150, 158, 150, 158, 150,
481 159, 150, 45, 25, 155, 155, 155, 155, 155, 155,
482 155, 155, 155, 20, 25, 155, 155, 155, 155, 155,
483 155, 160, 161, 155, 155, 155, 155, 155, 25, 155,
Carl Worth667173e2010-07-28 12:33:56 -0700484
Eric Anholtd4a04f32010-07-28 16:58:39 -0700485 162, 163, 155, 155, 155, 160, 150, 161, 150, 155,
486 155, 155, 155, 155, 25, 155, 162, 150, 163, 150,
487 164, 165, 155, 166, 155, 155, 155, 155, 25, 155,
488 164, 150, 165, 155, 166, 150, 167, 168, 155, 150,
489 155, 167, 150, 168, 155, 169, 155, 155, 169, 0,
490 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
491 150, 150, 150, 150, 150, 150, 150, 150, 150
Carl Worth667173e2010-07-28 12:33:56 -0700492 } ;
493
494static yyconst flex_int16_t yy_nxt[589] =
495 { 0,
496 10, 11, 12, 13, 14, 15, 16, 17, 16, 16,
497 18, 19, 20, 20, 21, 22, 23, 24, 24, 24,
498 24, 24, 25, 24, 24, 24, 24, 24, 24, 24,
499 24, 24, 24, 24, 24, 24, 24, 24, 26, 27,
500 31, 31, 36, 28, 37, 36, 36, 32, 32, 35,
501 36, 35, 35, 35, 35, 35, 35, 35, 35, 38,
502 36, 36, 35, 35, 35, 36, 40, 36, 39, 36,
503 36, 65, 48, 49, 41, 42, 56, 36, 55, 53,
504 57, 36, 50, 51, 52, 99, 35, 34, 35, 36,
505 35, 35, 35, 35, 35, 35, 35, 35, 43, 43,
506
507 34, 35, 35, 35, 34, 34, 44, 45, 34, 34,
508 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
509 34, 34, 44, 34, 45, 35, 35, 36, 35, 35,
510 35, 35, 35, 35, 35, 35, 46, 46, 46, 35,
511 35, 35, 68, 36, 47, 37, 36, 53, 74, 69,
512 70, 34, 34, 34, 56, 36, 36, 36, 57, 34,
513 47, 36, 36, 35, 34, 35, 36, 35, 35, 35,
514 35, 35, 35, 35, 35, 34, 34, 75, 35, 35,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700515 35, 84, 53, 80, 36, 85, 143, 81, 68, 82,
516 34, 34, 34, 34, 36, 150, 150, 84, 34, 36,
Carl Worth667173e2010-07-28 12:33:56 -0700517
518 36, 36, 35, 34, 35, 36, 35, 35, 35, 35,
519 35, 35, 35, 35, 34, 83, 68, 35, 35, 35,
520 34, 34, 34, 69, 70, 76, 54, 77, 34, 36,
521 78, 36, 36, 91, 36, 79, 36, 36, 36, 36,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700522 36, 35, 58, 36, 34, 36, 39, 36, 143, 36,
523 136, 86, 89, 96, 36, 87, 36, 97, 36, 36,
Carl Worth667173e2010-07-28 12:33:56 -0700524 111, 101, 88, 59, 60, 36, 90, 61, 98, 100,
525 102, 103, 62, 34, 34, 34, 63, 64, 73, 73,
526 73, 34, 104, 128, 73, 116, 34, 114, 73, 73,
527 73, 73, 123, 36, 36, 36, 36, 34, 36, 36,
528
529 36, 36, 34, 92, 92, 93, 92, 92, 92, 92,
530 92, 92, 92, 92, 105, 110, 113, 92, 92, 92,
531 125, 112, 121, 124, 36, 94, 122, 36, 129, 53,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700532 36, 36, 95, 36, 36, 36, 140, 36, 36, 36,
533 36, 92, 132, 53, 36, 136, 36, 132, 120, 127,
534 126, 130, 118, 138, 109, 137, 107, 120, 118, 115,
535 109, 107, 134, 139, 141, 145, 35, 140, 36, 35,
Carl Worth667173e2010-07-28 12:33:56 -0700536 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700537 35, 35, 35, 146, 146, 146, 146, 146, 146, 146,
538 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
Carl Worth667173e2010-07-28 12:33:56 -0700539
Eric Anholtd4a04f32010-07-28 16:58:39 -0700540 146, 146, 146, 146, 35, 36, 72, 66, 35, 35,
541 36, 53, 36, 36, 36, 36, 36, 72, 36, 36,
542 36, 36, 36, 36, 66, 36, 36, 150, 29, 29,
543 150, 150, 150, 147, 35, 35, 36, 35, 35, 35,
544 35, 35, 148, 35, 35, 138, 150, 150, 35, 35,
545 35, 150, 150, 150, 150, 150, 150, 150, 150, 150,
546 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
547 150, 150, 35, 35, 35, 36, 35, 35, 35, 35,
548 35, 148, 35, 35, 150, 150, 150, 35, 35, 35,
549 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
Carl Worth667173e2010-07-28 12:33:56 -0700550
Eric Anholtd4a04f32010-07-28 16:58:39 -0700551 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
552 150, 35, 29, 29, 30, 30, 33, 33, 34, 34,
Carl Worth667173e2010-07-28 12:33:56 -0700553 35, 35, 53, 53, 67, 67, 71, 71, 106, 106,
554 108, 108, 117, 117, 119, 119, 131, 131, 133, 133,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700555 135, 135, 142, 142, 144, 144, 149, 149, 9, 150,
556 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
557 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
558 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
559 150, 150, 150, 150, 150, 150, 150, 150
Carl Worth667173e2010-07-28 12:33:56 -0700560 } ;
561
562static yyconst flex_int16_t yy_chk[589] =
563 { 0,
564 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
565 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
566 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
567 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
568 5, 6, 26, 2, 11, 11, 14, 5, 6, 10,
569 10, 10, 10, 10, 10, 10, 10, 10, 10, 14,
570 21, 17, 10, 10, 10, 15, 17, 18, 15, 22,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700571 23, 157, 21, 21, 18, 18, 27, 27, 26, 85,
572 27, 148, 22, 23, 23, 85, 10, 19, 19, 19,
Carl Worth667173e2010-07-28 12:33:56 -0700573 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
574
575 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
576 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
577 19, 19, 19, 19, 19, 19, 20, 20, 20, 20,
578 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700579 20, 20, 32, 145, 20, 37, 37, 54, 54, 32,
Carl Worth667173e2010-07-28 12:33:56 -0700580 32, 34, 34, 34, 56, 56, 59, 62, 56, 34,
581 20, 61, 63, 20, 24, 24, 24, 24, 24, 24,
582 24, 24, 24, 24, 24, 34, 43, 59, 24, 24,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700583 24, 73, 74, 61, 144, 74, 142, 62, 67, 63,
584 44, 44, 44, 43, 64, 67, 67, 73, 44, 138,
Carl Worth667173e2010-07-28 12:33:56 -0700585
586 60, 79, 24, 25, 25, 25, 25, 25, 25, 25,
587 25, 25, 25, 25, 44, 64, 69, 25, 25, 25,
588 47, 47, 47, 69, 69, 60, 25, 60, 47, 75,
589 60, 76, 77, 79, 81, 60, 78, 82, 83, 87,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700590 95, 25, 28, 28, 47, 86, 28, 89, 137, 88,
591 135, 75, 77, 81, 90, 76, 98, 82, 100, 114,
Carl Worth667173e2010-07-28 12:33:56 -0700592 95, 87, 76, 28, 28, 105, 78, 28, 83, 86,
593 88, 89, 28, 84, 84, 84, 28, 28, 45, 45,
594 45, 84, 90, 114, 45, 100, 45, 98, 45, 45,
595 45, 45, 105, 91, 94, 97, 104, 84, 96, 111,
596
597 103, 110, 45, 80, 80, 80, 80, 80, 80, 80,
598 80, 80, 80, 80, 91, 94, 97, 80, 80, 80,
599 111, 96, 103, 110, 112, 80, 104, 113, 115, 115,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700600 116, 123, 80, 125, 126, 128, 130, 130, 139, 133,
601 134, 80, 131, 129, 127, 124, 122, 121, 119, 113,
602 112, 116, 117, 126, 108, 125, 106, 102, 101, 99,
603 93, 92, 123, 128, 134, 139, 140, 140, 140, 140,
Carl Worth667173e2010-07-28 12:33:56 -0700604 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
605 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
606 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
607
Eric Anholtd4a04f32010-07-28 16:58:39 -0700608 140, 140, 140, 140, 140, 141, 71, 65, 58, 57,
609 55, 53, 52, 51, 50, 49, 48, 42, 147, 41,
610 40, 39, 38, 35, 30, 16, 13, 9, 8, 7,
611 0, 0, 0, 141, 146, 146, 146, 146, 146, 146,
612 146, 146, 146, 146, 146, 147, 0, 0, 146, 146,
613 146, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Carl Worth667173e2010-07-28 12:33:56 -0700614 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700615 0, 0, 146, 149, 149, 149, 149, 149, 149, 149,
616 149, 149, 149, 149, 0, 0, 0, 149, 149, 149,
Carl Worth667173e2010-07-28 12:33:56 -0700617 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
618
619 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Eric Anholtd4a04f32010-07-28 16:58:39 -0700620 0, 149, 151, 151, 152, 152, 153, 153, 154, 154,
621 155, 155, 156, 156, 158, 158, 159, 159, 160, 160,
622 161, 161, 162, 162, 163, 163, 164, 164, 165, 165,
623 166, 166, 167, 167, 168, 168, 169, 169, 150, 150,
624 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
625 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
626 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
627 150, 150, 150, 150, 150, 150, 150, 150
Carl Worth667173e2010-07-28 12:33:56 -0700628 } ;
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 */ \
635yy_cp = yyg->yy_full_match; /* restore poss. backed-over text */ \
636yyg->yy_lp = yyg->yy_full_lp; /* restore orig. accepting pos. */ \
637yyg->yy_state_ptr = yyg->yy_full_state; /* restore orig. state */ \
638yy_current_state = *yyg->yy_state_ptr; /* restore curr. state */ \
639++yyg->yy_lp; \
640goto 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. */
680int glcpp_get_column (yyscan_t yyscanner);
681void 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->source = 0; \
688 yylloc->first_column = yycolumn + 1; \
689 yylloc->first_line = yylineno; \
690 yycolumn += yyleng; \
691 } while(0);
Carl Worth5a6285c2010-08-11 13:13:41 -0700692#define YY_USER_INIT yylineno = 1; yycolumn = 1;
Carl Worth667173e2010-07-28 12:33:56 -0700693
Carl Worth5a6285c2010-08-11 13:13:41 -0700694#line 695 "glcpp/glcpp-lex.c"
Carl Worth667173e2010-07-28 12:33:56 -0700695
696#define INITIAL 0
697#define DONE 1
698#define COMMENT 2
699#define UNREACHABLE 3
700
Carl Worth667173e2010-07-28 12:33:56 -0700701#define YY_EXTRA_TYPE glcpp_parser_t *
702
703/* Holds the entire state of the reentrant scanner. */
704struct yyguts_t
705 {
706
707 /* User-defined. Not touched by flex. */
708 YY_EXTRA_TYPE yyextra_r;
709
710 /* The rest are the same as the globals declared in the non-reentrant scanner. */
711 FILE *yyin_r, *yyout_r;
712 size_t yy_buffer_stack_top; /**< index of top of stack. */
713 size_t yy_buffer_stack_max; /**< capacity of stack. */
714 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
715 char yy_hold_char;
716 int yy_n_chars;
717 int yyleng_r;
718 char *yy_c_buf_p;
719 int yy_init;
720 int yy_start;
721 int yy_did_buffer_switch_on_eof;
722 int yy_start_stack_ptr;
723 int yy_start_stack_depth;
724 int *yy_start_stack;
725 yy_state_type yy_last_accepting_state;
726 char* yy_last_accepting_cpos;
727
728 int yylineno_r;
729 int yy_flex_debug_r;
730
731 yy_state_type *yy_state_buf;
732 yy_state_type *yy_state_ptr;
733 char *yy_full_match;
734 int yy_lp;
735
736 /* These are only needed for trailing context rules,
737 * but there's no conditional variable for that yet. */
738 int yy_looking_for_trail_begin;
739 int yy_full_lp;
740 int *yy_full_state;
741
742 char *yytext_r;
743 int yy_more_flag;
744 int yy_more_len;
745
746 YYSTYPE * yylval_r;
747
748 YYLTYPE * yylloc_r;
749
750 }; /* end struct yyguts_t */
751
752static int yy_init_globals (yyscan_t yyscanner );
753
754 /* This must go here because YYSTYPE and YYLTYPE are included
755 * from bison output in section 1.*/
756 # define yylval yyg->yylval_r
757
758 # define yylloc yyg->yylloc_r
759
760int glcpp_lex_init (yyscan_t* scanner);
761
762int glcpp_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
763
764/* Accessor methods to globals.
765 These are made visible to non-reentrant scanners for convenience. */
766
767int glcpp_lex_destroy (yyscan_t yyscanner );
768
769int glcpp_get_debug (yyscan_t yyscanner );
770
771void glcpp_set_debug (int debug_flag ,yyscan_t yyscanner );
772
773YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner );
774
775void glcpp_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
776
777FILE *glcpp_get_in (yyscan_t yyscanner );
778
779void glcpp_set_in (FILE * in_str ,yyscan_t yyscanner );
780
781FILE *glcpp_get_out (yyscan_t yyscanner );
782
783void glcpp_set_out (FILE * out_str ,yyscan_t yyscanner );
784
785int glcpp_get_leng (yyscan_t yyscanner );
786
787char *glcpp_get_text (yyscan_t yyscanner );
788
789int glcpp_get_lineno (yyscan_t yyscanner );
790
791void glcpp_set_lineno (int line_number ,yyscan_t yyscanner );
792
793YYSTYPE * glcpp_get_lval (yyscan_t yyscanner );
794
795void glcpp_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
796
797 YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner );
798
799 void glcpp_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
800
801/* Macros after this point can all be overridden by user definitions in
802 * section 1.
803 */
804
805#ifndef YY_SKIP_YYWRAP
806#ifdef __cplusplus
807extern "C" int glcpp_wrap (yyscan_t yyscanner );
808#else
809extern int glcpp_wrap (yyscan_t yyscanner );
810#endif
811#endif
812
813 static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
814
815#ifndef yytext_ptr
816static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
817#endif
818
819#ifdef YY_NEED_STRLEN
820static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
821#endif
822
823#ifndef YY_NO_INPUT
824
825#ifdef __cplusplus
826static int yyinput (yyscan_t yyscanner );
827#else
828static int input (yyscan_t yyscanner );
829#endif
830
831#endif
832
833 static void yy_push_state (int new_state ,yyscan_t yyscanner);
834
835 static void yy_pop_state (yyscan_t yyscanner );
836
837 static int yy_top_state (yyscan_t yyscanner );
838
839/* Amount of stuff to slurp up with each read. */
840#ifndef YY_READ_BUF_SIZE
Carl Worth5a6285c2010-08-11 13:13:41 -0700841#ifdef __ia64__
842/* On IA-64, the buffer size is 16k, not 8k */
843#define YY_READ_BUF_SIZE 16384
844#else
Carl Worth667173e2010-07-28 12:33:56 -0700845#define YY_READ_BUF_SIZE 8192
Carl Worth5a6285c2010-08-11 13:13:41 -0700846#endif /* __ia64__ */
Carl Worth667173e2010-07-28 12:33:56 -0700847#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 */
Carl Worth5a6285c2010-08-11 13:13:41 -0700854#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
Carl Worth667173e2010-07-28 12:33:56 -0700855#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 = '*'; \
Carl Worth5a6285c2010-08-11 13:13:41 -0700865 size_t n; \
Carl Worth667173e2010-07-28 12:33:56 -0700866 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
919extern 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 */
946YY_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
Ian Romanick23f60172010-08-13 13:13:24 -0700953#line 70 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -0700954
955
956 /* Single-line comments */
Ian Romanick23f60172010-08-13 13:13:24 -0700957#line 958 "glcpp/glcpp-lex.c"
Carl Worth667173e2010-07-28 12:33:56 -0700958
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
1013yy_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];
Eric Anholtd4a04f32010-07-28 16:58:39 -07001020 if ( yy_current_state >= 151 )
Carl Worth667173e2010-07-28 12:33:56 -07001021 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 }
Ian Romanick23f60172010-08-13 13:13:24 -07001027 while ( yy_current_state != 150 );
Carl Worth667173e2010-07-28 12:33:56 -07001028
1029yy_find_action:
1030 yy_current_state = *--yyg->yy_state_ptr;
1031 yyg->yy_lp = yy_accept[yy_current_state];
1032find_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
1073do_action: /* This label is used only to access EOF actions. */
1074
1075 switch ( yy_act )
1076 { /* beginning of action switch */
1077case 1:
1078/* rule 1 can match eol */
1079YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001080#line 73 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001081{
1082 yylineno++;
1083 yycolumn = 0;
1084 return NEWLINE;
1085}
1086 YY_BREAK
1087/* Multi-line comments */
1088case 2:
1089YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001090#line 80 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001091{ yy_push_state(COMMENT, yyscanner); }
1092 YY_BREAK
1093case 3:
1094YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001095#line 81 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001096
1097 YY_BREAK
1098case 4:
1099/* rule 4 can match eol */
1100YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001101#line 82 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001102{ yylineno++; yycolumn = 0; }
1103 YY_BREAK
1104case 5:
1105YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001106#line 83 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001107
1108 YY_BREAK
1109case 6:
1110/* rule 6 can match eol */
1111YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001112#line 84 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001113{ yylineno++; yycolumn = 0; }
1114 YY_BREAK
1115case 7:
1116YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001117#line 85 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001118{
1119 yy_pop_state(yyscanner);
1120 if (yyextra->space_tokens)
1121 return SPACE;
1122}
1123 YY_BREAK
Carl Worth667173e2010-07-28 12:33:56 -07001124case 8:
1125YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001126#line 91 "glcpp/glcpp-lex.l"
Eric Anholtd4a04f32010-07-28 16:58:39 -07001127{
Kenneth Graunke0ef79a52010-08-03 20:25:13 -07001128 yylval->str = talloc_strdup (yyextra, yytext);
Eric Anholtd4a04f32010-07-28 16:58:39 -07001129 yylineno++;
1130 yycolumn = 0;
1131 yyextra->space_tokens = 0;
1132 return HASH_VERSION;
1133}
1134 YY_BREAK
1135/* glcpp doesn't handle #extension, #version, or #pragma directives.
1136 * Simply pass them through to the main compiler's lexer/parser. */
1137case 9:
1138YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001139#line 101 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001140{
Kenneth Graunke0ef79a52010-08-03 20:25:13 -07001141 yylval->str = talloc_strdup (yyextra, yytext);
Carl Worth667173e2010-07-28 12:33:56 -07001142 yylineno++;
1143 yycolumn = 0;
1144 return OTHER;
1145}
1146 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001147case 10:
1148/* rule 10 can match eol */
Carl Worth667173e2010-07-28 12:33:56 -07001149YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001150#line 108 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001151{
1152 yyextra->lexing_if = 1;
1153 yyextra->space_tokens = 0;
1154 return HASH_IFDEF;
1155}
1156 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001157case 11:
1158/* rule 11 can match eol */
Carl Worth667173e2010-07-28 12:33:56 -07001159YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001160#line 114 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001161{
1162 yyextra->lexing_if = 1;
1163 yyextra->space_tokens = 0;
1164 return HASH_IFNDEF;
1165}
1166 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001167case 12:
1168/* rule 12 can match eol */
Carl Worth667173e2010-07-28 12:33:56 -07001169YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001170#line 120 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001171{
1172 yyextra->lexing_if = 1;
1173 yyextra->space_tokens = 0;
1174 return HASH_IF;
1175}
1176 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001177case 13:
1178/* rule 13 can match eol */
Carl Worth667173e2010-07-28 12:33:56 -07001179YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001180#line 126 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001181{
1182 yyextra->lexing_if = 1;
1183 yyextra->space_tokens = 0;
1184 return HASH_ELIF;
1185}
1186 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001187case 14:
1188/* rule 14 can match eol */
Carl Worth667173e2010-07-28 12:33:56 -07001189YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001190#line 132 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001191{
1192 yyextra->space_tokens = 0;
1193 return HASH_ELSE;
1194}
1195 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001196case 15:
1197/* rule 15 can match eol */
Carl Worth667173e2010-07-28 12:33:56 -07001198YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001199#line 137 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001200{
1201 yyextra->space_tokens = 0;
1202 return HASH_ENDIF;
1203}
1204 YY_BREAK
1205/* When skipping (due to an #if 0 or similar) consume anything
1206 * up to a newline. We do this with less priority than any
1207 * #if-related directive (#if, #elif, #else, #endif), but with
1208 * more priority than any other directive or token to avoid
1209 * any side-effects from skipped content.
1210 *
1211 * We use the lexing_if flag to avoid skipping any part of an
1212 * if conditional expression. */
Eric Anholtd4a04f32010-07-28 16:58:39 -07001213case 16:
1214/* rule 16 can match eol */
Carl Worth667173e2010-07-28 12:33:56 -07001215*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1216yyg->yy_c_buf_p = yy_cp -= 1;
1217YY_DO_BEFORE_ACTION; /* set up yytext again */
1218YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001219#line 150 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001220{
1221 /* Since this rule always matches, YY_USER_ACTION gets called for it,
1222 * wrongly incrementing yycolumn. We undo that effect here. */
1223 yycolumn -= yyleng;
1224 if (yyextra->lexing_if ||
1225 yyextra->skip_stack == NULL ||
1226 yyextra->skip_stack->type == SKIP_NO_SKIP)
1227 {
1228 REJECT;
1229 }
1230}
1231 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001232case 17:
Carl Worth667173e2010-07-28 12:33:56 -07001233YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001234#line 162 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001235{
1236 char *p;
1237 for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */
1238 p += 5; /* skip "error" */
1239 glcpp_error(yylloc, yyextra, "#error%s", p);
1240}
1241 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001242case 18:
Carl Worth667173e2010-07-28 12:33:56 -07001243YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001244#line 169 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001245{
1246 yyextra->space_tokens = 0;
1247 return HASH_DEFINE_FUNC;
1248}
1249 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001250case 19:
Carl Worth667173e2010-07-28 12:33:56 -07001251YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001252#line 174 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001253{
1254 yyextra->space_tokens = 0;
1255 return HASH_DEFINE_OBJ;
1256}
1257 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001258case 20:
Carl Worth667173e2010-07-28 12:33:56 -07001259YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001260#line 179 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001261{
1262 yyextra->space_tokens = 0;
1263 return HASH_UNDEF;
1264}
1265 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001266case 21:
Carl Worth667173e2010-07-28 12:33:56 -07001267YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001268#line 184 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001269{
1270 yyextra->space_tokens = 0;
1271 return HASH;
1272}
1273 YY_BREAK
Carl Worth667173e2010-07-28 12:33:56 -07001274case 22:
1275YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001276#line 189 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001277{
Kenneth Graunke0ef79a52010-08-03 20:25:13 -07001278 yylval->str = talloc_strdup (yyextra, yytext);
Carl Worth667173e2010-07-28 12:33:56 -07001279 return INTEGER_STRING;
1280}
1281 YY_BREAK
1282case 23:
1283YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001284#line 194 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001285{
Kenneth Graunke0ef79a52010-08-03 20:25:13 -07001286 yylval->str = talloc_strdup (yyextra, yytext);
Carl Worth667173e2010-07-28 12:33:56 -07001287 return INTEGER_STRING;
1288}
1289 YY_BREAK
1290case 24:
1291YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001292#line 199 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001293{
Kenneth Graunke0ef79a52010-08-03 20:25:13 -07001294 yylval->str = talloc_strdup (yyextra, yytext);
Eric Anholtd4a04f32010-07-28 16:58:39 -07001295 return INTEGER_STRING;
Carl Worth667173e2010-07-28 12:33:56 -07001296}
1297 YY_BREAK
1298case 25:
1299YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001300#line 204 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001301{
Eric Anholtd4a04f32010-07-28 16:58:39 -07001302 return LEFT_SHIFT;
Carl Worth667173e2010-07-28 12:33:56 -07001303}
1304 YY_BREAK
1305case 26:
1306YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001307#line 208 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001308{
Eric Anholtd4a04f32010-07-28 16:58:39 -07001309 return RIGHT_SHIFT;
Carl Worth667173e2010-07-28 12:33:56 -07001310}
1311 YY_BREAK
1312case 27:
1313YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001314#line 212 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001315{
Eric Anholtd4a04f32010-07-28 16:58:39 -07001316 return LESS_OR_EQUAL;
Carl Worth667173e2010-07-28 12:33:56 -07001317}
1318 YY_BREAK
1319case 28:
1320YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001321#line 216 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001322{
Eric Anholtd4a04f32010-07-28 16:58:39 -07001323 return GREATER_OR_EQUAL;
Carl Worth667173e2010-07-28 12:33:56 -07001324}
1325 YY_BREAK
1326case 29:
1327YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001328#line 220 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001329{
Eric Anholtd4a04f32010-07-28 16:58:39 -07001330 return EQUAL;
Carl Worth667173e2010-07-28 12:33:56 -07001331}
1332 YY_BREAK
1333case 30:
1334YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001335#line 224 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001336{
Eric Anholtd4a04f32010-07-28 16:58:39 -07001337 return NOT_EQUAL;
Carl Worth667173e2010-07-28 12:33:56 -07001338}
1339 YY_BREAK
1340case 31:
1341YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001342#line 228 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001343{
Eric Anholtd4a04f32010-07-28 16:58:39 -07001344 return AND;
Carl Worth667173e2010-07-28 12:33:56 -07001345}
1346 YY_BREAK
1347case 32:
1348YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001349#line 232 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001350{
Eric Anholtd4a04f32010-07-28 16:58:39 -07001351 return OR;
Carl Worth667173e2010-07-28 12:33:56 -07001352}
1353 YY_BREAK
1354case 33:
1355YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001356#line 236 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001357{
Eric Anholtd4a04f32010-07-28 16:58:39 -07001358 return PASTE;
Carl Worth667173e2010-07-28 12:33:56 -07001359}
1360 YY_BREAK
1361case 34:
1362YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001363#line 240 "glcpp/glcpp-lex.l"
Eric Anholtd4a04f32010-07-28 16:58:39 -07001364{
1365 return DEFINED;
1366}
1367 YY_BREAK
1368case 35:
1369YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001370#line 244 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001371{
Kenneth Graunke0ef79a52010-08-03 20:25:13 -07001372 yylval->str = talloc_strdup (yyextra, yytext);
Carl Worth667173e2010-07-28 12:33:56 -07001373 return IDENTIFIER;
1374}
1375 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001376case 36:
Carl Worth667173e2010-07-28 12:33:56 -07001377YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001378#line 249 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001379{
1380 return yytext[0];
1381}
1382 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001383case 37:
Carl Worth667173e2010-07-28 12:33:56 -07001384YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001385#line 253 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001386{
Kenneth Graunke0ef79a52010-08-03 20:25:13 -07001387 yylval->str = talloc_strdup (yyextra, yytext);
Carl Worth667173e2010-07-28 12:33:56 -07001388 return OTHER;
1389}
1390 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001391case 38:
Carl Worth667173e2010-07-28 12:33:56 -07001392YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001393#line 258 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001394{
1395 if (yyextra->space_tokens) {
1396 return SPACE;
1397 }
1398}
1399 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001400case 39:
1401/* rule 39 can match eol */
Carl Worth667173e2010-07-28 12:33:56 -07001402YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001403#line 264 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001404{
1405 yyextra->lexing_if = 0;
1406 yylineno++;
1407 yycolumn = 0;
1408 return NEWLINE;
1409}
1410 YY_BREAK
1411/* Handle missing newline at EOF. */
1412case YY_STATE_EOF(INITIAL):
Ian Romanick23f60172010-08-13 13:13:24 -07001413#line 272 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001414{
1415 BEGIN DONE; /* Don't keep matching this rule forever. */
1416 yyextra->lexing_if = 0;
1417 return NEWLINE;
1418}
1419 YY_BREAK
1420/* We don't actually use the UNREACHABLE start condition. We
1421 only have this action here so that we can pretend to call some
1422 generated functions, (to avoid "defined but not used"
1423 warnings. */
Eric Anholtd4a04f32010-07-28 16:58:39 -07001424case 40:
Carl Worth667173e2010-07-28 12:33:56 -07001425YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001426#line 282 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001427{
1428 unput('.');
1429 yy_top_state(yyextra);
1430}
1431 YY_BREAK
Eric Anholtd4a04f32010-07-28 16:58:39 -07001432case 41:
Carl Worth667173e2010-07-28 12:33:56 -07001433YY_RULE_SETUP
Ian Romanick23f60172010-08-13 13:13:24 -07001434#line 287 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07001435ECHO;
1436 YY_BREAK
Ian Romanick23f60172010-08-13 13:13:24 -07001437#line 1438 "glcpp/glcpp-lex.c"
Carl Worth667173e2010-07-28 12:33:56 -07001438 case YY_STATE_EOF(DONE):
1439 case YY_STATE_EOF(COMMENT):
1440 case YY_STATE_EOF(UNREACHABLE):
1441 yyterminate();
1442
1443 case YY_END_OF_BUFFER:
1444 {
1445 /* Amount of text matched not including the EOB char. */
1446 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1447
1448 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1449 *yy_cp = yyg->yy_hold_char;
1450 YY_RESTORE_YY_MORE_OFFSET
1451
1452 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1453 {
1454 /* We're scanning a new file or input source. It's
1455 * possible that this happened because the user
1456 * just pointed yyin at a new source and called
1457 * glcpp_lex(). If so, then we have to assure
1458 * consistency between YY_CURRENT_BUFFER and our
1459 * globals. Here is the right place to do so, because
1460 * this is the first action (other than possibly a
1461 * back-up) that will match for the new input source.
1462 */
1463 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1464 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1465 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1466 }
1467
1468 /* Note that here we test for yy_c_buf_p "<=" to the position
1469 * of the first EOB in the buffer, since yy_c_buf_p will
1470 * already have been incremented past the NUL character
1471 * (since all states make transitions on EOB to the
1472 * end-of-buffer state). Contrast this with the test
1473 * in input().
1474 */
1475 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1476 { /* This was really a NUL. */
1477 yy_state_type yy_next_state;
1478
1479 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1480
1481 yy_current_state = yy_get_previous_state( yyscanner );
1482
1483 /* Okay, we're now positioned to make the NUL
1484 * transition. We couldn't have
1485 * yy_get_previous_state() go ahead and do it
1486 * for us because it doesn't know how to deal
1487 * with the possibility of jamming (and we don't
1488 * want to build jamming into it because then it
1489 * will run more slowly).
1490 */
1491
1492 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1493
1494 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1495
1496 if ( yy_next_state )
1497 {
1498 /* Consume the NUL. */
1499 yy_cp = ++yyg->yy_c_buf_p;
1500 yy_current_state = yy_next_state;
1501 goto yy_match;
1502 }
1503
1504 else
1505 {
1506 yy_cp = yyg->yy_c_buf_p;
1507 goto yy_find_action;
1508 }
1509 }
1510
1511 else switch ( yy_get_next_buffer( yyscanner ) )
1512 {
1513 case EOB_ACT_END_OF_FILE:
1514 {
1515 yyg->yy_did_buffer_switch_on_eof = 0;
1516
1517 if ( glcpp_wrap(yyscanner ) )
1518 {
1519 /* Note: because we've taken care in
1520 * yy_get_next_buffer() to have set up
1521 * yytext, we can now set up
1522 * yy_c_buf_p so that if some total
1523 * hoser (like flex itself) wants to
1524 * call the scanner after we return the
1525 * YY_NULL, it'll still work - another
1526 * YY_NULL will get returned.
1527 */
1528 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1529
1530 yy_act = YY_STATE_EOF(YY_START);
1531 goto do_action;
1532 }
1533
1534 else
1535 {
1536 if ( ! yyg->yy_did_buffer_switch_on_eof )
1537 YY_NEW_FILE;
1538 }
1539 break;
1540 }
1541
1542 case EOB_ACT_CONTINUE_SCAN:
1543 yyg->yy_c_buf_p =
1544 yyg->yytext_ptr + yy_amount_of_matched_text;
1545
1546 yy_current_state = yy_get_previous_state( yyscanner );
1547
1548 yy_cp = yyg->yy_c_buf_p;
1549 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1550 goto yy_match;
1551
1552 case EOB_ACT_LAST_MATCH:
1553 yyg->yy_c_buf_p =
1554 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1555
1556 yy_current_state = yy_get_previous_state( yyscanner );
1557
1558 yy_cp = yyg->yy_c_buf_p;
1559 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1560 goto yy_find_action;
1561 }
1562 break;
1563 }
1564
1565 default:
1566 YY_FATAL_ERROR(
1567 "fatal flex scanner internal error--no action found" );
1568 } /* end of action switch */
1569 } /* end of scanning one token */
1570} /* end of glcpp_lex */
1571
1572/* yy_get_next_buffer - try to read in a new buffer
1573 *
1574 * Returns a code representing an action:
1575 * EOB_ACT_LAST_MATCH -
1576 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1577 * EOB_ACT_END_OF_FILE - end of file
1578 */
1579static int yy_get_next_buffer (yyscan_t yyscanner)
1580{
1581 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1582 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1583 register char *source = yyg->yytext_ptr;
1584 register int number_to_move, i;
1585 int ret_val;
1586
1587 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1588 YY_FATAL_ERROR(
1589 "fatal flex scanner internal error--end of buffer missed" );
1590
1591 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1592 { /* Don't try to fill the buffer, so this is an EOF. */
1593 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1594 {
1595 /* We matched a single character, the EOB, so
1596 * treat this as a final EOF.
1597 */
1598 return EOB_ACT_END_OF_FILE;
1599 }
1600
1601 else
1602 {
1603 /* We matched some text prior to the EOB, first
1604 * process it.
1605 */
1606 return EOB_ACT_LAST_MATCH;
1607 }
1608 }
1609
1610 /* Try to read more data. */
1611
1612 /* First move last chars to start of buffer. */
1613 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
1614
1615 for ( i = 0; i < number_to_move; ++i )
1616 *(dest++) = *(source++);
1617
1618 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1619 /* don't do the read, it's not guaranteed to return an EOF,
1620 * just force an EOF
1621 */
1622 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1623
1624 else
1625 {
1626 int num_to_read =
1627 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1628
1629 while ( num_to_read <= 0 )
1630 { /* Not enough room in the buffer - grow it. */
1631
1632 YY_FATAL_ERROR(
1633"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1634
1635 }
1636
1637 if ( num_to_read > YY_READ_BUF_SIZE )
1638 num_to_read = YY_READ_BUF_SIZE;
1639
1640 /* Read in more data. */
1641 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1642 yyg->yy_n_chars, (size_t) num_to_read );
1643
1644 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1645 }
1646
1647 if ( yyg->yy_n_chars == 0 )
1648 {
1649 if ( number_to_move == YY_MORE_ADJ )
1650 {
1651 ret_val = EOB_ACT_END_OF_FILE;
1652 glcpp_restart(yyin ,yyscanner);
1653 }
1654
1655 else
1656 {
1657 ret_val = EOB_ACT_LAST_MATCH;
1658 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1659 YY_BUFFER_EOF_PENDING;
1660 }
1661 }
1662
1663 else
1664 ret_val = EOB_ACT_CONTINUE_SCAN;
1665
1666 if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1667 /* Extend the array by 50%, plus the number we really need. */
1668 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1669 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) glcpp_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1670 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1671 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1672 }
1673
1674 yyg->yy_n_chars += number_to_move;
1675 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1676 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1677
1678 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1679
1680 return ret_val;
1681}
1682
1683/* yy_get_previous_state - get the state just before the EOB char was reached */
1684
1685 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1686{
1687 register yy_state_type yy_current_state;
1688 register char *yy_cp;
1689 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1690
1691 yy_current_state = yyg->yy_start;
1692 yy_current_state += YY_AT_BOL();
1693
1694 yyg->yy_state_ptr = yyg->yy_state_buf;
1695 *yyg->yy_state_ptr++ = yy_current_state;
1696
1697 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1698 {
1699 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1700 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1701 {
1702 yy_current_state = (int) yy_def[yy_current_state];
Eric Anholtd4a04f32010-07-28 16:58:39 -07001703 if ( yy_current_state >= 151 )
Carl Worth667173e2010-07-28 12:33:56 -07001704 yy_c = yy_meta[(unsigned int) yy_c];
1705 }
1706 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1707 *yyg->yy_state_ptr++ = yy_current_state;
1708 }
1709
1710 return yy_current_state;
1711}
1712
1713/* yy_try_NUL_trans - try to make a transition on the NUL character
1714 *
1715 * synopsis
1716 * next_state = yy_try_NUL_trans( current_state );
1717 */
1718 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
1719{
1720 register int yy_is_jam;
1721 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1722
1723 register YY_CHAR yy_c = 1;
1724 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1725 {
1726 yy_current_state = (int) yy_def[yy_current_state];
Eric Anholtd4a04f32010-07-28 16:58:39 -07001727 if ( yy_current_state >= 151 )
Carl Worth667173e2010-07-28 12:33:56 -07001728 yy_c = yy_meta[(unsigned int) yy_c];
1729 }
1730 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
Eric Anholtd4a04f32010-07-28 16:58:39 -07001731 yy_is_jam = (yy_current_state == 150);
Carl Worth667173e2010-07-28 12:33:56 -07001732 if ( ! yy_is_jam )
1733 *yyg->yy_state_ptr++ = yy_current_state;
1734
1735 return yy_is_jam ? 0 : yy_current_state;
1736}
1737
1738 static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
1739{
1740 register char *yy_cp;
1741 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1742
1743 yy_cp = yyg->yy_c_buf_p;
1744
1745 /* undo effects of setting up yytext */
1746 *yy_cp = yyg->yy_hold_char;
1747
1748 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1749 { /* need to shift things up to make room */
1750 /* +2 for EOB chars. */
1751 register int number_to_move = yyg->yy_n_chars + 2;
1752 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1753 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1754 register char *source =
1755 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1756
1757 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1758 *--dest = *--source;
1759
1760 yy_cp += (int) (dest - source);
1761 yy_bp += (int) (dest - source);
1762 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1763 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1764
1765 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1766 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1767 }
1768
1769 *--yy_cp = (char) c;
1770
1771 yyg->yytext_ptr = yy_bp;
1772 yyg->yy_hold_char = *yy_cp;
1773 yyg->yy_c_buf_p = yy_cp;
1774}
1775
1776#ifndef YY_NO_INPUT
1777#ifdef __cplusplus
1778 static int yyinput (yyscan_t yyscanner)
1779#else
1780 static int input (yyscan_t yyscanner)
1781#endif
1782
1783{
1784 int c;
1785 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1786
1787 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1788
1789 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1790 {
1791 /* yy_c_buf_p now points to the character we want to return.
1792 * If this occurs *before* the EOB characters, then it's a
1793 * valid NUL; if not, then we've hit the end of the buffer.
1794 */
1795 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1796 /* This was really a NUL. */
1797 *yyg->yy_c_buf_p = '\0';
1798
1799 else
1800 { /* need more input */
1801 int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1802 ++yyg->yy_c_buf_p;
1803
1804 switch ( yy_get_next_buffer( yyscanner ) )
1805 {
1806 case EOB_ACT_LAST_MATCH:
1807 /* This happens because yy_g_n_b()
1808 * sees that we've accumulated a
1809 * token and flags that we need to
1810 * try matching the token before
1811 * proceeding. But for input(),
1812 * there's no matching to consider.
1813 * So convert the EOB_ACT_LAST_MATCH
1814 * to EOB_ACT_END_OF_FILE.
1815 */
1816
1817 /* Reset buffer status. */
1818 glcpp_restart(yyin ,yyscanner);
1819
1820 /*FALLTHROUGH*/
1821
1822 case EOB_ACT_END_OF_FILE:
1823 {
1824 if ( glcpp_wrap(yyscanner ) )
1825 return EOF;
1826
1827 if ( ! yyg->yy_did_buffer_switch_on_eof )
1828 YY_NEW_FILE;
1829#ifdef __cplusplus
1830 return yyinput(yyscanner);
1831#else
1832 return input(yyscanner);
1833#endif
1834 }
1835
1836 case EOB_ACT_CONTINUE_SCAN:
1837 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1838 break;
1839 }
1840 }
1841 }
1842
1843 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1844 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
1845 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1846
1847 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1848
1849 return c;
1850}
1851#endif /* ifndef YY_NO_INPUT */
1852
1853/** Immediately switch to a different input stream.
1854 * @param input_file A readable stream.
1855 * @param yyscanner The scanner object.
1856 * @note This function does not reset the start condition to @c INITIAL .
1857 */
1858 void glcpp_restart (FILE * input_file , yyscan_t yyscanner)
1859{
1860 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1861
1862 if ( ! YY_CURRENT_BUFFER ){
1863 glcpp_ensure_buffer_stack (yyscanner);
1864 YY_CURRENT_BUFFER_LVALUE =
1865 glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1866 }
1867
1868 glcpp__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1869 glcpp__load_buffer_state(yyscanner );
1870}
1871
1872/** Switch to a different input buffer.
1873 * @param new_buffer The new input buffer.
1874 * @param yyscanner The scanner object.
1875 */
1876 void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1877{
1878 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1879
1880 /* TODO. We should be able to replace this entire function body
1881 * with
1882 * glcpp_pop_buffer_state();
1883 * glcpp_push_buffer_state(new_buffer);
1884 */
1885 glcpp_ensure_buffer_stack (yyscanner);
1886 if ( YY_CURRENT_BUFFER == new_buffer )
1887 return;
1888
1889 if ( YY_CURRENT_BUFFER )
1890 {
1891 /* Flush out information for old buffer. */
1892 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1893 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1894 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1895 }
1896
1897 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1898 glcpp__load_buffer_state(yyscanner );
1899
1900 /* We don't actually know whether we did this switch during
1901 * EOF (glcpp_wrap()) processing, but the only time this flag
1902 * is looked at is after glcpp_wrap() is called, so it's safe
1903 * to go ahead and always set it.
1904 */
1905 yyg->yy_did_buffer_switch_on_eof = 1;
1906}
1907
1908static void glcpp__load_buffer_state (yyscan_t yyscanner)
1909{
1910 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1911 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1912 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1913 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1914 yyg->yy_hold_char = *yyg->yy_c_buf_p;
1915}
1916
1917/** Allocate and initialize an input buffer state.
1918 * @param file A readable stream.
1919 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1920 * @param yyscanner The scanner object.
1921 * @return the allocated buffer state.
1922 */
1923 YY_BUFFER_STATE glcpp__create_buffer (FILE * file, int size , yyscan_t yyscanner)
1924{
1925 YY_BUFFER_STATE b;
1926
1927 b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1928 if ( ! b )
1929 YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
1930
1931 b->yy_buf_size = size;
1932
1933 /* yy_ch_buf has to be 2 characters longer than the size given because
1934 * we need to put in 2 end-of-buffer characters.
1935 */
1936 b->yy_ch_buf = (char *) glcpp_alloc(b->yy_buf_size + 2 ,yyscanner );
1937 if ( ! b->yy_ch_buf )
1938 YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
1939
1940 b->yy_is_our_buffer = 1;
1941
1942 glcpp__init_buffer(b,file ,yyscanner);
1943
1944 return b;
1945}
1946
1947/** Destroy the buffer.
1948 * @param b a buffer created with glcpp__create_buffer()
1949 * @param yyscanner The scanner object.
1950 */
1951 void glcpp__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1952{
1953 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1954
1955 if ( ! b )
1956 return;
1957
1958 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1959 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1960
1961 if ( b->yy_is_our_buffer )
1962 glcpp_free((void *) b->yy_ch_buf ,yyscanner );
1963
1964 glcpp_free((void *) b ,yyscanner );
1965}
1966
1967/* Initializes or reinitializes a buffer.
1968 * This function is sometimes called more than once on the same buffer,
1969 * such as during a glcpp_restart() or at EOF.
1970 */
1971 static void glcpp__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
1972
1973{
1974 int oerrno = errno;
1975 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1976
1977 glcpp__flush_buffer(b ,yyscanner);
1978
1979 b->yy_input_file = file;
1980 b->yy_fill_buffer = 1;
1981
1982 /* If b is the current buffer, then glcpp__init_buffer was _probably_
1983 * called from glcpp_restart() or through yy_get_next_buffer.
1984 * In that case, we don't want to reset the lineno or column.
1985 */
1986 if (b != YY_CURRENT_BUFFER){
1987 b->yy_bs_lineno = 1;
1988 b->yy_bs_column = 0;
1989 }
1990
1991 b->yy_is_interactive = 0;
1992
1993 errno = oerrno;
1994}
1995
1996/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1997 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1998 * @param yyscanner The scanner object.
1999 */
2000 void glcpp__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
2001{
2002 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2003 if ( ! b )
2004 return;
2005
2006 b->yy_n_chars = 0;
2007
2008 /* We always need two end-of-buffer characters. The first causes
2009 * a transition to the end-of-buffer state. The second causes
2010 * a jam in that state.
2011 */
2012 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2013 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2014
2015 b->yy_buf_pos = &b->yy_ch_buf[0];
2016
2017 b->yy_at_bol = 1;
2018 b->yy_buffer_status = YY_BUFFER_NEW;
2019
2020 if ( b == YY_CURRENT_BUFFER )
2021 glcpp__load_buffer_state(yyscanner );
2022}
2023
2024/** Pushes the new state onto the stack. The new state becomes
2025 * the current state. This function will allocate the stack
2026 * if necessary.
2027 * @param new_buffer The new state.
2028 * @param yyscanner The scanner object.
2029 */
2030void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
2031{
2032 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2033 if (new_buffer == NULL)
2034 return;
2035
2036 glcpp_ensure_buffer_stack(yyscanner);
2037
2038 /* This block is copied from glcpp__switch_to_buffer. */
2039 if ( YY_CURRENT_BUFFER )
2040 {
2041 /* Flush out information for old buffer. */
2042 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2043 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2044 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2045 }
2046
2047 /* Only push if top exists. Otherwise, replace top. */
2048 if (YY_CURRENT_BUFFER)
2049 yyg->yy_buffer_stack_top++;
2050 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2051
2052 /* copied from glcpp__switch_to_buffer. */
2053 glcpp__load_buffer_state(yyscanner );
2054 yyg->yy_did_buffer_switch_on_eof = 1;
2055}
2056
2057/** Removes and deletes the top of the stack, if present.
2058 * The next element becomes the new top.
2059 * @param yyscanner The scanner object.
2060 */
2061void glcpp_pop_buffer_state (yyscan_t yyscanner)
2062{
2063 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2064 if (!YY_CURRENT_BUFFER)
2065 return;
2066
2067 glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
2068 YY_CURRENT_BUFFER_LVALUE = NULL;
2069 if (yyg->yy_buffer_stack_top > 0)
2070 --yyg->yy_buffer_stack_top;
2071
2072 if (YY_CURRENT_BUFFER) {
2073 glcpp__load_buffer_state(yyscanner );
2074 yyg->yy_did_buffer_switch_on_eof = 1;
2075 }
2076}
2077
2078/* Allocates the stack if it does not exist.
2079 * Guarantees space for at least one push.
2080 */
2081static void glcpp_ensure_buffer_stack (yyscan_t yyscanner)
2082{
2083 int num_to_alloc;
2084 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2085
2086 if (!yyg->yy_buffer_stack) {
2087
2088 /* First allocation is just for 2 elements, since we don't know if this
2089 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2090 * immediate realloc on the next call.
2091 */
2092 num_to_alloc = 1;
2093 yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_alloc
2094 (num_to_alloc * sizeof(struct yy_buffer_state*)
2095 , yyscanner);
2096 if ( ! yyg->yy_buffer_stack )
2097 YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
2098
2099 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2100
2101 yyg->yy_buffer_stack_max = num_to_alloc;
2102 yyg->yy_buffer_stack_top = 0;
2103 return;
2104 }
2105
2106 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2107
2108 /* Increase the buffer to prepare for a possible push. */
2109 int grow_size = 8 /* arbitrary grow size */;
2110
2111 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
2112 yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_realloc
2113 (yyg->yy_buffer_stack,
2114 num_to_alloc * sizeof(struct yy_buffer_state*)
2115 , yyscanner);
2116 if ( ! yyg->yy_buffer_stack )
2117 YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
2118
2119 /* zero only the new slots.*/
2120 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
2121 yyg->yy_buffer_stack_max = num_to_alloc;
2122 }
2123}
2124
2125/** Setup the input buffer state to scan directly from a user-specified character buffer.
2126 * @param base the character buffer
2127 * @param size the size in bytes of the character buffer
2128 * @param yyscanner The scanner object.
2129 * @return the newly allocated buffer state object.
2130 */
2131YY_BUFFER_STATE glcpp__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
2132{
2133 YY_BUFFER_STATE b;
2134
2135 if ( size < 2 ||
2136 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2137 base[size-1] != YY_END_OF_BUFFER_CHAR )
2138 /* They forgot to leave room for the EOB's. */
2139 return 0;
2140
2141 b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
2142 if ( ! b )
2143 YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_buffer()" );
2144
2145 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2146 b->yy_buf_pos = b->yy_ch_buf = base;
2147 b->yy_is_our_buffer = 0;
2148 b->yy_input_file = 0;
2149 b->yy_n_chars = b->yy_buf_size;
2150 b->yy_is_interactive = 0;
2151 b->yy_at_bol = 1;
2152 b->yy_fill_buffer = 0;
2153 b->yy_buffer_status = YY_BUFFER_NEW;
2154
2155 glcpp__switch_to_buffer(b ,yyscanner );
2156
2157 return b;
2158}
2159
2160/** Setup the input buffer state to scan a string. The next call to glcpp_lex() will
2161 * scan from a @e copy of @a str.
2162 * @param yystr a NUL-terminated string to scan
2163 * @param yyscanner The scanner object.
2164 * @return the newly allocated buffer state object.
2165 * @note If you want to scan bytes that may contain NUL values, then use
2166 * glcpp__scan_bytes() instead.
2167 */
2168YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner)
2169{
2170
2171 return glcpp__scan_bytes(yystr,strlen(yystr) ,yyscanner);
2172}
2173
2174/** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will
2175 * scan from a @e copy of @a bytes.
Carl Worth5a6285c2010-08-11 13:13:41 -07002176 * @param yybytes the byte buffer to scan
2177 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
Carl Worth667173e2010-07-28 12:33:56 -07002178 * @param yyscanner The scanner object.
2179 * @return the newly allocated buffer state object.
2180 */
2181YY_BUFFER_STATE glcpp__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
2182{
2183 YY_BUFFER_STATE b;
2184 char *buf;
2185 yy_size_t n;
2186 int i;
2187
2188 /* Get memory for full buffer, including space for trailing EOB's. */
2189 n = _yybytes_len + 2;
2190 buf = (char *) glcpp_alloc(n ,yyscanner );
2191 if ( ! buf )
2192 YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_bytes()" );
2193
2194 for ( i = 0; i < _yybytes_len; ++i )
2195 buf[i] = yybytes[i];
2196
2197 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2198
2199 b = glcpp__scan_buffer(buf,n ,yyscanner);
2200 if ( ! b )
2201 YY_FATAL_ERROR( "bad buffer in glcpp__scan_bytes()" );
2202
2203 /* It's okay to grow etc. this buffer, and we should throw it
2204 * away when we're done.
2205 */
2206 b->yy_is_our_buffer = 1;
2207
2208 return b;
2209}
2210
2211 static void yy_push_state (int new_state , yyscan_t yyscanner)
2212{
2213 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2214 if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth )
2215 {
2216 yy_size_t new_size;
2217
2218 yyg->yy_start_stack_depth += YY_START_STACK_INCR;
2219 new_size = yyg->yy_start_stack_depth * sizeof( int );
2220
2221 if ( ! yyg->yy_start_stack )
2222 yyg->yy_start_stack = (int *) glcpp_alloc(new_size ,yyscanner );
2223
2224 else
2225 yyg->yy_start_stack = (int *) glcpp_realloc((void *) yyg->yy_start_stack,new_size ,yyscanner );
2226
2227 if ( ! yyg->yy_start_stack )
2228 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2229 }
2230
2231 yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START;
2232
2233 BEGIN(new_state);
2234}
2235
2236 static void yy_pop_state (yyscan_t yyscanner)
2237{
2238 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2239 if ( --yyg->yy_start_stack_ptr < 0 )
2240 YY_FATAL_ERROR( "start-condition stack underflow" );
2241
2242 BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]);
2243}
2244
2245 static int yy_top_state (yyscan_t yyscanner)
2246{
2247 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2248 return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1];
2249}
2250
2251#ifndef YY_EXIT_FAILURE
2252#define YY_EXIT_FAILURE 2
2253#endif
2254
2255static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
2256{
2257 (void) fprintf( stderr, "%s\n", msg );
2258 exit( YY_EXIT_FAILURE );
2259}
2260
2261/* Redefine yyless() so it works in section 3 code. */
2262
2263#undef yyless
2264#define yyless(n) \
2265 do \
2266 { \
2267 /* Undo effects of setting up yytext. */ \
2268 int yyless_macro_arg = (n); \
2269 YY_LESS_LINENO(yyless_macro_arg);\
2270 yytext[yyleng] = yyg->yy_hold_char; \
2271 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2272 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2273 *yyg->yy_c_buf_p = '\0'; \
2274 yyleng = yyless_macro_arg; \
2275 } \
2276 while ( 0 )
2277
2278/* Accessor methods (get/set functions) to struct members. */
2279
2280/** Get the user-defined data for this scanner.
2281 * @param yyscanner The scanner object.
2282 */
2283YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner)
2284{
2285 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2286 return yyextra;
2287}
2288
2289/** Get the current line number.
2290 * @param yyscanner The scanner object.
2291 */
2292int glcpp_get_lineno (yyscan_t yyscanner)
2293{
2294 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2295
2296 if (! YY_CURRENT_BUFFER)
2297 return 0;
2298
2299 return yylineno;
2300}
2301
2302/** Get the current column number.
2303 * @param yyscanner The scanner object.
2304 */
2305int glcpp_get_column (yyscan_t yyscanner)
2306{
2307 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2308
2309 if (! YY_CURRENT_BUFFER)
2310 return 0;
2311
2312 return yycolumn;
2313}
2314
2315/** Get the input stream.
2316 * @param yyscanner The scanner object.
2317 */
2318FILE *glcpp_get_in (yyscan_t yyscanner)
2319{
2320 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2321 return yyin;
2322}
2323
2324/** Get the output stream.
2325 * @param yyscanner The scanner object.
2326 */
2327FILE *glcpp_get_out (yyscan_t yyscanner)
2328{
2329 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2330 return yyout;
2331}
2332
2333/** Get the length of the current token.
2334 * @param yyscanner The scanner object.
2335 */
2336int glcpp_get_leng (yyscan_t yyscanner)
2337{
2338 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2339 return yyleng;
2340}
2341
2342/** Get the current token.
2343 * @param yyscanner The scanner object.
2344 */
2345
2346char *glcpp_get_text (yyscan_t yyscanner)
2347{
2348 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2349 return yytext;
2350}
2351
2352/** Set the user-defined data. This data is never touched by the scanner.
2353 * @param user_defined The data to be associated with this scanner.
2354 * @param yyscanner The scanner object.
2355 */
2356void glcpp_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
2357{
2358 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2359 yyextra = user_defined ;
2360}
2361
2362/** Set the current line number.
2363 * @param line_number
2364 * @param yyscanner The scanner object.
2365 */
2366void glcpp_set_lineno (int line_number , yyscan_t yyscanner)
2367{
2368 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2369
2370 /* lineno is only valid if an input buffer exists. */
2371 if (! YY_CURRENT_BUFFER )
2372 yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner);
2373
2374 yylineno = line_number;
2375}
2376
2377/** Set the current column.
2378 * @param line_number
2379 * @param yyscanner The scanner object.
2380 */
2381void glcpp_set_column (int column_no , yyscan_t yyscanner)
2382{
2383 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2384
2385 /* column is only valid if an input buffer exists. */
2386 if (! YY_CURRENT_BUFFER )
2387 yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner);
2388
2389 yycolumn = column_no;
2390}
2391
2392/** Set the input stream. This does not discard the current
2393 * input buffer.
2394 * @param in_str A readable stream.
2395 * @param yyscanner The scanner object.
2396 * @see glcpp__switch_to_buffer
2397 */
2398void glcpp_set_in (FILE * in_str , yyscan_t yyscanner)
2399{
2400 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2401 yyin = in_str ;
2402}
2403
2404void glcpp_set_out (FILE * out_str , yyscan_t yyscanner)
2405{
2406 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2407 yyout = out_str ;
2408}
2409
2410int glcpp_get_debug (yyscan_t yyscanner)
2411{
2412 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2413 return yy_flex_debug;
2414}
2415
2416void glcpp_set_debug (int bdebug , yyscan_t yyscanner)
2417{
2418 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2419 yy_flex_debug = bdebug ;
2420}
2421
2422/* Accessor methods for yylval and yylloc */
2423
2424YYSTYPE * glcpp_get_lval (yyscan_t yyscanner)
2425{
2426 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2427 return yylval;
2428}
2429
2430void glcpp_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
2431{
2432 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2433 yylval = yylval_param;
2434}
2435
2436YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner)
2437{
2438 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2439 return yylloc;
2440}
2441
2442void glcpp_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
2443{
2444 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2445 yylloc = yylloc_param;
2446}
2447
2448/* User-visible API */
2449
2450/* glcpp_lex_init is special because it creates the scanner itself, so it is
2451 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2452 * That's why we explicitly handle the declaration, instead of using our macros.
2453 */
2454
2455int glcpp_lex_init(yyscan_t* ptr_yy_globals)
2456
2457{
2458 if (ptr_yy_globals == NULL){
2459 errno = EINVAL;
2460 return 1;
2461 }
2462
2463 *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), NULL );
2464
2465 if (*ptr_yy_globals == NULL){
2466 errno = ENOMEM;
2467 return 1;
2468 }
2469
2470 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2471 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2472
2473 return yy_init_globals ( *ptr_yy_globals );
2474}
2475
2476/* glcpp_lex_init_extra has the same functionality as glcpp_lex_init, but follows the
2477 * convention of taking the scanner as the last argument. Note however, that
2478 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2479 * is the reason, too, why this function also must handle its own declaration).
2480 * The user defined value in the first argument will be available to glcpp_alloc in
2481 * the yyextra field.
2482 */
2483
2484int glcpp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
2485
2486{
2487 struct yyguts_t dummy_yyguts;
2488
2489 glcpp_set_extra (yy_user_defined, &dummy_yyguts);
2490
2491 if (ptr_yy_globals == NULL){
2492 errno = EINVAL;
2493 return 1;
2494 }
2495
2496 *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2497
2498 if (*ptr_yy_globals == NULL){
2499 errno = ENOMEM;
2500 return 1;
2501 }
2502
2503 /* By setting to 0xAA, we expose bugs in
2504 yy_init_globals. Leave at 0x00 for releases. */
2505 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2506
2507 glcpp_set_extra (yy_user_defined, *ptr_yy_globals);
2508
2509 return yy_init_globals ( *ptr_yy_globals );
2510}
2511
2512static int yy_init_globals (yyscan_t yyscanner)
2513{
2514 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2515 /* Initialization is the same as for the non-reentrant scanner.
2516 * This function is called from glcpp_lex_destroy(), so don't allocate here.
2517 */
2518
2519 yyg->yy_buffer_stack = 0;
2520 yyg->yy_buffer_stack_top = 0;
2521 yyg->yy_buffer_stack_max = 0;
2522 yyg->yy_c_buf_p = (char *) 0;
2523 yyg->yy_init = 0;
2524 yyg->yy_start = 0;
2525
2526 yyg->yy_start_stack_ptr = 0;
2527 yyg->yy_start_stack_depth = 0;
2528 yyg->yy_start_stack = NULL;
2529
2530 yyg->yy_state_buf = 0;
2531 yyg->yy_state_ptr = 0;
2532 yyg->yy_full_match = 0;
2533 yyg->yy_lp = 0;
2534
2535/* Defined in main.c */
2536#ifdef YY_STDINIT
2537 yyin = stdin;
2538 yyout = stdout;
2539#else
2540 yyin = (FILE *) 0;
2541 yyout = (FILE *) 0;
2542#endif
2543
2544 /* For future reference: Set errno on error, since we are called by
2545 * glcpp_lex_init()
2546 */
2547 return 0;
2548}
2549
2550/* glcpp_lex_destroy is for both reentrant and non-reentrant scanners. */
2551int glcpp_lex_destroy (yyscan_t yyscanner)
2552{
2553 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2554
2555 /* Pop the buffer stack, destroying each element. */
2556 while(YY_CURRENT_BUFFER){
2557 glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
2558 YY_CURRENT_BUFFER_LVALUE = NULL;
2559 glcpp_pop_buffer_state(yyscanner);
2560 }
2561
2562 /* Destroy the stack itself. */
2563 glcpp_free(yyg->yy_buffer_stack ,yyscanner);
2564 yyg->yy_buffer_stack = NULL;
2565
2566 /* Destroy the start condition stack. */
2567 glcpp_free(yyg->yy_start_stack ,yyscanner );
2568 yyg->yy_start_stack = NULL;
2569
2570 glcpp_free ( yyg->yy_state_buf , yyscanner);
2571 yyg->yy_state_buf = NULL;
2572
2573 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2574 * glcpp_lex() is called, initialization will occur. */
2575 yy_init_globals( yyscanner);
2576
2577 /* Destroy the main struct (reentrant only). */
2578 glcpp_free ( yyscanner , yyscanner );
2579 yyscanner = NULL;
2580 return 0;
2581}
2582
2583/*
2584 * Internal utility routines.
2585 */
2586
2587#ifndef yytext_ptr
2588static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2589{
2590 register int i;
2591 for ( i = 0; i < n; ++i )
2592 s1[i] = s2[i];
2593}
2594#endif
2595
2596#ifdef YY_NEED_STRLEN
2597static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2598{
2599 register int n;
2600 for ( n = 0; s[n]; ++n )
2601 ;
2602
2603 return n;
2604}
2605#endif
2606
2607void *glcpp_alloc (yy_size_t size , yyscan_t yyscanner)
2608{
2609 return (void *) malloc( size );
2610}
2611
2612void *glcpp_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
2613{
2614 /* The cast to (char *) in the following accommodates both
2615 * implementations that use char* generic pointers, and those
2616 * that use void* generic pointers. It works with the latter
2617 * because both ANSI C and C++ allow castless assignment from
2618 * any pointer type to void*, and deal with argument conversions
2619 * as though doing an assignment.
2620 */
2621 return (void *) realloc( (char *) ptr, size );
2622}
2623
2624void glcpp_free (void * ptr , yyscan_t yyscanner)
2625{
2626 free( (char *) ptr ); /* see glcpp_realloc() for (char *) cast */
2627}
2628
2629#define YYTABLES_NAME "yytables"
2630
Ian Romanick23f60172010-08-13 13:13:24 -07002631#line 287 "glcpp/glcpp-lex.l"
Carl Worth667173e2010-07-28 12:33:56 -07002632
2633
2634
2635void
2636glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader)
2637{
2638 glcpp__scan_string(shader,parser->scanner);
2639}
2640