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