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