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