1 #line 2 "glsl_lexer.cpp"
3 #line 4 "glsl_lexer.cpp"
5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 35
13 #if YY_FLEX_SUBMINOR_VERSION > 0
17 /* First, we deal with platform-specific or compiler-specific issues. */
19 /* begin standard C headers. */
25 /* end standard C headers. */
27 /* flex integer type definitions */
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
44 typedef int8_t flex_int8_t
;
45 typedef uint8_t flex_uint8_t
;
46 typedef int16_t flex_int16_t
;
47 typedef uint16_t flex_uint16_t
;
48 typedef int32_t flex_int32_t
;
49 typedef uint32_t flex_uint32_t
;
51 typedef signed char flex_int8_t
;
52 typedef short int flex_int16_t
;
53 typedef int flex_int32_t
;
54 typedef unsigned char flex_uint8_t
;
55 typedef unsigned short int flex_uint16_t
;
56 typedef unsigned int flex_uint32_t
;
58 /* Limits of integral types. */
60 #define INT8_MIN (-128)
63 #define INT16_MIN (-32767-1)
66 #define INT32_MIN (-2147483647-1)
69 #define INT8_MAX (127)
72 #define INT16_MAX (32767)
75 #define INT32_MAX (2147483647)
78 #define UINT8_MAX (255U)
81 #define UINT16_MAX (65535U)
84 #define UINT32_MAX (4294967295U)
89 #endif /* ! FLEXINT_H */
93 /* The "const" storage-class-modifier is valid. */
96 #else /* ! __cplusplus */
98 /* C99 requires __STDC__ to be defined as 1. */
99 #if defined (__STDC__)
103 #endif /* defined (__STDC__) */
104 #endif /* ! __cplusplus */
107 #define yyconst const
112 /* Returned upon end-of-file. */
115 /* Promotes a possibly negative, possibly signed char to an unsigned
116 * integer for use as an array index. If the signed char is negative,
117 * we want to instead treat it as an 8-bit unsigned char, hence the
120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
122 /* An opaque pointer. */
123 #ifndef YY_TYPEDEF_YY_SCANNER_T
124 #define YY_TYPEDEF_YY_SCANNER_T
125 typedef void* yyscan_t
;
128 /* For convenience, these vars (plus the bison vars far below)
129 are macros in the reentrant scanner. */
130 #define yyin yyg->yyin_r
131 #define yyout yyg->yyout_r
132 #define yyextra yyg->yyextra_r
133 #define yyleng yyg->yyleng_r
134 #define yytext yyg->yytext_r
135 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
136 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
137 #define yy_flex_debug yyg->yy_flex_debug_r
139 /* Enter a start condition. This macro really ought to take a parameter,
140 * but we do it the disgusting crufty way forced on us by the ()-less
141 * definition of BEGIN.
143 #define BEGIN yyg->yy_start = 1 + 2 *
145 /* Translate the current start state into a value that can be later handed
146 * to BEGIN to return to the state. The YYSTATE alias is for lex
149 #define YY_START ((yyg->yy_start - 1) / 2)
150 #define YYSTATE YY_START
152 /* Action number for EOF rule of a given start state. */
153 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
155 /* Special action meaning "start processing a new file". */
156 #define YY_NEW_FILE _mesa_glsl_restart(yyin ,yyscanner )
158 #define YY_END_OF_BUFFER_CHAR 0
160 /* Size of default input buffer. */
163 /* On IA-64, the buffer size is 16k, not 8k.
164 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
165 * Ditto for the __ia64__ case accordingly.
167 #define YY_BUF_SIZE 32768
169 #define YY_BUF_SIZE 16384
170 #endif /* __ia64__ */
173 /* The state buf must be large enough to hold one state per character in the main buffer.
175 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
177 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
178 #define YY_TYPEDEF_YY_BUFFER_STATE
179 typedef struct yy_buffer_state
*YY_BUFFER_STATE
;
182 #define EOB_ACT_CONTINUE_SCAN 0
183 #define EOB_ACT_END_OF_FILE 1
184 #define EOB_ACT_LAST_MATCH 2
186 #define YY_LESS_LINENO(n)
188 /* Return all but the first "n" matched characters back to the input stream. */
192 /* Undo effects of setting up yytext. */ \
193 int yyless_macro_arg = (n); \
194 YY_LESS_LINENO(yyless_macro_arg);\
195 *yy_cp = yyg->yy_hold_char; \
196 YY_RESTORE_YY_MORE_OFFSET \
197 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
198 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
202 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
204 #ifndef YY_TYPEDEF_YY_SIZE_T
205 #define YY_TYPEDEF_YY_SIZE_T
206 typedef size_t yy_size_t
;
209 #ifndef YY_STRUCT_YY_BUFFER_STATE
210 #define YY_STRUCT_YY_BUFFER_STATE
211 struct yy_buffer_state
215 char *yy_ch_buf
; /* input buffer */
216 char *yy_buf_pos
; /* current position in input buffer */
218 /* Size of input buffer in bytes, not including room for EOB
221 yy_size_t yy_buf_size
;
223 /* Number of characters read into yy_ch_buf, not including EOB
228 /* Whether we "own" the buffer - i.e., we know we created it,
229 * and can realloc() it to grow it, and should free() it to
232 int yy_is_our_buffer
;
234 /* Whether this is an "interactive" input source; if so, and
235 * if we're using stdio for input, then we want to use getc()
236 * instead of fread(), to make sure we stop fetching input after
239 int yy_is_interactive
;
241 /* Whether we're considered to be at the beginning of a line.
242 * If so, '^' rules will be active on the next match, otherwise
247 int yy_bs_lineno
; /**< The line count. */
248 int yy_bs_column
; /**< The column count. */
250 /* Whether to try to fill the input buffer when we reach the
255 int yy_buffer_status
;
257 #define YY_BUFFER_NEW 0
258 #define YY_BUFFER_NORMAL 1
259 /* When an EOF's been seen but there's still some text to process
260 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
261 * shouldn't try reading from the input source any more. We might
262 * still have a bunch of tokens to match, though, because of
263 * possible backing-up.
265 * When we actually see the EOF, we change the status to "new"
266 * (via _mesa_glsl_restart()), so that the user can continue scanning by
267 * just pointing yyin at a new input file.
269 #define YY_BUFFER_EOF_PENDING 2
272 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
274 /* We provide macros for accessing buffer states in case in the
275 * future we want to put the buffer states in a more general
278 * Returns the top of the stack, or NULL.
280 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
281 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
284 /* Same as previous macro, but useful when we know that the buffer stack is not
285 * NULL or when we need an lvalue. For internal use only.
287 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
289 void _mesa_glsl_restart (FILE *input_file
,yyscan_t yyscanner
);
290 void _mesa_glsl__switch_to_buffer (YY_BUFFER_STATE new_buffer
,yyscan_t yyscanner
);
291 YY_BUFFER_STATE
_mesa_glsl__create_buffer (FILE *file
,int size
,yyscan_t yyscanner
);
292 void _mesa_glsl__delete_buffer (YY_BUFFER_STATE b
,yyscan_t yyscanner
);
293 void _mesa_glsl__flush_buffer (YY_BUFFER_STATE b
,yyscan_t yyscanner
);
294 void _mesa_glsl_push_buffer_state (YY_BUFFER_STATE new_buffer
,yyscan_t yyscanner
);
295 void _mesa_glsl_pop_buffer_state (yyscan_t yyscanner
);
297 static void _mesa_glsl_ensure_buffer_stack (yyscan_t yyscanner
);
298 static void _mesa_glsl__load_buffer_state (yyscan_t yyscanner
);
299 static void _mesa_glsl__init_buffer (YY_BUFFER_STATE b
,FILE *file
,yyscan_t yyscanner
);
301 #define YY_FLUSH_BUFFER _mesa_glsl__flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
303 YY_BUFFER_STATE
_mesa_glsl__scan_buffer (char *base
,yy_size_t size
,yyscan_t yyscanner
);
304 YY_BUFFER_STATE
_mesa_glsl__scan_string (yyconst
char *yy_str
,yyscan_t yyscanner
);
305 YY_BUFFER_STATE
_mesa_glsl__scan_bytes (yyconst
char *bytes
,int len
,yyscan_t yyscanner
);
307 void *_mesa_glsl_alloc (yy_size_t
,yyscan_t yyscanner
);
308 void *_mesa_glsl_realloc (void *,yy_size_t
,yyscan_t yyscanner
);
309 void _mesa_glsl_free (void * ,yyscan_t yyscanner
);
311 #define yy_new_buffer _mesa_glsl__create_buffer
313 #define yy_set_interactive(is_interactive) \
315 if ( ! YY_CURRENT_BUFFER ){ \
316 _mesa_glsl_ensure_buffer_stack (yyscanner); \
317 YY_CURRENT_BUFFER_LVALUE = \
318 _mesa_glsl__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
320 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
323 #define yy_set_bol(at_bol) \
325 if ( ! YY_CURRENT_BUFFER ){\
326 _mesa_glsl_ensure_buffer_stack (yyscanner); \
327 YY_CURRENT_BUFFER_LVALUE = \
328 _mesa_glsl__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
330 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
333 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
335 /* Begin user sect3 */
337 #define _mesa_glsl_wrap(n) 1
338 #define YY_SKIP_YYWRAP
340 typedef unsigned char YY_CHAR
;
342 typedef int yy_state_type
;
344 #define yytext_ptr yytext_r
346 static yy_state_type
yy_get_previous_state (yyscan_t yyscanner
);
347 static yy_state_type
yy_try_NUL_trans (yy_state_type current_state
,yyscan_t yyscanner
);
348 static int yy_get_next_buffer (yyscan_t yyscanner
);
349 static void yy_fatal_error (yyconst
char msg
[] ,yyscan_t yyscanner
);
351 /* Done after the current pattern has been matched and before the
352 * corresponding action - sets up yytext.
354 #define YY_DO_BEFORE_ACTION \
355 yyg->yytext_ptr = yy_bp; \
356 yyleng = (size_t) (yy_cp - yy_bp); \
357 yyg->yy_hold_char = *yy_cp; \
359 yyg->yy_c_buf_p = yy_cp;
361 #define YY_NUM_RULES 145
362 #define YY_END_OF_BUFFER 146
363 /* This struct is not used in this scanner,
364 but its presence is necessary. */
367 flex_int32_t yy_verify
;
370 static yyconst flex_int16_t yy_accept
[519] =
372 0, 0, 9, 9, 146, 144, 1, 14, 144, 144,
373 144, 144, 144, 144, 144, 144, 89, 87, 144, 144,
374 144, 143, 144, 143, 143, 143, 143, 143, 143, 143,
375 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
376 143, 143, 143, 144, 1, 144, 84, 145, 9, 13,
377 145, 12, 10, 11, 1, 73, 80, 74, 83, 77,
378 68, 79, 69, 86, 91, 78, 92, 89, 0, 0,
379 0, 87, 0, 70, 72, 71, 0, 143, 76, 143,
380 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
381 22, 143, 143, 143, 143, 143, 143, 143, 143, 143,
383 143, 143, 143, 143, 26, 50, 143, 143, 143, 143,
384 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
385 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
386 143, 143, 143, 85, 75, 1, 0, 0, 2, 0,
387 0, 0, 0, 9, 8, 12, 11, 0, 91, 90,
388 0, 92, 0, 93, 88, 81, 82, 96, 143, 143,
389 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
390 143, 143, 143, 143, 143, 143, 143, 25, 143, 143,
391 143, 143, 143, 143, 143, 143, 19, 143, 143, 143,
392 143, 143, 143, 143, 143, 143, 51, 143, 143, 143,
394 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
395 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
396 0, 0, 0, 0, 8, 0, 91, 0, 90, 0,
397 92, 93, 143, 17, 143, 143, 136, 143, 143, 143,
398 143, 143, 143, 143, 143, 24, 99, 143, 143, 143,
399 57, 143, 143, 104, 118, 143, 143, 143, 143, 143,
400 143, 143, 143, 115, 139, 38, 39, 40, 143, 143,
401 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
402 143, 143, 143, 143, 143, 102, 94, 143, 143, 143,
403 143, 143, 143, 35, 36, 37, 67, 143, 143, 0,
405 0, 0, 0, 0, 90, 143, 20, 29, 30, 31,
406 143, 97, 16, 143, 143, 143, 143, 126, 127, 128,
407 143, 95, 119, 18, 129, 130, 131, 141, 123, 124,
408 125, 143, 52, 121, 143, 143, 32, 33, 34, 143,
409 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
410 143, 143, 116, 143, 143, 143, 143, 143, 143, 143,
411 143, 98, 143, 138, 143, 143, 23, 0, 0, 0,
412 0, 143, 143, 143, 143, 143, 117, 112, 107, 143,
413 143, 41, 42, 43, 44, 45, 46, 47, 48, 49,
414 143, 143, 143, 143, 122, 103, 143, 110, 28, 143,
416 135, 58, 111, 66, 105, 143, 143, 143, 143, 143,
417 143, 0, 0, 0, 0, 143, 143, 143, 106, 27,
418 143, 143, 143, 140, 143, 143, 143, 143, 143, 143,
419 100, 53, 143, 54, 143, 0, 0, 0, 7, 0,
420 143, 55, 21, 113, 143, 143, 143, 108, 143, 143,
421 143, 143, 143, 143, 101, 120, 109, 0, 0, 6,
422 0, 0, 0, 3, 15, 114, 56, 137, 143, 142,
423 60, 61, 62, 143, 0, 0, 0, 0, 143, 143,
424 143, 143, 143, 143, 4, 0, 5, 0, 0, 0,
425 143, 143, 143, 143, 143, 63, 0, 143, 143, 143,
427 143, 143, 59, 143, 132, 143, 133, 143, 143, 143,
428 64, 143, 65, 143, 143, 143, 134, 0
431 static yyconst flex_int32_t yy_ec
[256] =
433 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
434 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
435 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
436 1, 2, 5, 1, 6, 1, 7, 8, 1, 1,
437 1, 9, 10, 1, 11, 12, 13, 14, 15, 16,
438 17, 18, 19, 19, 19, 20, 20, 21, 1, 22,
439 23, 24, 1, 1, 25, 25, 26, 27, 28, 29,
440 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
441 30, 31, 32, 30, 30, 30, 30, 33, 30, 30,
442 1, 1, 1, 34, 30, 1, 35, 36, 37, 38,
444 39, 40, 41, 42, 43, 30, 44, 45, 46, 47,
445 48, 49, 30, 50, 51, 52, 53, 54, 55, 56,
446 57, 58, 1, 59, 1, 1, 1, 1, 1, 1,
447 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
448 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
449 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
450 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
451 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
452 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
453 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
455 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
456 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
457 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
458 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
459 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
463 static yyconst flex_int32_t yy_meta
[60] =
465 1, 2, 3, 1, 1, 1, 1, 1, 1, 4,
466 4, 5, 1, 6, 6, 6, 6, 6, 6, 7,
467 1, 1, 1, 1, 8, 8, 8, 9, 10, 11,
468 11, 11, 12, 1, 8, 8, 8, 8, 9, 10,
469 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
470 11, 11, 11, 11, 11, 12, 11, 11, 1
473 static yyconst flex_int16_t yy_base
[538] =
475 0, 58, 81, 0, 809, 810, 59, 810, 785, 784,
476 54, 783, 55, 56, 54, 782, 129, 130, 53, 781,
477 127, 0, 769, 101, 106, 126, 116, 128, 143, 754,
478 144, 136, 753, 128, 145, 747, 142, 760, 159, 165,
479 149, 164, 756, 149, 214, 207, 774, 810, 215, 810,
480 783, 209, 810, 0, 228, 810, 810, 810, 810, 810,
481 810, 810, 810, 810, 205, 810, 208, 133, 223, 171,
482 0, 226, 772, 810, 810, 810, 771, 0, 810, 747,
483 740, 743, 751, 750, 737, 740, 751, 738, 744, 732,
484 729, 742, 729, 726, 726, 732, 720, 205, 725, 735,
486 721, 727, 730, 731, 0, 215, 730, 166, 716, 729,
487 720, 200, 713, 727, 724, 726, 709, 714, 711, 700,
488 709, 207, 713, 709, 711, 700, 703, 188, 708, 700,
489 712, 223, 705, 810, 810, 268, 256, 273, 810, 691,
490 703, 695, 705, 269, 0, 263, 0, 274, 810, 258,
491 278, 810, 314, 280, 0, 810, 810, 0, 693, 697,
492 706, 703, 687, 686, 686, 241, 701, 698, 698, 696,
493 693, 685, 691, 678, 689, 675, 691, 0, 688, 676,
494 683, 680, 684, 677, 666, 665, 678, 681, 678, 673,
495 664, 286, 669, 672, 663, 670, 659, 663, 669, 660,
497 651, 654, 652, 662, 652, 647, 645, 645, 647, 644,
498 655, 654, 259, 649, 644, 633, 297, 651, 653, 642,
499 634, 638, 649, 633, 0, 321, 313, 306, 810, 329,
500 340, 810, 639, 0, 637, 338, 0, 630, 628, 626,
501 634, 623, 640, 629, 341, 0, 0, 623, 633, 633,
502 0, 618, 344, 0, 0, 620, 347, 621, 615, 614,
503 615, 614, 350, 0, 0, 607, 606, 605, 607, 608,
504 613, 607, 603, 616, 611, 610, 602, 606, 598, 601,
505 596, 604, 609, 608, 599, 0, 0, 605, 594, 594,
506 599, 598, 595, 0, 0, 0, 0, 585, 597, 596,
508 595, 592, 581, 356, 367, 595, 0, 0, 0, 0,
509 582, 0, 0, 582, 583, 577, 587, 0, 0, 0,
510 578, 0, 0, 0, 0, 0, 0, 0, 0, 0,
511 0, 585, 0, 0, 583, 579, 0, 0, 0, 365,
512 368, 371, 575, 571, 576, 567, 565, 578, 564, 577,
513 566, 573, 0, 571, 568, 572, 556, 565, 571, 566,
514 554, 0, 556, 0, 555, 558, 0, 553, 597, 552,
515 554, 543, 552, 541, 541, 554, 0, 556, 0, 548,
516 547, 0, 0, 0, 0, 0, 0, 0, 0, 0,
517 529, 542, 529, 526, 0, 0, 531, 0, 0, 522,
519 0, 0, 0, 0, 0, 519, 521, 514, 516, 513,
520 505, 498, 395, 513, 499, 494, 506, 504, 0, 0,
521 493, 497, 483, 0, 482, 470, 467, 452, 375, 456,
522 0, 0, 439, 0, 433, 428, 391, 323, 810, 423,
523 430, 0, 0, 0, 429, 415, 427, 0, 428, 417,
524 436, 435, 434, 407, 0, 0, 0, 411, 402, 810,
525 415, 0, 396, 810, 0, 0, 0, 0, 406, 0,
526 425, 371, 418, 412, 399, 417, 419, 423, 402, 402,
527 404, 400, 402, 384, 810, 425, 810, 437, 0, 433,
528 354, 371, 363, 360, 342, 0, 435, 313, 283, 267,
530 273, 256, 0, 258, 268, 248, 0, 239, 213, 195,
531 0, 206, 0, 168, 32, 11, 0, 810, 469, 473,
532 480, 487, 492, 498, 504, 506, 516, 525, 529, 533,
533 539, 550, 556, 558, 567, 578, 580
536 static yyconst flex_int16_t yy_def
[538] =
538 518, 1, 518, 3, 518, 518, 518, 518, 518, 518,
539 518, 518, 518, 518, 518, 518, 518, 519, 518, 518,
540 518, 520, 518, 520, 520, 520, 520, 520, 520, 520,
541 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
542 520, 520, 520, 518, 518, 518, 518, 518, 518, 518,
543 518, 518, 518, 521, 518, 518, 518, 518, 518, 518,
544 518, 518, 518, 518, 522, 518, 523, 17, 524, 525,
545 526, 519, 518, 518, 518, 518, 518, 520, 518, 520,
546 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
547 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
549 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
550 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
551 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
552 520, 520, 520, 518, 518, 518, 518, 518, 518, 518,
553 518, 518, 518, 518, 527, 518, 521, 528, 518, 523,
554 529, 518, 518, 525, 526, 518, 518, 520, 520, 520,
555 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
556 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
557 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
558 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
560 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
561 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
562 518, 518, 518, 518, 527, 518, 528, 530, 518, 518,
563 529, 518, 520, 520, 520, 520, 520, 520, 520, 520,
564 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
565 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
566 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
567 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
568 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
569 520, 520, 520, 520, 520, 520, 520, 520, 520, 518,
571 518, 518, 518, 518, 530, 520, 520, 520, 520, 520,
572 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
573 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
574 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
575 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
576 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
577 520, 520, 520, 520, 520, 520, 520, 518, 518, 518,
578 518, 520, 520, 520, 520, 520, 520, 520, 520, 520,
579 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
580 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
582 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
583 520, 518, 518, 518, 518, 520, 520, 520, 520, 520,
584 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
585 520, 520, 520, 520, 520, 518, 531, 532, 518, 518,
586 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
587 520, 520, 520, 520, 520, 520, 520, 518, 533, 518,
588 518, 534, 532, 518, 520, 520, 520, 520, 520, 520,
589 520, 520, 520, 520, 518, 535, 536, 534, 520, 520,
590 520, 520, 520, 520, 518, 518, 518, 518, 537, 536,
591 520, 520, 520, 520, 520, 520, 537, 520, 520, 520,
593 520, 520, 520, 520, 520, 520, 520, 520, 520, 520,
594 520, 520, 520, 520, 520, 520, 520, 0, 518, 518,
595 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
596 518, 518, 518, 518, 518, 518, 518
599 static yyconst flex_int16_t yy_nxt
[870] =
601 6, 7, 8, 7, 9, 6, 10, 11, 12, 13,
602 14, 15, 16, 17, 18, 18, 18, 18, 18, 18,
603 6, 19, 20, 21, 22, 22, 22, 22, 22, 22,
604 22, 22, 22, 23, 24, 25, 26, 27, 28, 29,
605 30, 31, 32, 22, 33, 34, 35, 36, 37, 38,
606 39, 40, 41, 42, 43, 22, 22, 22, 44, 45,
607 55, 58, 55, 46, 61, 517, 63, 65, 65, 65,
608 65, 65, 65, 65, 73, 74, 59, 62, 64, 516,
609 47, 48, 49, 50, 49, 48, 48, 48, 48, 48,
610 48, 48, 48, 51, 48, 52, 52, 52, 52, 52,
612 52, 53, 48, 48, 48, 54, 54, 54, 54, 54,
613 54, 54, 54, 54, 48, 54, 54, 54, 54, 54,
614 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
615 54, 54, 54, 54, 54, 54, 54, 54, 54, 48,
616 67, 67, 68, 68, 68, 68, 68, 68, 69, 76,
617 77, 80, 81, 82, 89, 83, 70, 70, 90, 84,
618 85, 71, 109, 91, 86, 518, 110, 70, 70, 92,
619 87, 134, 93, 88, 94, 105, 114, 96, 102, 111,
620 153, 153, 106, 95, 71, 97, 103, 98, 518, 107,
621 99, 115, 112, 118, 116, 128, 100, 104, 130, 129,
623 119, 120, 131, 124, 121, 515, 125, 135, 138, 139,
624 122, 132, 190, 123, 126, 136, 144, 55, 144, 137,
625 191, 127, 146, 146, 146, 146, 146, 146, 146, 55,
626 213, 55, 148, 149, 67, 151, 152, 67, 214, 176,
627 514, 206, 195, 148, 149, 140, 151, 152, 196, 513,
628 70, 141, 177, 70, 512, 142, 207, 138, 139, 184,
629 143, 70, 185, 186, 70, 218, 187, 219, 188, 136,
630 144, 55, 144, 137, 138, 139, 146, 146, 146, 146,
631 146, 146, 146, 226, 226, 228, 229, 230, 230, 518,
632 518, 240, 241, 511, 140, 510, 228, 229, 289, 509,
634 141, 266, 267, 268, 142, 508, 290, 507, 232, 143,
635 506, 140, 294, 295, 296, 304, 304, 141, 505, 232,
636 504, 142, 518, 518, 459, 460, 143, 154, 154, 154,
637 154, 154, 154, 154, 227, 227, 227, 227, 227, 227,
638 227, 149, 231, 231, 231, 231, 231, 231, 231, 518,
639 518, 503, 149, 308, 309, 310, 318, 319, 320, 325,
640 326, 327, 329, 330, 331, 337, 338, 339, 152, 305,
641 305, 305, 305, 305, 305, 305, 518, 518, 502, 152,
642 382, 383, 384, 385, 386, 387, 388, 389, 390, 451,
643 452, 453, 459, 460, 501, 229, 413, 459, 460, 500,
645 454, 481, 482, 459, 460, 499, 229, 498, 437, 438,
646 438, 438, 438, 438, 438, 476, 459, 460, 486, 487,
647 486, 487, 496, 462, 459, 460, 486, 487, 461, 461,
648 461, 461, 461, 461, 486, 487, 486, 487, 486, 487,
649 495, 494, 493, 492, 491, 485, 462, 484, 483, 489,
650 488, 488, 488, 488, 488, 488, 480, 479, 475, 474,
651 473, 472, 471, 470, 469, 468, 467, 466, 465, 464,
652 458, 457, 489, 72, 72, 72, 456, 72, 78, 78,
653 78, 78, 78, 78, 78, 147, 147, 147, 147, 147,
654 147, 147, 65, 65, 455, 65, 65, 150, 150, 450,
656 150, 150, 69, 69, 69, 449, 69, 154, 448, 154,
657 154, 155, 155, 155, 155, 155, 225, 225, 447, 225,
658 225, 225, 225, 225, 225, 225, 225, 225, 227, 446,
659 227, 227, 231, 445, 231, 231, 305, 444, 305, 305,
660 461, 461, 443, 442, 461, 441, 440, 439, 436, 435,
661 461, 463, 463, 434, 433, 463, 463, 477, 477, 432,
662 431, 477, 477, 478, 478, 478, 478, 478, 488, 488,
663 430, 429, 488, 428, 427, 426, 425, 424, 488, 490,
664 490, 423, 422, 490, 490, 497, 497, 497, 497, 497,
665 421, 420, 419, 418, 417, 416, 415, 414, 413, 412,
667 411, 410, 409, 408, 407, 406, 405, 404, 403, 402,
668 401, 400, 399, 398, 397, 396, 395, 394, 393, 392,
669 391, 381, 380, 379, 378, 377, 376, 375, 374, 373,
670 372, 371, 370, 369, 368, 367, 366, 365, 364, 363,
671 362, 361, 360, 359, 358, 357, 356, 355, 354, 353,
672 352, 351, 350, 349, 348, 347, 346, 345, 344, 343,
673 342, 341, 340, 336, 335, 334, 333, 332, 328, 324,
674 323, 322, 321, 317, 316, 315, 314, 313, 312, 311,
675 307, 306, 303, 302, 301, 300, 299, 298, 297, 293,
676 292, 291, 288, 287, 286, 285, 284, 283, 282, 281,
678 280, 279, 278, 277, 276, 275, 274, 273, 272, 271,
679 270, 269, 265, 264, 263, 262, 261, 260, 259, 258,
680 257, 256, 255, 254, 253, 252, 251, 250, 249, 248,
681 247, 246, 245, 244, 243, 242, 239, 238, 237, 236,
682 235, 234, 233, 224, 223, 222, 221, 220, 217, 216,
683 215, 212, 211, 210, 209, 208, 205, 204, 203, 202,
684 201, 200, 199, 198, 197, 194, 193, 192, 189, 183,
685 182, 181, 180, 179, 178, 175, 174, 173, 172, 171,
686 170, 169, 168, 167, 166, 165, 164, 163, 162, 161,
687 160, 159, 158, 157, 156, 145, 75, 133, 117, 113,
689 108, 101, 79, 75, 66, 60, 57, 56, 518, 5,
690 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
691 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
692 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
693 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
694 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
695 518, 518, 518, 518, 518, 518, 518, 518, 518
698 static yyconst flex_int16_t yy_chk
[870] =
700 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
701 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
702 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
703 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
704 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
705 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
706 7, 11, 7, 2, 13, 516, 14, 15, 15, 15,
707 15, 15, 15, 15, 19, 19, 11, 13, 14, 515,
708 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
709 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
711 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
712 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
713 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
714 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
715 17, 18, 17, 17, 17, 17, 17, 17, 17, 21,
716 21, 24, 24, 25, 27, 25, 17, 18, 27, 25,
717 26, 17, 34, 27, 26, 68, 34, 17, 18, 27,
718 26, 44, 28, 26, 28, 32, 37, 29, 31, 35,
719 70, 70, 32, 28, 17, 29, 31, 29, 68, 32,
720 29, 37, 35, 39, 37, 41, 29, 31, 42, 41,
722 39, 39, 42, 40, 39, 514, 40, 44, 46, 46,
723 39, 42, 108, 39, 40, 45, 49, 45, 49, 45,
724 108, 40, 52, 52, 52, 52, 52, 52, 52, 55,
725 128, 55, 65, 65, 69, 67, 67, 72, 128, 98,
726 512, 122, 112, 65, 65, 46, 67, 67, 112, 510,
727 69, 46, 98, 72, 509, 46, 122, 137, 137, 106,
728 46, 69, 106, 106, 72, 132, 106, 132, 106, 136,
729 144, 136, 144, 136, 138, 138, 146, 146, 146, 146,
730 146, 146, 146, 148, 148, 150, 150, 151, 151, 154,
731 154, 166, 166, 508, 137, 506, 150, 150, 213, 505,
733 137, 192, 192, 192, 137, 504, 213, 502, 154, 137,
734 501, 138, 217, 217, 217, 228, 228, 138, 500, 154,
735 499, 138, 227, 227, 438, 438, 138, 153, 153, 153,
736 153, 153, 153, 153, 226, 226, 226, 226, 226, 226,
737 226, 227, 230, 230, 230, 230, 230, 230, 230, 231,
738 231, 498, 227, 236, 236, 236, 245, 245, 245, 253,
739 253, 253, 257, 257, 257, 263, 263, 263, 231, 304,
740 304, 304, 304, 304, 304, 304, 305, 305, 495, 231,
741 340, 340, 340, 341, 341, 341, 342, 342, 342, 429,
742 429, 429, 437, 437, 494, 305, 413, 463, 463, 493,
744 429, 472, 472, 459, 459, 492, 305, 491, 413, 413,
745 413, 413, 413, 413, 413, 459, 461, 461, 476, 476,
746 477, 477, 484, 437, 478, 478, 486, 486, 461, 461,
747 461, 461, 461, 461, 490, 490, 497, 497, 488, 488,
748 483, 482, 481, 480, 479, 475, 437, 474, 473, 476,
749 488, 488, 488, 488, 488, 488, 471, 469, 458, 454,
750 453, 452, 451, 450, 449, 447, 446, 445, 441, 440,
751 436, 435, 476, 519, 519, 519, 433, 519, 520, 520,
752 520, 520, 520, 520, 520, 521, 521, 521, 521, 521,
753 521, 521, 522, 522, 430, 522, 522, 523, 523, 428,
755 523, 523, 524, 524, 524, 427, 524, 525, 426, 525,
756 525, 526, 526, 526, 526, 526, 527, 527, 425, 527,
757 527, 527, 527, 527, 527, 527, 527, 527, 528, 423,
758 528, 528, 529, 422, 529, 529, 530, 421, 530, 530,
759 531, 531, 418, 417, 531, 416, 415, 414, 412, 411,
760 531, 532, 532, 410, 409, 532, 532, 533, 533, 408,
761 407, 533, 533, 534, 534, 534, 534, 534, 535, 535,
762 406, 400, 535, 397, 394, 393, 392, 391, 535, 536,
763 536, 381, 380, 536, 536, 537, 537, 537, 537, 537,
764 378, 376, 375, 374, 373, 372, 371, 370, 369, 368,
766 366, 365, 363, 361, 360, 359, 358, 357, 356, 355,
767 354, 352, 351, 350, 349, 348, 347, 346, 345, 344,
768 343, 336, 335, 332, 321, 317, 316, 315, 314, 311,
769 306, 303, 302, 301, 300, 299, 298, 293, 292, 291,
770 290, 289, 288, 285, 284, 283, 282, 281, 280, 279,
771 278, 277, 276, 275, 274, 273, 272, 271, 270, 269,
772 268, 267, 266, 262, 261, 260, 259, 258, 256, 252,
773 250, 249, 248, 244, 243, 242, 241, 240, 239, 238,
774 235, 233, 224, 223, 222, 221, 220, 219, 218, 216,
775 215, 214, 212, 211, 210, 209, 208, 207, 206, 205,
777 204, 203, 202, 201, 200, 199, 198, 197, 196, 195,
778 194, 193, 191, 190, 189, 188, 187, 186, 185, 184,
779 183, 182, 181, 180, 179, 177, 176, 175, 174, 173,
780 172, 171, 170, 169, 168, 167, 165, 164, 163, 162,
781 161, 160, 159, 143, 142, 141, 140, 133, 131, 130,
782 129, 127, 126, 125, 124, 123, 121, 120, 119, 118,
783 117, 116, 115, 114, 113, 111, 110, 109, 107, 104,
784 103, 102, 101, 100, 99, 97, 96, 95, 94, 93,
785 92, 91, 90, 89, 88, 87, 86, 85, 84, 83,
786 82, 81, 80, 77, 73, 51, 47, 43, 38, 36,
788 33, 30, 23, 20, 16, 12, 10, 9, 5, 518,
789 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
790 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
791 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
792 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
793 518, 518, 518, 518, 518, 518, 518, 518, 518, 518,
794 518, 518, 518, 518, 518, 518, 518, 518, 518
797 /* The intent behind this definition is that it'll catch
798 * any uses of REJECT which flex missed.
800 #define REJECT reject_used_but_not_detected
801 #define yymore() yymore_used_but_not_detected
802 #define YY_MORE_ADJ 0
803 #define YY_RESTORE_YY_MORE_OFFSET
804 #line 1 "glsl_lexer.lpp"
805 #line 2 "glsl_lexer.lpp"
807 * Copyright © 2008, 2009 Intel Corporation
809 * Permission is hereby granted, free of charge, to any person obtaining a
810 * copy of this software and associated documentation files (the "Software"),
811 * to deal in the Software without restriction, including without limitation
812 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
813 * and/or sell copies of the Software, and to permit persons to whom the
814 * Software is furnished to do so, subject to the following conditions:
816 * The above copyright notice and this permission notice (including the next
817 * paragraph) shall be included in all copies or substantial portions of the
820 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
821 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
822 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
823 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
824 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
825 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
826 * DEALINGS IN THE SOFTWARE.
830 #include "glsl_parser_extras.h"
831 #include "glsl_parser.h"
833 #define YY_USER_ACTION \
835 yylloc->source = 0; \
836 yylloc->first_column = yycolumn + 1; \
837 yylloc->first_line = yylineno + 1; \
838 yycolumn += yyleng; \
841 #define YY_USER_INIT yylineno = 0; yycolumn = 0;
844 #line 845 "glsl_lexer.cpp"
849 #ifndef YY_NO_UNISTD_H
850 /* Special case for "unistd.h", since it is non-ANSI. We include it way
851 * down here because we want the user's section 1 to have been scanned first.
852 * The user has a chance to override it with an option.
857 #define YY_EXTRA_TYPE struct _mesa_glsl_parse_state *
859 /* Holds the entire state of the reentrant scanner. */
863 /* User-defined. Not touched by flex. */
864 YY_EXTRA_TYPE yyextra_r
;
866 /* The rest are the same as the globals declared in the non-reentrant scanner. */
867 FILE *yyin_r
, *yyout_r
;
868 size_t yy_buffer_stack_top
; /**< index of top of stack. */
869 size_t yy_buffer_stack_max
; /**< capacity of stack. */
870 YY_BUFFER_STATE
* yy_buffer_stack
; /**< Stack as an array. */
877 int yy_did_buffer_switch_on_eof
;
878 int yy_start_stack_ptr
;
879 int yy_start_stack_depth
;
881 yy_state_type yy_last_accepting_state
;
882 char* yy_last_accepting_cpos
;
895 }; /* end struct yyguts_t */
897 static int yy_init_globals (yyscan_t yyscanner
);
899 /* This must go here because YYSTYPE and YYLTYPE are included
900 * from bison output in section 1.*/
901 # define yylval yyg->yylval_r
903 # define yylloc yyg->yylloc_r
905 int _mesa_glsl_lex_init (yyscan_t
* scanner
);
907 int _mesa_glsl_lex_init_extra (YY_EXTRA_TYPE user_defined
,yyscan_t
* scanner
);
909 /* Accessor methods to globals.
910 These are made visible to non-reentrant scanners for convenience. */
912 int _mesa_glsl_lex_destroy (yyscan_t yyscanner
);
914 int _mesa_glsl_get_debug (yyscan_t yyscanner
);
916 void _mesa_glsl_set_debug (int debug_flag
,yyscan_t yyscanner
);
918 YY_EXTRA_TYPE
_mesa_glsl_get_extra (yyscan_t yyscanner
);
920 void _mesa_glsl_set_extra (YY_EXTRA_TYPE user_defined
,yyscan_t yyscanner
);
922 FILE *_mesa_glsl_get_in (yyscan_t yyscanner
);
924 void _mesa_glsl_set_in (FILE * in_str
,yyscan_t yyscanner
);
926 FILE *_mesa_glsl_get_out (yyscan_t yyscanner
);
928 void _mesa_glsl_set_out (FILE * out_str
,yyscan_t yyscanner
);
930 int _mesa_glsl_get_leng (yyscan_t yyscanner
);
932 char *_mesa_glsl_get_text (yyscan_t yyscanner
);
934 int _mesa_glsl_get_lineno (yyscan_t yyscanner
);
936 void _mesa_glsl_set_lineno (int line_number
,yyscan_t yyscanner
);
938 YYSTYPE
* _mesa_glsl_get_lval (yyscan_t yyscanner
);
940 void _mesa_glsl_set_lval (YYSTYPE
* yylval_param
,yyscan_t yyscanner
);
942 YYLTYPE
*_mesa_glsl_get_lloc (yyscan_t yyscanner
);
944 void _mesa_glsl_set_lloc (YYLTYPE
* yylloc_param
,yyscan_t yyscanner
);
946 /* Macros after this point can all be overridden by user definitions in
950 #ifndef YY_SKIP_YYWRAP
952 extern "C" int _mesa_glsl_wrap (yyscan_t yyscanner
);
954 extern int _mesa_glsl_wrap (yyscan_t yyscanner
);
959 static void yy_flex_strncpy (char *,yyconst
char *,int ,yyscan_t yyscanner
);
962 #ifdef YY_NEED_STRLEN
963 static int yy_flex_strlen (yyconst
char * ,yyscan_t yyscanner
);
969 static int yyinput (yyscan_t yyscanner
);
971 static int input (yyscan_t yyscanner
);
976 /* Amount of stuff to slurp up with each read. */
977 #ifndef YY_READ_BUF_SIZE
979 /* On IA-64, the buffer size is 16k, not 8k */
980 #define YY_READ_BUF_SIZE 16384
982 #define YY_READ_BUF_SIZE 8192
983 #endif /* __ia64__ */
986 /* Copy whatever the last rule matched to the standard output. */
988 /* This used to be an fputs(), but since the string might contain NUL's,
989 * we now use fwrite().
991 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
994 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
995 * is returned in "result".
998 #define YY_INPUT(buf,result,max_size) \
999 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1003 for ( n = 0; n < max_size && \
1004 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1005 buf[n] = (char) c; \
1007 buf[n++] = (char) c; \
1008 if ( c == EOF && ferror( yyin ) ) \
1009 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1015 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
1017 if( errno != EINTR) \
1019 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1030 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1031 * we don't want an extra ';' after the "return" because that will cause
1032 * some compilers to complain about unreachable statements.
1035 #define yyterminate() return YY_NULL
1038 /* Number of entries by which start-condition stack grows. */
1039 #ifndef YY_START_STACK_INCR
1040 #define YY_START_STACK_INCR 25
1043 /* Report a fatal error. */
1044 #ifndef YY_FATAL_ERROR
1045 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
1048 /* end tables serialization structures and prototypes */
1050 /* Default declaration of generated scanner - a define so the user can
1051 * easily add parameters.
1054 #define YY_DECL_IS_OURS 1
1056 extern int _mesa_glsl_lex \
1057 (YYSTYPE
* yylval_param
,YYLTYPE
* yylloc_param
,yyscan_t yyscanner
);
1059 #define YY_DECL int _mesa_glsl_lex \
1060 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
1061 #endif /* !YY_DECL */
1063 /* Code executed at the beginning of each rule, after yytext and yyleng
1066 #ifndef YY_USER_ACTION
1067 #define YY_USER_ACTION
1070 /* Code executed at the end of each rule. */
1072 #define YY_BREAK break;
1075 #define YY_RULE_SETUP \
1077 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
1078 (yytext[yyleng - 1] == '\n'); \
1081 /** The main scanner function which does all the work.
1085 register yy_state_type yy_current_state
;
1086 register char *yy_cp
, *yy_bp
;
1087 register int yy_act
;
1088 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1090 #line 56 "glsl_lexer.lpp"
1093 #line 1094 "glsl_lexer.cpp"
1095 yylval
= yylval_param
;
1097 yylloc
= yylloc_param
;
1099 if ( !yyg
->yy_init
)
1107 if ( ! yyg
->yy_start
)
1108 yyg
->yy_start
= 1; /* first start state */
1116 if ( ! YY_CURRENT_BUFFER
) {
1117 _mesa_glsl_ensure_buffer_stack (yyscanner
);
1118 YY_CURRENT_BUFFER_LVALUE
=
1119 _mesa_glsl__create_buffer(yyin
,YY_BUF_SIZE
,yyscanner
);
1122 _mesa_glsl__load_buffer_state(yyscanner
);
1125 while ( 1 ) /* loops until end-of-file is reached */
1127 yy_cp
= yyg
->yy_c_buf_p
;
1129 /* Support of yytext. */
1130 *yy_cp
= yyg
->yy_hold_char
;
1132 /* yy_bp points to the position in yy_ch_buf of the start of
1137 yy_current_state
= yyg
->yy_start
;
1138 yy_current_state
+= YY_AT_BOL();
1142 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
1143 if ( yy_accept
[yy_current_state
] )
1145 yyg
->yy_last_accepting_state
= yy_current_state
;
1146 yyg
->yy_last_accepting_cpos
= yy_cp
;
1148 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1150 yy_current_state
= (int) yy_def
[yy_current_state
];
1151 if ( yy_current_state
>= 519 )
1152 yy_c
= yy_meta
[(unsigned int) yy_c
];
1154 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1157 while ( yy_current_state
!= 518 );
1158 yy_cp
= yyg
->yy_last_accepting_cpos
;
1159 yy_current_state
= yyg
->yy_last_accepting_state
;
1162 yy_act
= yy_accept
[yy_current_state
];
1164 YY_DO_BEFORE_ACTION
;
1166 do_action
: /* This label is used only to access EOF actions. */
1169 { /* beginning of action switch */
1170 case 0: /* must back up */
1171 /* undo the effects of YY_DO_BEFORE_ACTION */
1172 *yy_cp
= yyg
->yy_hold_char
;
1173 yy_cp
= yyg
->yy_last_accepting_cpos
;
1174 yy_current_state
= yyg
->yy_last_accepting_state
;
1175 goto yy_find_action
;
1179 #line 58 "glsl_lexer.lpp"
1182 /* Preprocessor tokens. */
1184 *yy_cp
= yyg
->yy_hold_char
; /* undo effects of setting up yytext */
1185 yyg
->yy_c_buf_p
= yy_cp
-= 1;
1186 YY_DO_BEFORE_ACTION
; /* set up yytext again */
1188 #line 61 "glsl_lexer.lpp"
1193 #line 62 "glsl_lexer.lpp"
1194 { BEGIN PP
; return VERSION
; }
1198 #line 63 "glsl_lexer.lpp"
1199 { BEGIN PP
; return EXTENSION
; }
1202 *yy_cp
= yyg
->yy_hold_char
; /* undo effects of setting up yytext */
1203 yyg
->yy_c_buf_p
= yy_cp
-= 1;
1204 YY_DO_BEFORE_ACTION
; /* set up yytext again */
1206 #line 64 "glsl_lexer.lpp"
1208 /* Eat characters until the first digit is
1212 while (!isdigit(*ptr
))
1215 /* Subtract one from the line number because
1216 * yylineno is zero-based instead of
1219 yylineno
= strtol(ptr
, &ptr
, 0) - 1;
1220 yylloc
->source
= strtol(ptr
, NULL
, 0);
1224 *yy_cp
= yyg
->yy_hold_char
; /* undo effects of setting up yytext */
1225 yyg
->yy_c_buf_p
= yy_cp
-= 1;
1226 YY_DO_BEFORE_ACTION
; /* set up yytext again */
1228 #line 79 "glsl_lexer.lpp"
1230 /* Eat characters until the first digit is
1234 while (!isdigit(*ptr
))
1237 /* Subtract one from the line number because
1238 * yylineno is zero-based instead of
1241 yylineno
= strtol(ptr
, &ptr
, 0) - 1;
1246 #line 93 "glsl_lexer.lpp"
1247 { BEGIN PP
; return PRAGMA
; }
1251 #line 94 "glsl_lexer.lpp"
1256 #line 95 "glsl_lexer.lpp"
1261 #line 96 "glsl_lexer.lpp"
1266 #line 97 "glsl_lexer.lpp"
1268 yylval
->identifier
= strdup(yytext
);
1274 #line 101 "glsl_lexer.lpp"
1276 yylval
->n
= strtol(yytext
, NULL
, 10);
1281 /* rule 13 can match eol */
1283 #line 105 "glsl_lexer.lpp"
1284 { BEGIN
0; yylineno
++; yycolumn
= 0; return EOL
; }
1287 /* rule 14 can match eol */
1289 #line 107 "glsl_lexer.lpp"
1290 { yylineno
++; yycolumn
= 0; }
1294 #line 109 "glsl_lexer.lpp"
1299 #line 110 "glsl_lexer.lpp"
1304 #line 111 "glsl_lexer.lpp"
1309 #line 112 "glsl_lexer.lpp"
1314 #line 113 "glsl_lexer.lpp"
1319 #line 115 "glsl_lexer.lpp"
1324 #line 116 "glsl_lexer.lpp"
1329 #line 117 "glsl_lexer.lpp"
1334 #line 118 "glsl_lexer.lpp"
1339 #line 119 "glsl_lexer.lpp"
1344 #line 120 "glsl_lexer.lpp"
1349 #line 121 "glsl_lexer.lpp"
1354 #line 122 "glsl_lexer.lpp"
1359 #line 123 "glsl_lexer.lpp"
1364 #line 125 "glsl_lexer.lpp"
1369 #line 126 "glsl_lexer.lpp"
1374 #line 127 "glsl_lexer.lpp"
1379 #line 128 "glsl_lexer.lpp"
1384 #line 129 "glsl_lexer.lpp"
1389 #line 130 "glsl_lexer.lpp"
1394 #line 131 "glsl_lexer.lpp"
1399 #line 132 "glsl_lexer.lpp"
1404 #line 133 "glsl_lexer.lpp"
1409 #line 134 "glsl_lexer.lpp"
1414 #line 135 "glsl_lexer.lpp"
1419 #line 136 "glsl_lexer.lpp"
1424 #line 137 "glsl_lexer.lpp"
1429 #line 138 "glsl_lexer.lpp"
1434 #line 139 "glsl_lexer.lpp"
1439 #line 140 "glsl_lexer.lpp"
1444 #line 141 "glsl_lexer.lpp"
1449 #line 142 "glsl_lexer.lpp"
1454 #line 143 "glsl_lexer.lpp"
1459 #line 144 "glsl_lexer.lpp"
1464 #line 145 "glsl_lexer.lpp"
1469 #line 147 "glsl_lexer.lpp"
1474 #line 148 "glsl_lexer.lpp"
1479 #line 149 "glsl_lexer.lpp"
1484 #line 150 "glsl_lexer.lpp"
1489 #line 151 "glsl_lexer.lpp"
1494 #line 152 "glsl_lexer.lpp"
1496 if (yyextra
->language_version
>= 120) {
1499 yylval
->identifier
= strdup(yytext
);
1506 #line 160 "glsl_lexer.lpp"
1508 if (yyextra
->language_version
>= 120) {
1511 yylval
->identifier
= strdup(yytext
);
1518 #line 169 "glsl_lexer.lpp"
1520 if (yyextra
->language_version
>= 130) {
1523 yylval
->identifier
= strdup(yytext
);
1530 #line 177 "glsl_lexer.lpp"
1532 if (yyextra
->language_version
>= 130) {
1535 yylval
->identifier
= strdup(yytext
);
1542 #line 185 "glsl_lexer.lpp"
1544 if (yyextra
->language_version
>= 130) {
1545 return NOPERSPECTIVE
;
1547 yylval
->identifier
= strdup(yytext
);
1554 #line 194 "glsl_lexer.lpp"
1559 #line 195 "glsl_lexer.lpp"
1564 #line 196 "glsl_lexer.lpp"
1569 #line 197 "glsl_lexer.lpp"
1574 #line 198 "glsl_lexer.lpp"
1575 return SAMPLER1DSHADOW
;
1579 #line 199 "glsl_lexer.lpp"
1580 return SAMPLER2DSHADOW
;
1584 #line 201 "glsl_lexer.lpp"
1589 #line 202 "glsl_lexer.lpp"
1594 #line 204 "glsl_lexer.lpp"
1599 #line 205 "glsl_lexer.lpp"
1604 #line 206 "glsl_lexer.lpp"
1609 #line 207 "glsl_lexer.lpp"
1614 #line 208 "glsl_lexer.lpp"
1619 #line 209 "glsl_lexer.lpp"
1624 #line 210 "glsl_lexer.lpp"
1629 #line 211 "glsl_lexer.lpp"
1634 #line 212 "glsl_lexer.lpp"
1639 #line 214 "glsl_lexer.lpp"
1644 #line 215 "glsl_lexer.lpp"
1649 #line 216 "glsl_lexer.lpp"
1654 #line 217 "glsl_lexer.lpp"
1659 #line 218 "glsl_lexer.lpp"
1664 #line 219 "glsl_lexer.lpp"
1665 return RIGHT_ASSIGN
;
1669 #line 220 "glsl_lexer.lpp"
1674 #line 221 "glsl_lexer.lpp"
1679 #line 222 "glsl_lexer.lpp"
1684 #line 223 "glsl_lexer.lpp"
1689 #line 225 "glsl_lexer.lpp"
1691 yylval
->n
= strtol(yytext
, NULL
, 10);
1697 #line 229 "glsl_lexer.lpp"
1699 yylval
->n
= strtol(yytext
+ 2, NULL
, 16);
1705 #line 233 "glsl_lexer.lpp"
1707 yylval
->n
= strtol(yytext
, NULL
, 8);
1713 #line 238 "glsl_lexer.lpp"
1715 yylval
->real
= strtod(yytext
, NULL
);
1716 return FLOATCONSTANT
;
1721 #line 242 "glsl_lexer.lpp"
1723 yylval
->real
= strtod(yytext
, NULL
);
1724 return FLOATCONSTANT
;
1729 #line 246 "glsl_lexer.lpp"
1731 yylval
->real
= strtod(yytext
, NULL
);
1732 return FLOATCONSTANT
;
1737 #line 250 "glsl_lexer.lpp"
1739 yylval
->real
= strtod(yytext
, NULL
);
1740 return FLOATCONSTANT
;
1745 #line 255 "glsl_lexer.lpp"
1748 return BOOLCONSTANT
;
1753 #line 259 "glsl_lexer.lpp"
1756 return BOOLCONSTANT
;
1759 /* Reserved words in GLSL 1.10. */
1762 #line 266 "glsl_lexer.lpp"
1767 #line 267 "glsl_lexer.lpp"
1772 #line 268 "glsl_lexer.lpp"
1777 #line 269 "glsl_lexer.lpp"
1782 #line 270 "glsl_lexer.lpp"
1787 #line 271 "glsl_lexer.lpp"
1792 #line 272 "glsl_lexer.lpp"
1797 #line 273 "glsl_lexer.lpp"
1802 #line 274 "glsl_lexer.lpp"
1807 #line 275 "glsl_lexer.lpp"
1812 #line 276 "glsl_lexer.lpp"
1817 #line 277 "glsl_lexer.lpp"
1822 #line 278 "glsl_lexer.lpp"
1827 #line 279 "glsl_lexer.lpp"
1832 #line 280 "glsl_lexer.lpp"
1837 #line 281 "glsl_lexer.lpp"
1842 #line 282 "glsl_lexer.lpp"
1847 #line 283 "glsl_lexer.lpp"
1852 #line 284 "glsl_lexer.lpp"
1857 #line 285 "glsl_lexer.lpp"
1862 #line 286 "glsl_lexer.lpp"
1867 #line 287 "glsl_lexer.lpp"
1872 #line 288 "glsl_lexer.lpp"
1877 #line 289 "glsl_lexer.lpp"
1882 #line 290 "glsl_lexer.lpp"
1887 #line 291 "glsl_lexer.lpp"
1892 #line 292 "glsl_lexer.lpp"
1897 #line 293 "glsl_lexer.lpp"
1902 #line 294 "glsl_lexer.lpp"
1907 #line 295 "glsl_lexer.lpp"
1912 #line 296 "glsl_lexer.lpp"
1917 #line 297 "glsl_lexer.lpp"
1922 #line 298 "glsl_lexer.lpp"
1927 #line 299 "glsl_lexer.lpp"
1932 #line 300 "glsl_lexer.lpp"
1937 #line 301 "glsl_lexer.lpp"
1942 #line 302 "glsl_lexer.lpp"
1943 return SAMPLER2DRECT
;
1947 #line 303 "glsl_lexer.lpp"
1948 return SAMPLER3DRECT
;
1952 #line 304 "glsl_lexer.lpp"
1953 return SAMPLER2DRECTSHADOW
;
1957 #line 305 "glsl_lexer.lpp"
1962 #line 306 "glsl_lexer.lpp"
1967 #line 307 "glsl_lexer.lpp"
1972 #line 308 "glsl_lexer.lpp"
1975 /* Additional reserved words in GLSL 1.20. */
1978 #line 311 "glsl_lexer.lpp"
1983 #line 312 "glsl_lexer.lpp"
1988 #line 313 "glsl_lexer.lpp"
1993 #line 314 "glsl_lexer.lpp"
1998 #line 316 "glsl_lexer.lpp"
2000 struct _mesa_glsl_parse_state
*state
= yyextra
;
2002 yylval
->identifier
= talloc_strdup(ctx
, yytext
);
2008 #line 323 "glsl_lexer.lpp"
2009 { return yytext
[0]; }
2013 #line 325 "glsl_lexer.lpp"
2016 #line 2017 "glsl_lexer.cpp"
2017 case YY_STATE_EOF(INITIAL
):
2018 case YY_STATE_EOF(PP
):
2021 case YY_END_OF_BUFFER
:
2023 /* Amount of text matched not including the EOB char. */
2024 int yy_amount_of_matched_text
= (int) (yy_cp
- yyg
->yytext_ptr
) - 1;
2026 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2027 *yy_cp
= yyg
->yy_hold_char
;
2028 YY_RESTORE_YY_MORE_OFFSET
2030 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_NEW
)
2032 /* We're scanning a new file or input source. It's
2033 * possible that this happened because the user
2034 * just pointed yyin at a new source and called
2035 * _mesa_glsl_lex(). If so, then we have to assure
2036 * consistency between YY_CURRENT_BUFFER and our
2037 * globals. Here is the right place to do so, because
2038 * this is the first action (other than possibly a
2039 * back-up) that will match for the new input source.
2041 yyg
->yy_n_chars
= YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
2042 YY_CURRENT_BUFFER_LVALUE
->yy_input_file
= yyin
;
2043 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
= YY_BUFFER_NORMAL
;
2046 /* Note that here we test for yy_c_buf_p "<=" to the position
2047 * of the first EOB in the buffer, since yy_c_buf_p will
2048 * already have been incremented past the NUL character
2049 * (since all states make transitions on EOB to the
2050 * end-of-buffer state). Contrast this with the test
2053 if ( yyg
->yy_c_buf_p
<= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] )
2054 { /* This was really a NUL. */
2055 yy_state_type yy_next_state
;
2057 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ yy_amount_of_matched_text
;
2059 yy_current_state
= yy_get_previous_state( yyscanner
);
2061 /* Okay, we're now positioned to make the NUL
2062 * transition. We couldn't have
2063 * yy_get_previous_state() go ahead and do it
2064 * for us because it doesn't know how to deal
2065 * with the possibility of jamming (and we don't
2066 * want to build jamming into it because then it
2067 * will run more slowly).
2070 yy_next_state
= yy_try_NUL_trans( yy_current_state
, yyscanner
);
2072 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
2074 if ( yy_next_state
)
2076 /* Consume the NUL. */
2077 yy_cp
= ++yyg
->yy_c_buf_p
;
2078 yy_current_state
= yy_next_state
;
2084 yy_cp
= yyg
->yy_last_accepting_cpos
;
2085 yy_current_state
= yyg
->yy_last_accepting_state
;
2086 goto yy_find_action
;
2090 else switch ( yy_get_next_buffer( yyscanner
) )
2092 case EOB_ACT_END_OF_FILE
:
2094 yyg
->yy_did_buffer_switch_on_eof
= 0;
2096 if ( _mesa_glsl_wrap(yyscanner
) )
2098 /* Note: because we've taken care in
2099 * yy_get_next_buffer() to have set up
2100 * yytext, we can now set up
2101 * yy_c_buf_p so that if some total
2102 * hoser (like flex itself) wants to
2103 * call the scanner after we return the
2104 * YY_NULL, it'll still work - another
2105 * YY_NULL will get returned.
2107 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
2109 yy_act
= YY_STATE_EOF(YY_START
);
2115 if ( ! yyg
->yy_did_buffer_switch_on_eof
)
2121 case EOB_ACT_CONTINUE_SCAN
:
2123 yyg
->yytext_ptr
+ yy_amount_of_matched_text
;
2125 yy_current_state
= yy_get_previous_state( yyscanner
);
2127 yy_cp
= yyg
->yy_c_buf_p
;
2128 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
2131 case EOB_ACT_LAST_MATCH
:
2133 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
];
2135 yy_current_state
= yy_get_previous_state( yyscanner
);
2137 yy_cp
= yyg
->yy_c_buf_p
;
2138 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
2139 goto yy_find_action
;
2146 "fatal flex scanner internal error--no action found" );
2147 } /* end of action switch */
2148 } /* end of scanning one token */
2149 } /* end of _mesa_glsl_lex */
2151 /* yy_get_next_buffer - try to read in a new buffer
2153 * Returns a code representing an action:
2154 * EOB_ACT_LAST_MATCH -
2155 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2156 * EOB_ACT_END_OF_FILE - end of file
2158 static int yy_get_next_buffer (yyscan_t yyscanner
)
2160 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2161 register char *dest
= YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
;
2162 register char *source
= yyg
->yytext_ptr
;
2163 register int number_to_move
, i
;
2166 if ( yyg
->yy_c_buf_p
> &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
+ 1] )
2168 "fatal flex scanner internal error--end of buffer missed" );
2170 if ( YY_CURRENT_BUFFER_LVALUE
->yy_fill_buffer
== 0 )
2171 { /* Don't try to fill the buffer, so this is an EOF. */
2172 if ( yyg
->yy_c_buf_p
- yyg
->yytext_ptr
- YY_MORE_ADJ
== 1 )
2174 /* We matched a single character, the EOB, so
2175 * treat this as a final EOF.
2177 return EOB_ACT_END_OF_FILE
;
2182 /* We matched some text prior to the EOB, first
2185 return EOB_ACT_LAST_MATCH
;
2189 /* Try to read more data. */
2191 /* First move last chars to start of buffer. */
2192 number_to_move
= (int) (yyg
->yy_c_buf_p
- yyg
->yytext_ptr
) - 1;
2194 for ( i
= 0; i
< number_to_move
; ++i
)
2195 *(dest
++) = *(source
++);
2197 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
2198 /* don't do the read, it's not guaranteed to return an EOF,
2201 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
= 0;
2206 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
- number_to_move
- 1;
2208 while ( num_to_read
<= 0 )
2209 { /* Not enough room in the buffer - grow it. */
2211 /* just a shorter name for the current buffer */
2212 YY_BUFFER_STATE b
= YY_CURRENT_BUFFER
;
2214 int yy_c_buf_p_offset
=
2215 (int) (yyg
->yy_c_buf_p
- b
->yy_ch_buf
);
2217 if ( b
->yy_is_our_buffer
)
2219 int new_size
= b
->yy_buf_size
* 2;
2221 if ( new_size
<= 0 )
2222 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
2224 b
->yy_buf_size
*= 2;
2226 b
->yy_ch_buf
= (char *)
2227 /* Include room in for 2 EOB chars. */
2228 _mesa_glsl_realloc((void *) b
->yy_ch_buf
,b
->yy_buf_size
+ 2 ,yyscanner
);
2231 /* Can't grow it, we don't own it. */
2234 if ( ! b
->yy_ch_buf
)
2236 "fatal error - scanner input buffer overflow" );
2238 yyg
->yy_c_buf_p
= &b
->yy_ch_buf
[yy_c_buf_p_offset
];
2240 num_to_read
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
-
2245 if ( num_to_read
> YY_READ_BUF_SIZE
)
2246 num_to_read
= YY_READ_BUF_SIZE
;
2248 /* Read in more data. */
2249 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
]),
2250 yyg
->yy_n_chars
, (size_t) num_to_read
);
2252 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
2255 if ( yyg
->yy_n_chars
== 0 )
2257 if ( number_to_move
== YY_MORE_ADJ
)
2259 ret_val
= EOB_ACT_END_OF_FILE
;
2260 _mesa_glsl_restart(yyin
,yyscanner
);
2265 ret_val
= EOB_ACT_LAST_MATCH
;
2266 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
=
2267 YY_BUFFER_EOF_PENDING
;
2272 ret_val
= EOB_ACT_CONTINUE_SCAN
;
2274 if ((yy_size_t
) (yyg
->yy_n_chars
+ number_to_move
) > YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
) {
2275 /* Extend the array by 50%, plus the number we really need. */
2276 yy_size_t new_size
= yyg
->yy_n_chars
+ number_to_move
+ (yyg
->yy_n_chars
>> 1);
2277 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
= (char *) _mesa_glsl_realloc((void *) YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
,new_size
,yyscanner
);
2278 if ( ! YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
2279 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
2282 yyg
->yy_n_chars
+= number_to_move
;
2283 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] = YY_END_OF_BUFFER_CHAR
;
2284 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
+ 1] = YY_END_OF_BUFFER_CHAR
;
2286 yyg
->yytext_ptr
= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[0];
2291 /* yy_get_previous_state - get the state just before the EOB char was reached */
2293 static yy_state_type
yy_get_previous_state (yyscan_t yyscanner
)
2295 register yy_state_type yy_current_state
;
2296 register char *yy_cp
;
2297 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2299 yy_current_state
= yyg
->yy_start
;
2300 yy_current_state
+= YY_AT_BOL();
2302 for ( yy_cp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
; yy_cp
< yyg
->yy_c_buf_p
; ++yy_cp
)
2304 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
2305 if ( yy_accept
[yy_current_state
] )
2307 yyg
->yy_last_accepting_state
= yy_current_state
;
2308 yyg
->yy_last_accepting_cpos
= yy_cp
;
2310 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
2312 yy_current_state
= (int) yy_def
[yy_current_state
];
2313 if ( yy_current_state
>= 519 )
2314 yy_c
= yy_meta
[(unsigned int) yy_c
];
2316 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
2319 return yy_current_state
;
2322 /* yy_try_NUL_trans - try to make a transition on the NUL character
2325 * next_state = yy_try_NUL_trans( current_state );
2327 static yy_state_type
yy_try_NUL_trans (yy_state_type yy_current_state
, yyscan_t yyscanner
)
2329 register int yy_is_jam
;
2330 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
; /* This var may be unused depending upon options. */
2331 register char *yy_cp
= yyg
->yy_c_buf_p
;
2333 register YY_CHAR yy_c
= 1;
2334 if ( yy_accept
[yy_current_state
] )
2336 yyg
->yy_last_accepting_state
= yy_current_state
;
2337 yyg
->yy_last_accepting_cpos
= yy_cp
;
2339 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
2341 yy_current_state
= (int) yy_def
[yy_current_state
];
2342 if ( yy_current_state
>= 519 )
2343 yy_c
= yy_meta
[(unsigned int) yy_c
];
2345 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
2346 yy_is_jam
= (yy_current_state
== 518);
2348 return yy_is_jam
? 0 : yy_current_state
;
2353 static int yyinput (yyscan_t yyscanner
)
2355 static int input (yyscan_t yyscanner
)
2360 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2362 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
2364 if ( *yyg
->yy_c_buf_p
== YY_END_OF_BUFFER_CHAR
)
2366 /* yy_c_buf_p now points to the character we want to return.
2367 * If this occurs *before* the EOB characters, then it's a
2368 * valid NUL; if not, then we've hit the end of the buffer.
2370 if ( yyg
->yy_c_buf_p
< &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] )
2371 /* This was really a NUL. */
2372 *yyg
->yy_c_buf_p
= '\0';
2375 { /* need more input */
2376 int offset
= yyg
->yy_c_buf_p
- yyg
->yytext_ptr
;
2379 switch ( yy_get_next_buffer( yyscanner
) )
2381 case EOB_ACT_LAST_MATCH
:
2382 /* This happens because yy_g_n_b()
2383 * sees that we've accumulated a
2384 * token and flags that we need to
2385 * try matching the token before
2386 * proceeding. But for input(),
2387 * there's no matching to consider.
2388 * So convert the EOB_ACT_LAST_MATCH
2389 * to EOB_ACT_END_OF_FILE.
2392 /* Reset buffer status. */
2393 _mesa_glsl_restart(yyin
,yyscanner
);
2397 case EOB_ACT_END_OF_FILE
:
2399 if ( _mesa_glsl_wrap(yyscanner
) )
2402 if ( ! yyg
->yy_did_buffer_switch_on_eof
)
2405 return yyinput(yyscanner
);
2407 return input(yyscanner
);
2411 case EOB_ACT_CONTINUE_SCAN
:
2412 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ offset
;
2418 c
= *(unsigned char *) yyg
->yy_c_buf_p
; /* cast for 8-bit char's */
2419 *yyg
->yy_c_buf_p
= '\0'; /* preserve yytext */
2420 yyg
->yy_hold_char
= *++yyg
->yy_c_buf_p
;
2422 YY_CURRENT_BUFFER_LVALUE
->yy_at_bol
= (c
== '\n');
2426 #endif /* ifndef YY_NO_INPUT */
2428 /** Immediately switch to a different input stream.
2429 * @param input_file A readable stream.
2430 * @param yyscanner The scanner object.
2431 * @note This function does not reset the start condition to @c INITIAL .
2433 void _mesa_glsl_restart (FILE * input_file
, yyscan_t yyscanner
)
2435 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2437 if ( ! YY_CURRENT_BUFFER
){
2438 _mesa_glsl_ensure_buffer_stack (yyscanner
);
2439 YY_CURRENT_BUFFER_LVALUE
=
2440 _mesa_glsl__create_buffer(yyin
,YY_BUF_SIZE
,yyscanner
);
2443 _mesa_glsl__init_buffer(YY_CURRENT_BUFFER
,input_file
,yyscanner
);
2444 _mesa_glsl__load_buffer_state(yyscanner
);
2447 /** Switch to a different input buffer.
2448 * @param new_buffer The new input buffer.
2449 * @param yyscanner The scanner object.
2451 void _mesa_glsl__switch_to_buffer (YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
)
2453 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2455 /* TODO. We should be able to replace this entire function body
2457 * _mesa_glsl_pop_buffer_state();
2458 * _mesa_glsl_push_buffer_state(new_buffer);
2460 _mesa_glsl_ensure_buffer_stack (yyscanner
);
2461 if ( YY_CURRENT_BUFFER
== new_buffer
)
2464 if ( YY_CURRENT_BUFFER
)
2466 /* Flush out information for old buffer. */
2467 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
2468 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= yyg
->yy_c_buf_p
;
2469 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
2472 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
2473 _mesa_glsl__load_buffer_state(yyscanner
);
2475 /* We don't actually know whether we did this switch during
2476 * EOF (_mesa_glsl_wrap()) processing, but the only time this flag
2477 * is looked at is after _mesa_glsl_wrap() is called, so it's safe
2478 * to go ahead and always set it.
2480 yyg
->yy_did_buffer_switch_on_eof
= 1;
2483 static void _mesa_glsl__load_buffer_state (yyscan_t yyscanner
)
2485 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2486 yyg
->yy_n_chars
= YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
2487 yyg
->yytext_ptr
= yyg
->yy_c_buf_p
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
;
2488 yyin
= YY_CURRENT_BUFFER_LVALUE
->yy_input_file
;
2489 yyg
->yy_hold_char
= *yyg
->yy_c_buf_p
;
2492 /** Allocate and initialize an input buffer state.
2493 * @param file A readable stream.
2494 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2495 * @param yyscanner The scanner object.
2496 * @return the allocated buffer state.
2498 YY_BUFFER_STATE
_mesa_glsl__create_buffer (FILE * file
, int size
, yyscan_t yyscanner
)
2502 b
= (YY_BUFFER_STATE
) _mesa_glsl_alloc(sizeof( struct yy_buffer_state
) ,yyscanner
);
2504 YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl__create_buffer()" );
2506 b
->yy_buf_size
= size
;
2508 /* yy_ch_buf has to be 2 characters longer than the size given because
2509 * we need to put in 2 end-of-buffer characters.
2511 b
->yy_ch_buf
= (char *) _mesa_glsl_alloc(b
->yy_buf_size
+ 2 ,yyscanner
);
2512 if ( ! b
->yy_ch_buf
)
2513 YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl__create_buffer()" );
2515 b
->yy_is_our_buffer
= 1;
2517 _mesa_glsl__init_buffer(b
,file
,yyscanner
);
2522 /** Destroy the buffer.
2523 * @param b a buffer created with _mesa_glsl__create_buffer()
2524 * @param yyscanner The scanner object.
2526 void _mesa_glsl__delete_buffer (YY_BUFFER_STATE b
, yyscan_t yyscanner
)
2528 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2533 if ( b
== YY_CURRENT_BUFFER
) /* Not sure if we should pop here. */
2534 YY_CURRENT_BUFFER_LVALUE
= (YY_BUFFER_STATE
) 0;
2536 if ( b
->yy_is_our_buffer
)
2537 _mesa_glsl_free((void *) b
->yy_ch_buf
,yyscanner
);
2539 _mesa_glsl_free((void *) b
,yyscanner
);
2542 /* Initializes or reinitializes a buffer.
2543 * This function is sometimes called more than once on the same buffer,
2544 * such as during a _mesa_glsl_restart() or at EOF.
2546 static void _mesa_glsl__init_buffer (YY_BUFFER_STATE b
, FILE * file
, yyscan_t yyscanner
)
2550 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2552 _mesa_glsl__flush_buffer(b
,yyscanner
);
2554 b
->yy_input_file
= file
;
2555 b
->yy_fill_buffer
= 1;
2557 /* If b is the current buffer, then _mesa_glsl__init_buffer was _probably_
2558 * called from _mesa_glsl_restart() or through yy_get_next_buffer.
2559 * In that case, we don't want to reset the lineno or column.
2561 if (b
!= YY_CURRENT_BUFFER
){
2562 b
->yy_bs_lineno
= 1;
2563 b
->yy_bs_column
= 0;
2566 b
->yy_is_interactive
= 0;
2571 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2572 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2573 * @param yyscanner The scanner object.
2575 void _mesa_glsl__flush_buffer (YY_BUFFER_STATE b
, yyscan_t yyscanner
)
2577 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2583 /* We always need two end-of-buffer characters. The first causes
2584 * a transition to the end-of-buffer state. The second causes
2585 * a jam in that state.
2587 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
2588 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
2590 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
2593 b
->yy_buffer_status
= YY_BUFFER_NEW
;
2595 if ( b
== YY_CURRENT_BUFFER
)
2596 _mesa_glsl__load_buffer_state(yyscanner
);
2599 /** Pushes the new state onto the stack. The new state becomes
2600 * the current state. This function will allocate the stack
2602 * @param new_buffer The new state.
2603 * @param yyscanner The scanner object.
2605 void _mesa_glsl_push_buffer_state (YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
)
2607 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2608 if (new_buffer
== NULL
)
2611 _mesa_glsl_ensure_buffer_stack(yyscanner
);
2613 /* This block is copied from _mesa_glsl__switch_to_buffer. */
2614 if ( YY_CURRENT_BUFFER
)
2616 /* Flush out information for old buffer. */
2617 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
2618 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= yyg
->yy_c_buf_p
;
2619 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
2622 /* Only push if top exists. Otherwise, replace top. */
2623 if (YY_CURRENT_BUFFER
)
2624 yyg
->yy_buffer_stack_top
++;
2625 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
2627 /* copied from _mesa_glsl__switch_to_buffer. */
2628 _mesa_glsl__load_buffer_state(yyscanner
);
2629 yyg
->yy_did_buffer_switch_on_eof
= 1;
2632 /** Removes and deletes the top of the stack, if present.
2633 * The next element becomes the new top.
2634 * @param yyscanner The scanner object.
2636 void _mesa_glsl_pop_buffer_state (yyscan_t yyscanner
)
2638 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2639 if (!YY_CURRENT_BUFFER
)
2642 _mesa_glsl__delete_buffer(YY_CURRENT_BUFFER
,yyscanner
);
2643 YY_CURRENT_BUFFER_LVALUE
= NULL
;
2644 if (yyg
->yy_buffer_stack_top
> 0)
2645 --yyg
->yy_buffer_stack_top
;
2647 if (YY_CURRENT_BUFFER
) {
2648 _mesa_glsl__load_buffer_state(yyscanner
);
2649 yyg
->yy_did_buffer_switch_on_eof
= 1;
2653 /* Allocates the stack if it does not exist.
2654 * Guarantees space for at least one push.
2656 static void _mesa_glsl_ensure_buffer_stack (yyscan_t yyscanner
)
2659 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2661 if (!yyg
->yy_buffer_stack
) {
2663 /* First allocation is just for 2 elements, since we don't know if this
2664 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2665 * immediate realloc on the next call.
2668 yyg
->yy_buffer_stack
= (struct yy_buffer_state
**)_mesa_glsl_alloc
2669 (num_to_alloc
* sizeof(struct yy_buffer_state
*)
2671 if ( ! yyg
->yy_buffer_stack
)
2672 YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl_ensure_buffer_stack()" );
2674 memset(yyg
->yy_buffer_stack
, 0, num_to_alloc
* sizeof(struct yy_buffer_state
*));
2676 yyg
->yy_buffer_stack_max
= num_to_alloc
;
2677 yyg
->yy_buffer_stack_top
= 0;
2681 if (yyg
->yy_buffer_stack_top
>= (yyg
->yy_buffer_stack_max
) - 1){
2683 /* Increase the buffer to prepare for a possible push. */
2684 int grow_size
= 8 /* arbitrary grow size */;
2686 num_to_alloc
= yyg
->yy_buffer_stack_max
+ grow_size
;
2687 yyg
->yy_buffer_stack
= (struct yy_buffer_state
**)_mesa_glsl_realloc
2688 (yyg
->yy_buffer_stack
,
2689 num_to_alloc
* sizeof(struct yy_buffer_state
*)
2691 if ( ! yyg
->yy_buffer_stack
)
2692 YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl_ensure_buffer_stack()" );
2694 /* zero only the new slots.*/
2695 memset(yyg
->yy_buffer_stack
+ yyg
->yy_buffer_stack_max
, 0, grow_size
* sizeof(struct yy_buffer_state
*));
2696 yyg
->yy_buffer_stack_max
= num_to_alloc
;
2700 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2701 * @param base the character buffer
2702 * @param size the size in bytes of the character buffer
2703 * @param yyscanner The scanner object.
2704 * @return the newly allocated buffer state object.
2706 YY_BUFFER_STATE
_mesa_glsl__scan_buffer (char * base
, yy_size_t size
, yyscan_t yyscanner
)
2711 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
2712 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
2713 /* They forgot to leave room for the EOB's. */
2716 b
= (YY_BUFFER_STATE
) _mesa_glsl_alloc(sizeof( struct yy_buffer_state
) ,yyscanner
);
2718 YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl__scan_buffer()" );
2720 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
2721 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
2722 b
->yy_is_our_buffer
= 0;
2723 b
->yy_input_file
= 0;
2724 b
->yy_n_chars
= b
->yy_buf_size
;
2725 b
->yy_is_interactive
= 0;
2727 b
->yy_fill_buffer
= 0;
2728 b
->yy_buffer_status
= YY_BUFFER_NEW
;
2730 _mesa_glsl__switch_to_buffer(b
,yyscanner
);
2735 /** Setup the input buffer state to scan a string. The next call to _mesa_glsl_lex() will
2736 * scan from a @e copy of @a str.
2737 * @param yystr a NUL-terminated string to scan
2738 * @param yyscanner The scanner object.
2739 * @return the newly allocated buffer state object.
2740 * @note If you want to scan bytes that may contain NUL values, then use
2741 * _mesa_glsl__scan_bytes() instead.
2743 YY_BUFFER_STATE
_mesa_glsl__scan_string (yyconst
char * yystr
, yyscan_t yyscanner
)
2746 return _mesa_glsl__scan_bytes(yystr
,strlen(yystr
) ,yyscanner
);
2749 /** Setup the input buffer state to scan the given bytes. The next call to _mesa_glsl_lex() will
2750 * scan from a @e copy of @a bytes.
2751 * @param yybytes the byte buffer to scan
2752 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2753 * @param yyscanner The scanner object.
2754 * @return the newly allocated buffer state object.
2756 YY_BUFFER_STATE
_mesa_glsl__scan_bytes (yyconst
char * yybytes
, int _yybytes_len
, yyscan_t yyscanner
)
2763 /* Get memory for full buffer, including space for trailing EOB's. */
2764 n
= _yybytes_len
+ 2;
2765 buf
= (char *) _mesa_glsl_alloc(n
,yyscanner
);
2767 YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl__scan_bytes()" );
2769 for ( i
= 0; i
< _yybytes_len
; ++i
)
2770 buf
[i
] = yybytes
[i
];
2772 buf
[_yybytes_len
] = buf
[_yybytes_len
+1] = YY_END_OF_BUFFER_CHAR
;
2774 b
= _mesa_glsl__scan_buffer(buf
,n
,yyscanner
);
2776 YY_FATAL_ERROR( "bad buffer in _mesa_glsl__scan_bytes()" );
2778 /* It's okay to grow etc. this buffer, and we should throw it
2779 * away when we're done.
2781 b
->yy_is_our_buffer
= 1;
2786 #ifndef YY_EXIT_FAILURE
2787 #define YY_EXIT_FAILURE 2
2790 static void yy_fatal_error (yyconst
char* msg
, yyscan_t yyscanner
)
2792 (void) fprintf( stderr
, "%s\n", msg
);
2793 exit( YY_EXIT_FAILURE
);
2796 /* Redefine yyless() so it works in section 3 code. */
2802 /* Undo effects of setting up yytext. */ \
2803 int yyless_macro_arg = (n); \
2804 YY_LESS_LINENO(yyless_macro_arg);\
2805 yytext[yyleng] = yyg->yy_hold_char; \
2806 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2807 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2808 *yyg->yy_c_buf_p = '\0'; \
2809 yyleng = yyless_macro_arg; \
2813 /* Accessor methods (get/set functions) to struct members. */
2815 /** Get the user-defined data for this scanner.
2816 * @param yyscanner The scanner object.
2818 YY_EXTRA_TYPE
_mesa_glsl_get_extra (yyscan_t yyscanner
)
2820 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2824 /** Get the current line number.
2825 * @param yyscanner The scanner object.
2827 int _mesa_glsl_get_lineno (yyscan_t yyscanner
)
2829 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2831 if (! YY_CURRENT_BUFFER
)
2837 /** Get the current column number.
2838 * @param yyscanner The scanner object.
2840 int _mesa_glsl_get_column (yyscan_t yyscanner
)
2842 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2844 if (! YY_CURRENT_BUFFER
)
2850 /** Get the input stream.
2851 * @param yyscanner The scanner object.
2853 FILE *_mesa_glsl_get_in (yyscan_t yyscanner
)
2855 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2859 /** Get the output stream.
2860 * @param yyscanner The scanner object.
2862 FILE *_mesa_glsl_get_out (yyscan_t yyscanner
)
2864 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2868 /** Get the length of the current token.
2869 * @param yyscanner The scanner object.
2871 int _mesa_glsl_get_leng (yyscan_t yyscanner
)
2873 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2877 /** Get the current token.
2878 * @param yyscanner The scanner object.
2881 char *_mesa_glsl_get_text (yyscan_t yyscanner
)
2883 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2887 /** Set the user-defined data. This data is never touched by the scanner.
2888 * @param user_defined The data to be associated with this scanner.
2889 * @param yyscanner The scanner object.
2891 void _mesa_glsl_set_extra (YY_EXTRA_TYPE user_defined
, yyscan_t yyscanner
)
2893 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2894 yyextra
= user_defined
;
2897 /** Set the current line number.
2898 * @param line_number
2899 * @param yyscanner The scanner object.
2901 void _mesa_glsl_set_lineno (int line_number
, yyscan_t yyscanner
)
2903 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2905 /* lineno is only valid if an input buffer exists. */
2906 if (! YY_CURRENT_BUFFER
)
2907 yy_fatal_error( "_mesa_glsl_set_lineno called with no buffer" , yyscanner
);
2909 yylineno
= line_number
;
2912 /** Set the current column.
2913 * @param line_number
2914 * @param yyscanner The scanner object.
2916 void _mesa_glsl_set_column (int column_no
, yyscan_t yyscanner
)
2918 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2920 /* column is only valid if an input buffer exists. */
2921 if (! YY_CURRENT_BUFFER
)
2922 yy_fatal_error( "_mesa_glsl_set_column called with no buffer" , yyscanner
);
2924 yycolumn
= column_no
;
2927 /** Set the input stream. This does not discard the current
2929 * @param in_str A readable stream.
2930 * @param yyscanner The scanner object.
2931 * @see _mesa_glsl__switch_to_buffer
2933 void _mesa_glsl_set_in (FILE * in_str
, yyscan_t yyscanner
)
2935 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2939 void _mesa_glsl_set_out (FILE * out_str
, yyscan_t yyscanner
)
2941 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2945 int _mesa_glsl_get_debug (yyscan_t yyscanner
)
2947 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2948 return yy_flex_debug
;
2951 void _mesa_glsl_set_debug (int bdebug
, yyscan_t yyscanner
)
2953 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2954 yy_flex_debug
= bdebug
;
2957 /* Accessor methods for yylval and yylloc */
2959 YYSTYPE
* _mesa_glsl_get_lval (yyscan_t yyscanner
)
2961 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2965 void _mesa_glsl_set_lval (YYSTYPE
* yylval_param
, yyscan_t yyscanner
)
2967 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2968 yylval
= yylval_param
;
2971 YYLTYPE
*_mesa_glsl_get_lloc (yyscan_t yyscanner
)
2973 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2977 void _mesa_glsl_set_lloc (YYLTYPE
* yylloc_param
, yyscan_t yyscanner
)
2979 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2980 yylloc
= yylloc_param
;
2983 /* User-visible API */
2985 /* _mesa_glsl_lex_init is special because it creates the scanner itself, so it is
2986 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2987 * That's why we explicitly handle the declaration, instead of using our macros.
2990 int _mesa_glsl_lex_init(yyscan_t
* ptr_yy_globals
)
2993 if (ptr_yy_globals
== NULL
){
2998 *ptr_yy_globals
= (yyscan_t
) _mesa_glsl_alloc ( sizeof( struct yyguts_t
), NULL
);
3000 if (*ptr_yy_globals
== NULL
){
3005 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
3006 memset(*ptr_yy_globals
,0x00,sizeof(struct yyguts_t
));
3008 return yy_init_globals ( *ptr_yy_globals
);
3011 /* _mesa_glsl_lex_init_extra has the same functionality as _mesa_glsl_lex_init, but follows the
3012 * convention of taking the scanner as the last argument. Note however, that
3013 * this is a *pointer* to a scanner, as it will be allocated by this call (and
3014 * is the reason, too, why this function also must handle its own declaration).
3015 * The user defined value in the first argument will be available to _mesa_glsl_alloc in
3016 * the yyextra field.
3019 int _mesa_glsl_lex_init_extra(YY_EXTRA_TYPE yy_user_defined
,yyscan_t
* ptr_yy_globals
)
3022 struct yyguts_t dummy_yyguts
;
3024 _mesa_glsl_set_extra (yy_user_defined
, &dummy_yyguts
);
3026 if (ptr_yy_globals
== NULL
){
3031 *ptr_yy_globals
= (yyscan_t
) _mesa_glsl_alloc ( sizeof( struct yyguts_t
), &dummy_yyguts
);
3033 if (*ptr_yy_globals
== NULL
){
3038 /* By setting to 0xAA, we expose bugs in
3039 yy_init_globals. Leave at 0x00 for releases. */
3040 memset(*ptr_yy_globals
,0x00,sizeof(struct yyguts_t
));
3042 _mesa_glsl_set_extra (yy_user_defined
, *ptr_yy_globals
);
3044 return yy_init_globals ( *ptr_yy_globals
);
3047 static int yy_init_globals (yyscan_t yyscanner
)
3049 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3050 /* Initialization is the same as for the non-reentrant scanner.
3051 * This function is called from _mesa_glsl_lex_destroy(), so don't allocate here.
3054 yyg
->yy_buffer_stack
= 0;
3055 yyg
->yy_buffer_stack_top
= 0;
3056 yyg
->yy_buffer_stack_max
= 0;
3057 yyg
->yy_c_buf_p
= (char *) 0;
3061 yyg
->yy_start_stack_ptr
= 0;
3062 yyg
->yy_start_stack_depth
= 0;
3063 yyg
->yy_start_stack
= NULL
;
3065 /* Defined in main.c */
3074 /* For future reference: Set errno on error, since we are called by
3075 * _mesa_glsl_lex_init()
3080 /* _mesa_glsl_lex_destroy is for both reentrant and non-reentrant scanners. */
3081 int _mesa_glsl_lex_destroy (yyscan_t yyscanner
)
3083 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3085 /* Pop the buffer stack, destroying each element. */
3086 while(YY_CURRENT_BUFFER
){
3087 _mesa_glsl__delete_buffer(YY_CURRENT_BUFFER
,yyscanner
);
3088 YY_CURRENT_BUFFER_LVALUE
= NULL
;
3089 _mesa_glsl_pop_buffer_state(yyscanner
);
3092 /* Destroy the stack itself. */
3093 _mesa_glsl_free(yyg
->yy_buffer_stack
,yyscanner
);
3094 yyg
->yy_buffer_stack
= NULL
;
3096 /* Destroy the start condition stack. */
3097 _mesa_glsl_free(yyg
->yy_start_stack
,yyscanner
);
3098 yyg
->yy_start_stack
= NULL
;
3100 /* Reset the globals. This is important in a non-reentrant scanner so the next time
3101 * _mesa_glsl_lex() is called, initialization will occur. */
3102 yy_init_globals( yyscanner
);
3104 /* Destroy the main struct (reentrant only). */
3105 _mesa_glsl_free ( yyscanner
, yyscanner
);
3111 * Internal utility routines.
3115 static void yy_flex_strncpy (char* s1
, yyconst
char * s2
, int n
, yyscan_t yyscanner
)
3118 for ( i
= 0; i
< n
; ++i
)
3123 #ifdef YY_NEED_STRLEN
3124 static int yy_flex_strlen (yyconst
char * s
, yyscan_t yyscanner
)
3127 for ( n
= 0; s
[n
]; ++n
)
3134 void *_mesa_glsl_alloc (yy_size_t size
, yyscan_t yyscanner
)
3136 return (void *) malloc( size
);
3139 void *_mesa_glsl_realloc (void * ptr
, yy_size_t size
, yyscan_t yyscanner
)
3141 /* The cast to (char *) in the following accommodates both
3142 * implementations that use char* generic pointers, and those
3143 * that use void* generic pointers. It works with the latter
3144 * because both ANSI C and C++ allow castless assignment from
3145 * any pointer type to void*, and deal with argument conversions
3146 * as though doing an assignment.
3148 return (void *) realloc( (char *) ptr
, size
);
3151 void _mesa_glsl_free (void * ptr
, yyscan_t yyscanner
)
3153 free( (char *) ptr
); /* see _mesa_glsl_realloc() for (char *) cast */
3156 #define YYTABLES_NAME "yytables"
3158 #line 325 "glsl_lexer.lpp"
3163 _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state
*state
, const char *string
)
3165 _mesa_glsl_lex_init_extra(state
,& state
->scanner
);
3166 _mesa_glsl__scan_string(string
,state
->scanner
);
3170 _mesa_glsl_lexer_dtor(struct _mesa_glsl_parse_state
*state
)
3172 _mesa_glsl_lex_destroy(state
->scanner
);