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