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