1 #line 17 "glslang.l"
2 // GENERATED FILE - DO NOT EDIT.
3 // Generated by generate_parser.py from glslang.l
4 //
5 // Copyright 2019 The ANGLE Project Authors. All rights reserved.
6 // Use of this source code is governed by a BSD-style license that can be
7 // found in the LICENSE file.
8 //
9 // glslang.l:
10 // Lexer for the OpenGL shading language.
11
12 // Ignore errors in auto-generated code.
13 #if defined(__GNUC__)
14 # pragma GCC diagnostic ignored "-Wswitch-enum"
15 # pragma GCC diagnostic ignored "-Wunused-function"
16 # pragma GCC diagnostic ignored "-Wunused-variable"
17 #elif defined(_MSC_VER)
18 # pragma warning(disable : 4005)
19 # pragma warning(disable : 4065)
20 # pragma warning(disable : 4189)
21 # pragma warning(disable : 4244)
22 # pragma warning(disable : 4505)
23 # pragma warning(disable : 4701)
24 # pragma warning(disable : 4702)
25 #endif
26 #if defined(__clang__)
27 # pragma clang diagnostic ignored "-Wimplicit-fallthrough"
28 # if defined(__APPLE__)
29 // Older clang versions don't have -Wextra-semi-stmt, and detecting Apple clang versions is
30 // difficult because they use different yet overlapping version numbers vs. regular clang.
31 # pragma clang diagnostic ignored "-Wunknown-warning-option"
32 # endif
33 // Flex isn't semi-colon clean.
34 # pragma clang diagnostic ignored "-Wextra-semi-stmt"
35 # pragma clang diagnostic ignored "-Wunreachable-code"
36 #endif
37
38 #define YY_INT_ALIGNED short int
39
40 /* A lexical scanner generated by flex */
41
42 #define FLEX_SCANNER
43 #define YY_FLEX_MAJOR_VERSION 2
44 #define YY_FLEX_MINOR_VERSION 6
45 #define YY_FLEX_SUBMINOR_VERSION 4
46 #if YY_FLEX_SUBMINOR_VERSION > 0
47 # define FLEX_BETA
48 #endif
49
50 #ifdef yyget_lval
51 # define yyget_lval_ALREADY_DEFINED
52 #else
53 # define yyget_lval yyget_lval
54 #endif
55
56 #ifdef yyset_lval
57 # define yyset_lval_ALREADY_DEFINED
58 #else
59 # define yyset_lval yyset_lval
60 #endif
61
62 #ifdef yyget_lloc
63 # define yyget_lloc_ALREADY_DEFINED
64 #else
65 # define yyget_lloc yyget_lloc
66 #endif
67
68 #ifdef yyset_lloc
69 # define yyset_lloc_ALREADY_DEFINED
70 #else
71 # define yyset_lloc yyset_lloc
72 #endif
73
74 /* First, we deal with platform-specific or compiler-specific issues. */
75
76 /* begin standard C headers. */
77 #include <errno.h>
78 #include <stdio.h>
79 #include <stdlib.h>
80 #include <string.h>
81
82 /* end standard C headers. */
83
84 /* flex integer type definitions */
85
86 #ifndef FLEXINT_H
87 # define FLEXINT_H
88
89 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
90
91 # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
92
93 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
94 * if you want the limit (max/min) macros for int types.
95 */
96 # ifndef __STDC_LIMIT_MACROS
97 # define __STDC_LIMIT_MACROS 1
98 # endif
99
100 # include <inttypes.h>
101 typedef int8_t flex_int8_t;
102 typedef uint8_t flex_uint8_t;
103 typedef int16_t flex_int16_t;
104 typedef uint16_t flex_uint16_t;
105 typedef int32_t flex_int32_t;
106 typedef uint32_t flex_uint32_t;
107 # else
108 typedef signed char flex_int8_t;
109 typedef short int flex_int16_t;
110 typedef int flex_int32_t;
111 typedef unsigned char flex_uint8_t;
112 typedef unsigned short int flex_uint16_t;
113 typedef unsigned int flex_uint32_t;
114
115 /* Limits of integral types. */
116 # ifndef INT8_MIN
117 # define INT8_MIN (-128)
118 # endif
119 # ifndef INT16_MIN
120 # define INT16_MIN (-32767 - 1)
121 # endif
122 # ifndef INT32_MIN
123 # define INT32_MIN (-2147483647 - 1)
124 # endif
125 # ifndef INT8_MAX
126 # define INT8_MAX (127)
127 # endif
128 # ifndef INT16_MAX
129 # define INT16_MAX (32767)
130 # endif
131 # ifndef INT32_MAX
132 # define INT32_MAX (2147483647)
133 # endif
134 # ifndef UINT8_MAX
135 # define UINT8_MAX (255U)
136 # endif
137 # ifndef UINT16_MAX
138 # define UINT16_MAX (65535U)
139 # endif
140 # ifndef UINT32_MAX
141 # define UINT32_MAX (4294967295U)
142 # endif
143
144 # ifndef SIZE_MAX
145 # define SIZE_MAX (~(size_t)0)
146 # endif
147
148 # endif /* ! C99 */
149
150 #endif /* ! FLEXINT_H */
151
152 /* begin standard C++ headers. */
153
154 /* TODO: this is always defined, so inline it */
155 #define yyconst const
156
157 #if defined(__GNUC__) && __GNUC__ >= 3
158 # define yynoreturn __attribute__((__noreturn__))
159 #else
160 # define yynoreturn
161 #endif
162
163 /* Returned upon end-of-file. */
164 #define YY_NULL 0
165
166 /* Promotes a possibly negative, possibly signed char to an
167 * integer in range [0..255] for use as an array index.
168 */
169 #define YY_SC_TO_UI(c) ((YY_CHAR)(c))
170
171 /* An opaque pointer. */
172 #ifndef YY_TYPEDEF_YY_SCANNER_T
173 # define YY_TYPEDEF_YY_SCANNER_T
174 typedef void *yyscan_t;
175 #endif
176
177 /* For convenience, these vars (plus the bison vars far below)
178 are macros in the reentrant scanner. */
179 #define yyin yyg->yyin_r
180 #define yyout yyg->yyout_r
181 #define yyextra yyg->yyextra_r
182 #define yyleng yyg->yyleng_r
183 #define yytext yyg->yytext_r
184 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
185 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
186 #define yy_flex_debug yyg->yy_flex_debug_r
187
188 /* Enter a start condition. This macro really ought to take a parameter,
189 * but we do it the disgusting crufty way forced on us by the ()-less
190 * definition of BEGIN.
191 */
192 #define BEGIN yyg->yy_start = 1 + 2 *
193 /* Translate the current start state into a value that can be later handed
194 * to BEGIN to return to the state. The YYSTATE alias is for lex
195 * compatibility.
196 */
197 #define YY_START ((yyg->yy_start - 1) / 2)
198 #define YYSTATE YY_START
199 /* Action number for EOF rule of a given start state. */
200 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
201 /* Special action meaning "start processing a new file". */
202 #define YY_NEW_FILE yyrestart(yyin, yyscanner)
203 #define YY_END_OF_BUFFER_CHAR 0
204
205 /* Size of default input buffer. */
206 #ifndef YY_BUF_SIZE
207 # ifdef __ia64__
208 /* On IA-64, the buffer size is 16k, not 8k.
209 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
210 * Ditto for the __ia64__ case accordingly.
211 */
212 # define YY_BUF_SIZE 32768
213 # else
214 # define YY_BUF_SIZE 16384
215 # endif /* __ia64__ */
216 #endif
217
218 /* The state buf must be large enough to hold one state per character in the main buffer.
219 */
220 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
221
222 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
223 # define YY_TYPEDEF_YY_BUFFER_STATE
224 typedef struct yy_buffer_state *YY_BUFFER_STATE;
225 #endif
226
227 #ifndef YY_TYPEDEF_YY_SIZE_T
228 # define YY_TYPEDEF_YY_SIZE_T
229 typedef size_t yy_size_t;
230 #endif
231
232 #define EOB_ACT_CONTINUE_SCAN 0
233 #define EOB_ACT_END_OF_FILE 1
234 #define EOB_ACT_LAST_MATCH 2
235
236 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
237 * access to the local variable yy_act. Since yyless() is a macro, it would break
238 * existing scanners that call yyless() from OUTSIDE yylex.
239 * One obvious solution it to make yy_act a global. I tried that, and saw
240 * a 5% performance hit in a non-yylineno scanner, because yy_act is
241 * normally declared as a register variable-- so it is not worth it.
242 */
243 #define YY_LESS_LINENO(n) \
244 do \
245 { \
246 int yyl; \
247 for (yyl = n; yyl < yyleng; ++yyl) \
248 if (yytext[yyl] == '\n') \
249 --yylineno; \
250 } while (0)
251 #define YY_LINENO_REWIND_TO(dst) \
252 do \
253 { \
254 const char *p; \
255 for (p = yy_cp - 1; p >= (dst); --p) \
256 if (*p == '\n') \
257 --yylineno; \
258 } while (0)
259
260 /* Return all but the first "n" matched characters back to the input stream. */
261 #define yyless(n) \
262 do \
263 { \
264 /* Undo effects of setting up yytext. */ \
265 int yyless_macro_arg = (n); \
266 YY_LESS_LINENO(yyless_macro_arg); \
267 *yy_cp = yyg->yy_hold_char; \
268 YY_RESTORE_YY_MORE_OFFSET \
269 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
270 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
271 } while (0)
272 #define unput(c) yyunput(c, yyg->yytext_ptr, yyscanner)
273
274 #ifndef YY_STRUCT_YY_BUFFER_STATE
275 # define YY_STRUCT_YY_BUFFER_STATE
276 struct yy_buffer_state
277 {
278 FILE *yy_input_file;
279
280 char *yy_ch_buf; /* input buffer */
281 char *yy_buf_pos; /* current position in input buffer */
282
283 /* Size of input buffer in bytes, not including room for EOB
284 * characters.
285 */
286 int yy_buf_size;
287
288 /* Number of characters read into yy_ch_buf, not including EOB
289 * characters.
290 */
291 int yy_n_chars;
292
293 /* Whether we "own" the buffer - i.e., we know we created it,
294 * and can realloc() it to grow it, and should free() it to
295 * delete it.
296 */
297 int yy_is_our_buffer;
298
299 /* Whether this is an "interactive" input source; if so, and
300 * if we're using stdio for input, then we want to use getc()
301 * instead of fread(), to make sure we stop fetching input after
302 * each newline.
303 */
304 int yy_is_interactive;
305
306 /* Whether we're considered to be at the beginning of a line.
307 * If so, '^' rules will be active on the next match, otherwise
308 * not.
309 */
310 int yy_at_bol;
311
312 int yy_bs_lineno; /**< The line count. */
313 int yy_bs_column; /**< The column count. */
314
315 /* Whether to try to fill the input buffer when we reach the
316 * end of it.
317 */
318 int yy_fill_buffer;
319
320 int yy_buffer_status;
321
322 # define YY_BUFFER_NEW 0
323 # define YY_BUFFER_NORMAL 1
324 /* When an EOF's been seen but there's still some text to process
325 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
326 * shouldn't try reading from the input source any more. We might
327 * still have a bunch of tokens to match, though, because of
328 * possible backing-up.
329 *
330 * When we actually see the EOF, we change the status to "new"
331 * (via yyrestart()), so that the user can continue scanning by
332 * just pointing yyin at a new input file.
333 */
334 # define YY_BUFFER_EOF_PENDING 2
335 };
336 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
337
338 /* We provide macros for accessing buffer states in case in the
339 * future we want to put the buffer states in a more general
340 * "scanner state".
341 *
342 * Returns the top of the stack, or NULL.
343 */
344 #define YY_CURRENT_BUFFER \
345 (yyg->yy_buffer_stack ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] : NULL)
346 /* Same as previous macro, but useful when we know that the buffer stack is not
347 * NULL or when we need an lvalue. For internal use only.
348 */
349 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
350
351 void yyrestart(FILE *input_file, yyscan_t yyscanner);
352 void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner);
353 YY_BUFFER_STATE yy_create_buffer(FILE *file, int size, yyscan_t yyscanner);
354 void yy_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner);
355 void yy_flush_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner);
356 void yypush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner);
357 void yypop_buffer_state(yyscan_t yyscanner);
358
359 static void yyensure_buffer_stack(yyscan_t yyscanner);
360 static void yy_load_buffer_state(yyscan_t yyscanner);
361 static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file, yyscan_t yyscanner);
362 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER, yyscanner)
363
364 YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner);
365 YY_BUFFER_STATE yy_scan_string(const char *yy_str, yyscan_t yyscanner);
366 YY_BUFFER_STATE yy_scan_bytes(const char *bytes, int len, yyscan_t yyscanner);
367
368 void *yyalloc(yy_size_t, yyscan_t yyscanner);
369 void *yyrealloc(void *, yy_size_t, yyscan_t yyscanner);
370 void yyfree(void *, yyscan_t yyscanner);
371
372 #define yy_new_buffer yy_create_buffer
373 #define yy_set_interactive(is_interactive) \
374 { \
375 if (!YY_CURRENT_BUFFER) \
376 { \
377 yyensure_buffer_stack(yyscanner); \
378 YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); \
379 } \
380 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
381 }
382 #define yy_set_bol(at_bol) \
383 { \
384 if (!YY_CURRENT_BUFFER) \
385 { \
386 yyensure_buffer_stack(yyscanner); \
387 YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); \
388 } \
389 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
390 }
391 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
392
393 /* Begin user sect3 */
394
395 #define yywrap(yyscanner) (/*CONSTCOND*/ 1)
396 #define YY_SKIP_YYWRAP
397 typedef flex_uint8_t YY_CHAR;
398
399 typedef int yy_state_type;
400
401 #define yytext_ptr yytext_r
402
403 static yy_state_type yy_get_previous_state(yyscan_t yyscanner);
404 static yy_state_type yy_try_NUL_trans(yy_state_type current_state, yyscan_t yyscanner);
405 static int yy_get_next_buffer(yyscan_t yyscanner);
406 static void yynoreturn yy_fatal_error(const char *msg, yyscan_t yyscanner);
407
408 /* Done after the current pattern has been matched and before the
409 * corresponding action - sets up yytext.
410 */
411 #define YY_DO_BEFORE_ACTION \
412 yyg->yytext_ptr = yy_bp; \
413 yyleng = (int)(yy_cp - yy_bp); \
414 yyg->yy_hold_char = *yy_cp; \
415 *yy_cp = '\0'; \
416 yyg->yy_c_buf_p = yy_cp;
417 #define YY_NUM_RULES 256
418 #define YY_END_OF_BUFFER 257
419 /* This struct is not used in this scanner,
420 but its presence is necessary. */
421 struct yy_trans_info
422 {
423 flex_int32_t yy_verify;
424 flex_int32_t yy_nxt;
425 };
426 static const flex_int16_t yy_accept[938] = {
427 0, 0, 0, 0, 0, 257, 255, 254, 254, 238, 244, 249, 233, 234, 242, 241, 230, 239, 237,
428 243, 196, 196, 231, 227, 245, 232, 246, 250, 193, 235, 236, 248, 193, 193, 193, 193, 193, 193,
429 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 228, 247, 229,
430 240, 253, 252, 256, 251, 224, 210, 229, 218, 213, 208, 216, 206, 217, 207, 202, 209, 201, 195,
431 196, 0, 199, 0, 236, 228, 235, 225, 221, 223, 222, 226, 193, 214, 220, 193, 193, 193, 193,
432 193, 193, 193, 193, 193, 193,
433
434 193, 193, 193, 193, 13, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 16,
435 193, 193, 26, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
436 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
437 215, 219, 251, 0, 205, 201, 0, 204, 198, 0, 200, 194, 211, 212, 193, 193, 153, 193, 193,
438 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
439 193, 193, 193, 14, 193,
440
441 193, 193, 193, 193, 193, 193, 193, 193, 193, 31, 193, 193, 193, 193, 193, 193, 193, 193, 193,
442 193, 193, 193, 27, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
443 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
444 193, 193, 0, 202, 0, 201, 203, 197, 193, 193, 193, 193, 34, 193, 193, 193, 19, 190, 193,
445 193, 193, 193, 193, 193, 193, 193, 193, 193, 17, 156, 193, 193, 193, 193, 22, 193, 193, 160,
446 171, 193, 193, 193, 193,
447
448 193, 193, 193, 193, 193, 193, 193, 193, 193, 168, 4, 39, 40, 41, 193, 193, 193, 193, 193,
449 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
450 193, 159, 35, 193, 193, 32, 193, 193, 193, 193, 193, 193, 193, 51, 52, 53, 33, 193, 193,
451 193, 193, 193, 193, 193, 193, 11, 193, 57, 58, 59, 193, 154, 193, 193, 7, 193, 193, 193,
452 193, 180, 181, 182, 193, 36, 193, 172, 30, 183, 184, 185, 2, 177, 178, 179, 193, 193, 193,
453 28, 175, 193, 193, 193,
454
455 193, 193, 54, 55, 56, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 25, 193, 193,
456 193, 193, 193, 193, 193, 193, 169, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 155,
457 193, 193, 192, 60, 61, 62, 193, 193, 15, 193, 193, 193, 132, 193, 193, 9, 193, 193, 130,
458 193, 193, 193, 170, 165, 133, 193, 193, 193, 193, 193, 193, 161, 193, 193, 193, 193, 193, 97,
459 42, 45, 47, 46, 43, 49, 48, 50, 44, 193, 193, 193, 193, 176, 152, 193, 193, 163, 193,
460 193, 193, 38, 126, 29,
461
462 189, 23, 164, 96, 193, 174, 18, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
463 193, 193, 193, 193, 20, 37, 193, 193, 193, 193, 193, 193, 134, 102, 108, 193, 193, 193, 193,
464 193, 99, 101, 3, 193, 193, 193, 193, 127, 193, 193, 193, 193, 193, 193, 193, 157, 193, 193,
465 193, 193, 193, 8, 193, 193, 10, 193, 193, 193, 193, 193, 193, 21, 122, 12, 166, 135, 103,
466 110, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 162, 193, 193, 193, 120,
467 128, 123, 193, 193, 193,
468
469 193, 193, 193, 193, 193, 158, 136, 104, 109, 193, 193, 173, 193, 124, 193, 193, 193, 193, 6,
470 193, 193, 193, 193, 193, 193, 193, 193, 193, 113, 167, 1, 193, 193, 193, 193, 193, 193, 191,
471 193, 131, 5, 186, 63, 66, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
472 193, 121, 193, 193, 193, 193, 193, 193, 111, 193, 193, 193, 193, 193, 193, 146, 71, 72, 193,
473 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 129, 193, 193, 193, 112,
474 148, 76, 77, 193, 193,
475
476 193, 193, 125, 193, 193, 193, 193, 193, 193, 193, 193, 117, 193, 193, 193, 193, 193, 193, 193,
477 193, 193, 193, 193, 193, 70, 193, 193, 193, 193, 64, 193, 193, 193, 193, 193, 193, 193, 193,
478 193, 193, 193, 193, 193, 193, 193, 193, 118, 193, 137, 193, 105, 193, 193, 193, 193, 75, 193,
479 193, 73, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 119,
480 193, 193, 193, 80, 193, 193, 78, 193, 193, 138, 106, 193, 193, 140, 193, 141, 193, 193, 193,
481 193, 193, 193, 193, 193,
482
483 24, 193, 193, 193, 193, 68, 193, 67, 89, 193, 193, 193, 193, 139, 107, 193, 193, 193, 193,
484 193, 193, 193, 193, 193, 193, 193, 193, 114, 193, 193, 193, 150, 92, 193, 193, 144, 193, 69,
485 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 151, 94, 193, 193, 193, 115, 193, 193,
486 147, 74, 193, 193, 193, 193, 187, 193, 193, 193, 81, 193, 193, 193, 193, 116, 149, 79, 193,
487 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 85, 193, 88, 193, 193, 193, 193, 193, 193,
488 193, 193, 193, 86, 91,
489
490 193, 193, 193, 193, 193, 82, 193, 95, 87, 93, 98, 193, 142, 143, 100, 193, 193, 193, 193,
491 65, 193, 193, 193, 188, 193, 193, 145, 83, 193, 193, 193, 193, 90, 193, 193, 84, 0};
492
493 static const YY_CHAR yy_ec[256] = {
494 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
495 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 1, 1, 1, 5, 6, 1, 7, 8,
496 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
497 30, 1, 31, 32, 33, 34, 35, 36, 37, 38, 38, 38, 38, 39, 40, 38, 41, 38, 38, 42, 43,
498 44, 45, 46, 47, 48, 49, 38, 50, 1, 51, 52, 53, 1, 54, 55, 56, 57,
499
500 58, 59, 60, 61, 62, 38, 63, 64, 65, 66, 67, 68, 38, 69, 70, 71, 72, 73, 74, 75, 76,
501 77, 78, 79, 80, 81, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
502 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
503 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
504 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
505
506 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
507 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
508 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
509
510 static const YY_CHAR yy_meta[82] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 3, 3, 3, 3, 3, 3,
511 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 3, 5, 6, 6, 6, 6, 6,
512 6, 6, 6, 7, 6, 6, 6, 6, 1, 1, 1, 6, 4, 4, 4, 4, 3, 5, 6, 6, 6,
513 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 6, 6, 6, 6, 6, 1, 1, 1, 1};
514
515 static const flex_int16_t yy_base[944] = {
516 0, 0, 0, 81, 0, 1191, 1192, 1192, 1192, 1162, 135, 159, 1192, 1192, 1161,
517 156, 1192, 155, 153, 1160, 175, 166, 1158, 1192, 175, 1158, 153, 1192, 0, 1192,
518 1192, 157, 1132, 148, 158, 168, 178, 141, 175, 1117, 187, 193, 154, 159, 161,
519 1111, 199, 1124, 208, 185, 215, 220, 117, 1109, 1192, 178, 1192, 1192, 1192, 1192,
520 1192, 0, 1192, 1192, 1192, 1192, 1192, 1192, 1192, 1192, 1192, 1192, 240, 1192, 248,
521 241, 259, 317, 1192, 0, 1192, 1192, 1192, 1152, 1192, 1192, 1192, 1151, 0, 1192,
522 1192, 1108, 1106, 1111, 224, 1108, 1116, 1114, 1114, 1101, 1104,
523
524 1115, 231, 1109, 1097, 1094, 1107, 1094, 1091, 1091, 1097, 192, 236, 1091, 1101, 1087,
525 1093, 1096, 1097, 0, 1089, 1099, 241, 1098, 1079, 1092, 1073, 227, 1077, 1090, 1081,
526 253, 1074, 254, 1086, 1088, 248, 1077, 257, 1064, 1073, 274, 287, 1077, 1073, 1075,
527 1064, 1067, 279, 260, 292, 1076, 1064, 1076, 150, 1069, 1068, 1056, 1192, 1192, 0,
528 341, 1192, 312, 357, 1192, 1192, 367, 377, 357, 1192, 1192, 1074, 1065, 0, 1061,
529 1056, 1060, 1069, 1063, 1065, 345, 1049, 1049, 1060, 1052, 279, 1062, 1059, 1059, 1057,
530 1054, 1046, 1052, 1039, 1037, 1049, 1035, 1051, 0, 1048,
531
532 1036, 1043, 1040, 1044, 1045, 1038, 1035, 1024, 1023, 1036, 1039, 1027, 1038, 1034, 1022,
533 1028, 1019, 387, 1024, 1027, 1018, 1025, 1014, 1018, 1009, 1023, 1022, 1013, 1019, 340,
534 1003, 1006, 1004, 1003, 1013, 1003, 998, 996, 998, 1008, 994, 996, 993, 1004, 1003,
535 1006, 988, 350, 996, 992, 990, 999, 978, 401, 996, 998, 987, 979, 1016, 422,
536 432, 442, 454, 1192, 1192, 983, 974, 984, 983, 0, 981, 985, 404, 0, 0,
537 973, 971, 971, 972, 967, 975, 964, 981, 970, 407, 0, 0, 964, 974, 973,
538 973, 0, 958, 413, 0, 0, 960, 416, 967, 968,
539
540 959, 953, 952, 953, 952, 952, 393, 462, 947, 0, 0, 943, 942, 941, 943,
541 944, 949, 943, 939, 952, 947, 947, 945, 944, 938, 932, 934, 933, 937, 942,
542 928, 931, 926, 934, 939, 927, 924, 936, 927, 0, 0, 933, 929, 0, 921,
543 921, 926, 917, 924, 465, 921, 0, 0, 0, 0, 911, 923, 922, 909, 910,
544 919, 920, 920, 0, 905, 0, 0, 0, 906, 0, 914, 905, 0, 904, 905,
545 899, 909, 0, 0, 0, 900, 0, 896, 0, 0, 0, 0, 0, 0, 0,
546 0, 0, 906, 469, 905, 0, 0, 903, 899, 896,
547
548 944, 943, 0, 0, 0, 886, 475, 478, 481, 891, 887, 892, 883, 881, 894,
549 879, 0, 879, 892, 881, 877, 883, 878, 885, 885, 0, 882, 879, 883, 867,
550 865, 868, 874, 880, 875, 874, 862, 0, 864, 865, 0, 0, 0, 0, 862,
551 865, 0, 859, 869, 860, 0, 870, 850, 0, 859, 854, 0, 847, 847, 860,
552 0, 862, 0, 487, 881, 880, 879, 840, 839, 0, 856, 855, 850, 891, 882,
553 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 837, 850, 837, 834, 0,
554 0, 839, 350, 0, 836, 843, 842, 0, 828, 0,
555
556 0, 0, 0, 0, 825, 0, 0, 824, 835, 490, 828, 834, 833, 830, 825,
557 822, 844, 828, 813, 813, 826, 811, 823, 0, 0, 816, 845, 844, 843, 804,
558 803, 478, 481, 0, 815, 818, 816, 805, 801, 816, 0, 0, 812, 809, 808,
559 798, 0, 797, 787, 804, 790, 498, 798, 801, 0, 824, 823, 822, 783, 782,
560 0, 796, 783, 0, 793, 786, 778, 779, 785, 788, 0, 0, 0, 0, 814,
561 813, 0, 784, 787, 772, 779, 770, 777, 778, 778, 777, 763, 509, 774, 774,
562 0, 775, 764, 763, 0, 0, 0, 794, 793, 792,
563
564 753, 752, 748, 760, 755, 0, 789, 788, 0, 759, 762, 0, 518, 0, 740,
565 761, 779, 747, 0, 743, 742, 751, 751, 739, 753, 737, 751, 746, 772, 0,
566 0, 768, 767, 766, 727, 726, 725, 0, 725, 0, 0, 486, 497, 753, 735,
567 738, 721, 734, 732, 720, 719, 728, 728, 751, 750, 749, 710, 709, 0, 714,
568 704, 707, 708, 707, 717, 743, 719, 715, 717, 713, 700, 699, 736, 507, 0,
569 707, 710, 700, 701, 693, 700, 691, 716, 700, 696, 698, 696, 696, 695, 694,
570 0, 682, 681, 691, 717, 716, 512, 0, 687, 690,
571
572 687, 672, 0, 688, 687, 671, 670, 662, 670, 660, 668, 0, 665, 664, 663,
573 688, 672, 670, 670, 663, 653, 656, 670, 654, 691, 665, 666, 663, 660, 514,
574 648, 649, 661, 660, 644, 643, 642, 641, 666, 650, 648, 648, 651, 646, 627,
575 626, 0, 632, 657, 625, 655, 619, 636, 608, 607, 644, 133, 176, 213, 212,
576 242, 266, 269, 298, 297, 297, 353, 356, 359, 398, 427, 423, 463, 435, 442,
577 0, 463, 477, 479, 522, 499, 498, 527, 490, 491, 0, 0, 507, 501, 0,
578 502, 0, 488, 511, 512, 498, 497, 500, 501, 502,
579
580 0, 496, 506, 498, 506, 533, 510, 0, 0, 509, 525, 526, 546, 0, 0,
581 528, 529, 530, 516, 515, 518, 519, 532, 524, 515, 538, 539, 0, 518, 519,
582 527, 0, 0, 528, 544, 556, 526, 558, 548, 542, 530, 551, 549, 543, 576,
583 533, 534, 535, 543, 0, 0, 544, 579, 561, 0, 559, 560, 0, 0, 564,
584 565, 554, 560, 0, 561, 547, 570, 0, 549, 559, 586, 591, 0, 0, 0,
585 575, 576, 583, 568, 566, 567, 559, 560, 577, 584, 585, 0, 583, 598, 568,
586 608, 605, 569, 570, 603, 631, 575, 576, 0, 0,
587
588 593, 595, 596, 587, 594, 0, 613, 0, 0, 0, 0, 623, 0, 0, 0,
589 591, 592, 586, 607, 0, 613, 589, 590, 0, 608, 649, 0, 0, 600, 619,
590 595, 635, 0, 623, 628, 0, 1192, 671, 676, 681, 686, 689, 692};
591
592 static const flex_int16_t yy_def[944] = {
593 0, 937, 1, 937, 3, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937,
594 937, 937, 937, 937, 938, 937, 937, 937, 937, 937, 937, 939, 937, 937, 937, 939, 939,
595 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
596 939, 939, 939, 937, 937, 937, 937, 937, 937, 937, 940, 937, 937, 937, 937, 937, 937,
597 937, 937, 937, 937, 941, 937, 942, 20, 938, 937, 937, 943, 937, 937, 937, 937, 937,
598 937, 937, 937, 939, 937, 937, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
599
600 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
601 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
602 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
603 939, 939, 939, 939, 939, 939, 937, 937, 940, 937, 937, 942, 937, 937, 937, 937, 937,
604 943, 937, 937, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
605 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
606
607 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
608 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
609 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
610 939, 939, 939, 939, 939, 939, 939, 939, 937, 937, 937, 937, 937, 937, 939, 939, 939,
611 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
612 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
613
614 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
615 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
616 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
617 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
618 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
619 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
620
621 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
622 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
623 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
624 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
625 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
626 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
627
628 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
629 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
630 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
631 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
632 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
633 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
634
635 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
636 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
637 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
638 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
639 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
640 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
641
642 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
643 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
644 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
645 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
646 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
647 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
648
649 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
650 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
651 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
652 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
653 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
654 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
655
656 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
657 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
658 939, 939, 0, 937, 937, 937, 937, 937, 937};
659
660 static const flex_int16_t yy_nxt[1274] = {
661 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 21,
662 21, 21, 21, 21, 21, 21, 22, 23, 24, 25, 26, 27, 28, 28, 28, 28, 28, 28, 28,
663 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 30, 31, 32, 33, 34, 35,
664 36, 37, 38, 39, 40, 41, 28, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 28,
665 53, 28, 54, 55, 56, 57, 58, 59, 60, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
666 58, 58, 58, 58, 58, 58,
667
668 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 61, 61, 61, 61, 61, 61, 61, 61,
669 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 58, 58, 58, 61, 61, 61, 61, 61,
670 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
671 61, 58, 58, 58, 58, 63, 64, 65, 68, 70, 72, 72, 72, 72, 72, 72, 72, 72, 72,
672 72, 155, 74, 81, 86, 87, 71, 69, 89, 156, 66, 74, 797, 75, 75, 75, 75, 75, 75,
673 75, 75, 76, 76, 82,
674
675 77, 83, 84, 92, 107, 158, 108, 126, 90, 77, 78, 255, 128, 256, 130, 109, 129, 93, 94,
676 78, 127, 99, 79, 77, 95, 100, 96, 131, 110, 97, 98, 101, 77, 798, 102, 103, 111, 78,
677 112, 104, 116, 113, 144, 799, 105, 145, 78, 114, 117, 79, 106, 119, 133, 146, 120, 195, 159,
678 121, 122, 118, 147, 137, 123, 124, 800, 125, 196, 134, 138, 139, 135, 74, 140, 152, 161, 162,
679 148, 153, 141, 142, 149, 143, 164, 165, 150, 166, 154, 151, 937, 197, 175, 184, 216, 77, 176,
680 185, 186, 161, 162, 801,
681
682 217, 229, 198, 78, 207, 164, 165, 208, 209, 224, 233, 210, 166, 211, 221, 937, 77, 230, 231,
683 802, 222, 248, 225, 234, 226, 803, 167, 237, 167, 249, 78, 168, 168, 168, 168, 168, 168, 168,
684 168, 168, 168, 239, 238, 246, 247, 250, 164, 165, 280, 281, 260, 804, 260, 251, 240, 261, 261,
685 261, 261, 261, 261, 261, 261, 261, 261, 805, 262, 806, 262, 164, 165, 263, 263, 263, 263, 263,
686 263, 263, 263, 263, 263, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
687 168, 168, 168, 168, 168,
688
689 168, 265, 274, 312, 313, 314, 326, 547, 345, 807, 327, 548, 264, 401, 402, 275, 346, 352, 353,
690 354, 366, 367, 368, 378, 379, 380, 808, 809, 265, 386, 387, 388, 390, 391, 392, 264, 261, 261,
691 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 263,
692 263, 263, 263, 263, 263, 263, 263, 263, 263, 810, 162, 263, 263, 263, 263, 263, 263, 263, 263,
693 263, 263, 403, 404, 405, 442, 443, 444, 465, 466, 467, 811, 812, 165, 162, 477, 478, 479, 480,
694 481, 482, 483, 484, 485,
695
696 468, 469, 527, 528, 529, 556, 557, 558, 580, 813, 814, 582, 165, 598, 599, 600, 680, 815, 530,
697 531, 581, 559, 560, 583, 632, 633, 634, 682, 681, 601, 602, 816, 603, 654, 655, 656, 683, 715,
698 684, 685, 635, 636, 738, 604, 770, 817, 716, 818, 717, 657, 658, 739, 819, 740, 820, 821, 771,
699 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840,
700 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859,
701 860, 861, 862, 863, 864,
702
703 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883,
704 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902,
705 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921,
706 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 76, 76, 796, 795,
707 794, 76, 88, 88, 88, 88, 88, 160, 160, 160, 160, 160, 72, 793, 72, 163, 792, 163, 169,
708 169, 169, 791, 790, 789,
709
710 788, 787, 786, 785, 784, 783, 782, 781, 780, 779, 778, 777, 776, 775, 774, 773, 772, 769, 768,
711 767, 766, 765, 764, 763, 762, 761, 760, 759, 758, 757, 756, 755, 754, 753, 752, 751, 750, 749,
712 748, 747, 746, 745, 744, 743, 742, 741, 737, 736, 735, 734, 733, 732, 731, 730, 729, 728, 727,
713 726, 725, 724, 723, 722, 721, 720, 719, 718, 714, 713, 712, 711, 710, 709, 708, 707, 706, 705,
714 704, 703, 702, 701, 700, 699, 698, 697, 696, 695, 694, 693, 692, 691, 690, 689, 688, 687, 686,
715 679, 678, 677, 676, 675,
716
717 674, 673, 672, 671, 670, 669, 668, 667, 666, 665, 664, 663, 662, 661, 660, 659, 653, 652, 651,
718 650, 649, 648, 647, 646, 645, 644, 643, 642, 641, 640, 639, 638, 637, 631, 630, 629, 628, 627,
719 626, 625, 624, 623, 622, 621, 620, 619, 618, 617, 616, 615, 614, 613, 612, 611, 610, 609, 608,
720 607, 606, 605, 597, 596, 595, 594, 593, 592, 591, 590, 589, 588, 587, 586, 585, 584, 579, 578,
721 577, 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, 566, 565, 564, 563, 562, 561, 555, 554,
722 553, 552, 551, 550, 549,
723
724 546, 545, 544, 543, 542, 541, 540, 539, 538, 537, 536, 535, 534, 533, 532, 526, 525, 524, 523,
725 522, 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504,
726 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 476,
727 475, 474, 473, 472, 471, 470, 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452,
728 451, 450, 449, 448, 447, 446, 445, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 430,
729 429, 428, 427, 426, 425,
730
731 424, 423, 422, 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, 406,
732 400, 399, 398, 397, 396, 395, 394, 393, 389, 385, 384, 383, 382, 381, 377, 376, 375, 374, 373,
733 372, 371, 370, 369, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 351, 350, 349, 348,
734 347, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 325,
735 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 311, 310, 309, 308, 307, 306, 305, 304, 303,
736 302, 301, 300, 299, 298,
737
738 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 279, 278, 277,
739 276, 273, 272, 271, 270, 269, 268, 267, 266, 259, 258, 257, 254, 253, 252, 245, 244, 243, 242,
740 241, 236, 235, 232, 228, 227, 223, 220, 219, 218, 215, 214, 213, 212, 206, 205, 204, 203, 202,
741 201, 200, 199, 194, 193, 192, 191, 190, 189, 188, 187, 183, 182, 181, 180, 179, 178, 177, 174,
742 173, 172, 171, 170, 157, 136, 132, 115, 91, 85, 80, 73, 67, 62, 937, 5, 937, 937, 937,
743 937, 937, 937, 937, 937,
744
745 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937,
746 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937,
747 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937,
748 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937};
749
750 static const flex_int16_t yy_chk[1274] = {
751 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
752 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
753 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
754 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
755 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
756 3, 3, 3, 3, 3, 3,
757
758 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
759 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
760 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
761 3, 3, 3, 3, 3, 10, 10, 11, 15, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18,
762 18, 52, 21, 24, 26, 26, 17, 15, 31, 52, 11, 20, 757, 20, 20, 20, 20, 20, 20,
763 20, 20, 20, 20, 24,
764
765 21, 24, 24, 33, 37, 55, 37, 42, 31, 20, 21, 154, 43, 154, 44, 37, 43, 33, 33,
766 20, 42, 35, 20, 21, 34, 35, 34, 44, 38, 34, 34, 35, 20, 758, 35, 36, 38, 21,
767 38, 36, 40, 38, 49, 759, 36, 49, 20, 38, 40, 20, 36, 41, 46, 49, 41, 111, 55,
768 41, 41, 40, 49, 48, 41, 41, 760, 41, 111, 46, 48, 48, 46, 76, 48, 51, 72, 72,
769 50, 51, 48, 48, 50, 48, 74, 74, 50, 75, 51, 50, 75, 112, 94, 102, 127, 76, 94,
770 102, 102, 72, 72, 761,
771
772 127, 136, 112, 76, 122, 74, 74, 122, 122, 133, 138, 122, 75, 122, 131, 75, 76, 136, 136,
773 762, 131, 149, 133, 138, 133, 763, 77, 141, 77, 149, 76, 77, 77, 77, 77, 77, 77, 77,
774 77, 77, 77, 142, 141, 148, 148, 150, 163, 163, 186, 186, 161, 764, 161, 150, 142, 161, 161,
775 161, 161, 161, 161, 161, 161, 161, 161, 765, 164, 766, 164, 163, 163, 164, 164, 164, 164, 164,
776 164, 164, 164, 164, 164, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168,
777 168, 168, 168, 168, 168,
778
779 168, 169, 181, 218, 218, 218, 230, 493, 248, 767, 230, 493, 168, 307, 307, 181, 248, 254, 254,
780 254, 273, 273, 273, 285, 285, 285, 768, 769, 169, 294, 294, 294, 298, 298, 298, 168, 260, 260,
781 260, 260, 260, 260, 260, 260, 260, 260, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 262,
782 262, 262, 262, 262, 262, 262, 262, 262, 262, 770, 261, 263, 263, 263, 263, 263, 263, 263, 263,
783 263, 263, 308, 308, 308, 350, 350, 350, 394, 394, 394, 771, 772, 263, 261, 407, 407, 407, 408,
784 408, 408, 409, 409, 409,
785
786 394, 394, 464, 464, 464, 510, 510, 510, 532, 773, 774, 533, 263, 552, 552, 552, 642, 775, 464,
787 464, 532, 510, 510, 533, 588, 588, 588, 643, 642, 552, 552, 777, 552, 613, 613, 613, 643, 674,
788 643, 643, 588, 588, 697, 552, 730, 778, 674, 779, 674, 613, 613, 697, 780, 697, 781, 782, 730,
789 783, 784, 785, 788, 789, 791, 793, 794, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806,
790 807, 810, 811, 812, 813, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 829, 830,
791 831, 834, 835, 836, 837,
792
793 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 852, 853, 854, 856, 857, 860, 861,
794 862, 863, 865, 866, 867, 869, 870, 871, 872, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885,
795 886, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 901, 902, 903, 904, 905, 907, 912,
796 916, 917, 918, 919, 921, 922, 923, 925, 926, 929, 930, 931, 932, 934, 935, 938, 938, 756, 755,
797 754, 938, 939, 939, 939, 939, 939, 940, 940, 940, 940, 940, 941, 753, 941, 942, 752, 942, 943,
798 943, 943, 751, 750, 749,
799
800 748, 746, 745, 744, 743, 742, 741, 740, 739, 738, 737, 736, 735, 734, 733, 732, 731, 729, 728,
801 727, 726, 725, 724, 723, 722, 721, 720, 719, 718, 717, 716, 715, 714, 713, 711, 710, 709, 708,
802 707, 706, 705, 704, 702, 701, 700, 699, 696, 695, 694, 693, 692, 690, 689, 688, 687, 686, 685,
803 684, 683, 682, 681, 680, 679, 678, 677, 676, 673, 672, 671, 670, 669, 668, 667, 666, 665, 664,
804 663, 662, 661, 660, 658, 657, 656, 655, 654, 653, 652, 651, 650, 649, 648, 647, 646, 645, 644,
805 639, 637, 636, 635, 634,
806
807 633, 632, 629, 628, 627, 626, 625, 624, 623, 622, 621, 620, 618, 617, 616, 615, 611, 610, 608,
808 607, 605, 604, 603, 602, 601, 600, 599, 598, 594, 593, 592, 590, 589, 587, 586, 585, 584, 583,
809 582, 581, 580, 579, 578, 576, 575, 570, 569, 568, 567, 566, 565, 563, 562, 560, 559, 558, 557,
810 556, 554, 553, 551, 550, 549, 548, 546, 545, 544, 543, 540, 539, 538, 537, 536, 535, 531, 530,
811 529, 528, 527, 526, 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, 511, 509, 508,
812 505, 499, 497, 496, 495,
813
814 492, 489, 488, 487, 486, 475, 474, 473, 472, 471, 469, 468, 467, 466, 465, 462, 460, 459, 458,
815 456, 455, 453, 452, 450, 449, 448, 446, 445, 440, 439, 437, 436, 435, 434, 433, 432, 431, 430,
816 429, 428, 427, 425, 424, 423, 422, 421, 420, 419, 418, 416, 415, 414, 413, 412, 411, 410, 406,
817 402, 401, 400, 399, 398, 395, 393, 383, 381, 377, 376, 375, 374, 372, 371, 369, 365, 363, 362,
818 361, 360, 359, 358, 357, 356, 351, 349, 348, 347, 346, 345, 343, 342, 339, 338, 337, 336, 335,
819 334, 333, 332, 331, 330,
820
821 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, 309,
822 306, 305, 304, 303, 302, 301, 300, 299, 297, 293, 291, 290, 289, 288, 284, 283, 282, 281, 280,
823 279, 278, 277, 276, 272, 271, 269, 268, 267, 266, 259, 258, 257, 256, 255, 253, 252, 251, 250,
824 249, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 229,
825 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 217, 216, 215, 214, 213, 212, 211, 210, 209,
826 208, 207, 206, 205, 204,
827
828 203, 202, 201, 200, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 185, 184, 183,
829 182, 180, 179, 178, 177, 176, 175, 173, 172, 157, 156, 155, 153, 152, 151, 147, 146, 145, 144,
830 143, 140, 139, 137, 135, 134, 132, 130, 129, 128, 126, 125, 124, 123, 121, 120, 118, 117, 116,
831 115, 114, 113, 110, 109, 108, 107, 106, 105, 104, 103, 101, 100, 99, 98, 97, 96, 95, 93,
832 92, 91, 87, 83, 53, 47, 45, 39, 32, 25, 22, 19, 14, 9, 5, 937, 937, 937, 937,
833 937, 937, 937, 937, 937,
834
835 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937,
836 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937,
837 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937,
838 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937, 937};
839
840 /* Table of booleans, true if rule could match eol. */
841 static const flex_int32_t yy_rule_can_match_eol[257] = {
842 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
843 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
844 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
845 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
846 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
847 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
848 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
849 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
850 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
851 };
852
853 /* The intent behind this definition is that it'll catch
854 * any uses of REJECT which flex missed.
855 */
856 #define REJECT reject_used_but_not_detected
857 #define yymore() yymore_used_but_not_detected
858 #define YY_MORE_ADJ 0
859 #define YY_RESTORE_YY_MORE_OFFSET
860 /*
861 //
862 // Copyright 2002 The ANGLE Project Authors. All rights reserved.
863 // Use of this source code is governed by a BSD-style license that can be
864 // found in the LICENSE file.
865 //
866
867 This file contains the Lex specification for GLSL ES.
868 Based on ANSI C grammar, Lex specification:
869 http://www.lysator.liu.se/c/ANSI-C-grammar-l.html
870
871 IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN scripts/run_code_generation.py
872 WHICH GENERATES THE GLSL ES LEXER (glslang_lex_autogen.cpp).
873 */
874
875 #include "compiler/preprocessor/Token.h"
876 #include "compiler/translator/ParseContext.h"
877 #include "compiler/translator/glslang.h"
878 #include "compiler/translator/length_limits.h"
879 #include "compiler/translator/util.h"
880
881 using namespace sh;
882
883 #include "glslang_tab_autogen.h"
884
885 /* windows only pragma */
886 #ifdef _MSC_VER
887 # pragma warning(disable : 4102)
888 #endif
889
890 // Workaround for flex using the register keyword, deprecated in C++11.
891 #ifdef __cplusplus
892 # if __cplusplus > 199711L
893 # define register
894 # endif
895 #endif
896
897 #define YY_NO_INPUT
898 #define YY_USER_ACTION \
899 yylloc->first_file = yylloc->last_file = yycolumn; \
900 yylloc->first_line = yylloc->last_line = yylineno;
901
902 #define YY_INPUT(buf, result, max_size) result = string_input(buf, max_size, yyscanner);
903
904 static yy_size_t string_input(char *buf, yy_size_t max_size, yyscan_t yyscanner);
905 static int check_type(yyscan_t yyscanner);
906 static int reserved_word(yyscan_t yyscanner);
907 // Tests if an extension is enabled. If the extension is promoted to core, this function returns
908 // true.
909 static bool is_extension_enabled_or_is_core(TParseContext *context,
910 int extension_version,
911 TExtension extension,
912 int promotion_version);
913 // Helpers to determine if a symbol is reserved, keyword in extension or core, or identifier.
914 // Formatted as:
915 //
916 // [V1_reserved_][V2_extension_][V3_keyword]
917 //
918 // which means in version V1, the symbol is reserved, and remains reserved until V3. From versions
919 // V2 until V3, it's a keyword if the extension is enabled. From version V3 on, it's a keyword in
920 // the spec itself. Prior to V1, the symbol can be used as identifier.
921 static int ES2_extension_2_ES3_keyword(TParseContext *context,
922 TExtension extension1,
923 TExtension extension2,
924 int token);
925 static int ES2_reserved_ES3_keyword(TParseContext *context, int token);
926 static int ES2_keyword_ES3_reserved(TParseContext *context, int token);
927 static int ES3_keyword(TParseContext *context, int token);
928 static int ES3_reserved_ES3_1_keyword(TParseContext *context, int token);
929 static int ES2_reserved_ES3_1_keyword(TParseContext *context, int token);
930 static int ES3_1_keyword(TParseContext *context, int token);
931 static int ES2_reserved_ES2_extension_ES3_keyword(TParseContext *context,
932 TExtension extension,
933 int token);
934 static int ES3_extension(TParseContext *context, TExtension extension, int token);
935 static int ES3_reserved_ES3_1_extension_ES3_2_keyword(TParseContext *context,
936 TExtension extension,
937 int token);
938 static int ES3_reserved_ES3_extension(TParseContext *context, TExtension extension, int token);
939 static int ES3_reserved_ES3_extension_ES3_1_keyword(TParseContext *context,
940 TExtension extension,
941 int token);
942 static int ES3_reserved_ES3_extension_ES3_2_keyword(TParseContext *context,
943 TExtension extension,
944 int token);
945 static int ES3_1_reserved_ES3_1_extension_ES3_2_keyword(TParseContext *context,
946 TExtension extension,
947 int token);
948 static int ES3_1_reserved_ES3_1_extension_ES3_2_keyword_2(TParseContext *context,
949 TExtension extension1,
950 TExtension extension2,
951 int token1,
952 int token2);
953 static int ES3_and_3_1_reserved_ES3_1_extension_ES3_2_keyword_2(TParseContext *context,
954 TExtension extension1,
955 TExtension extension2,
956 int token1,
957 int token2);
958 static int WEBGL_video_texture_extension(TParseContext *context, int token);
959 static int uint_constant(TParseContext *context);
960 static int int_constant(TParseContext *context);
961 static int float_constant(yyscan_t yyscanner);
962 static int floatsuffix_check(TParseContext *context);
963 static int yuvcscstandardext_constant(TParseContext *context);
964
965 #define INITIAL 0
966 #define FIELDS 1
967
968 #define YY_EXTRA_TYPE TParseContext *
969
970 /* Holds the entire state of the reentrant scanner. */
971 struct yyguts_t
972 {
973
974 /* User-defined. Not touched by flex. */
975 YY_EXTRA_TYPE yyextra_r;
976
977 /* The rest are the same as the globals declared in the non-reentrant scanner. */
978 FILE *yyin_r, *yyout_r;
979 size_t yy_buffer_stack_top; /**< index of top of stack. */
980 size_t yy_buffer_stack_max; /**< capacity of stack. */
981 YY_BUFFER_STATE *yy_buffer_stack; /**< Stack as an array. */
982 char yy_hold_char;
983 int yy_n_chars;
984 int yyleng_r;
985 char *yy_c_buf_p;
986 int yy_init;
987 int yy_start;
988 int yy_did_buffer_switch_on_eof;
989 int yy_start_stack_ptr;
990 int yy_start_stack_depth;
991 int *yy_start_stack;
992 yy_state_type yy_last_accepting_state;
993 char *yy_last_accepting_cpos;
994
995 int yylineno_r;
996 int yy_flex_debug_r;
997
998 char *yytext_r;
999 int yy_more_flag;
1000 int yy_more_len;
1001
1002 YYSTYPE *yylval_r;
1003
1004 YYLTYPE *yylloc_r;
1005
1006 }; /* end struct yyguts_t */
1007
1008 static int yy_init_globals(yyscan_t yyscanner);
1009
1010 /* This must go here because YYSTYPE and YYLTYPE are included
1011 * from bison output in section 1.*/
1012 #define yylval yyg->yylval_r
1013
1014 #define yylloc yyg->yylloc_r
1015
1016 int yylex_init(yyscan_t *scanner);
1017
1018 int yylex_init_extra(YY_EXTRA_TYPE user_defined, yyscan_t *scanner);
1019
1020 /* Accessor methods to globals.
1021 These are made visible to non-reentrant scanners for convenience. */
1022
1023 int yylex_destroy(yyscan_t yyscanner);
1024
1025 int yyget_debug(yyscan_t yyscanner);
1026
1027 void yyset_debug(int debug_flag, yyscan_t yyscanner);
1028
1029 YY_EXTRA_TYPE yyget_extra(yyscan_t yyscanner);
1030
1031 void yyset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner);
1032
1033 FILE *yyget_in(yyscan_t yyscanner);
1034
1035 void yyset_in(FILE *_in_str, yyscan_t yyscanner);
1036
1037 FILE *yyget_out(yyscan_t yyscanner);
1038
1039 void yyset_out(FILE *_out_str, yyscan_t yyscanner);
1040
1041 int yyget_leng(yyscan_t yyscanner);
1042
1043 char *yyget_text(yyscan_t yyscanner);
1044
1045 int yyget_lineno(yyscan_t yyscanner);
1046
1047 void yyset_lineno(int _line_number, yyscan_t yyscanner);
1048
1049 int yyget_column(yyscan_t yyscanner);
1050
1051 void yyset_column(int _column_no, yyscan_t yyscanner);
1052
1053 YYSTYPE *yyget_lval(yyscan_t yyscanner);
1054
1055 void yyset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner);
1056
1057 YYLTYPE *yyget_lloc(yyscan_t yyscanner);
1058
1059 void yyset_lloc(YYLTYPE *yylloc_param, yyscan_t yyscanner);
1060
1061 /* Macros after this point can all be overridden by user definitions in
1062 * section 1.
1063 */
1064
1065 #ifndef YY_SKIP_YYWRAP
1066 # ifdef __cplusplus
1067 extern "C" int yywrap(yyscan_t yyscanner);
1068 # else
1069 extern int yywrap(yyscan_t yyscanner);
1070 # endif
1071 #endif
1072
1073 #ifndef YY_NO_UNPUT
1074
1075 #endif
1076
1077 #ifndef yytext_ptr
1078 static void yy_flex_strncpy(char *, const char *, int, yyscan_t yyscanner);
1079 #endif
1080
1081 #ifdef YY_NEED_STRLEN
1082 static int yy_flex_strlen(const char *, yyscan_t yyscanner);
1083 #endif
1084
1085 #ifndef YY_NO_INPUT
1086 # ifdef __cplusplus
1087 static int yyinput(yyscan_t yyscanner);
1088 # else
1089 static int input(yyscan_t yyscanner);
1090 # endif
1091
1092 #endif
1093
1094 /* Amount of stuff to slurp up with each read. */
1095 #ifndef YY_READ_BUF_SIZE
1096 # ifdef __ia64__
1097 /* On IA-64, the buffer size is 16k, not 8k */
1098 # define YY_READ_BUF_SIZE 16384
1099 # else
1100 # define YY_READ_BUF_SIZE 8192
1101 # endif /* __ia64__ */
1102 #endif
1103
1104 /* Copy whatever the last rule matched to the standard output. */
1105 #ifndef ECHO
1106 /* This used to be an fputs(), but since the string might contain NUL's,
1107 * we now use fwrite().
1108 */
1109 # define ECHO \
1110 do \
1111 { \
1112 if (fwrite(yytext, (size_t)yyleng, 1, yyout)) \
1113 { \
1114 } \
1115 } while (0)
1116 #endif
1117
1118 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1119 * is returned in "result".
1120 */
1121 #ifndef YY_INPUT
1122 # define YY_INPUT(buf, result, max_size) \
1123 if (YY_CURRENT_BUFFER_LVALUE->yy_is_interactive) \
1124 { \
1125 int c = '*'; \
1126 int n; \
1127 for (n = 0; n < max_size && (c = getc(yyin)) != EOF && c != '\n'; ++n) \
1128 buf[n] = (char)c; \
1129 if (c == '\n') \
1130 buf[n++] = (char)c; \
1131 if (c == EOF && ferror(yyin)) \
1132 YY_FATAL_ERROR("input in flex scanner failed"); \
1133 result = n; \
1134 } \
1135 else \
1136 { \
1137 errno = 0; \
1138 while ((result = (int)fread(buf, 1, (yy_size_t)max_size, yyin)) == 0 && ferror(yyin)) \
1139 { \
1140 if (errno != EINTR) \
1141 { \
1142 YY_FATAL_ERROR("input in flex scanner failed"); \
1143 break; \
1144 } \
1145 errno = 0; \
1146 clearerr(yyin); \
1147 } \
1148 }
1149
1150 #endif
1151
1152 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1153 * we don't want an extra ';' after the "return" because that will cause
1154 * some compilers to complain about unreachable statements.
1155 */
1156 #ifndef yyterminate
1157 # define yyterminate() return YY_NULL
1158 #endif
1159
1160 /* Number of entries by which start-condition stack grows. */
1161 #ifndef YY_START_STACK_INCR
1162 # define YY_START_STACK_INCR 25
1163 #endif
1164
1165 /* Report a fatal error. */
1166 #ifndef YY_FATAL_ERROR
1167 # define YY_FATAL_ERROR(msg) yy_fatal_error(msg, yyscanner)
1168 #endif
1169
1170 /* end tables serialization structures and prototypes */
1171
1172 /* Default declaration of generated scanner - a define so the user can
1173 * easily add parameters.
1174 */
1175 #ifndef YY_DECL
1176 # define YY_DECL_IS_OURS 1
1177
1178 extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner);
1179
1180 # define YY_DECL int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner)
1181 #endif /* !YY_DECL */
1182
1183 /* Code executed at the beginning of each rule, after yytext and yyleng
1184 * have been set up.
1185 */
1186 #ifndef YY_USER_ACTION
1187 # define YY_USER_ACTION
1188 #endif
1189
1190 /* Code executed at the end of each rule. */
1191 #ifndef YY_BREAK
1192 # define YY_BREAK /*LINTED*/ break;
1193 #endif
1194
1195 #define YY_RULE_SETUP YY_USER_ACTION
1196
1197 /** The main scanner function which does all the work.
1198 */
1199 YY_DECL
1200 {
1201 yy_state_type yy_current_state;
1202 char *yy_cp, *yy_bp;
1203 int yy_act;
1204 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
1205
1206 yylval = yylval_param;
1207
1208 yylloc = yylloc_param;
1209
1210 if (!yyg->yy_init)
1211 {
1212 yyg->yy_init = 1;
1213
1214 #ifdef YY_USER_INIT
1215 YY_USER_INIT;
1216 #endif
1217
1218 if (!yyg->yy_start)
1219 yyg->yy_start = 1; /* first start state */
1220
1221 if (!yyin)
1222 yyin = stdin;
1223
1224 if (!yyout)
1225 yyout = stdout;
1226
1227 if (!YY_CURRENT_BUFFER)
1228 {
1229 yyensure_buffer_stack(yyscanner);
1230 YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner);
1231 }
1232
1233 yy_load_buffer_state(yyscanner);
1234 }
1235
1236 {
1237
1238 TParseContext *context = yyextra;
1239
1240 while (/*CONSTCOND*/ 1) /* loops until end-of-file is reached */
1241 {
1242 yy_cp = yyg->yy_c_buf_p;
1243
1244 /* Support of yytext. */
1245 *yy_cp = yyg->yy_hold_char;
1246
1247 /* yy_bp points to the position in yy_ch_buf of the start of
1248 * the current run.
1249 */
1250 yy_bp = yy_cp;
1251
1252 yy_current_state = yyg->yy_start;
1253 yy_match:
1254 do
1255 {
1256 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1257 if (yy_accept[yy_current_state])
1258 {
1259 yyg->yy_last_accepting_state = yy_current_state;
1260 yyg->yy_last_accepting_cpos = yy_cp;
1261 }
1262 while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state)
1263 {
1264 yy_current_state = (int)yy_def[yy_current_state];
1265 if (yy_current_state >= 938)
1266 yy_c = yy_meta[yy_c];
1267 }
1268 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1269 ++yy_cp;
1270 } while (yy_current_state != 937);
1271 yy_cp = yyg->yy_last_accepting_cpos;
1272 yy_current_state = yyg->yy_last_accepting_state;
1273
1274 yy_find_action:
1275 yy_act = yy_accept[yy_current_state];
1276
1277 YY_DO_BEFORE_ACTION;
1278
1279 if (yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act])
1280 {
1281 int yyl;
1282 for (yyl = 0; yyl < yyleng; ++yyl)
1283 if (yytext[yyl] == '\n')
1284
1285 do
1286 {
1287 yylineno++;
1288 yycolumn = 0;
1289 } while (0);
1290 }
1291
1292 do_action: /* This label is used only to access EOF actions. */
1293
1294 switch (yy_act)
1295 { /* beginning of action switch */
1296 case 0: /* must back up */
1297 /* undo the effects of YY_DO_BEFORE_ACTION */
1298 *yy_cp = yyg->yy_hold_char;
1299 yy_cp = yyg->yy_last_accepting_cpos;
1300 yy_current_state = yyg->yy_last_accepting_state;
1301 goto yy_find_action;
1302
1303 case 1:
1304 YY_RULE_SETUP { return INVARIANT; }
1305 YY_BREAK
1306 case 2:
1307 YY_RULE_SETUP { return HIGH_PRECISION; }
1308 YY_BREAK
1309 case 3:
1310 YY_RULE_SETUP { return MEDIUM_PRECISION; }
1311 YY_BREAK
1312 case 4:
1313 YY_RULE_SETUP { return LOW_PRECISION; }
1314 YY_BREAK
1315 case 5:
1316 YY_RULE_SETUP { return PRECISION; }
1317 YY_BREAK
1318 case 6:
1319 YY_RULE_SETUP { return ES2_keyword_ES3_reserved(context, ATTRIBUTE); }
1320 YY_BREAK
1321 case 7:
1322 YY_RULE_SETUP { return CONST_QUAL; }
1323 YY_BREAK
1324 case 8:
1325 YY_RULE_SETUP { return UNIFORM; }
1326 YY_BREAK
1327 case 9:
1328 YY_RULE_SETUP { return ES3_1_keyword(context, BUFFER); }
1329 YY_BREAK
1330 case 10:
1331 YY_RULE_SETUP { return ES2_keyword_ES3_reserved(context, VARYING); }
1332 YY_BREAK
1333 case 11:
1334 YY_RULE_SETUP { return BREAK; }
1335 YY_BREAK
1336 case 12:
1337 YY_RULE_SETUP { return CONTINUE; }
1338 YY_BREAK
1339 case 13:
1340 YY_RULE_SETUP { return DO; }
1341 YY_BREAK
1342 case 14:
1343 YY_RULE_SETUP { return FOR; }
1344 YY_BREAK
1345 case 15:
1346 YY_RULE_SETUP { return WHILE; }
1347 YY_BREAK
1348 case 16:
1349 YY_RULE_SETUP { return IF; }
1350 YY_BREAK
1351 case 17:
1352 YY_RULE_SETUP { return ELSE; }
1353 YY_BREAK
1354 case 18:
1355 YY_RULE_SETUP { return ES2_reserved_ES3_keyword(context, SWITCH); }
1356 YY_BREAK
1357 case 19:
1358 YY_RULE_SETUP { return ES3_keyword(context, CASE); }
1359 YY_BREAK
1360 case 20:
1361 YY_RULE_SETUP { return ES2_reserved_ES3_keyword(context, DEFAULT); }
1362 YY_BREAK
1363 case 21:
1364 YY_RULE_SETUP { return ES3_keyword(context, CENTROID); }
1365 YY_BREAK
1366 case 22:
1367 YY_RULE_SETUP { return ES2_reserved_ES3_keyword(context, FLAT); }
1368 YY_BREAK
1369 case 23:
1370 YY_RULE_SETUP { return ES3_keyword(context, SMOOTH); }
1371 YY_BREAK
1372 case 24:
1373 YY_RULE_SETUP
1374 {
1375 return ES3_reserved_ES3_extension(
1376 context, TExtension::NV_shader_noperspective_interpolation,
1377 NOPERSPECTIVE);
1378 }
1379 YY_BREAK
1380 case 25:
1381 YY_RULE_SETUP
1382 {
1383 return ES3_reserved_ES3_1_extension_ES3_2_keyword(
1384 context, TExtension::EXT_tessellation_shader, PATCH);
1385 }
1386 YY_BREAK
1387 case 26:
1388 YY_RULE_SETUP { return IN_QUAL; }
1389 YY_BREAK
1390 case 27:
1391 YY_RULE_SETUP { return OUT_QUAL; }
1392 YY_BREAK
1393 case 28:
1394 YY_RULE_SETUP { return INOUT_QUAL; }
1395 YY_BREAK
1396 case 29:
1397 YY_RULE_SETUP { return ES3_1_keyword(context, SHARED); }
1398 YY_BREAK
1399 case 30:
1400 YY_RULE_SETUP { return FLOAT_TYPE; }
1401 YY_BREAK
1402 case 31:
1403 YY_RULE_SETUP { return INT_TYPE; }
1404 YY_BREAK
1405 case 32:
1406 YY_RULE_SETUP { return ES3_keyword(context, UINT_TYPE); }
1407 YY_BREAK
1408 case 33:
1409 YY_RULE_SETUP { return VOID_TYPE; }
1410 YY_BREAK
1411 case 34:
1412 YY_RULE_SETUP { return BOOL_TYPE; }
1413 YY_BREAK
1414 case 35:
1415 YY_RULE_SETUP
1416 {
1417 yylval->lex.b = true;
1418 return BOOLCONSTANT;
1419 }
1420 YY_BREAK
1421 case 36:
1422 YY_RULE_SETUP
1423 {
1424 yylval->lex.b = false;
1425 return BOOLCONSTANT;
1426 }
1427 YY_BREAK
1428 case 37:
1429 YY_RULE_SETUP { return DISCARD; }
1430 YY_BREAK
1431 case 38:
1432 YY_RULE_SETUP { return RETURN; }
1433 YY_BREAK
1434 case 39:
1435 YY_RULE_SETUP { return MATRIX2; }
1436 YY_BREAK
1437 case 40:
1438 YY_RULE_SETUP { return MATRIX3; }
1439 YY_BREAK
1440 case 41:
1441 YY_RULE_SETUP { return MATRIX4; }
1442 YY_BREAK
1443 case 42:
1444 YY_RULE_SETUP { return ES3_keyword(context, MATRIX2); }
1445 YY_BREAK
1446 case 43:
1447 YY_RULE_SETUP { return ES3_keyword(context, MATRIX3); }
1448 YY_BREAK
1449 case 44:
1450 YY_RULE_SETUP { return ES3_keyword(context, MATRIX4); }
1451 YY_BREAK
1452 case 45:
1453 YY_RULE_SETUP { return ES3_keyword(context, MATRIX2x3); }
1454 YY_BREAK
1455 case 46:
1456 YY_RULE_SETUP { return ES3_keyword(context, MATRIX3x2); }
1457 YY_BREAK
1458 case 47:
1459 YY_RULE_SETUP { return ES3_keyword(context, MATRIX2x4); }
1460 YY_BREAK
1461 case 48:
1462 YY_RULE_SETUP { return ES3_keyword(context, MATRIX4x2); }
1463 YY_BREAK
1464 case 49:
1465 YY_RULE_SETUP { return ES3_keyword(context, MATRIX3x4); }
1466 YY_BREAK
1467 case 50:
1468 YY_RULE_SETUP { return ES3_keyword(context, MATRIX4x3); }
1469 YY_BREAK
1470 case 51:
1471 YY_RULE_SETUP { return VEC2; }
1472 YY_BREAK
1473 case 52:
1474 YY_RULE_SETUP { return VEC3; }
1475 YY_BREAK
1476 case 53:
1477 YY_RULE_SETUP { return VEC4; }
1478 YY_BREAK
1479 case 54:
1480 YY_RULE_SETUP { return IVEC2; }
1481 YY_BREAK
1482 case 55:
1483 YY_RULE_SETUP { return IVEC3; }
1484 YY_BREAK
1485 case 56:
1486 YY_RULE_SETUP { return IVEC4; }
1487 YY_BREAK
1488 case 57:
1489 YY_RULE_SETUP { return BVEC2; }
1490 YY_BREAK
1491 case 58:
1492 YY_RULE_SETUP { return BVEC3; }
1493 YY_BREAK
1494 case 59:
1495 YY_RULE_SETUP { return BVEC4; }
1496 YY_BREAK
1497 case 60:
1498 YY_RULE_SETUP { return ES3_keyword(context, UVEC2); }
1499 YY_BREAK
1500 case 61:
1501 YY_RULE_SETUP { return ES3_keyword(context, UVEC3); }
1502 YY_BREAK
1503 case 62:
1504 YY_RULE_SETUP { return ES3_keyword(context, UVEC4); }
1505 YY_BREAK
1506 case 63:
1507 YY_RULE_SETUP { return SAMPLER2D; }
1508 YY_BREAK
1509 case 64:
1510 YY_RULE_SETUP { return SAMPLERCUBE; }
1511 YY_BREAK
1512 case 65:
1513 YY_RULE_SETUP { return SAMPLER_EXTERNAL_OES; }
1514 YY_BREAK
1515 case 66:
1516 YY_RULE_SETUP
1517 {
1518 return ES2_reserved_ES2_extension_ES3_keyword(
1519 context, TExtension::OES_texture_3D, SAMPLER3D);
1520 }
1521 YY_BREAK
1522 case 67:
1523 YY_RULE_SETUP { return ES2_reserved_ES3_keyword(context, SAMPLER3DRECT); }
1524 YY_BREAK
1525 case 68:
1526 YY_RULE_SETUP { return SAMPLER2DRECT; }
1527 YY_BREAK
1528 case 69:
1529 YY_RULE_SETUP { return ES3_keyword(context, SAMPLER2DARRAY); }
1530 YY_BREAK
1531 case 70:
1532 YY_RULE_SETUP
1533 {
1534 return ES3_reserved_ES3_extension_ES3_1_keyword(
1535 context, TExtension::ANGLE_texture_multisample, SAMPLER2DMS);
1536 }
1537 YY_BREAK
1538 case 71:
1539 YY_RULE_SETUP { return ES3_keyword(context, ISAMPLER2D); }
1540 YY_BREAK
1541 case 72:
1542 YY_RULE_SETUP { return ES3_keyword(context, ISAMPLER3D); }
1543 YY_BREAK
1544 case 73:
1545 YY_RULE_SETUP { return ES3_keyword(context, ISAMPLERCUBE); }
1546 YY_BREAK
1547 case 74:
1548 YY_RULE_SETUP { return ES3_keyword(context, ISAMPLER2DARRAY); }
1549 YY_BREAK
1550 case 75:
1551 YY_RULE_SETUP
1552 {
1553 return ES3_reserved_ES3_extension_ES3_1_keyword(
1554 context, TExtension::ANGLE_texture_multisample, ISAMPLER2DMS);
1555 }
1556 YY_BREAK
1557 case 76:
1558 YY_RULE_SETUP { return ES3_keyword(context, USAMPLER2D); }
1559 YY_BREAK
1560 case 77:
1561 YY_RULE_SETUP { return ES3_keyword(context, USAMPLER3D); }
1562 YY_BREAK
1563 case 78:
1564 YY_RULE_SETUP { return ES3_keyword(context, USAMPLERCUBE); }
1565 YY_BREAK
1566 case 79:
1567 YY_RULE_SETUP { return ES3_keyword(context, USAMPLER2DARRAY); }
1568 YY_BREAK
1569 case 80:
1570 YY_RULE_SETUP
1571 {
1572 return ES3_reserved_ES3_extension_ES3_1_keyword(
1573 context, TExtension::ANGLE_texture_multisample, USAMPLER2DMS);
1574 }
1575 YY_BREAK
1576 case 81:
1577 YY_RULE_SETUP
1578 {
1579 return ES2_reserved_ES2_extension_ES3_keyword(
1580 context, TExtension::EXT_shadow_samplers, SAMPLER2DSHADOW);
1581 }
1582 YY_BREAK
1583 case 82:
1584 YY_RULE_SETUP { return ES3_keyword(context, SAMPLERCUBESHADOW); }
1585 YY_BREAK
1586 case 83:
1587 YY_RULE_SETUP { return ES3_keyword(context, SAMPLER2DARRAYSHADOW); }
1588 YY_BREAK
1589 case 84:
1590 YY_RULE_SETUP
1591 {
1592 return ES3_extension(context, TExtension::EXT_YUV_target,
1593 SAMPLEREXTERNAL2DY2YEXT);
1594 }
1595 YY_BREAK
1596 case 85:
1597 YY_RULE_SETUP
1598 {
1599 return ES3_reserved_ES3_1_extension_ES3_2_keyword(
1600 context, TExtension::OES_texture_storage_multisample_2d_array,
1601 SAMPLER2DMSARRAY);
1602 }
1603 YY_BREAK
1604 case 86:
1605 YY_RULE_SETUP
1606 {
1607 return ES3_reserved_ES3_1_extension_ES3_2_keyword(
1608 context, TExtension::OES_texture_storage_multisample_2d_array,
1609 ISAMPLER2DMSARRAY);
1610 }
1611 YY_BREAK
1612 case 87:
1613 YY_RULE_SETUP
1614 {
1615 return ES3_reserved_ES3_1_extension_ES3_2_keyword(
1616 context, TExtension::OES_texture_storage_multisample_2d_array,
1617 USAMPLER2DMSARRAY);
1618 }
1619 YY_BREAK
1620 case 88:
1621 YY_RULE_SETUP
1622 {
1623 return ES3_1_reserved_ES3_1_extension_ES3_2_keyword_2(
1624 context, TExtension::OES_texture_cube_map_array,
1625 TExtension::EXT_texture_cube_map_array, SAMPLERCUBEARRAYOES,
1626 SAMPLERCUBEARRAYEXT);
1627 }
1628 YY_BREAK
1629 case 89:
1630 YY_RULE_SETUP
1631 {
1632 return ES3_and_3_1_reserved_ES3_1_extension_ES3_2_keyword_2(
1633 context, TExtension::OES_texture_buffer, TExtension::EXT_texture_buffer,
1634 SAMPLERBUFFER, SAMPLERBUFFER);
1635 }
1636 YY_BREAK
1637 case 90:
1638 YY_RULE_SETUP
1639 {
1640 return ES3_1_reserved_ES3_1_extension_ES3_2_keyword_2(
1641 context, TExtension::OES_texture_cube_map_array,
1642 TExtension::EXT_texture_cube_map_array, SAMPLERCUBEARRAYSHADOWOES,
1643 SAMPLERCUBEARRAYSHADOWEXT);
1644 }
1645 YY_BREAK
1646 case 91:
1647 YY_RULE_SETUP
1648 {
1649 return ES3_1_reserved_ES3_1_extension_ES3_2_keyword_2(
1650 context, TExtension::OES_texture_cube_map_array,
1651 TExtension::EXT_texture_cube_map_array, ISAMPLERCUBEARRAYOES,
1652 ISAMPLERCUBEARRAYEXT);
1653 }
1654 YY_BREAK
1655 case 92:
1656 YY_RULE_SETUP
1657 {
1658 return ES3_and_3_1_reserved_ES3_1_extension_ES3_2_keyword_2(
1659 context, TExtension::OES_texture_buffer, TExtension::EXT_texture_buffer,
1660 ISAMPLERBUFFER, ISAMPLERBUFFER);
1661 }
1662 YY_BREAK
1663 case 93:
1664 YY_RULE_SETUP
1665 {
1666 return ES3_1_reserved_ES3_1_extension_ES3_2_keyword_2(
1667 context, TExtension::OES_texture_cube_map_array,
1668 TExtension::EXT_texture_cube_map_array, USAMPLERCUBEARRAYOES,
1669 USAMPLERCUBEARRAYEXT);
1670 }
1671 YY_BREAK
1672 case 94:
1673 YY_RULE_SETUP
1674 {
1675 return ES3_and_3_1_reserved_ES3_1_extension_ES3_2_keyword_2(
1676 context, TExtension::OES_texture_buffer, TExtension::EXT_texture_buffer,
1677 USAMPLERBUFFER, USAMPLERBUFFER);
1678 }
1679 YY_BREAK
1680 case 95:
1681 YY_RULE_SETUP
1682 {
1683 return WEBGL_video_texture_extension(context, SAMPLERVIDEOWEBGL);
1684 }
1685 YY_BREAK
1686 case 96:
1687 YY_RULE_SETUP { return STRUCT; }
1688 YY_BREAK
1689 case 97:
1690 YY_RULE_SETUP
1691 {
1692 return ES2_extension_2_ES3_keyword(
1693 context, TExtension::EXT_shader_framebuffer_fetch,
1694 TExtension::EXT_shader_framebuffer_fetch_non_coherent, LAYOUT);
1695 }
1696 YY_BREAK
1697 case 98:
1698 YY_RULE_SETUP
1699 {
1700 return ES3_extension(context, TExtension::EXT_YUV_target,
1701 YUVCSCSTANDARDEXT);
1702 }
1703 YY_BREAK
1704 case 99:
1705 YY_RULE_SETUP { return yuvcscstandardext_constant(context); }
1706 YY_BREAK
1707 case 100:
1708 YY_RULE_SETUP { return yuvcscstandardext_constant(context); }
1709 YY_BREAK
1710 case 101:
1711 YY_RULE_SETUP { return yuvcscstandardext_constant(context); }
1712 YY_BREAK
1713 case 102:
1714 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, IMAGE2D); }
1715 YY_BREAK
1716 case 103:
1717 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, IIMAGE2D); }
1718 YY_BREAK
1719 case 104:
1720 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, UIMAGE2D); }
1721 YY_BREAK
1722 case 105:
1723 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, IMAGE2DARRAY); }
1724 YY_BREAK
1725 case 106:
1726 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, IIMAGE2DARRAY); }
1727 YY_BREAK
1728 case 107:
1729 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, UIMAGE2DARRAY); }
1730 YY_BREAK
1731 case 108:
1732 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, IMAGE3D); }
1733 YY_BREAK
1734 case 109:
1735 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, UIMAGE3D); }
1736 YY_BREAK
1737 case 110:
1738 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, IIMAGE3D); }
1739 YY_BREAK
1740 case 111:
1741 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, IIMAGECUBE); }
1742 YY_BREAK
1743 case 112:
1744 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, UIMAGECUBE); }
1745 YY_BREAK
1746 case 113:
1747 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, IMAGECUBE); }
1748 YY_BREAK
1749 case 114:
1750 YY_RULE_SETUP
1751 {
1752 return ES3_1_reserved_ES3_1_extension_ES3_2_keyword_2(
1753 context, TExtension::OES_texture_cube_map_array,
1754 TExtension::EXT_texture_cube_map_array, IMAGECUBEARRAYOES,
1755 IMAGECUBEARRAYEXT);
1756 }
1757 YY_BREAK
1758 case 115:
1759 YY_RULE_SETUP
1760 {
1761 return ES3_1_reserved_ES3_1_extension_ES3_2_keyword_2(
1762 context, TExtension::OES_texture_cube_map_array,
1763 TExtension::EXT_texture_cube_map_array, IIMAGECUBEARRAYOES,
1764 IIMAGECUBEARRAYEXT);
1765 }
1766 YY_BREAK
1767 case 116:
1768 YY_RULE_SETUP
1769 {
1770 return ES3_1_reserved_ES3_1_extension_ES3_2_keyword_2(
1771 context, TExtension::OES_texture_cube_map_array,
1772 TExtension::EXT_texture_cube_map_array, UIMAGECUBEARRAYOES,
1773 UIMAGECUBEARRAYEXT);
1774 }
1775 YY_BREAK
1776 case 117:
1777 YY_RULE_SETUP
1778 {
1779 return ES3_and_3_1_reserved_ES3_1_extension_ES3_2_keyword_2(
1780 context, TExtension::OES_texture_buffer, TExtension::EXT_texture_buffer,
1781 IMAGEBUFFER, IMAGEBUFFER);
1782 }
1783 YY_BREAK
1784 case 118:
1785 YY_RULE_SETUP
1786 {
1787 return ES3_and_3_1_reserved_ES3_1_extension_ES3_2_keyword_2(
1788 context, TExtension::OES_texture_buffer, TExtension::EXT_texture_buffer,
1789 IIMAGEBUFFER, IIMAGEBUFFER);
1790 }
1791 YY_BREAK
1792 case 119:
1793 YY_RULE_SETUP
1794 {
1795 return ES3_and_3_1_reserved_ES3_1_extension_ES3_2_keyword_2(
1796 context, TExtension::OES_texture_buffer, TExtension::EXT_texture_buffer,
1797 UIMAGEBUFFER, UIMAGEBUFFER);
1798 }
1799 YY_BREAK
1800 case 120:
1801 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, READONLY); }
1802 YY_BREAK
1803 case 121:
1804 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, WRITEONLY); }
1805 YY_BREAK
1806 case 122:
1807 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, COHERENT); }
1808 YY_BREAK
1809 case 123:
1810 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, RESTRICT); }
1811 YY_BREAK
1812 case 124:
1813 YY_RULE_SETUP { return ES2_reserved_ES3_1_keyword(context, VOLATILE); }
1814 YY_BREAK
1815 case 125:
1816 YY_RULE_SETUP { return ES3_reserved_ES3_1_keyword(context, ATOMICUINT); }
1817 YY_BREAK
1818 case 126:
1819 YY_RULE_SETUP
1820 {
1821 return ES3_reserved_ES3_extension_ES3_2_keyword(
1822 context, TExtension::OES_shader_multisample_interpolation, SAMPLE);
1823 }
1824 YY_BREAK
1825 case 127:
1826 YY_RULE_SETUP
1827 {
1828 return ES3_1_reserved_ES3_1_extension_ES3_2_keyword(
1829 context, TExtension::EXT_gpu_shader5, PRECISE);
1830 }
1831 YY_BREAK
1832 /* Reserved keywords for GLSL ES 3.00 that are not reserved for GLSL ES 1.00 */
1833 case 128:
1834 case 129:
1835 case 130:
1836 case 131:
1837 case 132:
1838 case 133:
1839 case 134:
1840 case 135:
1841 case 136:
1842 case 137:
1843 case 138:
1844 case 139:
1845 case 140:
1846 case 141:
1847 case 142:
1848 case 143:
1849 case 144:
1850 case 145:
1851 case 146:
1852 case 147:
1853 case 148:
1854 case 149:
1855 case 150:
1856 case 151:
1857 YY_RULE_SETUP
1858 {
1859 if (context->getShaderVersion() < 300)
1860 {
1861 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
1862 return check_type(yyscanner);
1863 }
1864 return reserved_word(yyscanner);
1865 }
1866 YY_BREAK
1867 /* Reserved keywords in GLSL ES 1.00 that are not reserved in GLSL ES 3.00 */
1868 case 152:
1869 YY_RULE_SETUP
1870 {
1871 if (context->getShaderVersion() >= 300)
1872 {
1873 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
1874 return check_type(yyscanner);
1875 }
1876
1877 return reserved_word(yyscanner);
1878 }
1879 YY_BREAK
1880 /* Reserved keywords */
1881 case 153:
1882 case 154:
1883 case 155:
1884 case 156:
1885 case 157:
1886 case 158:
1887 case 159:
1888 case 160:
1889 case 161:
1890 case 162:
1891 case 163:
1892 case 164:
1893 case 165:
1894 case 166:
1895 case 167:
1896 case 168:
1897 case 169:
1898 case 170:
1899 case 171:
1900 case 172:
1901 case 173:
1902 case 174:
1903 case 175:
1904 case 176:
1905 case 177:
1906 case 178:
1907 case 179:
1908 case 180:
1909 case 181:
1910 case 182:
1911 case 183:
1912 case 184:
1913 case 185:
1914 case 186:
1915 case 187:
1916 case 188:
1917 case 189:
1918 case 190:
1919 case 191:
1920 case 192:
1921 YY_RULE_SETUP { return reserved_word(yyscanner); }
1922 YY_BREAK
1923 case 193:
1924 YY_RULE_SETUP
1925 {
1926 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
1927 return check_type(yyscanner);
1928 }
1929 YY_BREAK
1930 case 194:
1931 YY_RULE_SETUP { return int_constant(context); }
1932 YY_BREAK
1933 case 195:
1934 YY_RULE_SETUP { return int_constant(context); }
1935 YY_BREAK
1936 case 196:
1937 YY_RULE_SETUP { return int_constant(context); }
1938 YY_BREAK
1939 case 197:
1940 YY_RULE_SETUP { return uint_constant(context); }
1941 YY_BREAK
1942 case 198:
1943 YY_RULE_SETUP { return uint_constant(context); }
1944 YY_BREAK
1945 case 199:
1946 YY_RULE_SETUP { return uint_constant(context); }
1947 YY_BREAK
1948 case 200:
1949 YY_RULE_SETUP { return float_constant(yyscanner); }
1950 YY_BREAK
1951 case 201:
1952 YY_RULE_SETUP { return float_constant(yyscanner); }
1953 YY_BREAK
1954 case 202:
1955 YY_RULE_SETUP { return float_constant(yyscanner); }
1956 YY_BREAK
1957 case 203:
1958 YY_RULE_SETUP { return floatsuffix_check(context); }
1959 YY_BREAK
1960 case 204:
1961 YY_RULE_SETUP { return floatsuffix_check(context); }
1962 YY_BREAK
1963 case 205:
1964 YY_RULE_SETUP { return floatsuffix_check(context); }
1965 YY_BREAK
1966 case 206:
1967 YY_RULE_SETUP { return ADD_ASSIGN; }
1968 YY_BREAK
1969 case 207:
1970 YY_RULE_SETUP { return SUB_ASSIGN; }
1971 YY_BREAK
1972 case 208:
1973 YY_RULE_SETUP { return MUL_ASSIGN; }
1974 YY_BREAK
1975 case 209:
1976 YY_RULE_SETUP { return DIV_ASSIGN; }
1977 YY_BREAK
1978 case 210:
1979 YY_RULE_SETUP { return MOD_ASSIGN; }
1980 YY_BREAK
1981 case 211:
1982 YY_RULE_SETUP { return LEFT_ASSIGN; }
1983 YY_BREAK
1984 case 212:
1985 YY_RULE_SETUP { return RIGHT_ASSIGN; }
1986 YY_BREAK
1987 case 213:
1988 YY_RULE_SETUP { return AND_ASSIGN; }
1989 YY_BREAK
1990 case 214:
1991 YY_RULE_SETUP { return XOR_ASSIGN; }
1992 YY_BREAK
1993 case 215:
1994 YY_RULE_SETUP { return OR_ASSIGN; }
1995 YY_BREAK
1996 case 216:
1997 YY_RULE_SETUP { return INC_OP; }
1998 YY_BREAK
1999 case 217:
2000 YY_RULE_SETUP { return DEC_OP; }
2001 YY_BREAK
2002 case 218:
2003 YY_RULE_SETUP { return AND_OP; }
2004 YY_BREAK
2005 case 219:
2006 YY_RULE_SETUP { return OR_OP; }
2007 YY_BREAK
2008 case 220:
2009 YY_RULE_SETUP { return XOR_OP; }
2010 YY_BREAK
2011 case 221:
2012 YY_RULE_SETUP { return LE_OP; }
2013 YY_BREAK
2014 case 222:
2015 YY_RULE_SETUP { return GE_OP; }
2016 YY_BREAK
2017 case 223:
2018 YY_RULE_SETUP { return EQ_OP; }
2019 YY_BREAK
2020 case 224:
2021 YY_RULE_SETUP { return NE_OP; }
2022 YY_BREAK
2023 case 225:
2024 YY_RULE_SETUP { return LEFT_OP; }
2025 YY_BREAK
2026 case 226:
2027 YY_RULE_SETUP { return RIGHT_OP; }
2028 YY_BREAK
2029 case 227:
2030 YY_RULE_SETUP { return SEMICOLON; }
2031 YY_BREAK
2032 case 228:
2033 YY_RULE_SETUP { return LEFT_BRACE; }
2034 YY_BREAK
2035 case 229:
2036 YY_RULE_SETUP { return RIGHT_BRACE; }
2037 YY_BREAK
2038 case 230:
2039 YY_RULE_SETUP { return COMMA; }
2040 YY_BREAK
2041 case 231:
2042 YY_RULE_SETUP { return COLON; }
2043 YY_BREAK
2044 case 232:
2045 YY_RULE_SETUP { return EQUAL; }
2046 YY_BREAK
2047 case 233:
2048 YY_RULE_SETUP { return LEFT_PAREN; }
2049 YY_BREAK
2050 case 234:
2051 YY_RULE_SETUP { return RIGHT_PAREN; }
2052 YY_BREAK
2053 case 235:
2054 YY_RULE_SETUP { return LEFT_BRACKET; }
2055 YY_BREAK
2056 case 236:
2057 YY_RULE_SETUP { return RIGHT_BRACKET; }
2058 YY_BREAK
2059 case 237:
2060 YY_RULE_SETUP
2061 {
2062 BEGIN(FIELDS);
2063 return DOT;
2064 }
2065 YY_BREAK
2066 case 238:
2067 YY_RULE_SETUP { return BANG; }
2068 YY_BREAK
2069 case 239:
2070 YY_RULE_SETUP { return DASH; }
2071 YY_BREAK
2072 case 240:
2073 YY_RULE_SETUP { return TILDE; }
2074 YY_BREAK
2075 case 241:
2076 YY_RULE_SETUP { return PLUS; }
2077 YY_BREAK
2078 case 242:
2079 YY_RULE_SETUP { return STAR; }
2080 YY_BREAK
2081 case 243:
2082 YY_RULE_SETUP { return SLASH; }
2083 YY_BREAK
2084 case 244:
2085 YY_RULE_SETUP { return PERCENT; }
2086 YY_BREAK
2087 case 245:
2088 YY_RULE_SETUP { return LEFT_ANGLE; }
2089 YY_BREAK
2090 case 246:
2091 YY_RULE_SETUP { return RIGHT_ANGLE; }
2092 YY_BREAK
2093 case 247:
2094 YY_RULE_SETUP { return VERTICAL_BAR; }
2095 YY_BREAK
2096 case 248:
2097 YY_RULE_SETUP { return CARET; }
2098 YY_BREAK
2099 case 249:
2100 YY_RULE_SETUP { return AMPERSAND; }
2101 YY_BREAK
2102 case 250:
2103 YY_RULE_SETUP { return QUESTION; }
2104 YY_BREAK
2105 case 251:
2106 YY_RULE_SETUP
2107 {
2108 BEGIN(INITIAL);
2109 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
2110 return FIELD_SELECTION;
2111 }
2112 YY_BREAK
2113 case 252:
2114 YY_RULE_SETUP {}
2115 YY_BREAK
2116 case 253:
2117 YY_RULE_SETUP
2118 {
2119 yyextra->error(*yylloc, "Illegal character at fieldname start", yytext);
2120 return 0;
2121 }
2122 YY_BREAK
2123 case 254:
2124 /* rule 254 can match eol */
2125 YY_RULE_SETUP {}
2126 YY_BREAK
2127 case YY_STATE_EOF(INITIAL):
2128 case YY_STATE_EOF(FIELDS):
2129 {
2130 yyterminate();
2131 }
2132 YY_BREAK
2133 case 255:
2134 YY_RULE_SETUP
2135 {
2136 assert(false);
2137 return 0;
2138 }
2139 YY_BREAK
2140 case 256:
2141 YY_RULE_SETUP
2142 ECHO;
2143 YY_BREAK
2144
2145 case YY_END_OF_BUFFER:
2146 {
2147 /* Amount of text matched not including the EOB char. */
2148 int yy_amount_of_matched_text = (int)(yy_cp - yyg->yytext_ptr) - 1;
2149
2150 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2151 *yy_cp = yyg->yy_hold_char;
2152 YY_RESTORE_YY_MORE_OFFSET
2153
2154 if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW)
2155 {
2156 /* We're scanning a new file or input source. It's
2157 * possible that this happened because the user
2158 * just pointed yyin at a new source and called
2159 * yylex(). If so, then we have to assure
2160 * consistency between YY_CURRENT_BUFFER and our
2161 * globals. Here is the right place to do so, because
2162 * this is the first action (other than possibly a
2163 * back-up) that will match for the new input source.
2164 */
2165 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2166 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
2167 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
2168 }
2169
2170 /* Note that here we test for yy_c_buf_p "<=" to the position
2171 * of the first EOB in the buffer, since yy_c_buf_p will
2172 * already have been incremented past the NUL character
2173 * (since all states make transitions on EOB to the
2174 * end-of-buffer state). Contrast this with the test
2175 * in input().
2176 */
2177 if (yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars])
2178 { /* This was really a NUL. */
2179 yy_state_type yy_next_state;
2180
2181 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
2182
2183 yy_current_state = yy_get_previous_state(yyscanner);
2184
2185 /* Okay, we're now positioned to make the NUL
2186 * transition. We couldn't have
2187 * yy_get_previous_state() go ahead and do it
2188 * for us because it doesn't know how to deal
2189 * with the possibility of jamming (and we don't
2190 * want to build jamming into it because then it
2191 * will run more slowly).
2192 */
2193
2194 yy_next_state = yy_try_NUL_trans(yy_current_state, yyscanner);
2195
2196 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
2197
2198 if (yy_next_state)
2199 {
2200 /* Consume the NUL. */
2201 yy_cp = ++yyg->yy_c_buf_p;
2202 yy_current_state = yy_next_state;
2203 goto yy_match;
2204 }
2205
2206 else
2207 {
2208 yy_cp = yyg->yy_last_accepting_cpos;
2209 yy_current_state = yyg->yy_last_accepting_state;
2210 goto yy_find_action;
2211 }
2212 }
2213
2214 else
2215 switch (yy_get_next_buffer(yyscanner))
2216 {
2217 case EOB_ACT_END_OF_FILE:
2218 {
2219 yyg->yy_did_buffer_switch_on_eof = 0;
2220
2221 if (yywrap(yyscanner))
2222 {
2223 /* Note: because we've taken care in
2224 * yy_get_next_buffer() to have set up
2225 * yytext, we can now set up
2226 * yy_c_buf_p so that if some total
2227 * hoser (like flex itself) wants to
2228 * call the scanner after we return the
2229 * YY_NULL, it'll still work - another
2230 * YY_NULL will get returned.
2231 */
2232 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
2233
2234 yy_act = YY_STATE_EOF(YY_START);
2235 goto do_action;
2236 }
2237
2238 else
2239 {
2240 if (!yyg->yy_did_buffer_switch_on_eof)
2241 YY_NEW_FILE;
2242 }
2243 break;
2244 }
2245
2246 case EOB_ACT_CONTINUE_SCAN:
2247 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
2248
2249 yy_current_state = yy_get_previous_state(yyscanner);
2250
2251 yy_cp = yyg->yy_c_buf_p;
2252 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
2253 goto yy_match;
2254
2255 case EOB_ACT_LAST_MATCH:
2256 yyg->yy_c_buf_p =
2257 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
2258
2259 yy_current_state = yy_get_previous_state(yyscanner);
2260
2261 yy_cp = yyg->yy_c_buf_p;
2262 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
2263 goto yy_find_action;
2264 }
2265 break;
2266 }
2267
2268 default:
2269 YY_FATAL_ERROR("fatal flex scanner internal error--no action found");
2270 } /* end of action switch */
2271 } /* end of scanning one token */
2272 } /* end of user's declarations */
2273 } /* end of yylex */
2274
2275 /* yy_get_next_buffer - try to read in a new buffer
2276 *
2277 * Returns a code representing an action:
2278 * EOB_ACT_LAST_MATCH -
2279 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2280 * EOB_ACT_END_OF_FILE - end of file
2281 */
2282 static int yy_get_next_buffer(yyscan_t yyscanner)
2283 {
2284 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2285 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
2286 char *source = yyg->yytext_ptr;
2287 int number_to_move, i;
2288 int ret_val;
2289
2290 if (yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1])
2291 YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed");
2292
2293 if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0)
2294 { /* Don't try to fill the buffer, so this is an EOF. */
2295 if (yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1)
2296 {
2297 /* We matched a single character, the EOB, so
2298 * treat this as a final EOF.
2299 */
2300 return EOB_ACT_END_OF_FILE;
2301 }
2302
2303 else
2304 {
2305 /* We matched some text prior to the EOB, first
2306 * process it.
2307 */
2308 return EOB_ACT_LAST_MATCH;
2309 }
2310 }
2311
2312 /* Try to read more data. */
2313
2314 /* First move last chars to start of buffer. */
2315 number_to_move = (int)(yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
2316
2317 for (i = 0; i < number_to_move; ++i)
2318 *(dest++) = *(source++);
2319
2320 if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING)
2321 /* don't do the read, it's not guaranteed to return an EOF,
2322 * just force an EOF
2323 */
2324 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
2325
2326 else
2327 {
2328 int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2329
2330 while (num_to_read <= 0)
2331 { /* Not enough room in the buffer - grow it. */
2332
2333 /* just a shorter name for the current buffer */
2334 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
2335
2336 int yy_c_buf_p_offset = (int)(yyg->yy_c_buf_p - b->yy_ch_buf);
2337
2338 if (b->yy_is_our_buffer)
2339 {
2340 int new_size = b->yy_buf_size * 2;
2341
2342 if (new_size <= 0)
2343 b->yy_buf_size += b->yy_buf_size / 8;
2344 else
2345 b->yy_buf_size *= 2;
2346
2347 b->yy_ch_buf = (char *)
2348 /* Include room in for 2 EOB chars. */
2349 yyrealloc((void *)b->yy_ch_buf, (yy_size_t)(b->yy_buf_size + 2), yyscanner);
2350 }
2351 else
2352 /* Can't grow it, we don't own it. */
2353 b->yy_ch_buf = NULL;
2354
2355 if (!b->yy_ch_buf)
2356 YY_FATAL_ERROR("fatal error - scanner input buffer overflow");
2357
2358 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
2359
2360 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2361 }
2362
2363 if (num_to_read > YY_READ_BUF_SIZE)
2364 num_to_read = YY_READ_BUF_SIZE;
2365
2366 /* Read in more data. */
2367 yy_size_t ret = 0;
2368 YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), ret, num_to_read);
2369 yyg->yy_n_chars = static_cast<int>(ret);
2370
2371 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2372 }
2373
2374 if (yyg->yy_n_chars == 0)
2375 {
2376 if (number_to_move == YY_MORE_ADJ)
2377 {
2378 ret_val = EOB_ACT_END_OF_FILE;
2379 yyrestart(yyin, yyscanner);
2380 }
2381
2382 else
2383 {
2384 ret_val = EOB_ACT_LAST_MATCH;
2385 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING;
2386 }
2387 }
2388
2389 else
2390 ret_val = EOB_ACT_CONTINUE_SCAN;
2391
2392 if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size)
2393 {
2394 /* Extend the array by 50%, plus the number we really need. */
2395 int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
2396 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *)yyrealloc(
2397 (void *)YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t)new_size, yyscanner);
2398 if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf)
2399 YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()");
2400 /* "- 2" to take care of EOB's */
2401 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int)(new_size - 2);
2402 }
2403
2404 yyg->yy_n_chars += number_to_move;
2405 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
2406 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
2407
2408 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
2409
2410 return ret_val;
2411 }
2412
2413 /* yy_get_previous_state - get the state just before the EOB char was reached */
2414
yy_get_previous_state(yyscan_t yyscanner)2415 static yy_state_type yy_get_previous_state(yyscan_t yyscanner)
2416 {
2417 yy_state_type yy_current_state;
2418 char *yy_cp;
2419 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2420
2421 yy_current_state = yyg->yy_start;
2422
2423 for (yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp)
2424 {
2425 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2426 if (yy_accept[yy_current_state])
2427 {
2428 yyg->yy_last_accepting_state = yy_current_state;
2429 yyg->yy_last_accepting_cpos = yy_cp;
2430 }
2431 while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state)
2432 {
2433 yy_current_state = (int)yy_def[yy_current_state];
2434 if (yy_current_state >= 938)
2435 yy_c = yy_meta[yy_c];
2436 }
2437 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
2438 }
2439
2440 return yy_current_state;
2441 }
2442
2443 /* yy_try_NUL_trans - try to make a transition on the NUL character
2444 *
2445 * synopsis
2446 * next_state = yy_try_NUL_trans( current_state );
2447 */
yy_try_NUL_trans(yy_state_type yy_current_state,yyscan_t yyscanner)2448 static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state, yyscan_t yyscanner)
2449 {
2450 int yy_is_jam;
2451 struct yyguts_t *yyg =
2452 (struct yyguts_t *)yyscanner; /* This var may be unused depending upon options. */
2453 char *yy_cp = yyg->yy_c_buf_p;
2454
2455 YY_CHAR yy_c = 1;
2456 if (yy_accept[yy_current_state])
2457 {
2458 yyg->yy_last_accepting_state = yy_current_state;
2459 yyg->yy_last_accepting_cpos = yy_cp;
2460 }
2461 while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state)
2462 {
2463 yy_current_state = (int)yy_def[yy_current_state];
2464 if (yy_current_state >= 938)
2465 yy_c = yy_meta[yy_c];
2466 }
2467 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
2468 yy_is_jam = (yy_current_state == 937);
2469
2470 (void)yyg;
2471 return yy_is_jam ? 0 : yy_current_state;
2472 }
2473
2474 #ifndef YY_NO_UNPUT
2475
2476 #endif
2477
2478 #ifndef YY_NO_INPUT
2479 # ifdef __cplusplus
yyinput(yyscan_t yyscanner)2480 static int yyinput(yyscan_t yyscanner)
2481 # else
2482 static int input(yyscan_t yyscanner)
2483 # endif
2484
2485 {
2486 int c;
2487 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2488
2489 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2490
2491 if (*yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR)
2492 {
2493 /* yy_c_buf_p now points to the character we want to return.
2494 * If this occurs *before* the EOB characters, then it's a
2495 * valid NUL; if not, then we've hit the end of the buffer.
2496 */
2497 if (yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars])
2498 /* This was really a NUL. */
2499 *yyg->yy_c_buf_p = '\0';
2500
2501 else
2502 { /* need more input */
2503 int offset = (int)(yyg->yy_c_buf_p - yyg->yytext_ptr);
2504 ++yyg->yy_c_buf_p;
2505
2506 switch (yy_get_next_buffer(yyscanner))
2507 {
2508 case EOB_ACT_LAST_MATCH:
2509 /* This happens because yy_g_n_b()
2510 * sees that we've accumulated a
2511 * token and flags that we need to
2512 * try matching the token before
2513 * proceeding. But for input(),
2514 * there's no matching to consider.
2515 * So convert the EOB_ACT_LAST_MATCH
2516 * to EOB_ACT_END_OF_FILE.
2517 */
2518
2519 /* Reset buffer status. */
2520 yyrestart(yyin, yyscanner);
2521
2522 /*FALLTHROUGH*/
2523
2524 case EOB_ACT_END_OF_FILE:
2525 {
2526 if (yywrap(yyscanner))
2527 return 0;
2528
2529 if (!yyg->yy_did_buffer_switch_on_eof)
2530 YY_NEW_FILE;
2531 # ifdef __cplusplus
2532 return yyinput(yyscanner);
2533 # else
2534 return input(yyscanner);
2535 # endif
2536 }
2537
2538 case EOB_ACT_CONTINUE_SCAN:
2539 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
2540 break;
2541 }
2542 }
2543 }
2544
2545 c = *(unsigned char *)yyg->yy_c_buf_p; /* cast for 8-bit char's */
2546 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
2547 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
2548
2549 if (c == '\n')
2550
2551 do
2552 {
2553 yylineno++;
2554 yycolumn = 0;
2555 } while (0);
2556
2557 return c;
2558 }
2559 #endif /* ifndef YY_NO_INPUT */
2560
2561 /** Immediately switch to a different input stream.
2562 * @param input_file A readable stream.
2563 * @param yyscanner The scanner object.
2564 * @note This function does not reset the start condition to @c INITIAL .
2565 */
yyrestart(FILE * input_file,yyscan_t yyscanner)2566 void yyrestart(FILE *input_file, yyscan_t yyscanner)
2567 {
2568 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2569
2570 if (!YY_CURRENT_BUFFER)
2571 {
2572 yyensure_buffer_stack(yyscanner);
2573 YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner);
2574 }
2575
2576 yy_init_buffer(YY_CURRENT_BUFFER, input_file, yyscanner);
2577 yy_load_buffer_state(yyscanner);
2578 }
2579
2580 /** Switch to a different input buffer.
2581 * @param new_buffer The new input buffer.
2582 * @param yyscanner The scanner object.
2583 */
yy_switch_to_buffer(YY_BUFFER_STATE new_buffer,yyscan_t yyscanner)2584 void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
2585 {
2586 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2587
2588 /* TODO. We should be able to replace this entire function body
2589 * with
2590 * yypop_buffer_state();
2591 * yypush_buffer_state(new_buffer);
2592 */
2593 yyensure_buffer_stack(yyscanner);
2594 if (YY_CURRENT_BUFFER == new_buffer)
2595 return;
2596
2597 if (YY_CURRENT_BUFFER)
2598 {
2599 /* Flush out information for old buffer. */
2600 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2601 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2602 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2603 }
2604
2605 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2606 yy_load_buffer_state(yyscanner);
2607
2608 /* We don't actually know whether we did this switch during
2609 * EOF (yywrap()) processing, but the only time this flag
2610 * is looked at is after yywrap() is called, so it's safe
2611 * to go ahead and always set it.
2612 */
2613 yyg->yy_did_buffer_switch_on_eof = 1;
2614 }
2615
yy_load_buffer_state(yyscan_t yyscanner)2616 static void yy_load_buffer_state(yyscan_t yyscanner)
2617 {
2618 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2619 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2620 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2621 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2622 yyg->yy_hold_char = *yyg->yy_c_buf_p;
2623 }
2624
2625 /** Allocate and initialize an input buffer state.
2626 * @param file A readable stream.
2627 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2628 * @param yyscanner The scanner object.
2629 * @return the allocated buffer state.
2630 */
yy_create_buffer(FILE * file,int size,yyscan_t yyscanner)2631 YY_BUFFER_STATE yy_create_buffer(FILE *file, int size, yyscan_t yyscanner)
2632 {
2633 YY_BUFFER_STATE b;
2634
2635 b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state), yyscanner);
2636 if (!b)
2637 YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
2638
2639 b->yy_buf_size = size;
2640
2641 /* yy_ch_buf has to be 2 characters longer than the size given because
2642 * we need to put in 2 end-of-buffer characters.
2643 */
2644 b->yy_ch_buf = (char *)yyalloc((yy_size_t)(b->yy_buf_size + 2), yyscanner);
2645 if (!b->yy_ch_buf)
2646 YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
2647
2648 b->yy_is_our_buffer = 1;
2649
2650 yy_init_buffer(b, file, yyscanner);
2651
2652 return b;
2653 }
2654
2655 /** Destroy the buffer.
2656 * @param b a buffer created with yy_create_buffer()
2657 * @param yyscanner The scanner object.
2658 */
yy_delete_buffer(YY_BUFFER_STATE b,yyscan_t yyscanner)2659 void yy_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner)
2660 {
2661 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2662
2663 if (!b)
2664 return;
2665
2666 if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */
2667 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE)0;
2668
2669 if (b->yy_is_our_buffer)
2670 yyfree((void *)b->yy_ch_buf, yyscanner);
2671
2672 yyfree((void *)b, yyscanner);
2673 }
2674
2675 /* Initializes or reinitializes a buffer.
2676 * This function is sometimes called more than once on the same buffer,
2677 * such as during a yyrestart() or at EOF.
2678 */
yy_init_buffer(YY_BUFFER_STATE b,FILE * file,yyscan_t yyscanner)2679 static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file, yyscan_t yyscanner)
2680
2681 {
2682 int oerrno = errno;
2683 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2684
2685 yy_flush_buffer(b, yyscanner);
2686
2687 b->yy_input_file = file;
2688 b->yy_fill_buffer = 1;
2689
2690 /* If b is the current buffer, then yy_init_buffer was _probably_
2691 * called from yyrestart() or through yy_get_next_buffer.
2692 * In that case, we don't want to reset the lineno or column.
2693 */
2694 if (b != YY_CURRENT_BUFFER)
2695 {
2696 b->yy_bs_lineno = 1;
2697 b->yy_bs_column = 0;
2698 }
2699
2700 b->yy_is_interactive = 0;
2701
2702 errno = oerrno;
2703 }
2704
2705 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2706 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2707 * @param yyscanner The scanner object.
2708 */
yy_flush_buffer(YY_BUFFER_STATE b,yyscan_t yyscanner)2709 void yy_flush_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner)
2710 {
2711 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2712 if (!b)
2713 return;
2714
2715 b->yy_n_chars = 0;
2716
2717 /* We always need two end-of-buffer characters. The first causes
2718 * a transition to the end-of-buffer state. The second causes
2719 * a jam in that state.
2720 */
2721 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2722 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2723
2724 b->yy_buf_pos = &b->yy_ch_buf[0];
2725
2726 b->yy_at_bol = 1;
2727 b->yy_buffer_status = YY_BUFFER_NEW;
2728
2729 if (b == YY_CURRENT_BUFFER)
2730 yy_load_buffer_state(yyscanner);
2731 }
2732
2733 /** Pushes the new state onto the stack. The new state becomes
2734 * the current state. This function will allocate the stack
2735 * if necessary.
2736 * @param new_buffer The new state.
2737 * @param yyscanner The scanner object.
2738 */
yypush_buffer_state(YY_BUFFER_STATE new_buffer,yyscan_t yyscanner)2739 void yypush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
2740 {
2741 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2742 if (new_buffer == NULL)
2743 return;
2744
2745 yyensure_buffer_stack(yyscanner);
2746
2747 /* This block is copied from yy_switch_to_buffer. */
2748 if (YY_CURRENT_BUFFER)
2749 {
2750 /* Flush out information for old buffer. */
2751 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2752 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2753 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2754 }
2755
2756 /* Only push if top exists. Otherwise, replace top. */
2757 if (YY_CURRENT_BUFFER)
2758 yyg->yy_buffer_stack_top++;
2759 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2760
2761 /* copied from yy_switch_to_buffer. */
2762 yy_load_buffer_state(yyscanner);
2763 yyg->yy_did_buffer_switch_on_eof = 1;
2764 }
2765
2766 /** Removes and deletes the top of the stack, if present.
2767 * The next element becomes the new top.
2768 * @param yyscanner The scanner object.
2769 */
yypop_buffer_state(yyscan_t yyscanner)2770 void yypop_buffer_state(yyscan_t yyscanner)
2771 {
2772 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2773 if (!YY_CURRENT_BUFFER)
2774 return;
2775
2776 yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
2777 YY_CURRENT_BUFFER_LVALUE = NULL;
2778 if (yyg->yy_buffer_stack_top > 0)
2779 --yyg->yy_buffer_stack_top;
2780
2781 if (YY_CURRENT_BUFFER)
2782 {
2783 yy_load_buffer_state(yyscanner);
2784 yyg->yy_did_buffer_switch_on_eof = 1;
2785 }
2786 }
2787
2788 /* Allocates the stack if it does not exist.
2789 * Guarantees space for at least one push.
2790 */
yyensure_buffer_stack(yyscan_t yyscanner)2791 static void yyensure_buffer_stack(yyscan_t yyscanner)
2792 {
2793 yy_size_t num_to_alloc;
2794 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2795
2796 if (!yyg->yy_buffer_stack)
2797 {
2798
2799 /* First allocation is just for 2 elements, since we don't know if this
2800 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2801 * immediate realloc on the next call.
2802 */
2803 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
2804 yyg->yy_buffer_stack = (struct yy_buffer_state **)yyalloc(
2805 num_to_alloc * sizeof(struct yy_buffer_state *), yyscanner);
2806 if (!yyg->yy_buffer_stack)
2807 YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
2808
2809 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state *));
2810
2811 yyg->yy_buffer_stack_max = num_to_alloc;
2812 yyg->yy_buffer_stack_top = 0;
2813 return;
2814 }
2815
2816 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1)
2817 {
2818
2819 /* Increase the buffer to prepare for a possible push. */
2820 yy_size_t grow_size = 8 /* arbitrary grow size */;
2821
2822 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
2823 yyg->yy_buffer_stack = (struct yy_buffer_state **)yyrealloc(
2824 yyg->yy_buffer_stack, num_to_alloc * sizeof(struct yy_buffer_state *), yyscanner);
2825 if (!yyg->yy_buffer_stack)
2826 YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
2827
2828 /* zero only the new slots.*/
2829 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0,
2830 grow_size * sizeof(struct yy_buffer_state *));
2831 yyg->yy_buffer_stack_max = num_to_alloc;
2832 }
2833 }
2834
2835 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2836 * @param base the character buffer
2837 * @param size the size in bytes of the character buffer
2838 * @param yyscanner The scanner object.
2839 * @return the newly allocated buffer state object.
2840 */
yy_scan_buffer(char * base,yy_size_t size,yyscan_t yyscanner)2841 YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner)
2842 {
2843 YY_BUFFER_STATE b;
2844
2845 if (size < 2 || base[size - 2] != YY_END_OF_BUFFER_CHAR ||
2846 base[size - 1] != YY_END_OF_BUFFER_CHAR)
2847 /* They forgot to leave room for the EOB's. */
2848 return NULL;
2849
2850 b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state), yyscanner);
2851 if (!b)
2852 YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()");
2853
2854 b->yy_buf_size = (int)(size - 2); /* "- 2" to take care of EOB's */
2855 b->yy_buf_pos = b->yy_ch_buf = base;
2856 b->yy_is_our_buffer = 0;
2857 b->yy_input_file = NULL;
2858 b->yy_n_chars = b->yy_buf_size;
2859 b->yy_is_interactive = 0;
2860 b->yy_at_bol = 1;
2861 b->yy_fill_buffer = 0;
2862 b->yy_buffer_status = YY_BUFFER_NEW;
2863
2864 yy_switch_to_buffer(b, yyscanner);
2865
2866 return b;
2867 }
2868
2869 /** Setup the input buffer state to scan a string. The next call to yylex() will
2870 * scan from a @e copy of @a str.
2871 * @param yystr a NUL-terminated string to scan
2872 * @param yyscanner The scanner object.
2873 * @return the newly allocated buffer state object.
2874 * @note If you want to scan bytes that may contain NUL values, then use
2875 * yy_scan_bytes() instead.
2876 */
yy_scan_string(const char * yystr,yyscan_t yyscanner)2877 YY_BUFFER_STATE yy_scan_string(const char *yystr, yyscan_t yyscanner)
2878 {
2879
2880 return yy_scan_bytes(yystr, (int)strlen(yystr), yyscanner);
2881 }
2882
2883 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2884 * scan from a @e copy of @a bytes.
2885 * @param yybytes the byte buffer to scan
2886 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2887 * @param yyscanner The scanner object.
2888 * @return the newly allocated buffer state object.
2889 */
yy_scan_bytes(const char * yybytes,int _yybytes_len,yyscan_t yyscanner)2890 YY_BUFFER_STATE yy_scan_bytes(const char *yybytes, int _yybytes_len, yyscan_t yyscanner)
2891 {
2892 YY_BUFFER_STATE b;
2893 char *buf;
2894 yy_size_t n;
2895 int i;
2896
2897 /* Get memory for full buffer, including space for trailing EOB's. */
2898 n = (yy_size_t)(_yybytes_len + 2);
2899 buf = (char *)yyalloc(n, yyscanner);
2900 if (!buf)
2901 YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()");
2902
2903 for (i = 0; i < _yybytes_len; ++i)
2904 buf[i] = yybytes[i];
2905
2906 buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR;
2907
2908 b = yy_scan_buffer(buf, n, yyscanner);
2909 if (!b)
2910 YY_FATAL_ERROR("bad buffer in yy_scan_bytes()");
2911
2912 /* It's okay to grow etc. this buffer, and we should throw it
2913 * away when we're done.
2914 */
2915 b->yy_is_our_buffer = 1;
2916
2917 return b;
2918 }
2919
2920 #ifndef YY_EXIT_FAILURE
2921 # define YY_EXIT_FAILURE 2
2922 #endif
2923
yy_fatal_error(const char * msg,yyscan_t yyscanner)2924 static void yynoreturn yy_fatal_error(const char *msg, yyscan_t yyscanner)
2925 {
2926 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2927 (void)yyg;
2928 fprintf(stderr, "%s\n", msg);
2929 exit(YY_EXIT_FAILURE);
2930 }
2931
2932 /* Redefine yyless() so it works in section 3 code. */
2933
2934 #undef yyless
2935 #define yyless(n) \
2936 do \
2937 { \
2938 /* Undo effects of setting up yytext. */ \
2939 int yyless_macro_arg = (n); \
2940 YY_LESS_LINENO(yyless_macro_arg); \
2941 yytext[yyleng] = yyg->yy_hold_char; \
2942 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2943 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2944 *yyg->yy_c_buf_p = '\0'; \
2945 yyleng = yyless_macro_arg; \
2946 } while (0)
2947
2948 /* Accessor methods (get/set functions) to struct members. */
2949
2950 /** Get the user-defined data for this scanner.
2951 * @param yyscanner The scanner object.
2952 */
yyget_extra(yyscan_t yyscanner)2953 YY_EXTRA_TYPE yyget_extra(yyscan_t yyscanner)
2954 {
2955 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2956 return yyextra;
2957 }
2958
2959 /** Get the current line number.
2960 * @param yyscanner The scanner object.
2961 */
yyget_lineno(yyscan_t yyscanner)2962 int yyget_lineno(yyscan_t yyscanner)
2963 {
2964 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2965
2966 if (!YY_CURRENT_BUFFER)
2967 return 0;
2968
2969 return yylineno;
2970 }
2971
2972 /** Get the current column number.
2973 * @param yyscanner The scanner object.
2974 */
yyget_column(yyscan_t yyscanner)2975 int yyget_column(yyscan_t yyscanner)
2976 {
2977 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2978
2979 if (!YY_CURRENT_BUFFER)
2980 return 0;
2981
2982 return yycolumn;
2983 }
2984
2985 /** Get the input stream.
2986 * @param yyscanner The scanner object.
2987 */
yyget_in(yyscan_t yyscanner)2988 FILE *yyget_in(yyscan_t yyscanner)
2989 {
2990 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
2991 return yyin;
2992 }
2993
2994 /** Get the output stream.
2995 * @param yyscanner The scanner object.
2996 */
yyget_out(yyscan_t yyscanner)2997 FILE *yyget_out(yyscan_t yyscanner)
2998 {
2999 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3000 return yyout;
3001 }
3002
3003 /** Get the length of the current token.
3004 * @param yyscanner The scanner object.
3005 */
yyget_leng(yyscan_t yyscanner)3006 int yyget_leng(yyscan_t yyscanner)
3007 {
3008 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3009 return yyleng;
3010 }
3011
3012 /** Get the current token.
3013 * @param yyscanner The scanner object.
3014 */
3015
yyget_text(yyscan_t yyscanner)3016 char *yyget_text(yyscan_t yyscanner)
3017 {
3018 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3019 return yytext;
3020 }
3021
3022 /** Set the user-defined data. This data is never touched by the scanner.
3023 * @param user_defined The data to be associated with this scanner.
3024 * @param yyscanner The scanner object.
3025 */
yyset_extra(YY_EXTRA_TYPE user_defined,yyscan_t yyscanner)3026 void yyset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner)
3027 {
3028 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3029 yyextra = user_defined;
3030 }
3031
3032 /** Set the current line number.
3033 * @param _line_number line number
3034 * @param yyscanner The scanner object.
3035 */
yyset_lineno(int _line_number,yyscan_t yyscanner)3036 void yyset_lineno(int _line_number, yyscan_t yyscanner)
3037 {
3038 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3039
3040 /* lineno is only valid if an input buffer exists. */
3041 if (!YY_CURRENT_BUFFER)
3042 YY_FATAL_ERROR("yyset_lineno called with no buffer");
3043
3044 yylineno = _line_number;
3045 }
3046
3047 /** Set the current column.
3048 * @param _column_no column number
3049 * @param yyscanner The scanner object.
3050 */
yyset_column(int _column_no,yyscan_t yyscanner)3051 void yyset_column(int _column_no, yyscan_t yyscanner)
3052 {
3053 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3054
3055 /* column is only valid if an input buffer exists. */
3056 if (!YY_CURRENT_BUFFER)
3057 YY_FATAL_ERROR("yyset_column called with no buffer");
3058
3059 yycolumn = _column_no;
3060 }
3061
3062 /** Set the input stream. This does not discard the current
3063 * input buffer.
3064 * @param _in_str A readable stream.
3065 * @param yyscanner The scanner object.
3066 * @see yy_switch_to_buffer
3067 */
yyset_in(FILE * _in_str,yyscan_t yyscanner)3068 void yyset_in(FILE *_in_str, yyscan_t yyscanner)
3069 {
3070 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3071 yyin = _in_str;
3072 }
3073
yyset_out(FILE * _out_str,yyscan_t yyscanner)3074 void yyset_out(FILE *_out_str, yyscan_t yyscanner)
3075 {
3076 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3077 yyout = _out_str;
3078 }
3079
yyget_debug(yyscan_t yyscanner)3080 int yyget_debug(yyscan_t yyscanner)
3081 {
3082 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3083 return yy_flex_debug;
3084 }
3085
yyset_debug(int _bdebug,yyscan_t yyscanner)3086 void yyset_debug(int _bdebug, yyscan_t yyscanner)
3087 {
3088 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3089 yy_flex_debug = _bdebug;
3090 }
3091
3092 /* Accessor methods for yylval and yylloc */
3093
yyget_lval(yyscan_t yyscanner)3094 YYSTYPE *yyget_lval(yyscan_t yyscanner)
3095 {
3096 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3097 return yylval;
3098 }
3099
yyset_lval(YYSTYPE * yylval_param,yyscan_t yyscanner)3100 void yyset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner)
3101 {
3102 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3103 yylval = yylval_param;
3104 }
3105
yyget_lloc(yyscan_t yyscanner)3106 YYLTYPE *yyget_lloc(yyscan_t yyscanner)
3107 {
3108 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3109 return yylloc;
3110 }
3111
yyset_lloc(YYLTYPE * yylloc_param,yyscan_t yyscanner)3112 void yyset_lloc(YYLTYPE *yylloc_param, yyscan_t yyscanner)
3113 {
3114 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3115 yylloc = yylloc_param;
3116 }
3117
3118 /* User-visible API */
3119
3120 /* yylex_init is special because it creates the scanner itself, so it is
3121 * the ONLY reentrant function that doesn't take the scanner as the last argument.
3122 * That's why we explicitly handle the declaration, instead of using our macros.
3123 */
yylex_init(yyscan_t * ptr_yy_globals)3124 int yylex_init(yyscan_t *ptr_yy_globals)
3125 {
3126 if (ptr_yy_globals == NULL)
3127 {
3128 errno = EINVAL;
3129 return 1;
3130 }
3131
3132 *ptr_yy_globals = (yyscan_t)yyalloc(sizeof(struct yyguts_t), NULL);
3133
3134 if (*ptr_yy_globals == NULL)
3135 {
3136 errno = ENOMEM;
3137 return 1;
3138 }
3139
3140 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
3141 memset(*ptr_yy_globals, 0x00, sizeof(struct yyguts_t));
3142
3143 return yy_init_globals(*ptr_yy_globals);
3144 }
3145
3146 /* yylex_init_extra has the same functionality as yylex_init, but follows the
3147 * convention of taking the scanner as the last argument. Note however, that
3148 * this is a *pointer* to a scanner, as it will be allocated by this call (and
3149 * is the reason, too, why this function also must handle its own declaration).
3150 * The user defined value in the first argument will be available to yyalloc in
3151 * the yyextra field.
3152 */
yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t * ptr_yy_globals)3153 int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined, yyscan_t *ptr_yy_globals)
3154 {
3155 struct yyguts_t dummy_yyguts;
3156
3157 yyset_extra(yy_user_defined, &dummy_yyguts);
3158
3159 if (ptr_yy_globals == NULL)
3160 {
3161 errno = EINVAL;
3162 return 1;
3163 }
3164
3165 *ptr_yy_globals = (yyscan_t)yyalloc(sizeof(struct yyguts_t), &dummy_yyguts);
3166
3167 if (*ptr_yy_globals == NULL)
3168 {
3169 errno = ENOMEM;
3170 return 1;
3171 }
3172
3173 /* By setting to 0xAA, we expose bugs in
3174 yy_init_globals. Leave at 0x00 for releases. */
3175 memset(*ptr_yy_globals, 0x00, sizeof(struct yyguts_t));
3176
3177 yyset_extra(yy_user_defined, *ptr_yy_globals);
3178
3179 return yy_init_globals(*ptr_yy_globals);
3180 }
3181
yy_init_globals(yyscan_t yyscanner)3182 static int yy_init_globals(yyscan_t yyscanner)
3183 {
3184 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3185 /* Initialization is the same as for the non-reentrant scanner.
3186 * This function is called from yylex_destroy(), so don't allocate here.
3187 */
3188
3189 yyg->yy_buffer_stack = NULL;
3190 yyg->yy_buffer_stack_top = 0;
3191 yyg->yy_buffer_stack_max = 0;
3192 yyg->yy_c_buf_p = NULL;
3193 yyg->yy_init = 0;
3194 yyg->yy_start = 0;
3195
3196 yyg->yy_start_stack_ptr = 0;
3197 yyg->yy_start_stack_depth = 0;
3198 yyg->yy_start_stack = NULL;
3199
3200 /* Defined in main.c */
3201 #ifdef YY_STDINIT
3202 yyin = stdin;
3203 yyout = stdout;
3204 #else
3205 yyin = NULL;
3206 yyout = NULL;
3207 #endif
3208
3209 /* For future reference: Set errno on error, since we are called by
3210 * yylex_init()
3211 */
3212 return 0;
3213 }
3214
3215 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
yylex_destroy(yyscan_t yyscanner)3216 int yylex_destroy(yyscan_t yyscanner)
3217 {
3218 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3219
3220 /* Pop the buffer stack, destroying each element. */
3221 while (YY_CURRENT_BUFFER)
3222 {
3223 yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
3224 YY_CURRENT_BUFFER_LVALUE = NULL;
3225 yypop_buffer_state(yyscanner);
3226 }
3227
3228 /* Destroy the stack itself. */
3229 yyfree(yyg->yy_buffer_stack, yyscanner);
3230 yyg->yy_buffer_stack = NULL;
3231
3232 /* Destroy the start condition stack. */
3233 yyfree(yyg->yy_start_stack, yyscanner);
3234 yyg->yy_start_stack = NULL;
3235
3236 /* Reset the globals. This is important in a non-reentrant scanner so the next time
3237 * yylex() is called, initialization will occur. */
3238 yy_init_globals(yyscanner);
3239
3240 /* Destroy the main struct (reentrant only). */
3241 yyfree(yyscanner, yyscanner);
3242 yyscanner = NULL;
3243 return 0;
3244 }
3245
3246 /*
3247 * Internal utility routines.
3248 */
3249
3250 #ifndef yytext_ptr
yy_flex_strncpy(char * s1,const char * s2,int n,yyscan_t yyscanner)3251 static void yy_flex_strncpy(char *s1, const char *s2, int n, yyscan_t yyscanner)
3252 {
3253 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3254 (void)yyg;
3255
3256 int i;
3257 for (i = 0; i < n; ++i)
3258 s1[i] = s2[i];
3259 }
3260 #endif
3261
3262 #ifdef YY_NEED_STRLEN
yy_flex_strlen(const char * s,yyscan_t yyscanner)3263 static int yy_flex_strlen(const char *s, yyscan_t yyscanner)
3264 {
3265 int n;
3266 for (n = 0; s[n]; ++n)
3267 ;
3268
3269 return n;
3270 }
3271 #endif
3272
yyalloc(yy_size_t size,yyscan_t yyscanner)3273 void *yyalloc(yy_size_t size, yyscan_t yyscanner)
3274 {
3275 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3276 (void)yyg;
3277 return malloc(size);
3278 }
3279
yyrealloc(void * ptr,yy_size_t size,yyscan_t yyscanner)3280 void *yyrealloc(void *ptr, yy_size_t size, yyscan_t yyscanner)
3281 {
3282 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3283 (void)yyg;
3284
3285 /* The cast to (char *) in the following accommodates both
3286 * implementations that use char* generic pointers, and those
3287 * that use void* generic pointers. It works with the latter
3288 * because both ANSI C and C++ allow castless assignment from
3289 * any pointer type to void*, and deal with argument conversions
3290 * as though doing an assignment.
3291 */
3292 return realloc(ptr, size);
3293 }
3294
yyfree(void * ptr,yyscan_t yyscanner)3295 void yyfree(void *ptr, yyscan_t yyscanner)
3296 {
3297 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3298 (void)yyg;
3299 free((char *)ptr); /* see yyrealloc() for (char *) cast */
3300 }
3301
3302 #define YYTABLES_NAME "yytables"
3303
string_input(char * buf,yy_size_t max_size,yyscan_t yyscanner)3304 yy_size_t string_input(char *buf, yy_size_t max_size, yyscan_t yyscanner)
3305 {
3306 angle::pp::Token token;
3307 yyget_extra(yyscanner)->getPreprocessor().lex(&token);
3308 yy_size_t len = token.type == angle::pp::Token::LAST ? 0 : token.text.size();
3309 if (len < max_size)
3310 memcpy(buf, token.text.c_str(), len);
3311 yyset_column(token.location.file, yyscanner);
3312 yyset_lineno(token.location.line, yyscanner);
3313
3314 if (len >= max_size)
3315 YY_FATAL_ERROR("Input buffer overflow");
3316 else if (len > 0)
3317 buf[len++] = ' ';
3318 return len;
3319 }
3320
check_type(yyscan_t yyscanner)3321 int check_type(yyscan_t yyscanner)
3322 {
3323 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3324
3325 int token = IDENTIFIER;
3326 // Note that the ImmutableString used here isn't static or pool allocated - but it's fine since
3327 // yytext is valid for the duration of its use.
3328 const TSymbol *symbol =
3329 yyextra->symbolTable.find(ImmutableString(yytext, yyleng), yyextra->getShaderVersion());
3330 if (symbol && symbol->isStruct())
3331 {
3332 token = TYPE_NAME;
3333 }
3334 yylval->lex.symbol = symbol;
3335 return token;
3336 }
3337
reserved_word(yyscan_t yyscanner)3338 int reserved_word(yyscan_t yyscanner)
3339 {
3340 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3341
3342 yyextra->error(*yylloc, "Illegal use of reserved word", yytext);
3343 return 0;
3344 }
3345
is_extension_enabled_or_is_core(TParseContext * context,int extension_version,TExtension extension,int promotion_version)3346 static bool is_extension_enabled_or_is_core(TParseContext *context,
3347 int extension_version,
3348 TExtension extension,
3349 int promotion_version)
3350 {
3351 int version = context->getShaderVersion();
3352
3353 // If version is at least promotion_version, symbol is definitely keyword. Otherwise it's a
3354 // keyword if version is at least extension_version (where the extension was introduced) and
3355 // the extension is enabled.
3356 return version >= promotion_version ||
3357 (version >= extension_version && context->isExtensionEnabled(extension));
3358 }
3359
ES2_reserved_ES3_keyword(TParseContext * context,int token)3360 int ES2_reserved_ES3_keyword(TParseContext *context, int token)
3361 {
3362 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3363
3364 if (context->getShaderVersion() < 300)
3365 {
3366 return reserved_word(yyscanner);
3367 }
3368
3369 return token;
3370 }
3371
ES2_keyword_ES3_reserved(TParseContext * context,int token)3372 int ES2_keyword_ES3_reserved(TParseContext *context, int token)
3373 {
3374 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3375
3376 if (context->getShaderVersion() >= 300)
3377 {
3378 return reserved_word(yyscanner);
3379 }
3380
3381 return token;
3382 }
3383
ES3_reserved_ES3_1_keyword(TParseContext * context,int token)3384 int ES3_reserved_ES3_1_keyword(TParseContext *context, int token)
3385 {
3386 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3387 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3388
3389 if (context->getShaderVersion() < 300)
3390 {
3391 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
3392 return check_type(yyscanner);
3393 }
3394 else if (context->getShaderVersion() == 300)
3395 {
3396 return reserved_word(yyscanner);
3397 }
3398
3399 return token;
3400 }
3401
ES3_keyword(TParseContext * context,int token)3402 int ES3_keyword(TParseContext *context, int token)
3403 {
3404 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3405 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3406
3407 // not a reserved word in GLSL ES 1.00, so could be used as an identifier/type name
3408 if (context->getShaderVersion() < 300)
3409 {
3410 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
3411 return check_type(yyscanner);
3412 }
3413
3414 return token;
3415 }
3416
ES2_reserved_ES3_1_keyword(TParseContext * context,int token)3417 int ES2_reserved_ES3_1_keyword(TParseContext *context, int token)
3418 {
3419 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3420
3421 if (context->getShaderVersion() < 310)
3422 {
3423 return reserved_word(yyscanner);
3424 }
3425
3426 return token;
3427 }
3428
ES3_1_keyword(TParseContext * context,int token)3429 int ES3_1_keyword(TParseContext *context, int token)
3430 {
3431 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3432 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3433
3434 // A keyword in GLSL ES 3.10.
3435 if (context->getShaderVersion() >= 310)
3436 {
3437 return token;
3438 }
3439
3440 // Otherwise can be used as an identifier/type name
3441 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
3442 return check_type(yyscanner);
3443 }
3444
WEBGL_video_texture_extension(TParseContext * context,int token)3445 int WEBGL_video_texture_extension(TParseContext *context, int token)
3446 {
3447 // Available with WEBGL_video_texture_extension
3448 if (context->isExtensionEnabled(TExtension::WEBGL_video_texture))
3449 {
3450 return token;
3451 }
3452
3453 // Otherwise can be used as an identifier/type name
3454 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3455 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3456
3457 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
3458 return check_type(yyscanner);
3459 }
3460
ES2_extension_2_ES3_keyword(TParseContext * context,TExtension extension1,TExtension extension2,int token)3461 int ES2_extension_2_ES3_keyword(TParseContext *context,
3462 TExtension extension1,
3463 TExtension extension2,
3464 int token)
3465 {
3466 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3467 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3468
3469 // A keyword in GLSL ES 3.00 or GLSL ES 1.00 with enabled extension.
3470 if (is_extension_enabled_or_is_core(context, 100, extension1, 300))
3471 {
3472 return token;
3473 }
3474 else if (is_extension_enabled_or_is_core(context, 100, extension2, 300))
3475 {
3476 return token;
3477 }
3478
3479 // not a reserved word in GLSL ES 1.00, so could be used as an identifier/type name
3480 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
3481 return check_type(yyscanner);
3482 }
3483
ES2_reserved_ES2_extension_ES3_keyword(TParseContext * context,TExtension extension,int token)3484 int ES2_reserved_ES2_extension_ES3_keyword(TParseContext *context, TExtension extension, int token)
3485 {
3486 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3487
3488 // A keyword in GLSL ES 3.00 or GLSL ES 1.00 with enabled extension.
3489 if (is_extension_enabled_or_is_core(context, 100, extension, 300))
3490 {
3491 return token;
3492 }
3493
3494 // Reserved otherwise.
3495 return reserved_word(yyscanner);
3496 }
3497
ES3_extension(TParseContext * context,TExtension extension,int token)3498 int ES3_extension(TParseContext *context, TExtension extension, int token)
3499 {
3500 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3501 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3502
3503 // a keyword word in GLSL ES 3.00 with enabled extension.
3504 if (context->getShaderVersion() >= 300 && context->isExtensionEnabled(extension))
3505 {
3506 return token;
3507 }
3508
3509 // Otherwise can be used as an identifier/type name
3510 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
3511 return check_type(yyscanner);
3512 }
3513
ES3_reserved_ES3_1_extension_ES3_2_keyword(TParseContext * context,TExtension extension,int token)3514 int ES3_reserved_ES3_1_extension_ES3_2_keyword(TParseContext *context,
3515 TExtension extension,
3516 int token)
3517 {
3518 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3519 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3520
3521 // a keyword in GLSL ES 3.10 with enabled extension
3522 if (is_extension_enabled_or_is_core(context, 310, extension, 320))
3523 {
3524 return token;
3525 }
3526 // a reserved word in GLSL ES 3.00+
3527 if (context->getShaderVersion() >= 300)
3528 {
3529 return reserved_word(yyscanner);
3530 }
3531
3532 // Otherwise can be used as an identifier/type name
3533 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
3534 return check_type(yyscanner);
3535 }
3536
ES3_reserved_ES3_extension(TParseContext * context,TExtension extension,int token)3537 int ES3_reserved_ES3_extension(TParseContext *context, TExtension extension, int token)
3538 {
3539 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3540 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3541
3542 if (context->getShaderVersion() >= 300)
3543 {
3544 if (context->isExtensionEnabled(extension))
3545 {
3546 return token;
3547 }
3548 else
3549 {
3550 return reserved_word(yyscanner);
3551 }
3552 }
3553
3554 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
3555 return check_type(yyscanner);
3556 }
3557
ES3_reserved_ES3_extension_ES3_1_keyword(TParseContext * context,TExtension extension,int token)3558 int ES3_reserved_ES3_extension_ES3_1_keyword(TParseContext *context,
3559 TExtension extension,
3560 int token)
3561 {
3562 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3563 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3564
3565 // A keyword in GLSL ES 3.00 with enabled extension or in GLSL ES 3.10
3566 if (is_extension_enabled_or_is_core(context, 300, extension, 310))
3567 {
3568 return token;
3569 }
3570
3571 if (context->getShaderVersion() == 300)
3572 {
3573 return reserved_word(yyscanner);
3574 }
3575
3576 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
3577 return check_type(yyscanner);
3578 }
3579
ES3_reserved_ES3_extension_ES3_2_keyword(TParseContext * context,TExtension extension,int token)3580 int ES3_reserved_ES3_extension_ES3_2_keyword(TParseContext *context,
3581 TExtension extension,
3582 int token)
3583 {
3584 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3585 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3586
3587 // A keyword in GLSL ES 3.00 with enabled extension or in GLSL ES 3.20
3588 if (is_extension_enabled_or_is_core(context, 300, extension, 320))
3589 {
3590 return token;
3591 }
3592
3593 if (context->getShaderVersion() == 300 || context->getShaderVersion() == 310)
3594 {
3595 return reserved_word(yyscanner);
3596 }
3597
3598 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
3599 return check_type(yyscanner);
3600 }
3601
ES3_1_reserved_ES3_1_extension_ES3_2_keyword(TParseContext * context,TExtension extension,int token)3602 static int ES3_1_reserved_ES3_1_extension_ES3_2_keyword(TParseContext *context,
3603 TExtension extension,
3604 int token)
3605 {
3606 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3607 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3608
3609 // A keyword in GLSL ES 3.20 or GLSL ES 3.10 with enabled extension.
3610 if (is_extension_enabled_or_is_core(context, 310, extension, 320))
3611 {
3612 return token;
3613 }
3614
3615 // A reserved word in GLSL ES 3.10
3616 if (context->getShaderVersion() == 310)
3617 {
3618 return reserved_word(yyscanner);
3619 }
3620
3621 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
3622 return check_type(yyscanner);
3623 }
3624
ES3_1_reserved_ES3_1_extension_ES3_2_keyword_2(TParseContext * context,TExtension extension1,TExtension extension2,int token1,int token2)3625 static int ES3_1_reserved_ES3_1_extension_ES3_2_keyword_2(TParseContext *context,
3626 TExtension extension1,
3627 TExtension extension2,
3628 int token1,
3629 int token2)
3630 {
3631 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3632 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3633
3634 // A keyword in GLSL ES 3.20 or GLSL ES 3.10 with enabled extension.
3635 if (is_extension_enabled_or_is_core(context, 310, extension1, 320))
3636 {
3637 return token1;
3638 }
3639 else if (is_extension_enabled_or_is_core(context, 310, extension2, 320))
3640 {
3641 return token2;
3642 }
3643
3644 // A reserved word in GLSL ES 3.10
3645 if (context->getShaderVersion() == 310)
3646 {
3647 return reserved_word(yyscanner);
3648 }
3649
3650 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
3651 return check_type(yyscanner);
3652 }
3653
ES3_and_3_1_reserved_ES3_1_extension_ES3_2_keyword_2(TParseContext * context,TExtension extension1,TExtension extension2,int token1,int token2)3654 static int ES3_and_3_1_reserved_ES3_1_extension_ES3_2_keyword_2(TParseContext *context,
3655 TExtension extension1,
3656 TExtension extension2,
3657 int token1,
3658 int token2)
3659 {
3660 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3661 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3662
3663 // A keyword in GLSL ES 3.20 or GLSL ES 3.10 with enabled extension.
3664 if (is_extension_enabled_or_is_core(context, 310, extension1, 320))
3665 {
3666 return token1;
3667 }
3668 else if (is_extension_enabled_or_is_core(context, 310, extension2, 320))
3669 {
3670 return token2;
3671 }
3672
3673 // A reserved word in GLSL ES 3.00 and 3.10
3674 if (context->getShaderVersion() >= 300)
3675 {
3676 return reserved_word(yyscanner);
3677 }
3678
3679 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
3680 return check_type(yyscanner);
3681 }
3682
uint_constant(TParseContext * context)3683 int uint_constant(TParseContext *context)
3684 {
3685 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3686
3687 if (context->getShaderVersion() < 300)
3688 {
3689 context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext);
3690 return 0;
3691 }
3692
3693 if (!atoi_clamp(yytext, &(yylval->lex.u)))
3694 yyextra->error(*yylloc, "Integer overflow", yytext);
3695
3696 return UINTCONSTANT;
3697 }
3698
floatsuffix_check(TParseContext * context)3699 int floatsuffix_check(TParseContext *context)
3700 {
3701 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3702
3703 if (context->getShaderVersion() < 300)
3704 {
3705 context->error(*yylloc, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext);
3706 return 0;
3707 }
3708
3709 std::string text = yytext;
3710 text.resize(text.size() - 1);
3711 if (!strtof_clamp(text, &(yylval->lex.f)))
3712 yyextra->warning(*yylloc, "Float overflow", yytext);
3713
3714 return (FLOATCONSTANT);
3715 }
3716
yyerror(YYLTYPE * lloc,TParseContext * context,void * scanner,const char * reason)3717 void yyerror(YYLTYPE *lloc, TParseContext *context, void *scanner, const char *reason)
3718 {
3719 context->error(*lloc, reason, yyget_text(scanner));
3720 }
3721
int_constant(TParseContext * context)3722 int int_constant(TParseContext *context)
3723 {
3724 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3725
3726 unsigned int u;
3727 if (!atoi_clamp(yytext, &u))
3728 {
3729 if (context->getShaderVersion() >= 300)
3730 yyextra->error(*yylloc, "Integer overflow", yytext);
3731 else
3732 yyextra->warning(*yylloc, "Integer overflow", yytext);
3733 }
3734 yylval->lex.i = static_cast<int>(u);
3735 return INTCONSTANT;
3736 }
3737
float_constant(yyscan_t yyscanner)3738 int float_constant(yyscan_t yyscanner)
3739 {
3740 struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
3741
3742 if (!strtof_clamp(yytext, &(yylval->lex.f)))
3743 yyextra->warning(*yylloc, "Float overflow", yytext);
3744 return FLOATCONSTANT;
3745 }
3746
yuvcscstandardext_constant(TParseContext * context)3747 int yuvcscstandardext_constant(TParseContext *context)
3748 {
3749 struct yyguts_t *yyg = (struct yyguts_t *)context->getScanner();
3750 yyscan_t yyscanner = (yyscan_t)context->getScanner();
3751
3752 // a reserved word in GLSL ES 3.00 with enabled extension, otherwise could be used as an
3753 // identifier/type name
3754 if (context->getShaderVersion() >= 300 &&
3755 context->isExtensionEnabled(TExtension::EXT_YUV_target))
3756 {
3757 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
3758 return YUVCSCSTANDARDEXTCONSTANT;
3759 }
3760
3761 yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
3762 return check_type(yyscanner);
3763 }
3764
glslang_initialize(TParseContext * context)3765 int glslang_initialize(TParseContext *context)
3766 {
3767 yyscan_t scanner = NULL;
3768 if (yylex_init_extra(context, &scanner))
3769 return 1;
3770
3771 context->setScanner(scanner);
3772 return 0;
3773 }
3774
glslang_finalize(TParseContext * context)3775 int glslang_finalize(TParseContext *context)
3776 {
3777 yyscan_t scanner = context->getScanner();
3778 if (scanner == NULL)
3779 return 0;
3780
3781 context->setScanner(NULL);
3782 yylex_destroy(scanner);
3783
3784 return 0;
3785 }
3786
glslang_scan(size_t count,const char * const string[],const int length[],TParseContext * context)3787 int glslang_scan(size_t count,
3788 const char *const string[],
3789 const int length[],
3790 TParseContext *context)
3791 {
3792 yyrestart(NULL, context->getScanner());
3793 yyset_column(0, context->getScanner());
3794 yyset_lineno(1, context->getScanner());
3795
3796 // Initialize preprocessor.
3797 angle::pp::Preprocessor *preprocessor = &context->getPreprocessor();
3798
3799 if (!preprocessor->init(count, string, length))
3800 return 1;
3801
3802 // Define extension macros.
3803 const TExtensionBehavior &extBehavior = context->extensionBehavior();
3804 for (TExtensionBehavior::const_iterator iter = extBehavior.begin(); iter != extBehavior.end();
3805 ++iter)
3806 {
3807 // OVR_multiview should not be defined for WebGL spec'ed shaders.
3808 if (sh::IsWebGLBasedSpec(context->getShaderSpec()) &&
3809 iter->first == TExtension::OVR_multiview)
3810 {
3811 continue;
3812 }
3813 preprocessor->predefineMacro(GetExtensionNameString(iter->first), 1);
3814 }
3815 if (context->getFragmentPrecisionHigh())
3816 preprocessor->predefineMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
3817
3818 preprocessor->setMaxTokenSize(sh::GetGlobalMaxTokenSize(context->getShaderSpec()));
3819
3820 return 0;
3821 }
3822