glsl: Add generated files from flex/bison.
[mesa.git] / src / glsl / glsl_lexer.cpp
1 #line 2 "glsl_lexer.cpp"
2
3 #line 4 "glsl_lexer.cpp"
4
5 #define YY_INT_ALIGNED short int
6
7 /* A lexical scanner generated by flex */
8
9 #define FLEX_SCANNER
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 35
13 #if YY_FLEX_SUBMINOR_VERSION > 0
14 #define FLEX_BETA
15 #endif
16
17 /* First, we deal with platform-specific or compiler-specific issues. */
18
19 /* begin standard C headers. */
20 #include <stdio.h>
21 #include <string.h>
22 #include <errno.h>
23 #include <stdlib.h>
24
25 /* end standard C headers. */
26
27 /* flex integer type definitions */
28
29 #ifndef FLEXINT_H
30 #define FLEXINT_H
31
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
38 */
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
41 #endif
42
43 #include <inttypes.h>
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;
50 #else
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;
57
58 /* Limits of integral types. */
59 #ifndef INT8_MIN
60 #define INT8_MIN (-128)
61 #endif
62 #ifndef INT16_MIN
63 #define INT16_MIN (-32767-1)
64 #endif
65 #ifndef INT32_MIN
66 #define INT32_MIN (-2147483647-1)
67 #endif
68 #ifndef INT8_MAX
69 #define INT8_MAX (127)
70 #endif
71 #ifndef INT16_MAX
72 #define INT16_MAX (32767)
73 #endif
74 #ifndef INT32_MAX
75 #define INT32_MAX (2147483647)
76 #endif
77 #ifndef UINT8_MAX
78 #define UINT8_MAX (255U)
79 #endif
80 #ifndef UINT16_MAX
81 #define UINT16_MAX (65535U)
82 #endif
83 #ifndef UINT32_MAX
84 #define UINT32_MAX (4294967295U)
85 #endif
86
87 #endif /* ! C99 */
88
89 #endif /* ! FLEXINT_H */
90
91 #ifdef __cplusplus
92
93 /* The "const" storage-class-modifier is valid. */
94 #define YY_USE_CONST
95
96 #else /* ! __cplusplus */
97
98 /* C99 requires __STDC__ to be defined as 1. */
99 #if defined (__STDC__)
100
101 #define YY_USE_CONST
102
103 #endif /* defined (__STDC__) */
104 #endif /* ! __cplusplus */
105
106 #ifdef YY_USE_CONST
107 #define yyconst const
108 #else
109 #define yyconst
110 #endif
111
112 /* Returned upon end-of-file. */
113 #define YY_NULL 0
114
115 /* Promotes a possibly negative, possibly signed char to an unsigned
116 * integer for use as an array index. If the signed char is negative,
117 * we want to instead treat it as an 8-bit unsigned char, hence the
118 * double cast.
119 */
120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
121
122 /* An opaque pointer. */
123 #ifndef YY_TYPEDEF_YY_SCANNER_T
124 #define YY_TYPEDEF_YY_SCANNER_T
125 typedef void* yyscan_t;
126 #endif
127
128 /* For convenience, these vars (plus the bison vars far below)
129 are macros in the reentrant scanner. */
130 #define yyin yyg->yyin_r
131 #define yyout yyg->yyout_r
132 #define yyextra yyg->yyextra_r
133 #define yyleng yyg->yyleng_r
134 #define yytext yyg->yytext_r
135 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
136 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
137 #define yy_flex_debug yyg->yy_flex_debug_r
138
139 /* Enter a start condition. This macro really ought to take a parameter,
140 * but we do it the disgusting crufty way forced on us by the ()-less
141 * definition of BEGIN.
142 */
143 #define BEGIN yyg->yy_start = 1 + 2 *
144
145 /* Translate the current start state into a value that can be later handed
146 * to BEGIN to return to the state. The YYSTATE alias is for lex
147 * compatibility.
148 */
149 #define YY_START ((yyg->yy_start - 1) / 2)
150 #define YYSTATE YY_START
151
152 /* Action number for EOF rule of a given start state. */
153 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
154
155 /* Special action meaning "start processing a new file". */
156 #define YY_NEW_FILE _mesa_glsl_restart(yyin ,yyscanner )
157
158 #define YY_END_OF_BUFFER_CHAR 0
159
160 /* Size of default input buffer. */
161 #ifndef YY_BUF_SIZE
162 #ifdef __ia64__
163 /* On IA-64, the buffer size is 16k, not 8k.
164 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
165 * Ditto for the __ia64__ case accordingly.
166 */
167 #define YY_BUF_SIZE 32768
168 #else
169 #define YY_BUF_SIZE 16384
170 #endif /* __ia64__ */
171 #endif
172
173 /* The state buf must be large enough to hold one state per character in the main buffer.
174 */
175 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
176
177 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
178 #define YY_TYPEDEF_YY_BUFFER_STATE
179 typedef struct yy_buffer_state *YY_BUFFER_STATE;
180 #endif
181
182 #define EOB_ACT_CONTINUE_SCAN 0
183 #define EOB_ACT_END_OF_FILE 1
184 #define EOB_ACT_LAST_MATCH 2
185
186 #define YY_LESS_LINENO(n)
187
188 /* Return all but the first "n" matched characters back to the input stream. */
189 #define yyless(n) \
190 do \
191 { \
192 /* Undo effects of setting up yytext. */ \
193 int yyless_macro_arg = (n); \
194 YY_LESS_LINENO(yyless_macro_arg);\
195 *yy_cp = yyg->yy_hold_char; \
196 YY_RESTORE_YY_MORE_OFFSET \
197 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
198 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
199 } \
200 while ( 0 )
201
202 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
203
204 #ifndef YY_TYPEDEF_YY_SIZE_T
205 #define YY_TYPEDEF_YY_SIZE_T
206 typedef size_t yy_size_t;
207 #endif
208
209 #ifndef YY_STRUCT_YY_BUFFER_STATE
210 #define YY_STRUCT_YY_BUFFER_STATE
211 struct yy_buffer_state
212 {
213 FILE *yy_input_file;
214
215 char *yy_ch_buf; /* input buffer */
216 char *yy_buf_pos; /* current position in input buffer */
217
218 /* Size of input buffer in bytes, not including room for EOB
219 * characters.
220 */
221 yy_size_t yy_buf_size;
222
223 /* Number of characters read into yy_ch_buf, not including EOB
224 * characters.
225 */
226 int yy_n_chars;
227
228 /* Whether we "own" the buffer - i.e., we know we created it,
229 * and can realloc() it to grow it, and should free() it to
230 * delete it.
231 */
232 int yy_is_our_buffer;
233
234 /* Whether this is an "interactive" input source; if so, and
235 * if we're using stdio for input, then we want to use getc()
236 * instead of fread(), to make sure we stop fetching input after
237 * each newline.
238 */
239 int yy_is_interactive;
240
241 /* Whether we're considered to be at the beginning of a line.
242 * If so, '^' rules will be active on the next match, otherwise
243 * not.
244 */
245 int yy_at_bol;
246
247 int yy_bs_lineno; /**< The line count. */
248 int yy_bs_column; /**< The column count. */
249
250 /* Whether to try to fill the input buffer when we reach the
251 * end of it.
252 */
253 int yy_fill_buffer;
254
255 int yy_buffer_status;
256
257 #define YY_BUFFER_NEW 0
258 #define YY_BUFFER_NORMAL 1
259 /* When an EOF's been seen but there's still some text to process
260 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
261 * shouldn't try reading from the input source any more. We might
262 * still have a bunch of tokens to match, though, because of
263 * possible backing-up.
264 *
265 * When we actually see the EOF, we change the status to "new"
266 * (via _mesa_glsl_restart()), so that the user can continue scanning by
267 * just pointing yyin at a new input file.
268 */
269 #define YY_BUFFER_EOF_PENDING 2
270
271 };
272 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
273
274 /* We provide macros for accessing buffer states in case in the
275 * future we want to put the buffer states in a more general
276 * "scanner state".
277 *
278 * Returns the top of the stack, or NULL.
279 */
280 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
281 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
282 : NULL)
283
284 /* Same as previous macro, but useful when we know that the buffer stack is not
285 * NULL or when we need an lvalue. For internal use only.
286 */
287 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
288
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 );
296
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 );
300
301 #define YY_FLUSH_BUFFER _mesa_glsl__flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
302
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 );
306
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 );
310
311 #define yy_new_buffer _mesa_glsl__create_buffer
312
313 #define yy_set_interactive(is_interactive) \
314 { \
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); \
319 } \
320 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
321 }
322
323 #define yy_set_bol(at_bol) \
324 { \
325 if ( ! YY_CURRENT_BUFFER ){\
326 _mesa_glsl_ensure_buffer_stack (yyscanner); \
327 YY_CURRENT_BUFFER_LVALUE = \
328 _mesa_glsl__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
329 } \
330 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
331 }
332
333 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
334
335 /* Begin user sect3 */
336
337 #define _mesa_glsl_wrap(n) 1
338 #define YY_SKIP_YYWRAP
339
340 typedef unsigned char YY_CHAR;
341
342 typedef int yy_state_type;
343
344 #define yytext_ptr yytext_r
345
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 );
350
351 /* Done after the current pattern has been matched and before the
352 * corresponding action - sets up yytext.
353 */
354 #define YY_DO_BEFORE_ACTION \
355 yyg->yytext_ptr = yy_bp; \
356 yyleng = (size_t) (yy_cp - yy_bp); \
357 yyg->yy_hold_char = *yy_cp; \
358 *yy_cp = '\0'; \
359 yyg->yy_c_buf_p = yy_cp;
360
361 #define YY_NUM_RULES 145
362 #define YY_END_OF_BUFFER 146
363 /* This struct is not used in this scanner,
364 but its presence is necessary. */
365 struct yy_trans_info
366 {
367 flex_int32_t yy_verify;
368 flex_int32_t yy_nxt;
369 };
370 static yyconst flex_int16_t yy_accept[519] =
371 { 0,
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,
382
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,
393
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,
404
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,
415
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,
426
427 143, 143, 59, 143, 132, 143, 133, 143, 143, 143,
428 64, 143, 65, 143, 143, 143, 134, 0
429 } ;
430
431 static yyconst flex_int32_t yy_ec[256] =
432 { 0,
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,
443
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,
454
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,
460 1, 1, 1, 1, 1
461 } ;
462
463 static yyconst flex_int32_t yy_meta[60] =
464 { 0,
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
471 } ;
472
473 static yyconst flex_int16_t yy_base[538] =
474 { 0,
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,
485
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,
496
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,
507
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,
518
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,
529
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
534 } ;
535
536 static yyconst flex_int16_t yy_def[538] =
537 { 0,
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,
548
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,
559
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,
570
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,
581
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,
592
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
597 } ;
598
599 static yyconst flex_int16_t yy_nxt[870] =
600 { 0,
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,
611
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,
622
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,
633
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,
644
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,
655
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,
666
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,
677
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,
688
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
696 } ;
697
698 static yyconst flex_int16_t yy_chk[870] =
699 { 0,
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,
710
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,
721
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,
732
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,
743
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,
754
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,
765
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,
776
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,
787
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
795 } ;
796
797 /* The intent behind this definition is that it'll catch
798 * any uses of REJECT which flex missed.
799 */
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"
806 /*
807 * Copyright © 2008, 2009 Intel Corporation
808 *
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:
815 *
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
818 * Software.
819 *
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.
827 */
828 #include <ctype.h>
829 #include "ast.h"
830 #include "glsl_parser_extras.h"
831 #include "glsl_parser.h"
832
833 #define YY_USER_ACTION \
834 do { \
835 yylloc->source = 0; \
836 yylloc->first_column = yycolumn + 1; \
837 yylloc->first_line = yylineno + 1; \
838 yycolumn += yyleng; \
839 } while(0);
840
841 #define YY_USER_INIT yylineno = 0; yycolumn = 0;
842
843
844 #line 845 "glsl_lexer.cpp"
845
846 #define INITIAL 0
847 #define PP 1
848
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.
853 */
854 #include <unistd.h>
855 #endif
856
857 #define YY_EXTRA_TYPE struct _mesa_glsl_parse_state *
858
859 /* Holds the entire state of the reentrant scanner. */
860 struct yyguts_t
861 {
862
863 /* User-defined. Not touched by flex. */
864 YY_EXTRA_TYPE yyextra_r;
865
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. */
871 char yy_hold_char;
872 int yy_n_chars;
873 int yyleng_r;
874 char *yy_c_buf_p;
875 int yy_init;
876 int yy_start;
877 int yy_did_buffer_switch_on_eof;
878 int yy_start_stack_ptr;
879 int yy_start_stack_depth;
880 int *yy_start_stack;
881 yy_state_type yy_last_accepting_state;
882 char* yy_last_accepting_cpos;
883
884 int yylineno_r;
885 int yy_flex_debug_r;
886
887 char *yytext_r;
888 int yy_more_flag;
889 int yy_more_len;
890
891 YYSTYPE * yylval_r;
892
893 YYLTYPE * yylloc_r;
894
895 }; /* end struct yyguts_t */
896
897 static int yy_init_globals (yyscan_t yyscanner );
898
899 /* This must go here because YYSTYPE and YYLTYPE are included
900 * from bison output in section 1.*/
901 # define yylval yyg->yylval_r
902
903 # define yylloc yyg->yylloc_r
904
905 int _mesa_glsl_lex_init (yyscan_t* scanner);
906
907 int _mesa_glsl_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
908
909 /* Accessor methods to globals.
910 These are made visible to non-reentrant scanners for convenience. */
911
912 int _mesa_glsl_lex_destroy (yyscan_t yyscanner );
913
914 int _mesa_glsl_get_debug (yyscan_t yyscanner );
915
916 void _mesa_glsl_set_debug (int debug_flag ,yyscan_t yyscanner );
917
918 YY_EXTRA_TYPE _mesa_glsl_get_extra (yyscan_t yyscanner );
919
920 void _mesa_glsl_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
921
922 FILE *_mesa_glsl_get_in (yyscan_t yyscanner );
923
924 void _mesa_glsl_set_in (FILE * in_str ,yyscan_t yyscanner );
925
926 FILE *_mesa_glsl_get_out (yyscan_t yyscanner );
927
928 void _mesa_glsl_set_out (FILE * out_str ,yyscan_t yyscanner );
929
930 int _mesa_glsl_get_leng (yyscan_t yyscanner );
931
932 char *_mesa_glsl_get_text (yyscan_t yyscanner );
933
934 int _mesa_glsl_get_lineno (yyscan_t yyscanner );
935
936 void _mesa_glsl_set_lineno (int line_number ,yyscan_t yyscanner );
937
938 YYSTYPE * _mesa_glsl_get_lval (yyscan_t yyscanner );
939
940 void _mesa_glsl_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
941
942 YYLTYPE *_mesa_glsl_get_lloc (yyscan_t yyscanner );
943
944 void _mesa_glsl_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
945
946 /* Macros after this point can all be overridden by user definitions in
947 * section 1.
948 */
949
950 #ifndef YY_SKIP_YYWRAP
951 #ifdef __cplusplus
952 extern "C" int _mesa_glsl_wrap (yyscan_t yyscanner );
953 #else
954 extern int _mesa_glsl_wrap (yyscan_t yyscanner );
955 #endif
956 #endif
957
958 #ifndef yytext_ptr
959 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
960 #endif
961
962 #ifdef YY_NEED_STRLEN
963 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
964 #endif
965
966 #ifndef YY_NO_INPUT
967
968 #ifdef __cplusplus
969 static int yyinput (yyscan_t yyscanner );
970 #else
971 static int input (yyscan_t yyscanner );
972 #endif
973
974 #endif
975
976 /* Amount of stuff to slurp up with each read. */
977 #ifndef YY_READ_BUF_SIZE
978 #ifdef __ia64__
979 /* On IA-64, the buffer size is 16k, not 8k */
980 #define YY_READ_BUF_SIZE 16384
981 #else
982 #define YY_READ_BUF_SIZE 8192
983 #endif /* __ia64__ */
984 #endif
985
986 /* Copy whatever the last rule matched to the standard output. */
987 #ifndef ECHO
988 /* This used to be an fputs(), but since the string might contain NUL's,
989 * we now use fwrite().
990 */
991 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
992 #endif
993
994 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
995 * is returned in "result".
996 */
997 #ifndef YY_INPUT
998 #define YY_INPUT(buf,result,max_size) \
999 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1000 { \
1001 int c = '*'; \
1002 size_t n; \
1003 for ( n = 0; n < max_size && \
1004 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1005 buf[n] = (char) c; \
1006 if ( c == '\n' ) \
1007 buf[n++] = (char) c; \
1008 if ( c == EOF && ferror( yyin ) ) \
1009 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1010 result = n; \
1011 } \
1012 else \
1013 { \
1014 errno=0; \
1015 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
1016 { \
1017 if( errno != EINTR) \
1018 { \
1019 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1020 break; \
1021 } \
1022 errno=0; \
1023 clearerr(yyin); \
1024 } \
1025 }\
1026 \
1027
1028 #endif
1029
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.
1033 */
1034 #ifndef yyterminate
1035 #define yyterminate() return YY_NULL
1036 #endif
1037
1038 /* Number of entries by which start-condition stack grows. */
1039 #ifndef YY_START_STACK_INCR
1040 #define YY_START_STACK_INCR 25
1041 #endif
1042
1043 /* Report a fatal error. */
1044 #ifndef YY_FATAL_ERROR
1045 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
1046 #endif
1047
1048 /* end tables serialization structures and prototypes */
1049
1050 /* Default declaration of generated scanner - a define so the user can
1051 * easily add parameters.
1052 */
1053 #ifndef YY_DECL
1054 #define YY_DECL_IS_OURS 1
1055
1056 extern int _mesa_glsl_lex \
1057 (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
1058
1059 #define YY_DECL int _mesa_glsl_lex \
1060 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
1061 #endif /* !YY_DECL */
1062
1063 /* Code executed at the beginning of each rule, after yytext and yyleng
1064 * have been set up.
1065 */
1066 #ifndef YY_USER_ACTION
1067 #define YY_USER_ACTION
1068 #endif
1069
1070 /* Code executed at the end of each rule. */
1071 #ifndef YY_BREAK
1072 #define YY_BREAK break;
1073 #endif
1074
1075 #define YY_RULE_SETUP \
1076 if ( yyleng > 0 ) \
1077 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
1078 (yytext[yyleng - 1] == '\n'); \
1079 YY_USER_ACTION
1080
1081 /** The main scanner function which does all the work.
1082 */
1083 YY_DECL
1084 {
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;
1089
1090 #line 56 "glsl_lexer.lpp"
1091
1092
1093 #line 1094 "glsl_lexer.cpp"
1094
1095 yylval = yylval_param;
1096
1097 yylloc = yylloc_param;
1098
1099 if ( !yyg->yy_init )
1100 {
1101 yyg->yy_init = 1;
1102
1103 #ifdef YY_USER_INIT
1104 YY_USER_INIT;
1105 #endif
1106
1107 if ( ! yyg->yy_start )
1108 yyg->yy_start = 1; /* first start state */
1109
1110 if ( ! yyin )
1111 yyin = stdin;
1112
1113 if ( ! yyout )
1114 yyout = stdout;
1115
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);
1120 }
1121
1122 _mesa_glsl__load_buffer_state(yyscanner );
1123 }
1124
1125 while ( 1 ) /* loops until end-of-file is reached */
1126 {
1127 yy_cp = yyg->yy_c_buf_p;
1128
1129 /* Support of yytext. */
1130 *yy_cp = yyg->yy_hold_char;
1131
1132 /* yy_bp points to the position in yy_ch_buf of the start of
1133 * the current run.
1134 */
1135 yy_bp = yy_cp;
1136
1137 yy_current_state = yyg->yy_start;
1138 yy_current_state += YY_AT_BOL();
1139 yy_match:
1140 do
1141 {
1142 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1143 if ( yy_accept[yy_current_state] )
1144 {
1145 yyg->yy_last_accepting_state = yy_current_state;
1146 yyg->yy_last_accepting_cpos = yy_cp;
1147 }
1148 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1149 {
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];
1153 }
1154 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1155 ++yy_cp;
1156 }
1157 while ( yy_current_state != 518 );
1158 yy_cp = yyg->yy_last_accepting_cpos;
1159 yy_current_state = yyg->yy_last_accepting_state;
1160
1161 yy_find_action:
1162 yy_act = yy_accept[yy_current_state];
1163
1164 YY_DO_BEFORE_ACTION;
1165
1166 do_action: /* This label is used only to access EOF actions. */
1167
1168 switch ( yy_act )
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;
1176
1177 case 1:
1178 YY_RULE_SETUP
1179 #line 58 "glsl_lexer.lpp"
1180 ;
1181 YY_BREAK
1182 /* Preprocessor tokens. */
1183 case 2:
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 */
1187 YY_RULE_SETUP
1188 #line 61 "glsl_lexer.lpp"
1189 ;
1190 YY_BREAK
1191 case 3:
1192 YY_RULE_SETUP
1193 #line 62 "glsl_lexer.lpp"
1194 { BEGIN PP; return VERSION; }
1195 YY_BREAK
1196 case 4:
1197 YY_RULE_SETUP
1198 #line 63 "glsl_lexer.lpp"
1199 { BEGIN PP; return EXTENSION; }
1200 YY_BREAK
1201 case 5:
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 */
1205 YY_RULE_SETUP
1206 #line 64 "glsl_lexer.lpp"
1207 {
1208 /* Eat characters until the first digit is
1209 * encountered
1210 */
1211 char *ptr = yytext;
1212 while (!isdigit(*ptr))
1213 ptr++;
1214
1215 /* Subtract one from the line number because
1216 * yylineno is zero-based instead of
1217 * one-based.
1218 */
1219 yylineno = strtol(ptr, &ptr, 0) - 1;
1220 yylloc->source = strtol(ptr, NULL, 0);
1221 }
1222 YY_BREAK
1223 case 6:
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 */
1227 YY_RULE_SETUP
1228 #line 79 "glsl_lexer.lpp"
1229 {
1230 /* Eat characters until the first digit is
1231 * encountered
1232 */
1233 char *ptr = yytext;
1234 while (!isdigit(*ptr))
1235 ptr++;
1236
1237 /* Subtract one from the line number because
1238 * yylineno is zero-based instead of
1239 * one-based.
1240 */
1241 yylineno = strtol(ptr, &ptr, 0) - 1;
1242 }
1243 YY_BREAK
1244 case 7:
1245 YY_RULE_SETUP
1246 #line 93 "glsl_lexer.lpp"
1247 { BEGIN PP; return PRAGMA; }
1248 YY_BREAK
1249 case 8:
1250 YY_RULE_SETUP
1251 #line 94 "glsl_lexer.lpp"
1252 { }
1253 YY_BREAK
1254 case 9:
1255 YY_RULE_SETUP
1256 #line 95 "glsl_lexer.lpp"
1257 { }
1258 YY_BREAK
1259 case 10:
1260 YY_RULE_SETUP
1261 #line 96 "glsl_lexer.lpp"
1262 return COLON;
1263 YY_BREAK
1264 case 11:
1265 YY_RULE_SETUP
1266 #line 97 "glsl_lexer.lpp"
1267 {
1268 yylval->identifier = strdup(yytext);
1269 return IDENTIFIER;
1270 }
1271 YY_BREAK
1272 case 12:
1273 YY_RULE_SETUP
1274 #line 101 "glsl_lexer.lpp"
1275 {
1276 yylval->n = strtol(yytext, NULL, 10);
1277 return INTCONSTANT;
1278 }
1279 YY_BREAK
1280 case 13:
1281 /* rule 13 can match eol */
1282 YY_RULE_SETUP
1283 #line 105 "glsl_lexer.lpp"
1284 { BEGIN 0; yylineno++; yycolumn = 0; return EOL; }
1285 YY_BREAK
1286 case 14:
1287 /* rule 14 can match eol */
1288 YY_RULE_SETUP
1289 #line 107 "glsl_lexer.lpp"
1290 { yylineno++; yycolumn = 0; }
1291 YY_BREAK
1292 case 15:
1293 YY_RULE_SETUP
1294 #line 109 "glsl_lexer.lpp"
1295 return ATTRIBUTE;
1296 YY_BREAK
1297 case 16:
1298 YY_RULE_SETUP
1299 #line 110 "glsl_lexer.lpp"
1300 return CONST_TOK;
1301 YY_BREAK
1302 case 17:
1303 YY_RULE_SETUP
1304 #line 111 "glsl_lexer.lpp"
1305 return BOOL;
1306 YY_BREAK
1307 case 18:
1308 YY_RULE_SETUP
1309 #line 112 "glsl_lexer.lpp"
1310 return FLOAT;
1311 YY_BREAK
1312 case 19:
1313 YY_RULE_SETUP
1314 #line 113 "glsl_lexer.lpp"
1315 return INT;
1316 YY_BREAK
1317 case 20:
1318 YY_RULE_SETUP
1319 #line 115 "glsl_lexer.lpp"
1320 return BREAK;
1321 YY_BREAK
1322 case 21:
1323 YY_RULE_SETUP
1324 #line 116 "glsl_lexer.lpp"
1325 return CONTINUE;
1326 YY_BREAK
1327 case 22:
1328 YY_RULE_SETUP
1329 #line 117 "glsl_lexer.lpp"
1330 return DO;
1331 YY_BREAK
1332 case 23:
1333 YY_RULE_SETUP
1334 #line 118 "glsl_lexer.lpp"
1335 return WHILE;
1336 YY_BREAK
1337 case 24:
1338 YY_RULE_SETUP
1339 #line 119 "glsl_lexer.lpp"
1340 return ELSE;
1341 YY_BREAK
1342 case 25:
1343 YY_RULE_SETUP
1344 #line 120 "glsl_lexer.lpp"
1345 return FOR;
1346 YY_BREAK
1347 case 26:
1348 YY_RULE_SETUP
1349 #line 121 "glsl_lexer.lpp"
1350 return IF;
1351 YY_BREAK
1352 case 27:
1353 YY_RULE_SETUP
1354 #line 122 "glsl_lexer.lpp"
1355 return DISCARD;
1356 YY_BREAK
1357 case 28:
1358 YY_RULE_SETUP
1359 #line 123 "glsl_lexer.lpp"
1360 return RETURN;
1361 YY_BREAK
1362 case 29:
1363 YY_RULE_SETUP
1364 #line 125 "glsl_lexer.lpp"
1365 return BVEC2;
1366 YY_BREAK
1367 case 30:
1368 YY_RULE_SETUP
1369 #line 126 "glsl_lexer.lpp"
1370 return BVEC3;
1371 YY_BREAK
1372 case 31:
1373 YY_RULE_SETUP
1374 #line 127 "glsl_lexer.lpp"
1375 return BVEC4;
1376 YY_BREAK
1377 case 32:
1378 YY_RULE_SETUP
1379 #line 128 "glsl_lexer.lpp"
1380 return IVEC2;
1381 YY_BREAK
1382 case 33:
1383 YY_RULE_SETUP
1384 #line 129 "glsl_lexer.lpp"
1385 return IVEC3;
1386 YY_BREAK
1387 case 34:
1388 YY_RULE_SETUP
1389 #line 130 "glsl_lexer.lpp"
1390 return IVEC4;
1391 YY_BREAK
1392 case 35:
1393 YY_RULE_SETUP
1394 #line 131 "glsl_lexer.lpp"
1395 return VEC2;
1396 YY_BREAK
1397 case 36:
1398 YY_RULE_SETUP
1399 #line 132 "glsl_lexer.lpp"
1400 return VEC3;
1401 YY_BREAK
1402 case 37:
1403 YY_RULE_SETUP
1404 #line 133 "glsl_lexer.lpp"
1405 return VEC4;
1406 YY_BREAK
1407 case 38:
1408 YY_RULE_SETUP
1409 #line 134 "glsl_lexer.lpp"
1410 return MAT2;
1411 YY_BREAK
1412 case 39:
1413 YY_RULE_SETUP
1414 #line 135 "glsl_lexer.lpp"
1415 return MAT3;
1416 YY_BREAK
1417 case 40:
1418 YY_RULE_SETUP
1419 #line 136 "glsl_lexer.lpp"
1420 return MAT4;
1421 YY_BREAK
1422 case 41:
1423 YY_RULE_SETUP
1424 #line 137 "glsl_lexer.lpp"
1425 return MAT2X2;
1426 YY_BREAK
1427 case 42:
1428 YY_RULE_SETUP
1429 #line 138 "glsl_lexer.lpp"
1430 return MAT2X3;
1431 YY_BREAK
1432 case 43:
1433 YY_RULE_SETUP
1434 #line 139 "glsl_lexer.lpp"
1435 return MAT2X4;
1436 YY_BREAK
1437 case 44:
1438 YY_RULE_SETUP
1439 #line 140 "glsl_lexer.lpp"
1440 return MAT3X2;
1441 YY_BREAK
1442 case 45:
1443 YY_RULE_SETUP
1444 #line 141 "glsl_lexer.lpp"
1445 return MAT3X3;
1446 YY_BREAK
1447 case 46:
1448 YY_RULE_SETUP
1449 #line 142 "glsl_lexer.lpp"
1450 return MAT3X4;
1451 YY_BREAK
1452 case 47:
1453 YY_RULE_SETUP
1454 #line 143 "glsl_lexer.lpp"
1455 return MAT4X2;
1456 YY_BREAK
1457 case 48:
1458 YY_RULE_SETUP
1459 #line 144 "glsl_lexer.lpp"
1460 return MAT4X3;
1461 YY_BREAK
1462 case 49:
1463 YY_RULE_SETUP
1464 #line 145 "glsl_lexer.lpp"
1465 return MAT4X4;
1466 YY_BREAK
1467 case 50:
1468 YY_RULE_SETUP
1469 #line 147 "glsl_lexer.lpp"
1470 return IN;
1471 YY_BREAK
1472 case 51:
1473 YY_RULE_SETUP
1474 #line 148 "glsl_lexer.lpp"
1475 return OUT;
1476 YY_BREAK
1477 case 52:
1478 YY_RULE_SETUP
1479 #line 149 "glsl_lexer.lpp"
1480 return INOUT;
1481 YY_BREAK
1482 case 53:
1483 YY_RULE_SETUP
1484 #line 150 "glsl_lexer.lpp"
1485 return UNIFORM;
1486 YY_BREAK
1487 case 54:
1488 YY_RULE_SETUP
1489 #line 151 "glsl_lexer.lpp"
1490 return VARYING;
1491 YY_BREAK
1492 case 55:
1493 YY_RULE_SETUP
1494 #line 152 "glsl_lexer.lpp"
1495 {
1496 if (yyextra->language_version >= 120) {
1497 return CENTROID;
1498 } else {
1499 yylval->identifier = strdup(yytext);
1500 return IDENTIFIER;
1501 }
1502 }
1503 YY_BREAK
1504 case 56:
1505 YY_RULE_SETUP
1506 #line 160 "glsl_lexer.lpp"
1507 {
1508 if (yyextra->language_version >= 120) {
1509 return INVARIANT;
1510 } else {
1511 yylval->identifier = strdup(yytext);
1512 return IDENTIFIER;
1513 }
1514 }
1515 YY_BREAK
1516 case 57:
1517 YY_RULE_SETUP
1518 #line 169 "glsl_lexer.lpp"
1519 {
1520 if (yyextra->language_version >= 130) {
1521 return FLAT;
1522 } else {
1523 yylval->identifier = strdup(yytext);
1524 return IDENTIFIER;
1525 }
1526 }
1527 YY_BREAK
1528 case 58:
1529 YY_RULE_SETUP
1530 #line 177 "glsl_lexer.lpp"
1531 {
1532 if (yyextra->language_version >= 130) {
1533 return SMOOTH;
1534 } else {
1535 yylval->identifier = strdup(yytext);
1536 return IDENTIFIER;
1537 }
1538 }
1539 YY_BREAK
1540 case 59:
1541 YY_RULE_SETUP
1542 #line 185 "glsl_lexer.lpp"
1543 {
1544 if (yyextra->language_version >= 130) {
1545 return NOPERSPECTIVE;
1546 } else {
1547 yylval->identifier = strdup(yytext);
1548 return IDENTIFIER;
1549 }
1550 }
1551 YY_BREAK
1552 case 60:
1553 YY_RULE_SETUP
1554 #line 194 "glsl_lexer.lpp"
1555 return SAMPLER1D;
1556 YY_BREAK
1557 case 61:
1558 YY_RULE_SETUP
1559 #line 195 "glsl_lexer.lpp"
1560 return SAMPLER2D;
1561 YY_BREAK
1562 case 62:
1563 YY_RULE_SETUP
1564 #line 196 "glsl_lexer.lpp"
1565 return SAMPLER3D;
1566 YY_BREAK
1567 case 63:
1568 YY_RULE_SETUP
1569 #line 197 "glsl_lexer.lpp"
1570 return SAMPLERCUBE;
1571 YY_BREAK
1572 case 64:
1573 YY_RULE_SETUP
1574 #line 198 "glsl_lexer.lpp"
1575 return SAMPLER1DSHADOW;
1576 YY_BREAK
1577 case 65:
1578 YY_RULE_SETUP
1579 #line 199 "glsl_lexer.lpp"
1580 return SAMPLER2DSHADOW;
1581 YY_BREAK
1582 case 66:
1583 YY_RULE_SETUP
1584 #line 201 "glsl_lexer.lpp"
1585 return STRUCT;
1586 YY_BREAK
1587 case 67:
1588 YY_RULE_SETUP
1589 #line 202 "glsl_lexer.lpp"
1590 return VOID;
1591 YY_BREAK
1592 case 68:
1593 YY_RULE_SETUP
1594 #line 204 "glsl_lexer.lpp"
1595 return INC_OP;
1596 YY_BREAK
1597 case 69:
1598 YY_RULE_SETUP
1599 #line 205 "glsl_lexer.lpp"
1600 return DEC_OP;
1601 YY_BREAK
1602 case 70:
1603 YY_RULE_SETUP
1604 #line 206 "glsl_lexer.lpp"
1605 return LE_OP;
1606 YY_BREAK
1607 case 71:
1608 YY_RULE_SETUP
1609 #line 207 "glsl_lexer.lpp"
1610 return GE_OP;
1611 YY_BREAK
1612 case 72:
1613 YY_RULE_SETUP
1614 #line 208 "glsl_lexer.lpp"
1615 return EQ_OP;
1616 YY_BREAK
1617 case 73:
1618 YY_RULE_SETUP
1619 #line 209 "glsl_lexer.lpp"
1620 return NE_OP;
1621 YY_BREAK
1622 case 74:
1623 YY_RULE_SETUP
1624 #line 210 "glsl_lexer.lpp"
1625 return AND_OP;
1626 YY_BREAK
1627 case 75:
1628 YY_RULE_SETUP
1629 #line 211 "glsl_lexer.lpp"
1630 return OR_OP;
1631 YY_BREAK
1632 case 76:
1633 YY_RULE_SETUP
1634 #line 212 "glsl_lexer.lpp"
1635 return XOR_OP;
1636 YY_BREAK
1637 case 77:
1638 YY_RULE_SETUP
1639 #line 214 "glsl_lexer.lpp"
1640 return MUL_ASSIGN;
1641 YY_BREAK
1642 case 78:
1643 YY_RULE_SETUP
1644 #line 215 "glsl_lexer.lpp"
1645 return DIV_ASSIGN;
1646 YY_BREAK
1647 case 79:
1648 YY_RULE_SETUP
1649 #line 216 "glsl_lexer.lpp"
1650 return ADD_ASSIGN;
1651 YY_BREAK
1652 case 80:
1653 YY_RULE_SETUP
1654 #line 217 "glsl_lexer.lpp"
1655 return MOD_ASSIGN;
1656 YY_BREAK
1657 case 81:
1658 YY_RULE_SETUP
1659 #line 218 "glsl_lexer.lpp"
1660 return LEFT_ASSIGN;
1661 YY_BREAK
1662 case 82:
1663 YY_RULE_SETUP
1664 #line 219 "glsl_lexer.lpp"
1665 return RIGHT_ASSIGN;
1666 YY_BREAK
1667 case 83:
1668 YY_RULE_SETUP
1669 #line 220 "glsl_lexer.lpp"
1670 return AND_ASSIGN;
1671 YY_BREAK
1672 case 84:
1673 YY_RULE_SETUP
1674 #line 221 "glsl_lexer.lpp"
1675 return XOR_ASSIGN;
1676 YY_BREAK
1677 case 85:
1678 YY_RULE_SETUP
1679 #line 222 "glsl_lexer.lpp"
1680 return OR_ASSIGN;
1681 YY_BREAK
1682 case 86:
1683 YY_RULE_SETUP
1684 #line 223 "glsl_lexer.lpp"
1685 return SUB_ASSIGN;
1686 YY_BREAK
1687 case 87:
1688 YY_RULE_SETUP
1689 #line 225 "glsl_lexer.lpp"
1690 {
1691 yylval->n = strtol(yytext, NULL, 10);
1692 return INTCONSTANT;
1693 }
1694 YY_BREAK
1695 case 88:
1696 YY_RULE_SETUP
1697 #line 229 "glsl_lexer.lpp"
1698 {
1699 yylval->n = strtol(yytext + 2, NULL, 16);
1700 return INTCONSTANT;
1701 }
1702 YY_BREAK
1703 case 89:
1704 YY_RULE_SETUP
1705 #line 233 "glsl_lexer.lpp"
1706 {
1707 yylval->n = strtol(yytext, NULL, 8);
1708 return INTCONSTANT;
1709 }
1710 YY_BREAK
1711 case 90:
1712 YY_RULE_SETUP
1713 #line 238 "glsl_lexer.lpp"
1714 {
1715 yylval->real = strtod(yytext, NULL);
1716 return FLOATCONSTANT;
1717 }
1718 YY_BREAK
1719 case 91:
1720 YY_RULE_SETUP
1721 #line 242 "glsl_lexer.lpp"
1722 {
1723 yylval->real = strtod(yytext, NULL);
1724 return FLOATCONSTANT;
1725 }
1726 YY_BREAK
1727 case 92:
1728 YY_RULE_SETUP
1729 #line 246 "glsl_lexer.lpp"
1730 {
1731 yylval->real = strtod(yytext, NULL);
1732 return FLOATCONSTANT;
1733 }
1734 YY_BREAK
1735 case 93:
1736 YY_RULE_SETUP
1737 #line 250 "glsl_lexer.lpp"
1738 {
1739 yylval->real = strtod(yytext, NULL);
1740 return FLOATCONSTANT;
1741 }
1742 YY_BREAK
1743 case 94:
1744 YY_RULE_SETUP
1745 #line 255 "glsl_lexer.lpp"
1746 {
1747 yylval->n = 1;
1748 return BOOLCONSTANT;
1749 }
1750 YY_BREAK
1751 case 95:
1752 YY_RULE_SETUP
1753 #line 259 "glsl_lexer.lpp"
1754 {
1755 yylval->n = 0;
1756 return BOOLCONSTANT;
1757 }
1758 YY_BREAK
1759 /* Reserved words in GLSL 1.10. */
1760 case 96:
1761 YY_RULE_SETUP
1762 #line 266 "glsl_lexer.lpp"
1763 return ASM;
1764 YY_BREAK
1765 case 97:
1766 YY_RULE_SETUP
1767 #line 267 "glsl_lexer.lpp"
1768 return CLASS;
1769 YY_BREAK
1770 case 98:
1771 YY_RULE_SETUP
1772 #line 268 "glsl_lexer.lpp"
1773 return UNION;
1774 YY_BREAK
1775 case 99:
1776 YY_RULE_SETUP
1777 #line 269 "glsl_lexer.lpp"
1778 return ENUM;
1779 YY_BREAK
1780 case 100:
1781 YY_RULE_SETUP
1782 #line 270 "glsl_lexer.lpp"
1783 return TYPEDEF;
1784 YY_BREAK
1785 case 101:
1786 YY_RULE_SETUP
1787 #line 271 "glsl_lexer.lpp"
1788 return TEMPLATE;
1789 YY_BREAK
1790 case 102:
1791 YY_RULE_SETUP
1792 #line 272 "glsl_lexer.lpp"
1793 return THIS;
1794 YY_BREAK
1795 case 103:
1796 YY_RULE_SETUP
1797 #line 273 "glsl_lexer.lpp"
1798 return PACKED;
1799 YY_BREAK
1800 case 104:
1801 YY_RULE_SETUP
1802 #line 274 "glsl_lexer.lpp"
1803 return GOTO;
1804 YY_BREAK
1805 case 105:
1806 YY_RULE_SETUP
1807 #line 275 "glsl_lexer.lpp"
1808 return SWITCH;
1809 YY_BREAK
1810 case 106:
1811 YY_RULE_SETUP
1812 #line 276 "glsl_lexer.lpp"
1813 return DEFAULT;
1814 YY_BREAK
1815 case 107:
1816 YY_RULE_SETUP
1817 #line 277 "glsl_lexer.lpp"
1818 return INLINE_TOK;
1819 YY_BREAK
1820 case 108:
1821 YY_RULE_SETUP
1822 #line 278 "glsl_lexer.lpp"
1823 return NOINLINE;
1824 YY_BREAK
1825 case 109:
1826 YY_RULE_SETUP
1827 #line 279 "glsl_lexer.lpp"
1828 return VOLATILE;
1829 YY_BREAK
1830 case 110:
1831 YY_RULE_SETUP
1832 #line 280 "glsl_lexer.lpp"
1833 return PUBLIC_TOK;
1834 YY_BREAK
1835 case 111:
1836 YY_RULE_SETUP
1837 #line 281 "glsl_lexer.lpp"
1838 return STATIC;
1839 YY_BREAK
1840 case 112:
1841 YY_RULE_SETUP
1842 #line 282 "glsl_lexer.lpp"
1843 return EXTERN;
1844 YY_BREAK
1845 case 113:
1846 YY_RULE_SETUP
1847 #line 283 "glsl_lexer.lpp"
1848 return EXTERNAL;
1849 YY_BREAK
1850 case 114:
1851 YY_RULE_SETUP
1852 #line 284 "glsl_lexer.lpp"
1853 return INTERFACE;
1854 YY_BREAK
1855 case 115:
1856 YY_RULE_SETUP
1857 #line 285 "glsl_lexer.lpp"
1858 return LONG;
1859 YY_BREAK
1860 case 116:
1861 YY_RULE_SETUP
1862 #line 286 "glsl_lexer.lpp"
1863 return SHORT;
1864 YY_BREAK
1865 case 117:
1866 YY_RULE_SETUP
1867 #line 287 "glsl_lexer.lpp"
1868 return DOUBLE;
1869 YY_BREAK
1870 case 118:
1871 YY_RULE_SETUP
1872 #line 288 "glsl_lexer.lpp"
1873 return HALF;
1874 YY_BREAK
1875 case 119:
1876 YY_RULE_SETUP
1877 #line 289 "glsl_lexer.lpp"
1878 return FIXED;
1879 YY_BREAK
1880 case 120:
1881 YY_RULE_SETUP
1882 #line 290 "glsl_lexer.lpp"
1883 return UNSIGNED;
1884 YY_BREAK
1885 case 121:
1886 YY_RULE_SETUP
1887 #line 291 "glsl_lexer.lpp"
1888 return INPUT;
1889 YY_BREAK
1890 case 122:
1891 YY_RULE_SETUP
1892 #line 292 "glsl_lexer.lpp"
1893 return OUTPUT;
1894 YY_BREAK
1895 case 123:
1896 YY_RULE_SETUP
1897 #line 293 "glsl_lexer.lpp"
1898 return HVEC2;
1899 YY_BREAK
1900 case 124:
1901 YY_RULE_SETUP
1902 #line 294 "glsl_lexer.lpp"
1903 return HVEC3;
1904 YY_BREAK
1905 case 125:
1906 YY_RULE_SETUP
1907 #line 295 "glsl_lexer.lpp"
1908 return HVEC4;
1909 YY_BREAK
1910 case 126:
1911 YY_RULE_SETUP
1912 #line 296 "glsl_lexer.lpp"
1913 return DVEC2;
1914 YY_BREAK
1915 case 127:
1916 YY_RULE_SETUP
1917 #line 297 "glsl_lexer.lpp"
1918 return DVEC3;
1919 YY_BREAK
1920 case 128:
1921 YY_RULE_SETUP
1922 #line 298 "glsl_lexer.lpp"
1923 return DVEC4;
1924 YY_BREAK
1925 case 129:
1926 YY_RULE_SETUP
1927 #line 299 "glsl_lexer.lpp"
1928 return FVEC2;
1929 YY_BREAK
1930 case 130:
1931 YY_RULE_SETUP
1932 #line 300 "glsl_lexer.lpp"
1933 return FVEC3;
1934 YY_BREAK
1935 case 131:
1936 YY_RULE_SETUP
1937 #line 301 "glsl_lexer.lpp"
1938 return FVEC4;
1939 YY_BREAK
1940 case 132:
1941 YY_RULE_SETUP
1942 #line 302 "glsl_lexer.lpp"
1943 return SAMPLER2DRECT;
1944 YY_BREAK
1945 case 133:
1946 YY_RULE_SETUP
1947 #line 303 "glsl_lexer.lpp"
1948 return SAMPLER3DRECT;
1949 YY_BREAK
1950 case 134:
1951 YY_RULE_SETUP
1952 #line 304 "glsl_lexer.lpp"
1953 return SAMPLER2DRECTSHADOW;
1954 YY_BREAK
1955 case 135:
1956 YY_RULE_SETUP
1957 #line 305 "glsl_lexer.lpp"
1958 return SIZEOF;
1959 YY_BREAK
1960 case 136:
1961 YY_RULE_SETUP
1962 #line 306 "glsl_lexer.lpp"
1963 return CAST;
1964 YY_BREAK
1965 case 137:
1966 YY_RULE_SETUP
1967 #line 307 "glsl_lexer.lpp"
1968 return NAMESPACE;
1969 YY_BREAK
1970 case 138:
1971 YY_RULE_SETUP
1972 #line 308 "glsl_lexer.lpp"
1973 return USING;
1974 YY_BREAK
1975 /* Additional reserved words in GLSL 1.20. */
1976 case 139:
1977 YY_RULE_SETUP
1978 #line 311 "glsl_lexer.lpp"
1979 return LOWP;
1980 YY_BREAK
1981 case 140:
1982 YY_RULE_SETUP
1983 #line 312 "glsl_lexer.lpp"
1984 return MEDIUMP;
1985 YY_BREAK
1986 case 141:
1987 YY_RULE_SETUP
1988 #line 313 "glsl_lexer.lpp"
1989 return HIGHP;
1990 YY_BREAK
1991 case 142:
1992 YY_RULE_SETUP
1993 #line 314 "glsl_lexer.lpp"
1994 return PRECISION;
1995 YY_BREAK
1996 case 143:
1997 YY_RULE_SETUP
1998 #line 316 "glsl_lexer.lpp"
1999 {
2000 struct _mesa_glsl_parse_state *state = yyextra;
2001 void *ctx = state;
2002 yylval->identifier = talloc_strdup(ctx, yytext);
2003 return IDENTIFIER;
2004 }
2005 YY_BREAK
2006 case 144:
2007 YY_RULE_SETUP
2008 #line 323 "glsl_lexer.lpp"
2009 { return yytext[0]; }
2010 YY_BREAK
2011 case 145:
2012 YY_RULE_SETUP
2013 #line 325 "glsl_lexer.lpp"
2014 ECHO;
2015 YY_BREAK
2016 #line 2017 "glsl_lexer.cpp"
2017 case YY_STATE_EOF(INITIAL):
2018 case YY_STATE_EOF(PP):
2019 yyterminate();
2020
2021 case YY_END_OF_BUFFER:
2022 {
2023 /* Amount of text matched not including the EOB char. */
2024 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
2025
2026 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2027 *yy_cp = yyg->yy_hold_char;
2028 YY_RESTORE_YY_MORE_OFFSET
2029
2030 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
2031 {
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.
2040 */
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;
2044 }
2045
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
2051 * in input().
2052 */
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;
2056
2057 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
2058
2059 yy_current_state = yy_get_previous_state( yyscanner );
2060
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).
2068 */
2069
2070 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
2071
2072 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
2073
2074 if ( yy_next_state )
2075 {
2076 /* Consume the NUL. */
2077 yy_cp = ++yyg->yy_c_buf_p;
2078 yy_current_state = yy_next_state;
2079 goto yy_match;
2080 }
2081
2082 else
2083 {
2084 yy_cp = yyg->yy_last_accepting_cpos;
2085 yy_current_state = yyg->yy_last_accepting_state;
2086 goto yy_find_action;
2087 }
2088 }
2089
2090 else switch ( yy_get_next_buffer( yyscanner ) )
2091 {
2092 case EOB_ACT_END_OF_FILE:
2093 {
2094 yyg->yy_did_buffer_switch_on_eof = 0;
2095
2096 if ( _mesa_glsl_wrap(yyscanner ) )
2097 {
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.
2106 */
2107 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
2108
2109 yy_act = YY_STATE_EOF(YY_START);
2110 goto do_action;
2111 }
2112
2113 else
2114 {
2115 if ( ! yyg->yy_did_buffer_switch_on_eof )
2116 YY_NEW_FILE;
2117 }
2118 break;
2119 }
2120
2121 case EOB_ACT_CONTINUE_SCAN:
2122 yyg->yy_c_buf_p =
2123 yyg->yytext_ptr + yy_amount_of_matched_text;
2124
2125 yy_current_state = yy_get_previous_state( yyscanner );
2126
2127 yy_cp = yyg->yy_c_buf_p;
2128 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
2129 goto yy_match;
2130
2131 case EOB_ACT_LAST_MATCH:
2132 yyg->yy_c_buf_p =
2133 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
2134
2135 yy_current_state = yy_get_previous_state( yyscanner );
2136
2137 yy_cp = yyg->yy_c_buf_p;
2138 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
2139 goto yy_find_action;
2140 }
2141 break;
2142 }
2143
2144 default:
2145 YY_FATAL_ERROR(
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 */
2150
2151 /* yy_get_next_buffer - try to read in a new buffer
2152 *
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
2157 */
2158 static int yy_get_next_buffer (yyscan_t yyscanner)
2159 {
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;
2164 int ret_val;
2165
2166 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
2167 YY_FATAL_ERROR(
2168 "fatal flex scanner internal error--end of buffer missed" );
2169
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 )
2173 {
2174 /* We matched a single character, the EOB, so
2175 * treat this as a final EOF.
2176 */
2177 return EOB_ACT_END_OF_FILE;
2178 }
2179
2180 else
2181 {
2182 /* We matched some text prior to the EOB, first
2183 * process it.
2184 */
2185 return EOB_ACT_LAST_MATCH;
2186 }
2187 }
2188
2189 /* Try to read more data. */
2190
2191 /* First move last chars to start of buffer. */
2192 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
2193
2194 for ( i = 0; i < number_to_move; ++i )
2195 *(dest++) = *(source++);
2196
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,
2199 * just force an EOF
2200 */
2201 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
2202
2203 else
2204 {
2205 int num_to_read =
2206 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2207
2208 while ( num_to_read <= 0 )
2209 { /* Not enough room in the buffer - grow it. */
2210
2211 /* just a shorter name for the current buffer */
2212 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
2213
2214 int yy_c_buf_p_offset =
2215 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
2216
2217 if ( b->yy_is_our_buffer )
2218 {
2219 int new_size = b->yy_buf_size * 2;
2220
2221 if ( new_size <= 0 )
2222 b->yy_buf_size += b->yy_buf_size / 8;
2223 else
2224 b->yy_buf_size *= 2;
2225
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 );
2229 }
2230 else
2231 /* Can't grow it, we don't own it. */
2232 b->yy_ch_buf = 0;
2233
2234 if ( ! b->yy_ch_buf )
2235 YY_FATAL_ERROR(
2236 "fatal error - scanner input buffer overflow" );
2237
2238 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
2239
2240 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
2241 number_to_move - 1;
2242
2243 }
2244
2245 if ( num_to_read > YY_READ_BUF_SIZE )
2246 num_to_read = YY_READ_BUF_SIZE;
2247
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 );
2251
2252 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2253 }
2254
2255 if ( yyg->yy_n_chars == 0 )
2256 {
2257 if ( number_to_move == YY_MORE_ADJ )
2258 {
2259 ret_val = EOB_ACT_END_OF_FILE;
2260 _mesa_glsl_restart(yyin ,yyscanner);
2261 }
2262
2263 else
2264 {
2265 ret_val = EOB_ACT_LAST_MATCH;
2266 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
2267 YY_BUFFER_EOF_PENDING;
2268 }
2269 }
2270
2271 else
2272 ret_val = EOB_ACT_CONTINUE_SCAN;
2273
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()" );
2280 }
2281
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;
2285
2286 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
2287
2288 return ret_val;
2289 }
2290
2291 /* yy_get_previous_state - get the state just before the EOB char was reached */
2292
2293 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
2294 {
2295 register yy_state_type yy_current_state;
2296 register char *yy_cp;
2297 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2298
2299 yy_current_state = yyg->yy_start;
2300 yy_current_state += YY_AT_BOL();
2301
2302 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
2303 {
2304 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2305 if ( yy_accept[yy_current_state] )
2306 {
2307 yyg->yy_last_accepting_state = yy_current_state;
2308 yyg->yy_last_accepting_cpos = yy_cp;
2309 }
2310 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2311 {
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];
2315 }
2316 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2317 }
2318
2319 return yy_current_state;
2320 }
2321
2322 /* yy_try_NUL_trans - try to make a transition on the NUL character
2323 *
2324 * synopsis
2325 * next_state = yy_try_NUL_trans( current_state );
2326 */
2327 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
2328 {
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;
2332
2333 register YY_CHAR yy_c = 1;
2334 if ( yy_accept[yy_current_state] )
2335 {
2336 yyg->yy_last_accepting_state = yy_current_state;
2337 yyg->yy_last_accepting_cpos = yy_cp;
2338 }
2339 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2340 {
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];
2344 }
2345 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2346 yy_is_jam = (yy_current_state == 518);
2347
2348 return yy_is_jam ? 0 : yy_current_state;
2349 }
2350
2351 #ifndef YY_NO_INPUT
2352 #ifdef __cplusplus
2353 static int yyinput (yyscan_t yyscanner)
2354 #else
2355 static int input (yyscan_t yyscanner)
2356 #endif
2357
2358 {
2359 int c;
2360 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2361
2362 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2363
2364 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2365 {
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.
2369 */
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';
2373
2374 else
2375 { /* need more input */
2376 int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
2377 ++yyg->yy_c_buf_p;
2378
2379 switch ( yy_get_next_buffer( yyscanner ) )
2380 {
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.
2390 */
2391
2392 /* Reset buffer status. */
2393 _mesa_glsl_restart(yyin ,yyscanner);
2394
2395 /*FALLTHROUGH*/
2396
2397 case EOB_ACT_END_OF_FILE:
2398 {
2399 if ( _mesa_glsl_wrap(yyscanner ) )
2400 return EOF;
2401
2402 if ( ! yyg->yy_did_buffer_switch_on_eof )
2403 YY_NEW_FILE;
2404 #ifdef __cplusplus
2405 return yyinput(yyscanner);
2406 #else
2407 return input(yyscanner);
2408 #endif
2409 }
2410
2411 case EOB_ACT_CONTINUE_SCAN:
2412 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
2413 break;
2414 }
2415 }
2416 }
2417
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;
2421
2422 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
2423
2424 return c;
2425 }
2426 #endif /* ifndef YY_NO_INPUT */
2427
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 .
2432 */
2433 void _mesa_glsl_restart (FILE * input_file , yyscan_t yyscanner)
2434 {
2435 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2436
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);
2441 }
2442
2443 _mesa_glsl__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
2444 _mesa_glsl__load_buffer_state(yyscanner );
2445 }
2446
2447 /** Switch to a different input buffer.
2448 * @param new_buffer The new input buffer.
2449 * @param yyscanner The scanner object.
2450 */
2451 void _mesa_glsl__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
2452 {
2453 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2454
2455 /* TODO. We should be able to replace this entire function body
2456 * with
2457 * _mesa_glsl_pop_buffer_state();
2458 * _mesa_glsl_push_buffer_state(new_buffer);
2459 */
2460 _mesa_glsl_ensure_buffer_stack (yyscanner);
2461 if ( YY_CURRENT_BUFFER == new_buffer )
2462 return;
2463
2464 if ( YY_CURRENT_BUFFER )
2465 {
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;
2470 }
2471
2472 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2473 _mesa_glsl__load_buffer_state(yyscanner );
2474
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.
2479 */
2480 yyg->yy_did_buffer_switch_on_eof = 1;
2481 }
2482
2483 static void _mesa_glsl__load_buffer_state (yyscan_t yyscanner)
2484 {
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;
2490 }
2491
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.
2497 */
2498 YY_BUFFER_STATE _mesa_glsl__create_buffer (FILE * file, int size , yyscan_t yyscanner)
2499 {
2500 YY_BUFFER_STATE b;
2501
2502 b = (YY_BUFFER_STATE) _mesa_glsl_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
2503 if ( ! b )
2504 YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl__create_buffer()" );
2505
2506 b->yy_buf_size = size;
2507
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.
2510 */
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()" );
2514
2515 b->yy_is_our_buffer = 1;
2516
2517 _mesa_glsl__init_buffer(b,file ,yyscanner);
2518
2519 return b;
2520 }
2521
2522 /** Destroy the buffer.
2523 * @param b a buffer created with _mesa_glsl__create_buffer()
2524 * @param yyscanner The scanner object.
2525 */
2526 void _mesa_glsl__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
2527 {
2528 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2529
2530 if ( ! b )
2531 return;
2532
2533 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2534 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2535
2536 if ( b->yy_is_our_buffer )
2537 _mesa_glsl_free((void *) b->yy_ch_buf ,yyscanner );
2538
2539 _mesa_glsl_free((void *) b ,yyscanner );
2540 }
2541
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.
2545 */
2546 static void _mesa_glsl__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
2547
2548 {
2549 int oerrno = errno;
2550 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2551
2552 _mesa_glsl__flush_buffer(b ,yyscanner);
2553
2554 b->yy_input_file = file;
2555 b->yy_fill_buffer = 1;
2556
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.
2560 */
2561 if (b != YY_CURRENT_BUFFER){
2562 b->yy_bs_lineno = 1;
2563 b->yy_bs_column = 0;
2564 }
2565
2566 b->yy_is_interactive = 0;
2567
2568 errno = oerrno;
2569 }
2570
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.
2574 */
2575 void _mesa_glsl__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
2576 {
2577 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2578 if ( ! b )
2579 return;
2580
2581 b->yy_n_chars = 0;
2582
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.
2586 */
2587 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2588 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2589
2590 b->yy_buf_pos = &b->yy_ch_buf[0];
2591
2592 b->yy_at_bol = 1;
2593 b->yy_buffer_status = YY_BUFFER_NEW;
2594
2595 if ( b == YY_CURRENT_BUFFER )
2596 _mesa_glsl__load_buffer_state(yyscanner );
2597 }
2598
2599 /** Pushes the new state onto the stack. The new state becomes
2600 * the current state. This function will allocate the stack
2601 * if necessary.
2602 * @param new_buffer The new state.
2603 * @param yyscanner The scanner object.
2604 */
2605 void _mesa_glsl_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
2606 {
2607 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2608 if (new_buffer == NULL)
2609 return;
2610
2611 _mesa_glsl_ensure_buffer_stack(yyscanner);
2612
2613 /* This block is copied from _mesa_glsl__switch_to_buffer. */
2614 if ( YY_CURRENT_BUFFER )
2615 {
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;
2620 }
2621
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;
2626
2627 /* copied from _mesa_glsl__switch_to_buffer. */
2628 _mesa_glsl__load_buffer_state(yyscanner );
2629 yyg->yy_did_buffer_switch_on_eof = 1;
2630 }
2631
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.
2635 */
2636 void _mesa_glsl_pop_buffer_state (yyscan_t yyscanner)
2637 {
2638 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2639 if (!YY_CURRENT_BUFFER)
2640 return;
2641
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;
2646
2647 if (YY_CURRENT_BUFFER) {
2648 _mesa_glsl__load_buffer_state(yyscanner );
2649 yyg->yy_did_buffer_switch_on_eof = 1;
2650 }
2651 }
2652
2653 /* Allocates the stack if it does not exist.
2654 * Guarantees space for at least one push.
2655 */
2656 static void _mesa_glsl_ensure_buffer_stack (yyscan_t yyscanner)
2657 {
2658 int num_to_alloc;
2659 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2660
2661 if (!yyg->yy_buffer_stack) {
2662
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.
2666 */
2667 num_to_alloc = 1;
2668 yyg->yy_buffer_stack = (struct yy_buffer_state**)_mesa_glsl_alloc
2669 (num_to_alloc * sizeof(struct yy_buffer_state*)
2670 , yyscanner);
2671 if ( ! yyg->yy_buffer_stack )
2672 YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl_ensure_buffer_stack()" );
2673
2674 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2675
2676 yyg->yy_buffer_stack_max = num_to_alloc;
2677 yyg->yy_buffer_stack_top = 0;
2678 return;
2679 }
2680
2681 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2682
2683 /* Increase the buffer to prepare for a possible push. */
2684 int grow_size = 8 /* arbitrary grow size */;
2685
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*)
2690 , yyscanner);
2691 if ( ! yyg->yy_buffer_stack )
2692 YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl_ensure_buffer_stack()" );
2693
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;
2697 }
2698 }
2699
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.
2705 */
2706 YY_BUFFER_STATE _mesa_glsl__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
2707 {
2708 YY_BUFFER_STATE b;
2709
2710 if ( size < 2 ||
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. */
2714 return 0;
2715
2716 b = (YY_BUFFER_STATE) _mesa_glsl_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
2717 if ( ! b )
2718 YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl__scan_buffer()" );
2719
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;
2726 b->yy_at_bol = 1;
2727 b->yy_fill_buffer = 0;
2728 b->yy_buffer_status = YY_BUFFER_NEW;
2729
2730 _mesa_glsl__switch_to_buffer(b ,yyscanner );
2731
2732 return b;
2733 }
2734
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.
2742 */
2743 YY_BUFFER_STATE _mesa_glsl__scan_string (yyconst char * yystr , yyscan_t yyscanner)
2744 {
2745
2746 return _mesa_glsl__scan_bytes(yystr,strlen(yystr) ,yyscanner);
2747 }
2748
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.
2755 */
2756 YY_BUFFER_STATE _mesa_glsl__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
2757 {
2758 YY_BUFFER_STATE b;
2759 char *buf;
2760 yy_size_t n;
2761 int i;
2762
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 );
2766 if ( ! buf )
2767 YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl__scan_bytes()" );
2768
2769 for ( i = 0; i < _yybytes_len; ++i )
2770 buf[i] = yybytes[i];
2771
2772 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2773
2774 b = _mesa_glsl__scan_buffer(buf,n ,yyscanner);
2775 if ( ! b )
2776 YY_FATAL_ERROR( "bad buffer in _mesa_glsl__scan_bytes()" );
2777
2778 /* It's okay to grow etc. this buffer, and we should throw it
2779 * away when we're done.
2780 */
2781 b->yy_is_our_buffer = 1;
2782
2783 return b;
2784 }
2785
2786 #ifndef YY_EXIT_FAILURE
2787 #define YY_EXIT_FAILURE 2
2788 #endif
2789
2790 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
2791 {
2792 (void) fprintf( stderr, "%s\n", msg );
2793 exit( YY_EXIT_FAILURE );
2794 }
2795
2796 /* Redefine yyless() so it works in section 3 code. */
2797
2798 #undef yyless
2799 #define yyless(n) \
2800 do \
2801 { \
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; \
2810 } \
2811 while ( 0 )
2812
2813 /* Accessor methods (get/set functions) to struct members. */
2814
2815 /** Get the user-defined data for this scanner.
2816 * @param yyscanner The scanner object.
2817 */
2818 YY_EXTRA_TYPE _mesa_glsl_get_extra (yyscan_t yyscanner)
2819 {
2820 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2821 return yyextra;
2822 }
2823
2824 /** Get the current line number.
2825 * @param yyscanner The scanner object.
2826 */
2827 int _mesa_glsl_get_lineno (yyscan_t yyscanner)
2828 {
2829 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2830
2831 if (! YY_CURRENT_BUFFER)
2832 return 0;
2833
2834 return yylineno;
2835 }
2836
2837 /** Get the current column number.
2838 * @param yyscanner The scanner object.
2839 */
2840 int _mesa_glsl_get_column (yyscan_t yyscanner)
2841 {
2842 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2843
2844 if (! YY_CURRENT_BUFFER)
2845 return 0;
2846
2847 return yycolumn;
2848 }
2849
2850 /** Get the input stream.
2851 * @param yyscanner The scanner object.
2852 */
2853 FILE *_mesa_glsl_get_in (yyscan_t yyscanner)
2854 {
2855 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2856 return yyin;
2857 }
2858
2859 /** Get the output stream.
2860 * @param yyscanner The scanner object.
2861 */
2862 FILE *_mesa_glsl_get_out (yyscan_t yyscanner)
2863 {
2864 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2865 return yyout;
2866 }
2867
2868 /** Get the length of the current token.
2869 * @param yyscanner The scanner object.
2870 */
2871 int _mesa_glsl_get_leng (yyscan_t yyscanner)
2872 {
2873 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2874 return yyleng;
2875 }
2876
2877 /** Get the current token.
2878 * @param yyscanner The scanner object.
2879 */
2880
2881 char *_mesa_glsl_get_text (yyscan_t yyscanner)
2882 {
2883 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2884 return yytext;
2885 }
2886
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.
2890 */
2891 void _mesa_glsl_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
2892 {
2893 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2894 yyextra = user_defined ;
2895 }
2896
2897 /** Set the current line number.
2898 * @param line_number
2899 * @param yyscanner The scanner object.
2900 */
2901 void _mesa_glsl_set_lineno (int line_number , yyscan_t yyscanner)
2902 {
2903 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2904
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);
2908
2909 yylineno = line_number;
2910 }
2911
2912 /** Set the current column.
2913 * @param line_number
2914 * @param yyscanner The scanner object.
2915 */
2916 void _mesa_glsl_set_column (int column_no , yyscan_t yyscanner)
2917 {
2918 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2919
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);
2923
2924 yycolumn = column_no;
2925 }
2926
2927 /** Set the input stream. This does not discard the current
2928 * input buffer.
2929 * @param in_str A readable stream.
2930 * @param yyscanner The scanner object.
2931 * @see _mesa_glsl__switch_to_buffer
2932 */
2933 void _mesa_glsl_set_in (FILE * in_str , yyscan_t yyscanner)
2934 {
2935 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2936 yyin = in_str ;
2937 }
2938
2939 void _mesa_glsl_set_out (FILE * out_str , yyscan_t yyscanner)
2940 {
2941 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2942 yyout = out_str ;
2943 }
2944
2945 int _mesa_glsl_get_debug (yyscan_t yyscanner)
2946 {
2947 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2948 return yy_flex_debug;
2949 }
2950
2951 void _mesa_glsl_set_debug (int bdebug , yyscan_t yyscanner)
2952 {
2953 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2954 yy_flex_debug = bdebug ;
2955 }
2956
2957 /* Accessor methods for yylval and yylloc */
2958
2959 YYSTYPE * _mesa_glsl_get_lval (yyscan_t yyscanner)
2960 {
2961 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2962 return yylval;
2963 }
2964
2965 void _mesa_glsl_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
2966 {
2967 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2968 yylval = yylval_param;
2969 }
2970
2971 YYLTYPE *_mesa_glsl_get_lloc (yyscan_t yyscanner)
2972 {
2973 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2974 return yylloc;
2975 }
2976
2977 void _mesa_glsl_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
2978 {
2979 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2980 yylloc = yylloc_param;
2981 }
2982
2983 /* User-visible API */
2984
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.
2988 */
2989
2990 int _mesa_glsl_lex_init(yyscan_t* ptr_yy_globals)
2991
2992 {
2993 if (ptr_yy_globals == NULL){
2994 errno = EINVAL;
2995 return 1;
2996 }
2997
2998 *ptr_yy_globals = (yyscan_t) _mesa_glsl_alloc ( sizeof( struct yyguts_t ), NULL );
2999
3000 if (*ptr_yy_globals == NULL){
3001 errno = ENOMEM;
3002 return 1;
3003 }
3004
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));
3007
3008 return yy_init_globals ( *ptr_yy_globals );
3009 }
3010
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.
3017 */
3018
3019 int _mesa_glsl_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
3020
3021 {
3022 struct yyguts_t dummy_yyguts;
3023
3024 _mesa_glsl_set_extra (yy_user_defined, &dummy_yyguts);
3025
3026 if (ptr_yy_globals == NULL){
3027 errno = EINVAL;
3028 return 1;
3029 }
3030
3031 *ptr_yy_globals = (yyscan_t) _mesa_glsl_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
3032
3033 if (*ptr_yy_globals == NULL){
3034 errno = ENOMEM;
3035 return 1;
3036 }
3037
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));
3041
3042 _mesa_glsl_set_extra (yy_user_defined, *ptr_yy_globals);
3043
3044 return yy_init_globals ( *ptr_yy_globals );
3045 }
3046
3047 static int yy_init_globals (yyscan_t yyscanner)
3048 {
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.
3052 */
3053
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;
3058 yyg->yy_init = 0;
3059 yyg->yy_start = 0;
3060
3061 yyg->yy_start_stack_ptr = 0;
3062 yyg->yy_start_stack_depth = 0;
3063 yyg->yy_start_stack = NULL;
3064
3065 /* Defined in main.c */
3066 #ifdef YY_STDINIT
3067 yyin = stdin;
3068 yyout = stdout;
3069 #else
3070 yyin = (FILE *) 0;
3071 yyout = (FILE *) 0;
3072 #endif
3073
3074 /* For future reference: Set errno on error, since we are called by
3075 * _mesa_glsl_lex_init()
3076 */
3077 return 0;
3078 }
3079
3080 /* _mesa_glsl_lex_destroy is for both reentrant and non-reentrant scanners. */
3081 int _mesa_glsl_lex_destroy (yyscan_t yyscanner)
3082 {
3083 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3084
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);
3090 }
3091
3092 /* Destroy the stack itself. */
3093 _mesa_glsl_free(yyg->yy_buffer_stack ,yyscanner);
3094 yyg->yy_buffer_stack = NULL;
3095
3096 /* Destroy the start condition stack. */
3097 _mesa_glsl_free(yyg->yy_start_stack ,yyscanner );
3098 yyg->yy_start_stack = NULL;
3099
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);
3103
3104 /* Destroy the main struct (reentrant only). */
3105 _mesa_glsl_free ( yyscanner , yyscanner );
3106 yyscanner = NULL;
3107 return 0;
3108 }
3109
3110 /*
3111 * Internal utility routines.
3112 */
3113
3114 #ifndef yytext_ptr
3115 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
3116 {
3117 register int i;
3118 for ( i = 0; i < n; ++i )
3119 s1[i] = s2[i];
3120 }
3121 #endif
3122
3123 #ifdef YY_NEED_STRLEN
3124 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
3125 {
3126 register int n;
3127 for ( n = 0; s[n]; ++n )
3128 ;
3129
3130 return n;
3131 }
3132 #endif
3133
3134 void *_mesa_glsl_alloc (yy_size_t size , yyscan_t yyscanner)
3135 {
3136 return (void *) malloc( size );
3137 }
3138
3139 void *_mesa_glsl_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
3140 {
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.
3147 */
3148 return (void *) realloc( (char *) ptr, size );
3149 }
3150
3151 void _mesa_glsl_free (void * ptr , yyscan_t yyscanner)
3152 {
3153 free( (char *) ptr ); /* see _mesa_glsl_realloc() for (char *) cast */
3154 }
3155
3156 #define YYTABLES_NAME "yytables"
3157
3158 #line 325 "glsl_lexer.lpp"
3159
3160
3161
3162 void
3163 _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, const char *string)
3164 {
3165 _mesa_glsl_lex_init_extra(state,& state->scanner);
3166 _mesa_glsl__scan_string(string,state->scanner);
3167 }
3168
3169 void
3170 _mesa_glsl_lexer_dtor(struct _mesa_glsl_parse_state *state)
3171 {
3172 _mesa_glsl_lex_destroy(state->scanner);
3173 }
3174