Debian Codegraph @

third_party/rust/glslopt/glsl-optimizer/src/compiler/glsl/glcpp/glcpp-lex.c

raw
1 #line 1 "src/compiler/glsl/glcpp/glcpp-lex.c"
2
3 #line 3 "src/compiler/glsl/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 6
12 #define YY_FLEX_SUBMINOR_VERSION 4
13 #if YY_FLEX_SUBMINOR_VERSION > 0
14 #define FLEX_BETA
15 #endif
16
17 #ifdef yy_create_buffer
18 #define glcpp__create_buffer_ALREADY_DEFINED
19 #else
20 #define yy_create_buffer glcpp__create_buffer
21 #endif
22
23 #ifdef yy_delete_buffer
24 #define glcpp__delete_buffer_ALREADY_DEFINED
25 #else
26 #define yy_delete_buffer glcpp__delete_buffer
27 #endif
28
29 #ifdef yy_scan_buffer
30 #define glcpp__scan_buffer_ALREADY_DEFINED
31 #else
32 #define yy_scan_buffer glcpp__scan_buffer
33 #endif
34
35 #ifdef yy_scan_string
36 #define glcpp__scan_string_ALREADY_DEFINED
37 #else
38 #define yy_scan_string glcpp__scan_string
39 #endif
40
41 #ifdef yy_scan_bytes
42 #define glcpp__scan_bytes_ALREADY_DEFINED
43 #else
44 #define yy_scan_bytes glcpp__scan_bytes
45 #endif
46
47 #ifdef yy_init_buffer
48 #define glcpp__init_buffer_ALREADY_DEFINED
49 #else
50 #define yy_init_buffer glcpp__init_buffer
51 #endif
52
53 #ifdef yy_flush_buffer
54 #define glcpp__flush_buffer_ALREADY_DEFINED
55 #else
56 #define yy_flush_buffer glcpp__flush_buffer
57 #endif
58
59 #ifdef yy_load_buffer_state
60 #define glcpp__load_buffer_state_ALREADY_DEFINED
61 #else
62 #define yy_load_buffer_state glcpp__load_buffer_state
63 #endif
64
65 #ifdef yy_switch_to_buffer
66 #define glcpp__switch_to_buffer_ALREADY_DEFINED
67 #else
68 #define yy_switch_to_buffer glcpp__switch_to_buffer
69 #endif
70
71 #ifdef yypush_buffer_state
72 #define glcpp_push_buffer_state_ALREADY_DEFINED
73 #else
74 #define yypush_buffer_state glcpp_push_buffer_state
75 #endif
76
77 #ifdef yypop_buffer_state
78 #define glcpp_pop_buffer_state_ALREADY_DEFINED
79 #else
80 #define yypop_buffer_state glcpp_pop_buffer_state
81 #endif
82
83 #ifdef yyensure_buffer_stack
84 #define glcpp_ensure_buffer_stack_ALREADY_DEFINED
85 #else
86 #define yyensure_buffer_stack glcpp_ensure_buffer_stack
87 #endif
88
89 #ifdef yylex
90 #define glcpp_lex_ALREADY_DEFINED
91 #else
92 #define yylex glcpp_lex
93 #endif
94
95 #ifdef yyrestart
96 #define glcpp_restart_ALREADY_DEFINED
97 #else
98 #define yyrestart glcpp_restart
99 #endif
100
101 #ifdef yylex_init
102 #define glcpp_lex_init_ALREADY_DEFINED
103 #else
104 #define yylex_init glcpp_lex_init
105 #endif
106
107 #ifdef yylex_init_extra
108 #define glcpp_lex_init_extra_ALREADY_DEFINED
109 #else
110 #define yylex_init_extra glcpp_lex_init_extra
111 #endif
112
113 #ifdef yylex_destroy
114 #define glcpp_lex_destroy_ALREADY_DEFINED
115 #else
116 #define yylex_destroy glcpp_lex_destroy
117 #endif
118
119 #ifdef yyget_debug
120 #define glcpp_get_debug_ALREADY_DEFINED
121 #else
122 #define yyget_debug glcpp_get_debug
123 #endif
124
125 #ifdef yyset_debug
126 #define glcpp_set_debug_ALREADY_DEFINED
127 #else
128 #define yyset_debug glcpp_set_debug
129 #endif
130
131 #ifdef yyget_extra
132 #define glcpp_get_extra_ALREADY_DEFINED
133 #else
134 #define yyget_extra glcpp_get_extra
135 #endif
136
137 #ifdef yyset_extra
138 #define glcpp_set_extra_ALREADY_DEFINED
139 #else
140 #define yyset_extra glcpp_set_extra
141 #endif
142
143 #ifdef yyget_in
144 #define glcpp_get_in_ALREADY_DEFINED
145 #else
146 #define yyget_in glcpp_get_in
147 #endif
148
149 #ifdef yyset_in
150 #define glcpp_set_in_ALREADY_DEFINED
151 #else
152 #define yyset_in glcpp_set_in
153 #endif
154
155 #ifdef yyget_out
156 #define glcpp_get_out_ALREADY_DEFINED
157 #else
158 #define yyget_out glcpp_get_out
159 #endif
160
161 #ifdef yyset_out
162 #define glcpp_set_out_ALREADY_DEFINED
163 #else
164 #define yyset_out glcpp_set_out
165 #endif
166
167 #ifdef yyget_leng
168 #define glcpp_get_leng_ALREADY_DEFINED
169 #else
170 #define yyget_leng glcpp_get_leng
171 #endif
172
173 #ifdef yyget_text
174 #define glcpp_get_text_ALREADY_DEFINED
175 #else
176 #define yyget_text glcpp_get_text
177 #endif
178
179 #ifdef yyget_lineno
180 #define glcpp_get_lineno_ALREADY_DEFINED
181 #else
182 #define yyget_lineno glcpp_get_lineno
183 #endif
184
185 #ifdef yyset_lineno
186 #define glcpp_set_lineno_ALREADY_DEFINED
187 #else
188 #define yyset_lineno glcpp_set_lineno
189 #endif
190
191 #ifdef yyget_column
192 #define glcpp_get_column_ALREADY_DEFINED
193 #else
194 #define yyget_column glcpp_get_column
195 #endif
196
197 #ifdef yyset_column
198 #define glcpp_set_column_ALREADY_DEFINED
199 #else
200 #define yyset_column glcpp_set_column
201 #endif
202
203 #ifdef yywrap
204 #define glcpp_wrap_ALREADY_DEFINED
205 #else
206 #define yywrap glcpp_wrap
207 #endif
208
209 #ifdef yyget_lval
210 #define glcpp_get_lval_ALREADY_DEFINED
211 #else
212 #define yyget_lval glcpp_get_lval
213 #endif
214
215 #ifdef yyset_lval
216 #define glcpp_set_lval_ALREADY_DEFINED
217 #else
218 #define yyset_lval glcpp_set_lval
219 #endif
220
221 #ifdef yyget_lloc
222 #define glcpp_get_lloc_ALREADY_DEFINED
223 #else
224 #define yyget_lloc glcpp_get_lloc
225 #endif
226
227 #ifdef yyset_lloc
228 #define glcpp_set_lloc_ALREADY_DEFINED
229 #else
230 #define yyset_lloc glcpp_set_lloc
231 #endif
232
233 #ifdef yyalloc
234 #define glcpp_alloc_ALREADY_DEFINED
235 #else
236 #define yyalloc glcpp_alloc
237 #endif
238
239 #ifdef yyrealloc
240 #define glcpp_realloc_ALREADY_DEFINED
241 #else
242 #define yyrealloc glcpp_realloc
243 #endif
244
245 #ifdef yyfree
246 #define glcpp_free_ALREADY_DEFINED
247 #else
248 #define yyfree glcpp_free
249 #endif
250
251 /* First, we deal with platform-specific or compiler-specific issues. */
252
253 /* begin standard C headers. */
254 #include <stdio.h>
255 #include <string.h>
256 #include <errno.h>
257 #include <stdlib.h>
258
259 /* end standard C headers. */
260
261 /* flex integer type definitions */
262
263 #ifndef FLEXINT_H
264 #define FLEXINT_H
265
266 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
267
268 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
269
270 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
271 * if you want the limit (max/min) macros for int types.
272 */
273 #ifndef __STDC_LIMIT_MACROS
274 #define __STDC_LIMIT_MACROS 1
275 #endif
276
277 #include <inttypes.h>
278 typedef int8_t flex_int8_t;
279 typedef uint8_t flex_uint8_t;
280 typedef int16_t flex_int16_t;
281 typedef uint16_t flex_uint16_t;
282 typedef int32_t flex_int32_t;
283 typedef uint32_t flex_uint32_t;
284 #else
285 typedef signed char flex_int8_t;
286 typedef short int flex_int16_t;
287 typedef int flex_int32_t;
288 typedef unsigned char flex_uint8_t;
289 typedef unsigned short int flex_uint16_t;
290 typedef unsigned int flex_uint32_t;
291
292 /* Limits of integral types. */
293 #ifndef INT8_MIN
294 #define INT8_MIN (-128)
295 #endif
296 #ifndef INT16_MIN
297 #define INT16_MIN (-32767-1)
298 #endif
299 #ifndef INT32_MIN
300 #define INT32_MIN (-2147483647-1)
301 #endif
302 #ifndef INT8_MAX
303 #define INT8_MAX (127)
304 #endif
305 #ifndef INT16_MAX
306 #define INT16_MAX (32767)
307 #endif
308 #ifndef INT32_MAX
309 #define INT32_MAX (2147483647)
310 #endif
311 #ifndef UINT8_MAX
312 #define UINT8_MAX (255U)
313 #endif
314 #ifndef UINT16_MAX
315 #define UINT16_MAX (65535U)
316 #endif
317 #ifndef UINT32_MAX
318 #define UINT32_MAX (4294967295U)
319 #endif
320
321 #ifndef SIZE_MAX
322 #define SIZE_MAX (~(size_t)0)
323 #endif
324
325 #endif /* ! C99 */
326
327 #endif /* ! FLEXINT_H */
328
329 /* begin standard C++ headers. */
330
331 /* TODO: this is always defined, so inline it */
332 #define yyconst const
333
334 #if defined(__GNUC__) && __GNUC__ >= 3
335 #define yynoreturn __attribute__((__noreturn__))
336 #else
337 #define yynoreturn
338 #endif
339
340 /* Returned upon end-of-file. */
341 #define YY_NULL 0
342
343 /* Promotes a possibly negative, possibly signed char to an
344 * integer in range [0..255] for use as an array index.
345 */
346 #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
347
348 /* An opaque pointer. */
349 #ifndef YY_TYPEDEF_YY_SCANNER_T
350 #define YY_TYPEDEF_YY_SCANNER_T
351 typedef void* yyscan_t;
352 #endif
353
354 /* For convenience, these vars (plus the bison vars far below)
355 are macros in the reentrant scanner. */
356 #define yyin yyg->yyin_r
357 #define yyout yyg->yyout_r
358 #define yyextra yyg->yyextra_r
359 #define yyleng yyg->yyleng_r
360 #define yytext yyg->yytext_r
361 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
362 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
363 #define yy_flex_debug yyg->yy_flex_debug_r
364
365 /* Enter a start condition. This macro really ought to take a parameter,
366 * but we do it the disgusting crufty way forced on us by the ()-less
367 * definition of BEGIN.
368 */
369 #define BEGIN yyg->yy_start = 1 + 2 *
370 /* Translate the current start state into a value that can be later handed
371 * to BEGIN to return to the state. The YYSTATE alias is for lex
372 * compatibility.
373 */
374 #define YY_START ((yyg->yy_start - 1) / 2)
375 #define YYSTATE YY_START
376 /* Action number for EOF rule of a given start state. */
377 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
378 /* Special action meaning "start processing a new file". */
379 #define YY_NEW_FILE yyrestart( yyin , yyscanner )
380 #define YY_END_OF_BUFFER_CHAR 0
381
382 /* Size of default input buffer. */
383 #ifndef YY_BUF_SIZE
384 #ifdef __ia64__
385 /* On IA-64, the buffer size is 16k, not 8k.
386 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
387 * Ditto for the __ia64__ case accordingly.
388 */
389 #define YY_BUF_SIZE 32768
390 #else
391 #define YY_BUF_SIZE 16384
392 #endif /* __ia64__ */
393 #endif
394
395 /* The state buf must be large enough to hold one state per character in the main buffer.
396 */
397 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
398
399 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
400 #define YY_TYPEDEF_YY_BUFFER_STATE
401 typedef struct yy_buffer_state *YY_BUFFER_STATE;
402 #endif
403
404 #ifndef YY_TYPEDEF_YY_SIZE_T
405 #define YY_TYPEDEF_YY_SIZE_T
406 typedef size_t yy_size_t;
407 #endif
408
409 #define EOB_ACT_CONTINUE_SCAN 0
410 #define EOB_ACT_END_OF_FILE 1
411 #define EOB_ACT_LAST_MATCH 2
412
413 #define YY_LESS_LINENO(n)
414 #define YY_LINENO_REWIND_TO(ptr)
415
416 /* Return all but the first "n" matched characters back to the input stream. */
417 #define yyless(n) \
418 do \
419 { \
420 /* Undo effects of setting up yytext. */ \
421 int yyless_macro_arg = (n); \
422 YY_LESS_LINENO(yyless_macro_arg);\
423 *yy_cp = yyg->yy_hold_char; \
424 YY_RESTORE_YY_MORE_OFFSET \
425 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
426 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
427 } \
428 while ( 0 )
429 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
430
431 #ifndef YY_STRUCT_YY_BUFFER_STATE
432 #define YY_STRUCT_YY_BUFFER_STATE
433 struct yy_buffer_state
434 {
435 FILE *yy_input_file;
436
437 char *yy_ch_buf; /* input buffer */
438 char *yy_buf_pos; /* current position in input buffer */
439
440 /* Size of input buffer in bytes, not including room for EOB
441 * characters.
442 */
443 int yy_buf_size;
444
445 /* Number of characters read into yy_ch_buf, not including EOB
446 * characters.
447 */
448 int yy_n_chars;
449
450 /* Whether we "own" the buffer - i.e., we know we created it,
451 * and can realloc() it to grow it, and should free() it to
452 * delete it.
453 */
454 int yy_is_our_buffer;
455
456 /* Whether this is an "interactive" input source; if so, and
457 * if we're using stdio for input, then we want to use getc()
458 * instead of fread(), to make sure we stop fetching input after
459 * each newline.
460 */
461 int yy_is_interactive;
462
463 /* Whether we're considered to be at the beginning of a line.
464 * If so, '^' rules will be active on the next match, otherwise
465 * not.
466 */
467 int yy_at_bol;
468
469 int yy_bs_lineno; /**< The line count. */
470 int yy_bs_column; /**< The column count. */
471
472 /* Whether to try to fill the input buffer when we reach the
473 * end of it.
474 */
475 int yy_fill_buffer;
476
477 int yy_buffer_status;
478
479 #define YY_BUFFER_NEW 0
480 #define YY_BUFFER_NORMAL 1
481 /* When an EOF's been seen but there's still some text to process
482 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
483 * shouldn't try reading from the input source any more. We might
484 * still have a bunch of tokens to match, though, because of
485 * possible backing-up.
486 *
487 * When we actually see the EOF, we change the status to "new"
488 * (via yyrestart()), so that the user can continue scanning by
489 * just pointing yyin at a new input file.
490 */
491 #define YY_BUFFER_EOF_PENDING 2
492
493 };
494 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
495
496 /* We provide macros for accessing buffer states in case in the
497 * future we want to put the buffer states in a more general
498 * "scanner state".
499 *
500 * Returns the top of the stack, or NULL.
501 */
502 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
503 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
504 : NULL)
505 /* Same as previous macro, but useful when we know that the buffer stack is not
506 * NULL or when we need an lvalue. For internal use only.
507 */
508 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
509
510 void yyrestart ( FILE *input_file , yyscan_t yyscanner );
511 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
512 YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
513 void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
514 void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
515 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
516 void yypop_buffer_state ( yyscan_t yyscanner );
517
518 static void yyensure_buffer_stack ( yyscan_t yyscanner );
519 static void yy_load_buffer_state ( yyscan_t yyscanner );
520 static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );
521 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)
522
523 YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
524 YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
525 YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
526
527 void *yyalloc ( yy_size_t , yyscan_t yyscanner );
528 void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
529 void yyfree ( void * , yyscan_t yyscanner );
530
531 #define yy_new_buffer yy_create_buffer
532 #define yy_set_interactive(is_interactive) \
533 { \
534 if ( ! YY_CURRENT_BUFFER ){ \
535 yyensure_buffer_stack (yyscanner); \
536 YY_CURRENT_BUFFER_LVALUE = \
537 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
538 } \
539 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
540 }
541 #define yy_set_bol(at_bol) \
542 { \
543 if ( ! YY_CURRENT_BUFFER ){\
544 yyensure_buffer_stack (yyscanner); \
545 YY_CURRENT_BUFFER_LVALUE = \
546 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
547 } \
548 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
549 }
550 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
551
552 /* Begin user sect3 */
553
554 #define glcpp_wrap(yyscanner) (/*CONSTCOND*/1)
555 #define YY_SKIP_YYWRAP
556 typedef flex_uint8_t YY_CHAR;
557
558 typedef int yy_state_type;
559
560 #define yytext_ptr yytext_r
561
562 static yy_state_type yy_get_previous_state ( yyscan_t yyscanner );
563 static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner);
564 static int yy_get_next_buffer ( yyscan_t yyscanner );
565 static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
566
567 /* Done after the current pattern has been matched and before the
568 * corresponding action - sets up yytext.
569 */
570 #define YY_DO_BEFORE_ACTION \
571 yyg->yytext_ptr = yy_bp; \
572 yyleng = (int) (yy_cp - yy_bp); \
573 yyg->yy_hold_char = *yy_cp; \
574 *yy_cp = '\0'; \
575 yyg->yy_c_buf_p = yy_cp;
576 #define YY_NUM_RULES 54
577 #define YY_END_OF_BUFFER 55
578 /* This struct is not used in this scanner,
579 but its presence is necessary. */
580 struct yy_trans_info
581 {
582 flex_int32_t yy_verify;
583 flex_int32_t yy_nxt;
584 };
585 static const flex_int16_t yy_accept[189] =
586 { 0,
587 0, 0, 3, 3, 0, 0, 0, 0, 0, 0,
588 0, 0, 0, 0, 55, 49, 50, 52, 52, 48,
589 49, 8, 48, 48, 48, 48, 48, 48, 32, 31,
590 48, 48, 48, 46, 46, 48, 3, 4, 4, 5,
591 30, 28, 53, 27, 53, 25, 24, 14, 14, 25,
592 25, 25, 25, 25, 25, 25, 25, 49, 52, 39,
593 0, 49, 49, 44, 40, 42, 43, 47, 2, 1,
594 47, 32, 47, 32, 47, 31, 31, 34, 36, 38,
595 37, 35, 46, 46, 41, 3, 4, 4, 4, 5,
596 6, 6, 5, 7, 30, 28, 29, 1, 26, 27,
597
598 24, 14, 0, 0, 0, 0, 0, 0, 0, 0,
599 0, 0, 0, 51, 1, 33, 33, 46, 4, 6,
600 29, 1, 0, 0, 0, 0, 0, 0, 17, 0,
601 0, 0, 0, 0, 0, 0, 33, 46, 0, 0,
602 19, 0, 0, 0, 0, 0, 0, 0, 0, 0,
603 0, 46, 0, 18, 20, 21, 0, 15, 0, 0,
604 13, 0, 23, 0, 46, 22, 21, 0, 16, 0,
605 11, 0, 45, 22, 0, 0, 11, 11, 10, 0,
606 0, 0, 9, 11, 0, 0, 12, 0
607 } ;
608
609 static const YY_CHAR yy_ec[256] =
610 { 0,
611 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
612 2, 2, 4, 1, 1, 1, 1, 1, 1, 1,
613 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
614 1, 5, 6, 7, 8, 1, 9, 10, 1, 11,
615 9, 12, 13, 9, 14, 15, 16, 17, 18, 18,
616 18, 18, 18, 18, 18, 19, 19, 20, 9, 21,
617 22, 23, 20, 1, 24, 24, 24, 24, 25, 24,
618 26, 26, 26, 26, 26, 26, 26, 26, 26, 27,
619 26, 26, 26, 26, 28, 26, 26, 29, 26, 26,
620 9, 1, 9, 9, 26, 1, 30, 24, 31, 32,
621
622 33, 34, 35, 26, 36, 26, 26, 37, 38, 39,
623 40, 41, 26, 42, 43, 44, 45, 46, 26, 47,
624 26, 26, 9, 48, 9, 9, 1, 1, 1, 1,
625 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
626 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
627 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
628 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
629 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
630 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
631 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
632
633 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
634 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
635 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
636 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
637 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
638 1, 1, 1, 1, 1
639 } ;
640
641 static const YY_CHAR yy_meta[49] =
642 { 0,
643 1, 2, 3, 3, 4, 5, 1, 6, 5, 5,
644 7, 8, 5, 5, 9, 5, 10, 10, 10, 5,
645 6, 5, 6, 10, 10, 10, 10, 10, 10, 10,
646 10, 11, 10, 10, 10, 10, 10, 10, 11, 10,
647 10, 10, 10, 10, 10, 10, 10, 5
648 } ;
649
650 static const flex_int16_t yy_base[208] =
651 { 0,
652 0, 0, 46, 48, 60, 0, 50, 52, 107, 152,
653 110, 112, 114, 116, 538, 121, 539, 533, 533, 513,
654 125, 526, 539, 523, 519, 517, 112, 109, 182, 213,
655 112, 508, 113, 0, 496, 480, 134, 523, 523, 146,
656 0, 122, 130, 514, 539, 539, 158, 520, 520, 135,
657 489, 122, 131, 485, 478, 480, 485, 166, 539, 539,
658 165, 170, 174, 539, 539, 539, 539, 179, 539, 0,
659 192, 217, 230, 165, 259, 0, 169, 539, 539, 539,
660 539, 539, 0, 483, 539, 188, 512, 512, 539, 210,
661 510, 510, 244, 539, 0, 200, 0, 216, 539, 496,
662
663 237, 539, 451, 144, 440, 412, 400, 164, 412, 403,
664 402, 395, 384, 539, 0, 221, 237, 370, 539, 539,
665 0, 259, 369, 370, 355, 334, 327, 333, 539, 297,
666 297, 291, 294, 291, 292, 281, 239, 284, 283, 0,
667 539, 287, 278, 280, 284, 271, 251, 265, 257, 253,
668 250, 248, 247, 539, 539, 0, 236, 539, 225, 205,
669 283, 198, 539, 176, 169, 292, 0, 159, 539, 143,
670 296, 135, 0, 300, 19, 301, 265, 305, 539, 309,
671 18, 310, 311, 271, 0, 201, 539, 539, 331, 342,
672 353, 364, 367, 369, 380, 391, 402, 413, 418, 429,
673
674 440, 451, 462, 473, 482, 493, 501
675 } ;
676
677 static const flex_int16_t yy_def[208] =
678 { 0,
679 188, 1, 189, 189, 188, 5, 190, 190, 191, 191,
680 190, 190, 190, 190, 188, 188, 188, 188, 188, 188,
681 192, 188, 188, 188, 188, 188, 188, 188, 193, 193,
682 188, 188, 188, 194, 194, 188, 195, 188, 188, 196,
683 197, 188, 198, 199, 188, 188, 188, 188, 188, 188,
684 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
685 192, 188, 192, 188, 188, 188, 188, 193, 188, 200,
686 193, 30, 193, 73, 73, 30, 73, 188, 188, 188,
687 188, 188, 194, 194, 188, 195, 188, 188, 188, 196,
688 188, 188, 196, 188, 197, 188, 201, 202, 188, 199,
689
690 188, 188, 188, 188, 188, 188, 188, 203, 188, 188,
691 188, 188, 188, 188, 200, 75, 75, 194, 188, 188,
692 201, 202, 188, 188, 188, 188, 188, 188, 188, 188,
693 188, 188, 188, 188, 188, 188, 73, 194, 188, 204,
694 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
695 188, 194, 188, 188, 188, 205, 188, 188, 188, 188,
696 188, 188, 188, 188, 194, 188, 205, 188, 188, 188,
697 206, 188, 194, 188, 188, 188, 206, 206, 188, 188,
698 188, 188, 188, 206, 207, 207, 188, 0, 188, 188,
699 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
700
701 188, 188, 188, 188, 188, 188, 188
702 } ;
703
704 static const flex_int16_t yy_nxt[588] =
705 { 0,
706 16, 17, 18, 19, 17, 20, 21, 22, 23, 24,
707 23, 23, 25, 26, 27, 28, 29, 30, 30, 16,
708 31, 32, 33, 34, 34, 34, 34, 34, 34, 34,
709 34, 35, 34, 34, 34, 34, 34, 34, 34, 34,
710 34, 34, 34, 34, 34, 34, 34, 36, 38, 39,
711 38, 39, 18, 19, 18, 19, 184, 40, 181, 40,
712 41, 42, 18, 19, 42, 41, 41, 41, 41, 41,
713 41, 41, 41, 41, 41, 43, 41, 41, 41, 41,
714 41, 41, 41, 44, 44, 44, 44, 44, 44, 44,
715 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
716
717 44, 44, 44, 44, 44, 44, 44, 41, 47, 48,
718 49, 47, 18, 19, 18, 19, 18, 19, 18, 19,
719 69, 58, 50, 96, 70, 58, 96, 58, 68, 68,
720 68, 62, 78, 79, 81, 82, 87, 88, 51, 52,
721 58, 69, 53, 54, 63, 98, 69, 55, 91, 92,
722 70, 56, 57, 47, 48, 49, 47, 93, 104, 101,
723 105, 94, 101, 106, 108, 188, 58, 50, 107, 109,
724 58, 114, 58, 180, 58, 176, 58, 188, 188, 124,
725 62, 188, 188, 51, 52, 58, 125, 53, 54, 58,
726 87, 88, 55, 63, 175, 130, 56, 57, 72, 72,
727
728 173, 96, 131, 73, 96, 73, 73, 187, 73, 74,
729 75, 73, 91, 92, 73, 172, 73, 115, 73, 73,
730 115, 188, 73, 187, 73, 188, 74, 171, 75, 76,
731 76, 76, 73, 72, 72, 71, 170, 73, 101, 73,
732 77, 101, 71, 71, 74, 73, 91, 92, 137, 71,
733 71, 188, 188, 73, 73, 93, 73, 77, 169, 94,
734 115, 74, 73, 115, 137, 137, 161, 188, 188, 161,
735 73, 188, 188, 188, 188, 116, 116, 116, 168, 166,
736 165, 137, 116, 117, 161, 164, 163, 161, 116, 116,
737 116, 117, 116, 174, 162, 160, 174, 178, 179, 179,
738
739 178, 174, 182, 159, 174, 182, 178, 179, 179, 178,
740 183, 182, 183, 183, 182, 183, 185, 158, 157, 156,
741 155, 153, 152, 151, 150, 149, 148, 147, 146, 145,
742 185, 37, 37, 37, 37, 37, 37, 37, 37, 37,
743 37, 37, 45, 45, 45, 45, 45, 45, 45, 45,
744 45, 45, 45, 46, 46, 46, 46, 46, 46, 46,
745 46, 46, 46, 46, 61, 144, 143, 61, 61, 142,
746 61, 61, 61, 61, 61, 71, 71, 71, 83, 83,
747 86, 86, 86, 86, 86, 86, 86, 141, 86, 86,
748 86, 90, 90, 90, 90, 90, 90, 90, 90, 90,
749
750 90, 90, 95, 140, 139, 138, 95, 95, 95, 95,
751 95, 95, 95, 97, 97, 97, 97, 97, 97, 97,
752 97, 97, 97, 97, 100, 136, 135, 100, 100, 115,
753 115, 134, 115, 115, 115, 115, 115, 115, 115, 115,
754 121, 133, 132, 128, 121, 121, 121, 121, 121, 121,
755 121, 122, 122, 127, 122, 122, 122, 122, 122, 122,
756 122, 122, 129, 129, 129, 129, 129, 129, 129, 129,
757 129, 126, 129, 154, 154, 154, 154, 154, 154, 154,
758 154, 154, 167, 167, 123, 167, 167, 167, 167, 167,
759 167, 167, 167, 177, 177, 177, 177, 177, 177, 177,
760
761 177, 177, 177, 177, 186, 186, 99, 186, 186, 186,
762 186, 186, 120, 120, 119, 119, 118, 113, 112, 111,
763 110, 103, 102, 102, 99, 89, 89, 85, 84, 80,
764 67, 66, 65, 64, 60, 59, 59, 188, 15, 188,
765 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
766 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
767 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
768 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
769 188, 188, 188, 188, 188, 188, 188
770 } ;
771
772 static const flex_int16_t yy_chk[588] =
773 { 0,
774 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
775 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
776 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
777 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
778 1, 1, 1, 1, 1, 1, 1, 1, 3, 3,
779 4, 4, 7, 7, 8, 8, 181, 3, 175, 4,
780 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
781 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
782 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
783 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
784
785 5, 5, 5, 5, 5, 5, 5, 5, 9, 9,
786 9, 9, 11, 11, 12, 12, 13, 13, 14, 14,
787 28, 16, 9, 42, 28, 21, 42, 16, 27, 27,
788 27, 21, 31, 31, 33, 33, 37, 37, 9, 9,
789 16, 43, 9, 9, 21, 43, 50, 9, 40, 40,
790 50, 9, 9, 10, 10, 10, 10, 40, 52, 47,
791 52, 40, 47, 52, 53, 61, 58, 10, 52, 53,
792 62, 61, 58, 172, 63, 170, 62, 74, 74, 104,
793 63, 77, 77, 10, 10, 58, 104, 10, 10, 62,
794 86, 86, 10, 63, 168, 108, 10, 10, 29, 29,
795
796 165, 96, 108, 68, 96, 68, 29, 186, 29, 29,
797 29, 68, 90, 90, 29, 164, 71, 98, 71, 68,
798 98, 90, 29, 186, 71, 90, 29, 162, 29, 30,
799 30, 30, 71, 72, 72, 72, 160, 30, 101, 30,
800 30, 101, 73, 73, 72, 30, 93, 93, 116, 117,
801 117, 137, 137, 30, 73, 93, 73, 30, 159, 93,
802 122, 72, 73, 122, 117, 116, 148, 177, 177, 148,
803 73, 75, 75, 184, 184, 75, 75, 75, 157, 153,
804 152, 117, 75, 75, 161, 151, 150, 161, 75, 75,
805 75, 75, 75, 166, 149, 147, 166, 171, 171, 171,
806
807 171, 174, 176, 146, 174, 176, 178, 178, 178, 178,
808 180, 182, 183, 180, 182, 183, 182, 145, 144, 143,
809 142, 139, 138, 136, 135, 134, 133, 132, 131, 130,
810 182, 189, 189, 189, 189, 189, 189, 189, 189, 189,
811 189, 189, 190, 190, 190, 190, 190, 190, 190, 190,
812 190, 190, 190, 191, 191, 191, 191, 191, 191, 191,
813 191, 191, 191, 191, 192, 128, 127, 192, 192, 126,
814 192, 192, 192, 192, 192, 193, 193, 193, 194, 194,
815 195, 195, 195, 195, 195, 195, 195, 125, 195, 195,
816 195, 196, 196, 196, 196, 196, 196, 196, 196, 196,
817
818 196, 196, 197, 124, 123, 118, 197, 197, 197, 197,
819 197, 197, 197, 198, 198, 198, 198, 198, 198, 198,
820 198, 198, 198, 198, 199, 113, 112, 199, 199, 200,
821 200, 111, 200, 200, 200, 200, 200, 200, 200, 200,
822 201, 110, 109, 107, 201, 201, 201, 201, 201, 201,
823 201, 202, 202, 106, 202, 202, 202, 202, 202, 202,
824 202, 202, 203, 203, 203, 203, 203, 203, 203, 203,
825 203, 105, 203, 204, 204, 204, 204, 204, 204, 204,
826 204, 204, 205, 205, 103, 205, 205, 205, 205, 205,
827 205, 205, 205, 206, 206, 206, 206, 206, 206, 206,
828
829 206, 206, 206, 206, 207, 207, 100, 207, 207, 207,
830 207, 207, 92, 91, 88, 87, 84, 57, 56, 55,
831 54, 51, 49, 48, 44, 39, 38, 36, 35, 32,
832 26, 25, 24, 22, 20, 19, 18, 15, 188, 188,
833 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
834 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
835 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
836 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
837 188, 188, 188, 188, 188, 188, 188
838 } ;
839
840 /* The intent behind this definition is that it'll catch
841 * any uses of REJECT which flex missed.
842 */
843 #define REJECT reject_used_but_not_detected
844 #define yymore() yymore_used_but_not_detected
845 #define YY_MORE_ADJ 0
846 #define YY_RESTORE_YY_MORE_OFFSET
847 #line 1 "src/compiler/glsl/glcpp/glcpp-lex.l"
848 #line 2 "src/compiler/glsl/glcpp/glcpp-lex.l"
849 /*
850 * Copyright © 2010 Intel Corporation
851 *
852 * Permission is hereby granted, free of charge, to any person obtaining a
853 * copy of this software and associated documentation files (the "Software"),
854 * to deal in the Software without restriction, including without limitation
855 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
856 * and/or sell copies of the Software, and to permit persons to whom the
857 * Software is furnished to do so, subject to the following conditions:
858 *
859 * The above copyright notice and this permission notice (including the next
860 * paragraph) shall be included in all copies or substantial portions of the
861 * Software.
862 *
863 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
864 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
865 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
866 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
867 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
868 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
869 * DEALINGS IN THE SOFTWARE.
870 */
871
872 #include <stdio.h>
873 #include <string.h>
874 #include <ctype.h>
875
876 #include "glcpp.h"
877 #include "glcpp-parse.h"
878
879 /* Flex annoyingly generates some functions without making them
880 * static. Let's declare them here. */
881 int glcpp_get_column (yyscan_t yyscanner);
882 void glcpp_set_column (int column_no , yyscan_t yyscanner);
883
884 #ifdef _MSC_VER
885 #define YY_NO_UNISTD_H
886 #endif
887
888 #define YY_NO_INPUT
889
890 #define YY_USER_ACTION \
891 do { \
892 if (parser->has_new_line_number) \
893 yylineno = parser->new_line_number; \
894 if (parser->has_new_source_number) \
895 yylloc->source = parser->new_source_number; \
896 yylloc->first_column = yycolumn + 1; \
897 yylloc->first_line = yylloc->last_line = yylineno; \
898 yycolumn += yyleng; \
899 yylloc->last_column = yycolumn + 1; \
900 parser->has_new_line_number = 0; \
901 parser->has_new_source_number = 0; \
902 } while(0);
903
904 #define YY_USER_INIT \
905 do { \
906 yylineno = 1; \
907 yycolumn = 0; \
908 yylloc->source = 0; \
909 } while(0)
910
911 /* It's ugly to have macros that have return statements inside of
912 * them, but flex-based lexer generation is all built around the
913 * return statement.
914 *
915 * To mitigate the ugliness, we defer as much of the logic as possible
916 * to an actual function, not a macro (see
917 * glcpplex_update_state_per_token) and we make the word RETURN
918 * prominent in all of the macros which may return.
919 *
920 * The most-commonly-used macro is RETURN_TOKEN which will perform all
921 * necessary state updates based on the provided token,, then
922 * conditionally return the token. It will not return a token if the
923 * parser is currently skipping tokens, (such as within #if
924 * 0...#else).
925 *
926 * The RETURN_TOKEN_NEVER_SKIP macro is a lower-level variant that
927 * makes the token returning unconditional. This is needed for things
928 * like #if and the tokens of its condition, (since these must be
929 * evaluated by the parser even when otherwise skipping).
930 *
931 * Finally, RETURN_STRING_TOKEN is a simple convenience wrapper on top
932 * of RETURN_TOKEN that performs a string copy of yytext before the
933 * return.
934 */
935 #define RETURN_TOKEN_NEVER_SKIP(token) \
936 do { \
937 if (glcpp_lex_update_state_per_token (parser, token)) \
938 return token; \
939 } while (0)
940
941 #define RETURN_TOKEN(token) \
942 do { \
943 if (! parser->skipping) { \
944 RETURN_TOKEN_NEVER_SKIP(token); \
945 } \
946 } while(0)
947
948 #define RETURN_STRING_TOKEN(token) \
949 do { \
950 if (! parser->skipping) { \
951 /* We're not doing linear_strdup here, to avoid \
952 * an implicit call on strlen() for the length \
953 * of the string, as this is already found by \
954 * flex and stored in yyleng */ \
955 void *mem_ctx = yyextra->linalloc; \
956 yylval->str = linear_alloc_child(mem_ctx, \
957 yyleng + 1); \
958 memcpy(yylval->str, yytext, yyleng + 1); \
959 RETURN_TOKEN_NEVER_SKIP (token); \
960 } \
961 } while(0)
962
963
964 /* Update all state necessary for each token being returned.
965 *
966 * Here we'll be tracking newlines and spaces so that the lexer can
967 * alter its behavior as necessary, (for example, '#' has special
968 * significance if it is the first non-whitespace, non-comment token
969 * in a line, but does not otherwise).
970 *
971 * NOTE: If this function returns FALSE, then no token should be
972 * returned at all. This is used to suprress duplicate SPACE tokens.
973 */
974 static int
975 glcpp_lex_update_state_per_token (glcpp_parser_t *parser, int token)
976 {
977 if (token != NEWLINE && token != SPACE && token != HASH_TOKEN &&
978 !parser->lexing_version_directive) {
979 glcpp_parser_resolve_implicit_version(parser);
980 }
981
982 /* After the first non-space token in a line, we won't
983 * allow any '#' to introduce a directive. */
984 if (token == NEWLINE) {
985 parser->first_non_space_token_this_line = 1;
986 } else if (token != SPACE) {
987 parser->first_non_space_token_this_line = 0;
988 }
989
990 /* Track newlines just to know whether a newline needs
991 * to be inserted if end-of-file comes early. */
992 if (token == NEWLINE) {
993 parser->last_token_was_newline = 1;
994 } else {
995 parser->last_token_was_newline = 0;
996 }
997
998 /* Track spaces to avoid emitting multiple SPACE
999 * tokens in a row. */
1000 if (token == SPACE) {
1001 if (! parser->last_token_was_space) {
1002 parser->last_token_was_space = 1;
1003 return 1;
1004 } else {
1005 parser->last_token_was_space = 1;
1006 return 0;
1007 }
1008 } else {
1009 parser->last_token_was_space = 0;
1010 return 1;
1011 }
1012 }
1013
1014
1015 #line 1015 "src/compiler/glsl/glcpp/glcpp-lex.c"
1016 #line 178 "src/compiler/glsl/glcpp/glcpp-lex.l"
1017 /* Note: When adding any start conditions to this list, you must also
1018 * update the "Internal compiler error" catch-all rule near the end of
1019 * this file. */
1020
1021 /* The OTHER class is simply a catch-all for things that the CPP
1022 parser just doesn't care about. Since flex regular expressions that
1023 match longer strings take priority over those matching shorter
1024 strings, we have to be careful to avoid OTHER matching and hiding
1025 something that CPP does care about. So we simply exclude all
1026 characters that appear in any other expressions. */
1027 #line 1027 "src/compiler/glsl/glcpp/glcpp-lex.c"
1028
1029 #define INITIAL 0
1030 #define COMMENT 1
1031 #define DEFINE 2
1032 #define DONE 3
1033 #define HASH 4
1034 #define NEWLINE_CATCHUP 5
1035 #define UNREACHABLE 6
1036
1037 #define YY_EXTRA_TYPE glcpp_parser_t *
1038
1039 /* Holds the entire state of the reentrant scanner. */
1040 struct yyguts_t
1041 {
1042
1043 /* User-defined. Not touched by flex. */
1044 YY_EXTRA_TYPE yyextra_r;
1045
1046 /* The rest are the same as the globals declared in the non-reentrant scanner. */
1047 FILE *yyin_r, *yyout_r;
1048 size_t yy_buffer_stack_top; /**< index of top of stack. */
1049 size_t yy_buffer_stack_max; /**< capacity of stack. */
1050 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
1051 char yy_hold_char;
1052 int yy_n_chars;
1053 int yyleng_r;
1054 char *yy_c_buf_p;
1055 int yy_init;
1056 int yy_start;
1057 int yy_did_buffer_switch_on_eof;
1058 int yy_start_stack_ptr;
1059 int yy_start_stack_depth;
1060 int *yy_start_stack;
1061 yy_state_type yy_last_accepting_state;
1062 char* yy_last_accepting_cpos;
1063
1064 int yylineno_r;
1065 int yy_flex_debug_r;
1066
1067 char *yytext_r;
1068 int yy_more_flag;
1069 int yy_more_len;
1070
1071 YYSTYPE * yylval_r;
1072
1073 YYLTYPE * yylloc_r;
1074
1075 }; /* end struct yyguts_t */
1076
1077 static int yy_init_globals ( yyscan_t yyscanner );
1078
1079 /* This must go here because YYSTYPE and YYLTYPE are included
1080 * from bison output in section 1.*/
1081 # define yylval yyg->yylval_r
1082
1083 # define yylloc yyg->yylloc_r
1084
1085 int yylex_init (yyscan_t* scanner);
1086
1087 int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
1088
1089 /* Accessor methods to globals.
1090 These are made visible to non-reentrant scanners for convenience. */
1091
1092 int yylex_destroy ( yyscan_t yyscanner );
1093
1094 int yyget_debug ( yyscan_t yyscanner );
1095
1096 void yyset_debug ( int debug_flag , yyscan_t yyscanner );
1097
1098 YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
1099
1100 void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
1101
1102 FILE *yyget_in ( yyscan_t yyscanner );
1103
1104 void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
1105
1106 FILE *yyget_out ( yyscan_t yyscanner );
1107
1108 void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
1109
1110 int yyget_leng ( yyscan_t yyscanner );
1111
1112 char *yyget_text ( yyscan_t yyscanner );
1113
1114 int yyget_lineno ( yyscan_t yyscanner );
1115
1116 void yyset_lineno ( int _line_number , yyscan_t yyscanner );
1117
1118 int yyget_column ( yyscan_t yyscanner );
1119
1120 void yyset_column ( int _column_no , yyscan_t yyscanner );
1121
1122 YYSTYPE * yyget_lval ( yyscan_t yyscanner );
1123
1124 void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
1125
1126 YYLTYPE *yyget_lloc ( yyscan_t yyscanner );
1127
1128 void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner );
1129
1130 /* Macros after this point can all be overridden by user definitions in
1131 * section 1.
1132 */
1133
1134 #ifndef YY_SKIP_YYWRAP
1135 #ifdef __cplusplus
1136 extern "C" int yywrap ( yyscan_t yyscanner );
1137 #else
1138 extern int yywrap ( yyscan_t yyscanner );
1139 #endif
1140 #endif
1141
1142 #ifndef YY_NO_UNPUT
1143
1144 static void yyunput ( int c, char *buf_ptr , yyscan_t yyscanner);
1145
1146 #endif
1147
1148 #ifndef yytext_ptr
1149 static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
1150 #endif
1151
1152 #ifdef YY_NEED_STRLEN
1153 static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
1154 #endif
1155
1156 #ifndef YY_NO_INPUT
1157 #ifdef __cplusplus
1158 static int yyinput ( yyscan_t yyscanner );
1159 #else
1160 static int input ( yyscan_t yyscanner );
1161 #endif
1162
1163 #endif
1164
1165 static void yy_push_state ( int _new_state , yyscan_t yyscanner);
1166
1167 static void yy_pop_state ( yyscan_t yyscanner );
1168
1169 static int yy_top_state ( yyscan_t yyscanner );
1170
1171 /* Amount of stuff to slurp up with each read. */
1172 #ifndef YY_READ_BUF_SIZE
1173 #ifdef __ia64__
1174 /* On IA-64, the buffer size is 16k, not 8k */
1175 #define YY_READ_BUF_SIZE 16384
1176 #else
1177 #define YY_READ_BUF_SIZE 8192
1178 #endif /* __ia64__ */
1179 #endif
1180
1181 /* Copy whatever the last rule matched to the standard output. */
1182 #ifndef ECHO
1183 /* This used to be an fputs(), but since the string might contain NUL's,
1184 * we now use fwrite().
1185 */
1186 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
1187 #endif
1188
1189 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1190 * is returned in "result".
1191 */
1192 #ifndef YY_INPUT
1193 #define YY_INPUT(buf,result,max_size) \
1194 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1195 { \
1196 int c = '*'; \
1197 int n; \
1198 for ( n = 0; n < max_size && \
1199 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1200 buf[n] = (char) c; \
1201 if ( c == '\n' ) \
1202 buf[n++] = (char) c; \
1203 if ( c == EOF && ferror( yyin ) ) \
1204 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1205 result = n; \
1206 } \
1207 else \
1208 { \
1209 errno=0; \
1210 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
1211 { \
1212 if( errno != EINTR) \
1213 { \
1214 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1215 break; \
1216 } \
1217 errno=0; \
1218 clearerr(yyin); \
1219 } \
1220 }\
1221 \
1222
1223 #endif
1224
1225 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1226 * we don't want an extra ';' after the "return" because that will cause
1227 * some compilers to complain about unreachable statements.
1228 */
1229 #ifndef yyterminate
1230 #define yyterminate() return YY_NULL
1231 #endif
1232
1233 /* Number of entries by which start-condition stack grows. */
1234 #ifndef YY_START_STACK_INCR
1235 #define YY_START_STACK_INCR 25
1236 #endif
1237
1238 /* Report a fatal error. */
1239 #ifndef YY_FATAL_ERROR
1240 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
1241 #endif
1242
1243 /* end tables serialization structures and prototypes */
1244
1245 /* Default declaration of generated scanner - a define so the user can
1246 * easily add parameters.
1247 */
1248 #ifndef YY_DECL
1249 #define YY_DECL_IS_OURS 1
1250
1251 extern int yylex \
1252 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner);
1253
1254 #define YY_DECL int yylex \
1255 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
1256 #endif /* !YY_DECL */
1257
1258 /* Code executed at the beginning of each rule, after yytext and yyleng
1259 * have been set up.
1260 */
1261 #ifndef YY_USER_ACTION
1262 #define YY_USER_ACTION
1263 #endif
1264
1265 /* Code executed at the end of each rule. */
1266 #ifndef YY_BREAK
1267 #define YY_BREAK /*LINTED*/break;
1268 #endif
1269
1270 #define YY_RULE_SETUP \
1271 YY_USER_ACTION
1272
1273 /** The main scanner function which does all the work.
1274 */
1275 YY_DECL
1276 {
1277 yy_state_type yy_current_state;
1278 char *yy_cp, *yy_bp;
1279 int yy_act;
1280 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1281
1282 yylval = yylval_param;
1283
1284 yylloc = yylloc_param;
1285
1286 if ( !yyg->yy_init )
1287 {
1288 yyg->yy_init = 1;
1289
1290 #ifdef YY_USER_INIT
1291 YY_USER_INIT;
1292 #endif
1293
1294 if ( ! yyg->yy_start )
1295 yyg->yy_start = 1; /* first start state */
1296
1297 if ( ! yyin )
1298 yyin = stdin;
1299
1300 if ( ! yyout )
1301 yyout = stdout;
1302
1303 if ( ! YY_CURRENT_BUFFER ) {
1304 yyensure_buffer_stack (yyscanner);
1305 YY_CURRENT_BUFFER_LVALUE =
1306 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
1307 }
1308
1309 yy_load_buffer_state( yyscanner );
1310 }
1311
1312 {
1313 #line 208 "src/compiler/glsl/glcpp/glcpp-lex.l"
1314
1315
1316 glcpp_parser_t *parser = yyextra;
1317
1318 /* When we lex a multi-line comment, we replace it (as
1319 * specified) with a single space. But if the comment spanned
1320 * multiple lines, then subsequent parsing stages will not
1321 * count correct line numbers. To avoid this problem we keep
1322 * track of all newlines that were commented out by a
1323 * multi-line comment, and we emit a NEWLINE token for each at
1324 * the next legal opportunity, (which is when the lexer would
1325 * be emitting a NEWLINE token anyway).
1326 */
1327 if (YY_START == NEWLINE_CATCHUP) {
1328 if (parser->commented_newlines)
1329 parser->commented_newlines--;
1330 if (parser->commented_newlines == 0)
1331 BEGIN INITIAL;
1332 RETURN_TOKEN_NEVER_SKIP (NEWLINE);
1333 }
1334
1335 /* Set up the parser->skipping bit here before doing any lexing.
1336 *
1337 * This bit controls whether tokens are skipped, (as implemented by
1338 * RETURN_TOKEN), such as between "#if 0" and "#endif".
1339 *
1340 * The parser maintains a skip_stack indicating whether we should be
1341 * skipping, (and nested levels of #if/#ifdef/#ifndef/#endif) will
1342 * push and pop items from the stack.
1343 *
1344 * Here are the rules for determining whether we are skipping:
1345 *
1346 * 1. If the skip stack is NULL, we are outside of all #if blocks
1347 * and we are not skipping.
1348 *
1349 * 2. If the skip stack is non-NULL, the type of the top node in
1350 * the stack determines whether to skip. A type of
1351 * SKIP_NO_SKIP is used for blocks wheere we are emitting
1352 * tokens, (such as between #if 1 and #endif, or after the
1353 * #else of an #if 0, etc.).
1354 *
1355 * 3. The lexing_directive bit overrides the skip stack. This bit
1356 * is set when we are actively lexing the expression for a
1357 * pre-processor condition, (such as #if, #elif, or #else). In
1358 * this case, even if otherwise skipping, we need to emit the
1359 * tokens for this condition so that the parser can evaluate
1360 * the expression. (For, #else, there's no expression, but we
1361 * emit tokens so the parser can generate a nice error message
1362 * if there are any tokens here).
1363 */
1364 if (parser->skip_stack &&
1365 parser->skip_stack->type != SKIP_NO_SKIP &&
1366 ! parser->lexing_directive)
1367 {
1368 parser->skipping = 1;
1369 } else {
1370 parser->skipping = 0;
1371 }
1372
1373 /* Single-line comments */
1374 #line 1374 "src/compiler/glsl/glcpp/glcpp-lex.c"
1375
1376 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
1377 {
1378 yy_cp = yyg->yy_c_buf_p;
1379
1380 /* Support of yytext. */
1381 *yy_cp = yyg->yy_hold_char;
1382
1383 /* yy_bp points to the position in yy_ch_buf of the start of
1384 * the current run.
1385 */
1386 yy_bp = yy_cp;
1387
1388 yy_current_state = yyg->yy_start;
1389 yy_match:
1390 do
1391 {
1392 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
1393 if ( yy_accept[yy_current_state] )
1394 {
1395 yyg->yy_last_accepting_state = yy_current_state;
1396 yyg->yy_last_accepting_cpos = yy_cp;
1397 }
1398 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1399 {
1400 yy_current_state = (int) yy_def[yy_current_state];
1401 if ( yy_current_state >= 189 )
1402 yy_c = yy_meta[yy_c];
1403 }
1404 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1405 ++yy_cp;
1406 }
1407 while ( yy_current_state != 188 );
1408 yy_cp = yyg->yy_last_accepting_cpos;
1409 yy_current_state = yyg->yy_last_accepting_state;
1410
1411 yy_find_action:
1412 yy_act = yy_accept[yy_current_state];
1413
1414 YY_DO_BEFORE_ACTION;
1415
1416 do_action: /* This label is used only to access EOF actions. */
1417
1418 switch ( yy_act )
1419 { /* beginning of action switch */
1420 case 0: /* must back up */
1421 /* undo the effects of YY_DO_BEFORE_ACTION */
1422 *yy_cp = yyg->yy_hold_char;
1423 yy_cp = yyg->yy_last_accepting_cpos;
1424 yy_current_state = yyg->yy_last_accepting_state;
1425 goto yy_find_action;
1426
1427 case 1:
1428 YY_RULE_SETUP
1429 #line 268 "src/compiler/glsl/glcpp/glcpp-lex.l"
1430 {
1431 }
1432 YY_BREAK
1433 /* Multi-line comments */
1434 case 2:
1435 YY_RULE_SETUP
1436 #line 272 "src/compiler/glsl/glcpp/glcpp-lex.l"
1437 { yy_push_state(COMMENT, yyscanner); }
1438 YY_BREAK
1439 case 3:
1440 YY_RULE_SETUP
1441 #line 273 "src/compiler/glsl/glcpp/glcpp-lex.l"
1442
1443 YY_BREAK
1444 case 4:
1445 /* rule 4 can match eol */
1446 YY_RULE_SETUP
1447 #line 274 "src/compiler/glsl/glcpp/glcpp-lex.l"
1448 { yylineno++; yycolumn = 0; parser->commented_newlines++; }
1449 YY_BREAK
1450 case 5:
1451 YY_RULE_SETUP
1452 #line 275 "src/compiler/glsl/glcpp/glcpp-lex.l"
1453
1454 YY_BREAK
1455 case 6:
1456 /* rule 6 can match eol */
1457 YY_RULE_SETUP
1458 #line 276 "src/compiler/glsl/glcpp/glcpp-lex.l"
1459 { yylineno++; yycolumn = 0; parser->commented_newlines++; }
1460 YY_BREAK
1461 case 7:
1462 YY_RULE_SETUP
1463 #line 277 "src/compiler/glsl/glcpp/glcpp-lex.l"
1464 {
1465 yy_pop_state(yyscanner);
1466 /* In the <HASH> start condition, we don't want any SPACE token. */
1467 if (yyextra->space_tokens && YY_START != HASH)
1468 RETURN_TOKEN (SPACE);
1469 }
1470 YY_BREAK
1471 case 8:
1472 YY_RULE_SETUP
1473 #line 284 "src/compiler/glsl/glcpp/glcpp-lex.l"
1474 {
1475
1476 /* If the '#' is the first non-whitespace, non-comment token on this
1477 * line, then it introduces a directive, switch to the <HASH> start
1478 * condition.
1479 *
1480 * Otherwise, this is just punctuation, so return the HASH_TOKEN
1481 * token. */
1482 if (parser->first_non_space_token_this_line) {
1483 BEGIN HASH;
1484 yyextra->in_define = false;
1485 }
1486
1487 RETURN_TOKEN_NEVER_SKIP (HASH_TOKEN);
1488 }
1489 YY_BREAK
1490 case 9:
1491 YY_RULE_SETUP
1492 #line 300 "src/compiler/glsl/glcpp/glcpp-lex.l"
1493 {
1494 BEGIN INITIAL;
1495 yyextra->space_tokens = 0;
1496 yyextra->lexing_version_directive = 1;
1497 RETURN_STRING_TOKEN (VERSION_TOKEN);
1498 }
1499 YY_BREAK
1500 /* Swallow empty #pragma directives, (to avoid confusing the
1501 * downstream compiler).
1502 *
1503 * Note: We use a simple regular expression for the lookahead
1504 * here. Specifically, we cannot use the complete {NEWLINE} expression
1505 * since it uses alternation and we've found that there's a flex bug
1506 * where using alternation in the lookahead portion of a pattern
1507 * triggers a buffer overrun. */
1508 case 10:
1509 /* rule 10 can match eol */
1510 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1511 YY_LINENO_REWIND_TO(yy_cp - 1);
1512 yyg->yy_c_buf_p = yy_cp -= 1;
1513 YY_DO_BEFORE_ACTION; /* set up yytext again */
1514 YY_RULE_SETUP
1515 #line 315 "src/compiler/glsl/glcpp/glcpp-lex.l"
1516 {
1517 BEGIN INITIAL;
1518 }
1519 YY_BREAK
1520 /* glcpp doesn't handle #extension, #version, or #pragma directives.
1521 * Simply pass them through to the main compiler's lexer/parser. */
1522 case 11:
1523 YY_RULE_SETUP
1524 #line 321 "src/compiler/glsl/glcpp/glcpp-lex.l"
1525 {
1526 BEGIN INITIAL;
1527 RETURN_STRING_TOKEN (PRAGMA);
1528 }
1529 YY_BREAK
1530 case 12:
1531 YY_RULE_SETUP
1532 #line 326 "src/compiler/glsl/glcpp/glcpp-lex.l"
1533 {
1534 BEGIN INITIAL;
1535 RETURN_STRING_TOKEN (INCLUDE);
1536 }
1537 YY_BREAK
1538 case 13:
1539 YY_RULE_SETUP
1540 #line 331 "src/compiler/glsl/glcpp/glcpp-lex.l"
1541 {
1542 BEGIN INITIAL;
1543 RETURN_TOKEN (LINE);
1544 }
1545 YY_BREAK
1546 case 14:
1547 /* rule 14 can match eol */
1548 YY_RULE_SETUP
1549 #line 336 "src/compiler/glsl/glcpp/glcpp-lex.l"
1550 {
1551 BEGIN INITIAL;
1552 yyextra->space_tokens = 0;
1553 yylineno++;
1554 yycolumn = 0;
1555 RETURN_TOKEN_NEVER_SKIP (NEWLINE);
1556 }
1557 YY_BREAK
1558 /* For the pre-processor directives, we return these tokens
1559 * even when we are otherwise skipping. */
1560 case 15:
1561 YY_RULE_SETUP
1562 #line 346 "src/compiler/glsl/glcpp/glcpp-lex.l"
1563 {
1564 if (!yyextra->in_define) {
1565 BEGIN INITIAL;
1566 yyextra->lexing_directive = 1;
1567 yyextra->space_tokens = 0;
1568 RETURN_TOKEN_NEVER_SKIP (IFDEF);
1569 }
1570 }
1571 YY_BREAK
1572 case 16:
1573 YY_RULE_SETUP
1574 #line 355 "src/compiler/glsl/glcpp/glcpp-lex.l"
1575 {
1576 if (!yyextra->in_define) {
1577 BEGIN INITIAL;
1578 yyextra->lexing_directive = 1;
1579 yyextra->space_tokens = 0;
1580 RETURN_TOKEN_NEVER_SKIP (IFNDEF);
1581 }
1582 }
1583 YY_BREAK
1584 case 17:
1585 /* rule 17 can match eol */
1586 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1587 YY_LINENO_REWIND_TO(yy_bp + 2);
1588 yyg->yy_c_buf_p = yy_cp = yy_bp + 2;
1589 YY_DO_BEFORE_ACTION; /* set up yytext again */
1590 YY_RULE_SETUP
1591 #line 364 "src/compiler/glsl/glcpp/glcpp-lex.l"
1592 {
1593 if (!yyextra->in_define) {
1594 BEGIN INITIAL;
1595 yyextra->lexing_directive = 1;
1596 yyextra->space_tokens = 0;
1597 RETURN_TOKEN_NEVER_SKIP (IF);
1598 }
1599 }
1600 YY_BREAK
1601 case 18:
1602 /* rule 18 can match eol */
1603 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1604 YY_LINENO_REWIND_TO(yy_bp + 4);
1605 yyg->yy_c_buf_p = yy_cp = yy_bp + 4;
1606 YY_DO_BEFORE_ACTION; /* set up yytext again */
1607 YY_RULE_SETUP
1608 #line 373 "src/compiler/glsl/glcpp/glcpp-lex.l"
1609 {
1610 if (!yyextra->in_define) {
1611 BEGIN INITIAL;
1612 yyextra->lexing_directive = 1;
1613 yyextra->space_tokens = 0;
1614 RETURN_TOKEN_NEVER_SKIP (ELIF);
1615 }
1616 }
1617 YY_BREAK
1618 case 19:
1619 YY_RULE_SETUP
1620 #line 382 "src/compiler/glsl/glcpp/glcpp-lex.l"
1621 {
1622 if (!yyextra->in_define) {
1623 BEGIN INITIAL;
1624 yyextra->space_tokens = 0;
1625 RETURN_TOKEN_NEVER_SKIP (ELSE);
1626 }
1627 }
1628 YY_BREAK
1629 case 20:
1630 YY_RULE_SETUP
1631 #line 390 "src/compiler/glsl/glcpp/glcpp-lex.l"
1632 {
1633 if (!yyextra->in_define) {
1634 BEGIN INITIAL;
1635 yyextra->space_tokens = 0;
1636 RETURN_TOKEN_NEVER_SKIP (ENDIF);
1637 }
1638 }
1639 YY_BREAK
1640 case 21:
1641 YY_RULE_SETUP
1642 #line 398 "src/compiler/glsl/glcpp/glcpp-lex.l"
1643 {
1644 BEGIN INITIAL;
1645 RETURN_STRING_TOKEN (ERROR_TOKEN);
1646 }
1647 YY_BREAK
1648 /* After we see a "#define" we enter the <DEFINE> start state
1649 * for the lexer. Within <DEFINE> we are looking for the first
1650 * identifier and specifically checking whether the identifier
1651 * is followed by a '(' or not, (to lex either a
1652 * FUNC_IDENTIFIER or an OBJ_IDENITIFIER token).
1653 *
1654 * While in the <DEFINE> state we also need to explicitly
1655 * handle a few other things that may appear before the
1656 * identifier:
1657 *
1658 * * Comments, (handled above with the main support for
1659 * comments).
1660 *
1661 * * Whitespace (simply ignored)
1662 *
1663 * * Anything else, (not an identifier, not a comment,
1664 * and not whitespace). This will generate an error.
1665 */
1666 case 22:
1667 YY_RULE_SETUP
1668 #line 421 "src/compiler/glsl/glcpp/glcpp-lex.l"
1669 {
1670 yyextra->in_define = true;
1671 if (!parser->skipping) {
1672 BEGIN DEFINE;
1673 yyextra->space_tokens = 0;
1674 RETURN_TOKEN (DEFINE_TOKEN);
1675 }
1676 }
1677 YY_BREAK
1678 case 23:
1679 YY_RULE_SETUP
1680 #line 430 "src/compiler/glsl/glcpp/glcpp-lex.l"
1681 {
1682 BEGIN INITIAL;
1683 yyextra->space_tokens = 0;
1684 RETURN_TOKEN (UNDEF);
1685 }
1686 YY_BREAK
1687 case 24:
1688 YY_RULE_SETUP
1689 #line 436 "src/compiler/glsl/glcpp/glcpp-lex.l"
1690 {
1691 /* Nothing to do here. Importantly, don't leave the <HASH>
1692 * start condition, since it's legal to have space between the
1693 * '#' and the directive.. */
1694 }
1695 YY_BREAK
1696 /* This will catch any non-directive garbage after a HASH */
1697 case 25:
1698 YY_RULE_SETUP
1699 #line 443 "src/compiler/glsl/glcpp/glcpp-lex.l"
1700 {
1701 if (!parser->skipping) {
1702 BEGIN INITIAL;
1703 RETURN_TOKEN (GARBAGE);
1704 }
1705 }
1706 YY_BREAK
1707 /* An identifier immediately followed by '(' */
1708 case 26:
1709 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1710 yyg->yy_c_buf_p = yy_cp -= 1;
1711 YY_DO_BEFORE_ACTION; /* set up yytext again */
1712 YY_RULE_SETUP
1713 #line 451 "src/compiler/glsl/glcpp/glcpp-lex.l"
1714 {
1715 BEGIN INITIAL;
1716 RETURN_STRING_TOKEN (FUNC_IDENTIFIER);
1717 }
1718 YY_BREAK
1719 /* An identifier not immediately followed by '(' */
1720 case 27:
1721 YY_RULE_SETUP
1722 #line 457 "src/compiler/glsl/glcpp/glcpp-lex.l"
1723 {
1724 BEGIN INITIAL;
1725 RETURN_STRING_TOKEN (OBJ_IDENTIFIER);
1726 }
1727 YY_BREAK
1728 /* Whitespace */
1729 case 28:
1730 YY_RULE_SETUP
1731 #line 463 "src/compiler/glsl/glcpp/glcpp-lex.l"
1732 {
1733 /* Just ignore it. Nothing to do here. */
1734 }
1735 YY_BREAK
1736 /* '/' not followed by '*', so not a comment. This is an error. */
1737 case 29:
1738 /* rule 29 can match eol */
1739 YY_RULE_SETUP
1740 #line 468 "src/compiler/glsl/glcpp/glcpp-lex.l"
1741 {
1742 BEGIN INITIAL;
1743 glcpp_error(yylloc, yyextra, "#define followed by a non-identifier: %s", yytext);
1744 RETURN_STRING_TOKEN (INTEGER_STRING);
1745 }
1746 YY_BREAK
1747 /* A character that can't start an identifier, comment, or
1748 * space. This is an error. */
1749 case 30:
1750 YY_RULE_SETUP
1751 #line 476 "src/compiler/glsl/glcpp/glcpp-lex.l"
1752 {
1753 BEGIN INITIAL;
1754 glcpp_error(yylloc, yyextra, "#define followed by a non-identifier: %s", yytext);
1755 RETURN_STRING_TOKEN (INTEGER_STRING);
1756 }
1757 YY_BREAK
1758 case 31:
1759 YY_RULE_SETUP
1760 #line 482 "src/compiler/glsl/glcpp/glcpp-lex.l"
1761 {
1762 RETURN_STRING_TOKEN (INTEGER_STRING);
1763 }
1764 YY_BREAK
1765 case 32:
1766 YY_RULE_SETUP
1767 #line 486 "src/compiler/glsl/glcpp/glcpp-lex.l"
1768 {
1769 RETURN_STRING_TOKEN (INTEGER_STRING);
1770 }
1771 YY_BREAK
1772 case 33:
1773 YY_RULE_SETUP
1774 #line 490 "src/compiler/glsl/glcpp/glcpp-lex.l"
1775 {
1776 RETURN_STRING_TOKEN (INTEGER_STRING);
1777 }
1778 YY_BREAK
1779 case 34:
1780 YY_RULE_SETUP
1781 #line 494 "src/compiler/glsl/glcpp/glcpp-lex.l"
1782 {
1783 RETURN_TOKEN (LEFT_SHIFT);
1784 }
1785 YY_BREAK
1786 case 35:
1787 YY_RULE_SETUP
1788 #line 498 "src/compiler/glsl/glcpp/glcpp-lex.l"
1789 {
1790 RETURN_TOKEN (RIGHT_SHIFT);
1791 }
1792 YY_BREAK
1793 case 36:
1794 YY_RULE_SETUP
1795 #line 502 "src/compiler/glsl/glcpp/glcpp-lex.l"
1796 {
1797 RETURN_TOKEN (LESS_OR_EQUAL);
1798 }
1799 YY_BREAK
1800 case 37:
1801 YY_RULE_SETUP
1802 #line 506 "src/compiler/glsl/glcpp/glcpp-lex.l"
1803 {
1804 RETURN_TOKEN (GREATER_OR_EQUAL);
1805 }
1806 YY_BREAK
1807 case 38:
1808 YY_RULE_SETUP
1809 #line 510 "src/compiler/glsl/glcpp/glcpp-lex.l"
1810 {
1811 RETURN_TOKEN (EQUAL);
1812 }
1813 YY_BREAK
1814 case 39:
1815 YY_RULE_SETUP
1816 #line 514 "src/compiler/glsl/glcpp/glcpp-lex.l"
1817 {
1818 RETURN_TOKEN (NOT_EQUAL);
1819 }
1820 YY_BREAK
1821 case 40:
1822 YY_RULE_SETUP
1823 #line 518 "src/compiler/glsl/glcpp/glcpp-lex.l"
1824 {
1825 RETURN_TOKEN (AND);
1826 }
1827 YY_BREAK
1828 case 41:
1829 YY_RULE_SETUP
1830 #line 522 "src/compiler/glsl/glcpp/glcpp-lex.l"
1831 {
1832 RETURN_TOKEN (OR);
1833 }
1834 YY_BREAK
1835 case 42:
1836 YY_RULE_SETUP
1837 #line 526 "src/compiler/glsl/glcpp/glcpp-lex.l"
1838 {
1839 RETURN_TOKEN (PLUS_PLUS);
1840 }
1841 YY_BREAK
1842 case 43:
1843 YY_RULE_SETUP
1844 #line 530 "src/compiler/glsl/glcpp/glcpp-lex.l"
1845 {
1846 RETURN_TOKEN (MINUS_MINUS);
1847 }
1848 YY_BREAK
1849 case 44:
1850 YY_RULE_SETUP
1851 #line 534 "src/compiler/glsl/glcpp/glcpp-lex.l"
1852 {
1853 if (! parser->skipping) {
1854 if (parser->is_gles)
1855 glcpp_error(yylloc, yyextra, "Token pasting (##) is illegal in GLES");
1856 RETURN_TOKEN (PASTE);
1857 }
1858 }
1859 YY_BREAK
1860 case 45:
1861 YY_RULE_SETUP
1862 #line 542 "src/compiler/glsl/glcpp/glcpp-lex.l"
1863 {
1864 RETURN_TOKEN (DEFINED);
1865 }
1866 YY_BREAK
1867 case 46:
1868 YY_RULE_SETUP
1869 #line 546 "src/compiler/glsl/glcpp/glcpp-lex.l"
1870 {
1871 RETURN_STRING_TOKEN (IDENTIFIER);
1872 }
1873 YY_BREAK
1874 case 47:
1875 YY_RULE_SETUP
1876 #line 550 "src/compiler/glsl/glcpp/glcpp-lex.l"
1877 {
1878 RETURN_STRING_TOKEN (OTHER);
1879 }
1880 YY_BREAK
1881 case 48:
1882 YY_RULE_SETUP
1883 #line 554 "src/compiler/glsl/glcpp/glcpp-lex.l"
1884 {
1885 RETURN_TOKEN (yytext[0]);
1886 }
1887 YY_BREAK
1888 case 49:
1889 YY_RULE_SETUP
1890 #line 558 "src/compiler/glsl/glcpp/glcpp-lex.l"
1891 {
1892 RETURN_STRING_TOKEN (OTHER);
1893 }
1894 YY_BREAK
1895 case 50:
1896 YY_RULE_SETUP
1897 #line 562 "src/compiler/glsl/glcpp/glcpp-lex.l"
1898 {
1899 if (yyextra->space_tokens) {
1900 RETURN_TOKEN (SPACE);
1901 }
1902 }
1903 YY_BREAK
1904 case 51:
1905 YY_RULE_SETUP
1906 #line 568 "src/compiler/glsl/glcpp/glcpp-lex.l"
1907 {
1908 RETURN_STRING_TOKEN (PATH);
1909 }
1910 YY_BREAK
1911 /* We preserve all newlines, even between #if 0..#endif, so no
1912 skipping.. */
1913 case 52:
1914 /* rule 52 can match eol */
1915 YY_RULE_SETUP
1916 #line 574 "src/compiler/glsl/glcpp/glcpp-lex.l"
1917 {
1918 if (parser->commented_newlines) {
1919 BEGIN NEWLINE_CATCHUP;
1920 } else {
1921 BEGIN INITIAL;
1922 }
1923 yyextra->space_tokens = 1;
1924 yyextra->lexing_directive = 0;
1925 yyextra->lexing_version_directive = 0;
1926 yylineno++;
1927 yycolumn = 0;
1928 RETURN_TOKEN_NEVER_SKIP (NEWLINE);
1929 }
1930 YY_BREAK
1931 case YY_STATE_EOF(INITIAL):
1932 case YY_STATE_EOF(COMMENT):
1933 case YY_STATE_EOF(DEFINE):
1934 case YY_STATE_EOF(HASH):
1935 #line 588 "src/compiler/glsl/glcpp/glcpp-lex.l"
1936 {
1937 if (YY_START == COMMENT)
1938 glcpp_error(yylloc, yyextra, "Unterminated comment");
1939 BEGIN DONE; /* Don't keep matching this rule forever. */
1940 yyextra->lexing_directive = 0;
1941 yyextra->lexing_version_directive = 0;
1942 if (! parser->last_token_was_newline)
1943 RETURN_TOKEN (NEWLINE);
1944 }
1945 YY_BREAK
1946 /* This is a catch-all to avoid the annoying default flex action which
1947 * matches any character and prints it. If any input ever matches this
1948 * rule, then we have made a mistake above and need to fix one or more
1949 * of the preceding patterns to match that input. */
1950 case 53:
1951 YY_RULE_SETUP
1952 #line 603 "src/compiler/glsl/glcpp/glcpp-lex.l"
1953 {
1954 glcpp_error(yylloc, yyextra, "Internal compiler error: Unexpected character: %s", yytext);
1955
1956 /* We don't actually use the UNREACHABLE start condition. We
1957 only have this block here so that we can pretend to call some
1958 generated functions, (to avoid "defined but not used"
1959 warnings. */
1960 if (YY_START == UNREACHABLE) {
1961 unput('.');
1962 yy_top_state(yyextra);
1963 }
1964 }
1965 YY_BREAK
1966 case 54:
1967 YY_RULE_SETUP
1968 #line 616 "src/compiler/glsl/glcpp/glcpp-lex.l"
1969 YY_FATAL_ERROR( "flex scanner jammed" );
1970 YY_BREAK
1971 #line 1971 "src/compiler/glsl/glcpp/glcpp-lex.c"
1972 case YY_STATE_EOF(DONE):
1973 case YY_STATE_EOF(NEWLINE_CATCHUP):
1974 case YY_STATE_EOF(UNREACHABLE):
1975 yyterminate();
1976
1977 case YY_END_OF_BUFFER:
1978 {
1979 /* Amount of text matched not including the EOB char. */
1980 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1981
1982 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1983 *yy_cp = yyg->yy_hold_char;
1984 YY_RESTORE_YY_MORE_OFFSET
1985
1986 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1987 {
1988 /* We're scanning a new file or input source. It's
1989 * possible that this happened because the user
1990 * just pointed yyin at a new source and called
1991 * yylex(). If so, then we have to assure
1992 * consistency between YY_CURRENT_BUFFER and our
1993 * globals. Here is the right place to do so, because
1994 * this is the first action (other than possibly a
1995 * back-up) that will match for the new input source.
1996 */
1997 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1998 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1999 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
2000 }
2001
2002 /* Note that here we test for yy_c_buf_p "<=" to the position
2003 * of the first EOB in the buffer, since yy_c_buf_p will
2004 * already have been incremented past the NUL character
2005 * (since all states make transitions on EOB to the
2006 * end-of-buffer state). Contrast this with the test
2007 * in input().
2008 */
2009 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
2010 { /* This was really a NUL. */
2011 yy_state_type yy_next_state;
2012
2013 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
2014
2015 yy_current_state = yy_get_previous_state( yyscanner );
2016
2017 /* Okay, we're now positioned to make the NUL
2018 * transition. We couldn't have
2019 * yy_get_previous_state() go ahead and do it
2020 * for us because it doesn't know how to deal
2021 * with the possibility of jamming (and we don't
2022 * want to build jamming into it because then it
2023 * will run more slowly).
2024 */
2025
2026 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
2027
2028 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
2029
2030 if ( yy_next_state )
2031 {
2032 /* Consume the NUL. */
2033 yy_cp = ++yyg->yy_c_buf_p;
2034 yy_current_state = yy_next_state;
2035 goto yy_match;
2036 }
2037
2038 else
2039 {
2040 yy_cp = yyg->yy_last_accepting_cpos;
2041 yy_current_state = yyg->yy_last_accepting_state;
2042 goto yy_find_action;
2043 }
2044 }
2045
2046 else switch ( yy_get_next_buffer( yyscanner ) )
2047 {
2048 case EOB_ACT_END_OF_FILE:
2049 {
2050 yyg->yy_did_buffer_switch_on_eof = 0;
2051
2052 if ( yywrap( yyscanner ) )
2053 {
2054 /* Note: because we've taken care in
2055 * yy_get_next_buffer() to have set up
2056 * yytext, we can now set up
2057 * yy_c_buf_p so that if some total
2058 * hoser (like flex itself) wants to
2059 * call the scanner after we return the
2060 * YY_NULL, it'll still work - another
2061 * YY_NULL will get returned.
2062 */
2063 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
2064
2065 yy_act = YY_STATE_EOF(YY_START);
2066 goto do_action;
2067 }
2068
2069 else
2070 {
2071 if ( ! yyg->yy_did_buffer_switch_on_eof )
2072 YY_NEW_FILE;
2073 }
2074 break;
2075 }
2076
2077 case EOB_ACT_CONTINUE_SCAN:
2078 yyg->yy_c_buf_p =
2079 yyg->yytext_ptr + yy_amount_of_matched_text;
2080
2081 yy_current_state = yy_get_previous_state( yyscanner );
2082
2083 yy_cp = yyg->yy_c_buf_p;
2084 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
2085 goto yy_match;
2086
2087 case EOB_ACT_LAST_MATCH:
2088 yyg->yy_c_buf_p =
2089 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
2090
2091 yy_current_state = yy_get_previous_state( yyscanner );
2092
2093 yy_cp = yyg->yy_c_buf_p;
2094 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
2095 goto yy_find_action;
2096 }
2097 break;
2098 }
2099
2100 default:
2101 YY_FATAL_ERROR(
2102 "fatal flex scanner internal error--no action found" );
2103 } /* end of action switch */
2104 } /* end of scanning one token */
2105 } /* end of user's declarations */
2106 } /* end of yylex */
2107
2108 /* yy_get_next_buffer - try to read in a new buffer
2109 *
2110 * Returns a code representing an action:
2111 * EOB_ACT_LAST_MATCH -
2112 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2113 * EOB_ACT_END_OF_FILE - end of file
2114 */
2115 static int yy_get_next_buffer (yyscan_t yyscanner)
2116 {
2117 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2118 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
2119 char *source = yyg->yytext_ptr;
2120 int number_to_move, i;
2121 int ret_val;
2122
2123 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
2124 YY_FATAL_ERROR(
2125 "fatal flex scanner internal error--end of buffer missed" );
2126
2127 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
2128 { /* Don't try to fill the buffer, so this is an EOF. */
2129 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
2130 {
2131 /* We matched a single character, the EOB, so
2132 * treat this as a final EOF.
2133 */
2134 return EOB_ACT_END_OF_FILE;
2135 }
2136
2137 else
2138 {
2139 /* We matched some text prior to the EOB, first
2140 * process it.
2141 */
2142 return EOB_ACT_LAST_MATCH;
2143 }
2144 }
2145
2146 /* Try to read more data. */
2147
2148 /* First move last chars to start of buffer. */
2149 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
2150
2151 for ( i = 0; i < number_to_move; ++i )
2152 *(dest++) = *(source++);
2153
2154 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2155 /* don't do the read, it's not guaranteed to return an EOF,
2156 * just force an EOF
2157 */
2158 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
2159
2160 else
2161 {
2162 int num_to_read =
2163 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2164
2165 while ( num_to_read <= 0 )
2166 { /* Not enough room in the buffer - grow it. */
2167
2168 /* just a shorter name for the current buffer */
2169 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
2170
2171 int yy_c_buf_p_offset =
2172 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
2173
2174 if ( b->yy_is_our_buffer )
2175 {
2176 int new_size = b->yy_buf_size * 2;
2177
2178 if ( new_size <= 0 )
2179 b->yy_buf_size += b->yy_buf_size / 8;
2180 else
2181 b->yy_buf_size *= 2;
2182
2183 b->yy_ch_buf = (char *)
2184 /* Include room in for 2 EOB chars. */
2185 yyrealloc( (void *) b->yy_ch_buf,
2186 (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
2187 }
2188 else
2189 /* Can't grow it, we don't own it. */
2190 b->yy_ch_buf = NULL;
2191
2192 if ( ! b->yy_ch_buf )
2193 YY_FATAL_ERROR(
2194 "fatal error - scanner input buffer overflow" );
2195
2196 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
2197
2198 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
2199 number_to_move - 1;
2200
2201 }
2202
2203 if ( num_to_read > YY_READ_BUF_SIZE )
2204 num_to_read = YY_READ_BUF_SIZE;
2205
2206 /* Read in more data. */
2207 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
2208 yyg->yy_n_chars, num_to_read );
2209
2210 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2211 }
2212
2213 if ( yyg->yy_n_chars == 0 )
2214 {
2215 if ( number_to_move == YY_MORE_ADJ )
2216 {
2217 ret_val = EOB_ACT_END_OF_FILE;
2218 yyrestart( yyin , yyscanner);
2219 }
2220
2221 else
2222 {
2223 ret_val = EOB_ACT_LAST_MATCH;
2224 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
2225 YY_BUFFER_EOF_PENDING;
2226 }
2227 }
2228
2229 else
2230 ret_val = EOB_ACT_CONTINUE_SCAN;
2231
2232 if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
2233 /* Extend the array by 50%, plus the number we really need. */
2234 int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
2235 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
2236 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
2237 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2238 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
2239 /* "- 2" to take care of EOB's */
2240 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
2241 }
2242
2243 yyg->yy_n_chars += number_to_move;
2244 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
2245 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
2246
2247 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
2248
2249 return ret_val;
2250 }
2251
2252 /* yy_get_previous_state - get the state just before the EOB char was reached */
2253
2254 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
2255 {
2256 yy_state_type yy_current_state;
2257 char *yy_cp;
2258 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2259
2260 yy_current_state = yyg->yy_start;
2261
2262 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
2263 {
2264 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2265 if ( yy_accept[yy_current_state] )
2266 {
2267 yyg->yy_last_accepting_state = yy_current_state;
2268 yyg->yy_last_accepting_cpos = yy_cp;
2269 }
2270 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2271 {
2272 yy_current_state = (int) yy_def[yy_current_state];
2273 if ( yy_current_state >= 189 )
2274 yy_c = yy_meta[yy_c];
2275 }
2276 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
2277 }
2278
2279 return yy_current_state;
2280 }
2281
2282 /* yy_try_NUL_trans - try to make a transition on the NUL character
2283 *
2284 * synopsis
2285 * next_state = yy_try_NUL_trans( current_state );
2286 */
2287 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
2288 {
2289 int yy_is_jam;
2290 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
2291 char *yy_cp = yyg->yy_c_buf_p;
2292
2293 YY_CHAR yy_c = 1;
2294 if ( yy_accept[yy_current_state] )
2295 {
2296 yyg->yy_last_accepting_state = yy_current_state;
2297 yyg->yy_last_accepting_cpos = yy_cp;
2298 }
2299 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2300 {
2301 yy_current_state = (int) yy_def[yy_current_state];
2302 if ( yy_current_state >= 189 )
2303 yy_c = yy_meta[yy_c];
2304 }
2305 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
2306 yy_is_jam = (yy_current_state == 188);
2307
2308 (void)yyg;
2309 return yy_is_jam ? 0 : yy_current_state;
2310 }
2311
2312 #ifndef YY_NO_UNPUT
2313
2314 static void yyunput (int c, char * yy_bp , yyscan_t yyscanner)
2315 {
2316 char *yy_cp;
2317 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2318
2319 yy_cp = yyg->yy_c_buf_p;
2320
2321 /* undo effects of setting up yytext */
2322 *yy_cp = yyg->yy_hold_char;
2323
2324 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2325 { /* need to shift things up to make room */
2326 /* +2 for EOB chars. */
2327 int number_to_move = yyg->yy_n_chars + 2;
2328 char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
2329 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
2330 char *source =
2331 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
2332
2333 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2334 *--dest = *--source;
2335
2336 yy_cp += (int) (dest - source);
2337 yy_bp += (int) (dest - source);
2338 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
2339 yyg->yy_n_chars = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
2340
2341 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2342 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2343 }
2344
2345 *--yy_cp = (char) c;
2346
2347 yyg->yytext_ptr = yy_bp;
2348 yyg->yy_hold_char = *yy_cp;
2349 yyg->yy_c_buf_p = yy_cp;
2350 }
2351
2352 #endif
2353
2354 #ifndef YY_NO_INPUT
2355 #ifdef __cplusplus
2356 static int yyinput (yyscan_t yyscanner)
2357 #else
2358 static int input (yyscan_t yyscanner)
2359 #endif
2360
2361 {
2362 int c;
2363 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2364
2365 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2366
2367 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2368 {
2369 /* yy_c_buf_p now points to the character we want to return.
2370 * If this occurs *before* the EOB characters, then it's a
2371 * valid NUL; if not, then we've hit the end of the buffer.
2372 */
2373 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
2374 /* This was really a NUL. */
2375 *yyg->yy_c_buf_p = '\0';
2376
2377 else
2378 { /* need more input */
2379 int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
2380 ++yyg->yy_c_buf_p;
2381
2382 switch ( yy_get_next_buffer( yyscanner ) )
2383 {
2384 case EOB_ACT_LAST_MATCH:
2385 /* This happens because yy_g_n_b()
2386 * sees that we've accumulated a
2387 * token and flags that we need to
2388 * try matching the token before
2389 * proceeding. But for input(),
2390 * there's no matching to consider.
2391 * So convert the EOB_ACT_LAST_MATCH
2392 * to EOB_ACT_END_OF_FILE.
2393 */
2394
2395 /* Reset buffer status. */
2396 yyrestart( yyin , yyscanner);
2397
2398 /*FALLTHROUGH*/
2399
2400 case EOB_ACT_END_OF_FILE:
2401 {
2402 if ( yywrap( yyscanner ) )
2403 return 0;
2404
2405 if ( ! yyg->yy_did_buffer_switch_on_eof )
2406 YY_NEW_FILE;
2407 #ifdef __cplusplus
2408 return yyinput(yyscanner);
2409 #else
2410 return input(yyscanner);
2411 #endif
2412 }
2413
2414 case EOB_ACT_CONTINUE_SCAN:
2415 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
2416 break;
2417 }
2418 }
2419 }
2420
2421 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
2422 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
2423 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
2424
2425 return c;
2426 }
2427 #endif /* ifndef YY_NO_INPUT */
2428
2429 /** Immediately switch to a different input stream.
2430 * @param input_file A readable stream.
2431 * @param yyscanner The scanner object.
2432 * @note This function does not reset the start condition to @c INITIAL .
2433 */
2434 void yyrestart (FILE * input_file , yyscan_t yyscanner)
2435 {
2436 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2437
2438 if ( ! YY_CURRENT_BUFFER ){
2439 yyensure_buffer_stack (yyscanner);
2440 YY_CURRENT_BUFFER_LVALUE =
2441 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
2442 }
2443
2444 yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
2445 yy_load_buffer_state( yyscanner );
2446 }
2447
2448 /** Switch to a different input buffer.
2449 * @param new_buffer The new input buffer.
2450 * @param yyscanner The scanner object.
2451 */
2452 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
2453 {
2454 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2455
2456 /* TODO. We should be able to replace this entire function body
2457 * with
2458 * yypop_buffer_state();
2459 * yypush_buffer_state(new_buffer);
2460 */
2461 yyensure_buffer_stack (yyscanner);
2462 if ( YY_CURRENT_BUFFER == new_buffer )
2463 return;
2464
2465 if ( YY_CURRENT_BUFFER )
2466 {
2467 /* Flush out information for old buffer. */
2468 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2469 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2470 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2471 }
2472
2473 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2474 yy_load_buffer_state( yyscanner );
2475
2476 /* We don't actually know whether we did this switch during
2477 * EOF (yywrap()) processing, but the only time this flag
2478 * is looked at is after yywrap() is called, so it's safe
2479 * to go ahead and always set it.
2480 */
2481 yyg->yy_did_buffer_switch_on_eof = 1;
2482 }
2483
2484 static void yy_load_buffer_state (yyscan_t yyscanner)
2485 {
2486 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2487 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2488 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2489 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2490 yyg->yy_hold_char = *yyg->yy_c_buf_p;
2491 }
2492
2493 /** Allocate and initialize an input buffer state.
2494 * @param file A readable stream.
2495 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2496 * @param yyscanner The scanner object.
2497 * @return the allocated buffer state.
2498 */
2499 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
2500 {
2501 YY_BUFFER_STATE b;
2502
2503 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
2504 if ( ! b )
2505 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2506
2507 b->yy_buf_size = size;
2508
2509 /* yy_ch_buf has to be 2 characters longer than the size given because
2510 * we need to put in 2 end-of-buffer characters.
2511 */
2512 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
2513 if ( ! b->yy_ch_buf )
2514 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2515
2516 b->yy_is_our_buffer = 1;
2517
2518 yy_init_buffer( b, file , yyscanner);
2519
2520 return b;
2521 }
2522
2523 /** Destroy the buffer.
2524 * @param b a buffer created with yy_create_buffer()
2525 * @param yyscanner The scanner object.
2526 */
2527 void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
2528 {
2529 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2530
2531 if ( ! b )
2532 return;
2533
2534 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2535 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2536
2537 if ( b->yy_is_our_buffer )
2538 yyfree( (void *) b->yy_ch_buf , yyscanner );
2539
2540 yyfree( (void *) b , yyscanner );
2541 }
2542
2543 /* Initializes or reinitializes a buffer.
2544 * This function is sometimes called more than once on the same buffer,
2545 * such as during a yyrestart() or at EOF.
2546 */
2547 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
2548
2549 {
2550 int oerrno = errno;
2551 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2552
2553 yy_flush_buffer( b , yyscanner);
2554
2555 b->yy_input_file = file;
2556 b->yy_fill_buffer = 1;
2557
2558 /* If b is the current buffer, then yy_init_buffer was _probably_
2559 * called from yyrestart() or through yy_get_next_buffer.
2560 * In that case, we don't want to reset the lineno or column.
2561 */
2562 if (b != YY_CURRENT_BUFFER){
2563 b->yy_bs_lineno = 1;
2564 b->yy_bs_column = 0;
2565 }
2566
2567 b->yy_is_interactive = 0;
2568
2569 errno = oerrno;
2570 }
2571
2572 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2573 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2574 * @param yyscanner The scanner object.
2575 */
2576 void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
2577 {
2578 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2579 if ( ! b )
2580 return;
2581
2582 b->yy_n_chars = 0;
2583
2584 /* We always need two end-of-buffer characters. The first causes
2585 * a transition to the end-of-buffer state. The second causes
2586 * a jam in that state.
2587 */
2588 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2589 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2590
2591 b->yy_buf_pos = &b->yy_ch_buf[0];
2592
2593 b->yy_at_bol = 1;
2594 b->yy_buffer_status = YY_BUFFER_NEW;
2595
2596 if ( b == YY_CURRENT_BUFFER )
2597 yy_load_buffer_state( yyscanner );
2598 }
2599
2600 /** Pushes the new state onto the stack. The new state becomes
2601 * the current state. This function will allocate the stack
2602 * if necessary.
2603 * @param new_buffer The new state.
2604 * @param yyscanner The scanner object.
2605 */
2606 void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
2607 {
2608 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2609 if (new_buffer == NULL)
2610 return;
2611
2612 yyensure_buffer_stack(yyscanner);
2613
2614 /* This block is copied from yy_switch_to_buffer. */
2615 if ( YY_CURRENT_BUFFER )
2616 {
2617 /* Flush out information for old buffer. */
2618 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2619 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2620 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2621 }
2622
2623 /* Only push if top exists. Otherwise, replace top. */
2624 if (YY_CURRENT_BUFFER)
2625 yyg->yy_buffer_stack_top++;
2626 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2627
2628 /* copied from yy_switch_to_buffer. */
2629 yy_load_buffer_state( yyscanner );
2630 yyg->yy_did_buffer_switch_on_eof = 1;
2631 }
2632
2633 /** Removes and deletes the top of the stack, if present.
2634 * The next element becomes the new top.
2635 * @param yyscanner The scanner object.
2636 */
2637 void yypop_buffer_state (yyscan_t yyscanner)
2638 {
2639 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2640 if (!YY_CURRENT_BUFFER)
2641 return;
2642
2643 yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
2644 YY_CURRENT_BUFFER_LVALUE = NULL;
2645 if (yyg->yy_buffer_stack_top > 0)
2646 --yyg->yy_buffer_stack_top;
2647
2648 if (YY_CURRENT_BUFFER) {
2649 yy_load_buffer_state( yyscanner );
2650 yyg->yy_did_buffer_switch_on_eof = 1;
2651 }
2652 }
2653
2654 /* Allocates the stack if it does not exist.
2655 * Guarantees space for at least one push.
2656 */
2657 static void yyensure_buffer_stack (yyscan_t yyscanner)
2658 {
2659 yy_size_t num_to_alloc;
2660 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2661
2662 if (!yyg->yy_buffer_stack) {
2663
2664 /* First allocation is just for 2 elements, since we don't know if this
2665 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2666 * immediate realloc on the next call.
2667 */
2668 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
2669 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
2670 (num_to_alloc * sizeof(struct yy_buffer_state*)
2671 , yyscanner);
2672 if ( ! yyg->yy_buffer_stack )
2673 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2674
2675 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2676
2677 yyg->yy_buffer_stack_max = num_to_alloc;
2678 yyg->yy_buffer_stack_top = 0;
2679 return;
2680 }
2681
2682 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2683
2684 /* Increase the buffer to prepare for a possible push. */
2685 yy_size_t grow_size = 8 /* arbitrary grow size */;
2686
2687 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
2688 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
2689 (yyg->yy_buffer_stack,
2690 num_to_alloc * sizeof(struct yy_buffer_state*)
2691 , yyscanner);
2692 if ( ! yyg->yy_buffer_stack )
2693 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2694
2695 /* zero only the new slots.*/
2696 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
2697 yyg->yy_buffer_stack_max = num_to_alloc;
2698 }
2699 }
2700
2701 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2702 * @param base the character buffer
2703 * @param size the size in bytes of the character buffer
2704 * @param yyscanner The scanner object.
2705 * @return the newly allocated buffer state object.
2706 */
2707 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
2708 {
2709 YY_BUFFER_STATE b;
2710
2711 if ( size < 2 ||
2712 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2713 base[size-1] != YY_END_OF_BUFFER_CHAR )
2714 /* They forgot to leave room for the EOB's. */
2715 return NULL;
2716
2717 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
2718 if ( ! b )
2719 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2720
2721 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
2722 b->yy_buf_pos = b->yy_ch_buf = base;
2723 b->yy_is_our_buffer = 0;
2724 b->yy_input_file = NULL;
2725 b->yy_n_chars = b->yy_buf_size;
2726 b->yy_is_interactive = 0;
2727 b->yy_at_bol = 1;
2728 b->yy_fill_buffer = 0;
2729 b->yy_buffer_status = YY_BUFFER_NEW;
2730
2731 yy_switch_to_buffer( b , yyscanner );
2732
2733 return b;
2734 }
2735
2736 /** Setup the input buffer state to scan a string. The next call to yylex() will
2737 * scan from a @e copy of @a str.
2738 * @param yystr a NUL-terminated string to scan
2739 * @param yyscanner The scanner object.
2740 * @return the newly allocated buffer state object.
2741 * @note If you want to scan bytes that may contain NUL values, then use
2742 * yy_scan_bytes() instead.
2743 */
2744 YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
2745 {
2746
2747 return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
2748 }
2749
2750 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2751 * scan from a @e copy of @a bytes.
2752 * @param yybytes the byte buffer to scan
2753 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2754 * @param yyscanner The scanner object.
2755 * @return the newly allocated buffer state object.
2756 */
2757 YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
2758 {
2759 YY_BUFFER_STATE b;
2760 char *buf;
2761 yy_size_t n;
2762 int i;
2763
2764 /* Get memory for full buffer, including space for trailing EOB's. */
2765 n = (yy_size_t) (_yybytes_len + 2);
2766 buf = (char *) yyalloc( n , yyscanner );
2767 if ( ! buf )
2768 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2769
2770 for ( i = 0; i < _yybytes_len; ++i )
2771 buf[i] = yybytes[i];
2772
2773 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2774
2775 b = yy_scan_buffer( buf, n , yyscanner);
2776 if ( ! b )
2777 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2778
2779 /* It's okay to grow etc. this buffer, and we should throw it
2780 * away when we're done.
2781 */
2782 b->yy_is_our_buffer = 1;
2783
2784 return b;
2785 }
2786
2787 static void yy_push_state (int _new_state , yyscan_t yyscanner)
2788 {
2789 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2790 if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth )
2791 {
2792 yy_size_t new_size;
2793
2794 yyg->yy_start_stack_depth += YY_START_STACK_INCR;
2795 new_size = (yy_size_t) yyg->yy_start_stack_depth * sizeof( int );
2796
2797 if ( ! yyg->yy_start_stack )
2798 yyg->yy_start_stack = (int *) yyalloc( new_size , yyscanner );
2799
2800 else
2801 yyg->yy_start_stack = (int *) yyrealloc(
2802 (void *) yyg->yy_start_stack, new_size , yyscanner );
2803
2804 if ( ! yyg->yy_start_stack )
2805 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2806 }
2807
2808 yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START;
2809
2810 BEGIN(_new_state);
2811 }
2812
2813 static void yy_pop_state (yyscan_t yyscanner)
2814 {
2815 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2816 if ( --yyg->yy_start_stack_ptr < 0 )
2817 YY_FATAL_ERROR( "start-condition stack underflow" );
2818
2819 BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]);
2820 }
2821
2822 static int yy_top_state (yyscan_t yyscanner)
2823 {
2824 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2825 return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1];
2826 }
2827
2828 #ifndef YY_EXIT_FAILURE
2829 #define YY_EXIT_FAILURE 2
2830 #endif
2831
2832 static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
2833 {
2834 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2835 (void)yyg;
2836 fprintf( stderr, "%s\n", msg );
2837 exit( YY_EXIT_FAILURE );
2838 }
2839
2840 /* Redefine yyless() so it works in section 3 code. */
2841
2842 #undef yyless
2843 #define yyless(n) \
2844 do \
2845 { \
2846 /* Undo effects of setting up yytext. */ \
2847 int yyless_macro_arg = (n); \
2848 YY_LESS_LINENO(yyless_macro_arg);\
2849 yytext[yyleng] = yyg->yy_hold_char; \
2850 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2851 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2852 *yyg->yy_c_buf_p = '\0'; \
2853 yyleng = yyless_macro_arg; \
2854 } \
2855 while ( 0 )
2856
2857 /* Accessor methods (get/set functions) to struct members. */
2858
2859 /** Get the user-defined data for this scanner.
2860 * @param yyscanner The scanner object.
2861 */
2862 YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
2863 {
2864 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2865 return yyextra;
2866 }
2867
2868 /** Get the current line number.
2869 * @param yyscanner The scanner object.
2870 */
2871 int yyget_lineno (yyscan_t yyscanner)
2872 {
2873 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2874
2875 if (! YY_CURRENT_BUFFER)
2876 return 0;
2877
2878 return yylineno;
2879 }
2880
2881 /** Get the current column number.
2882 * @param yyscanner The scanner object.
2883 */
2884 int yyget_column (yyscan_t yyscanner)
2885 {
2886 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2887
2888 if (! YY_CURRENT_BUFFER)
2889 return 0;
2890
2891 return yycolumn;
2892 }
2893
2894 /** Get the input stream.
2895 * @param yyscanner The scanner object.
2896 */
2897 FILE *yyget_in (yyscan_t yyscanner)
2898 {
2899 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2900 return yyin;
2901 }
2902
2903 /** Get the output stream.
2904 * @param yyscanner The scanner object.
2905 */
2906 FILE *yyget_out (yyscan_t yyscanner)
2907 {
2908 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2909 return yyout;
2910 }
2911
2912 /** Get the length of the current token.
2913 * @param yyscanner The scanner object.
2914 */
2915 int yyget_leng (yyscan_t yyscanner)
2916 {
2917 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2918 return yyleng;
2919 }
2920
2921 /** Get the current token.
2922 * @param yyscanner The scanner object.
2923 */
2924
2925 char *yyget_text (yyscan_t yyscanner)
2926 {
2927 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2928 return yytext;
2929 }
2930
2931 /** Set the user-defined data. This data is never touched by the scanner.
2932 * @param user_defined The data to be associated with this scanner.
2933 * @param yyscanner The scanner object.
2934 */
2935 void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
2936 {
2937 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2938 yyextra = user_defined ;
2939 }
2940
2941 /** Set the current line number.
2942 * @param _line_number line number
2943 * @param yyscanner The scanner object.
2944 */
2945 void yyset_lineno (int _line_number , yyscan_t yyscanner)
2946 {
2947 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2948
2949 /* lineno is only valid if an input buffer exists. */
2950 if (! YY_CURRENT_BUFFER )
2951 YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
2952
2953 yylineno = _line_number;
2954 }
2955
2956 /** Set the current column.
2957 * @param _column_no column number
2958 * @param yyscanner The scanner object.
2959 */
2960 void yyset_column (int _column_no , yyscan_t yyscanner)
2961 {
2962 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2963
2964 /* column is only valid if an input buffer exists. */
2965 if (! YY_CURRENT_BUFFER )
2966 YY_FATAL_ERROR( "yyset_column called with no buffer" );
2967
2968 yycolumn = _column_no;
2969 }
2970
2971 /** Set the input stream. This does not discard the current
2972 * input buffer.
2973 * @param _in_str A readable stream.
2974 * @param yyscanner The scanner object.
2975 * @see yy_switch_to_buffer
2976 */
2977 void yyset_in (FILE * _in_str , yyscan_t yyscanner)
2978 {
2979 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2980 yyin = _in_str ;
2981 }
2982
2983 void yyset_out (FILE * _out_str , yyscan_t yyscanner)
2984 {
2985 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2986 yyout = _out_str ;
2987 }
2988
2989 int yyget_debug (yyscan_t yyscanner)
2990 {
2991 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2992 return yy_flex_debug;
2993 }
2994
2995 void yyset_debug (int _bdebug , yyscan_t yyscanner)
2996 {
2997 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2998 yy_flex_debug = _bdebug ;
2999 }
3000
3001 /* Accessor methods for yylval and yylloc */
3002
3003 YYSTYPE * yyget_lval (yyscan_t yyscanner)
3004 {
3005 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3006 return yylval;
3007 }
3008
3009 void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
3010 {
3011 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3012 yylval = yylval_param;
3013 }
3014
3015 YYLTYPE *yyget_lloc (yyscan_t yyscanner)
3016 {
3017 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3018 return yylloc;
3019 }
3020
3021 void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
3022 {
3023 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3024 yylloc = yylloc_param;
3025 }
3026
3027 /* User-visible API */
3028
3029 /* yylex_init is special because it creates the scanner itself, so it is
3030 * the ONLY reentrant function that doesn't take the scanner as the last argument.
3031 * That's why we explicitly handle the declaration, instead of using our macros.
3032 */
3033 int yylex_init(yyscan_t* ptr_yy_globals)
3034 {
3035 if (ptr_yy_globals == NULL){
3036 errno = EINVAL;
3037 return 1;
3038 }
3039
3040 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
3041
3042 if (*ptr_yy_globals == NULL){
3043 errno = ENOMEM;
3044 return 1;
3045 }
3046
3047 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
3048 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
3049
3050 return yy_init_globals ( *ptr_yy_globals );
3051 }
3052
3053 /* yylex_init_extra has the same functionality as yylex_init, but follows the
3054 * convention of taking the scanner as the last argument. Note however, that
3055 * this is a *pointer* to a scanner, as it will be allocated by this call (and
3056 * is the reason, too, why this function also must handle its own declaration).
3057 * The user defined value in the first argument will be available to yyalloc in
3058 * the yyextra field.
3059 */
3060 int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
3061 {
3062 struct yyguts_t dummy_yyguts;
3063
3064 yyset_extra (yy_user_defined, &dummy_yyguts);
3065
3066 if (ptr_yy_globals == NULL){
3067 errno = EINVAL;
3068 return 1;
3069 }
3070
3071 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
3072
3073 if (*ptr_yy_globals == NULL){
3074 errno = ENOMEM;
3075 return 1;
3076 }
3077
3078 /* By setting to 0xAA, we expose bugs in
3079 yy_init_globals. Leave at 0x00 for releases. */
3080 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
3081
3082 yyset_extra (yy_user_defined, *ptr_yy_globals);
3083
3084 return yy_init_globals ( *ptr_yy_globals );
3085 }
3086
3087 static int yy_init_globals (yyscan_t yyscanner)
3088 {
3089 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3090 /* Initialization is the same as for the non-reentrant scanner.
3091 * This function is called from yylex_destroy(), so don't allocate here.
3092 */
3093
3094 yyg->yy_buffer_stack = NULL;
3095 yyg->yy_buffer_stack_top = 0;
3096 yyg->yy_buffer_stack_max = 0;
3097 yyg->yy_c_buf_p = NULL;
3098 yyg->yy_init = 0;
3099 yyg->yy_start = 0;
3100
3101 yyg->yy_start_stack_ptr = 0;
3102 yyg->yy_start_stack_depth = 0;
3103 yyg->yy_start_stack = NULL;
3104
3105 /* Defined in main.c */
3106 #ifdef YY_STDINIT
3107 yyin = stdin;
3108 yyout = stdout;
3109 #else
3110 yyin = NULL;
3111 yyout = NULL;
3112 #endif
3113
3114 /* For future reference: Set errno on error, since we are called by
3115 * yylex_init()
3116 */
3117 return 0;
3118 }
3119
3120 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
3121 int yylex_destroy (yyscan_t yyscanner)
3122 {
3123 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3124
3125 /* Pop the buffer stack, destroying each element. */
3126 while(YY_CURRENT_BUFFER){
3127 yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
3128 YY_CURRENT_BUFFER_LVALUE = NULL;
3129 yypop_buffer_state(yyscanner);
3130 }
3131
3132 /* Destroy the stack itself. */
3133 yyfree(yyg->yy_buffer_stack , yyscanner);
3134 yyg->yy_buffer_stack = NULL;
3135
3136 /* Destroy the start condition stack. */
3137 yyfree( yyg->yy_start_stack , yyscanner );
3138 yyg->yy_start_stack = NULL;
3139
3140 /* Reset the globals. This is important in a non-reentrant scanner so the next time
3141 * yylex() is called, initialization will occur. */
3142 yy_init_globals( yyscanner);
3143
3144 /* Destroy the main struct (reentrant only). */
3145 yyfree ( yyscanner , yyscanner );
3146 yyscanner = NULL;
3147 return 0;
3148 }
3149
3150 /*
3151 * Internal utility routines.
3152 */
3153
3154 #ifndef yytext_ptr
3155 static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
3156 {
3157 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3158 (void)yyg;
3159
3160 int i;
3161 for ( i = 0; i < n; ++i )
3162 s1[i] = s2[i];
3163 }
3164 #endif
3165
3166 #ifdef YY_NEED_STRLEN
3167 static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
3168 {
3169 int n;
3170 for ( n = 0; s[n]; ++n )
3171 ;
3172
3173 return n;
3174 }
3175 #endif
3176
3177 void *yyalloc (yy_size_t size , yyscan_t yyscanner)
3178 {
3179 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3180 (void)yyg;
3181 return malloc(size);
3182 }
3183
3184 void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
3185 {
3186 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3187 (void)yyg;
3188
3189 /* The cast to (char *) in the following accommodates both
3190 * implementations that use char* generic pointers, and those
3191 * that use void* generic pointers. It works with the latter
3192 * because both ANSI C and C++ allow castless assignment from
3193 * any pointer type to void*, and deal with argument conversions
3194 * as though doing an assignment.
3195 */
3196 return realloc(ptr, size);
3197 }
3198
3199 void yyfree (void * ptr , yyscan_t yyscanner)
3200 {
3201 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3202 (void)yyg;
3203 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
3204 }
3205
3206 #define YYTABLES_NAME "yytables"
3207
3208 #line 616 "src/compiler/glsl/glcpp/glcpp-lex.l"
3209
3210
3211 void
3212 glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader)
3213 {
3214 yy_scan_string(shader, parser->scanner);
3215 }
3216