Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: src/sksl/lex.sksl.c

Issue 1984363002: initial checkin of SkSL compiler (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: documentation and cleanups Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8
9 #line 3 "lex.sksl.c"
10
11 #define YY_INT_ALIGNED short int
12
13 /* A lexical scanner generated by flex */
14
15 #define yy_create_buffer sksl_create_buffer
16 #define yy_delete_buffer sksl_delete_buffer
17 #define yy_flex_debug sksl_flex_debug
18 #define yy_init_buffer sksl_init_buffer
19 #define yy_flush_buffer sksl_flush_buffer
20 #define yy_load_buffer_state sksl_load_buffer_state
21 #define yy_switch_to_buffer sksl_switch_to_buffer
22 #define yyin skslin
23 #define yyleng skslleng
24 #define yylex sksllex
25 #define yylineno sksllineno
26 #define yyout skslout
27 #define yyrestart skslrestart
28 #define yytext sksltext
29 #define yywrap skslwrap
30 #define yyalloc skslalloc
31 #define yyrealloc skslrealloc
32 #define yyfree skslfree
33
34 #define FLEX_SCANNER
35 #define YY_FLEX_MAJOR_VERSION 2
36 #define YY_FLEX_MINOR_VERSION 5
37 #define YY_FLEX_SUBMINOR_VERSION 39
38 #if YY_FLEX_SUBMINOR_VERSION > 0
39 #define FLEX_BETA
40 #endif
41
42 /* First, we deal with platform-specific or compiler-specific issues. */
43
44 /* begin standard C headers. */
45 #include <stdio.h>
46 #include <string.h>
47 #include <errno.h>
48 #include <stdlib.h>
49
50 /* end standard C headers. */
51
52 /* flex integer type definitions */
53
54 #ifndef FLEXINT_H
55 #define FLEXINT_H
56
57 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
58
59 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
60
61 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
62 * if you want the limit (max/min) macros for int types.
63 */
64 #ifndef __STDC_LIMIT_MACROS
65 #define __STDC_LIMIT_MACROS 1
66 #endif
67
68 #include <inttypes.h>
69 typedef int8_t flex_int8_t;
70 typedef uint8_t flex_uint8_t;
71 typedef int16_t flex_int16_t;
72 typedef uint16_t flex_uint16_t;
73 typedef int32_t flex_int32_t;
74 typedef uint32_t flex_uint32_t;
75 #else
76 typedef signed char flex_int8_t;
77 typedef short int flex_int16_t;
78 typedef int flex_int32_t;
79 typedef unsigned char flex_uint8_t;
80 typedef unsigned short int flex_uint16_t;
81 typedef unsigned int flex_uint32_t;
82
83 /* Limits of integral types. */
84 #ifndef INT8_MIN
85 #define INT8_MIN (-128)
86 #endif
87 #ifndef INT16_MIN
88 #define INT16_MIN (-32767-1)
89 #endif
90 #ifndef INT32_MIN
91 #define INT32_MIN (-2147483647-1)
92 #endif
93 #ifndef INT8_MAX
94 #define INT8_MAX (127)
95 #endif
96 #ifndef INT16_MAX
97 #define INT16_MAX (32767)
98 #endif
99 #ifndef INT32_MAX
100 #define INT32_MAX (2147483647)
101 #endif
102 #ifndef UINT8_MAX
103 #define UINT8_MAX (255U)
104 #endif
105 #ifndef UINT16_MAX
106 #define UINT16_MAX (65535U)
107 #endif
108 #ifndef UINT32_MAX
109 #define UINT32_MAX (4294967295U)
110 #endif
111
112 #endif /* ! C99 */
113
114 #endif /* ! FLEXINT_H */
115
116 #ifdef __cplusplus
117
118 /* The "const" storage-class-modifier is valid. */
119 #define YY_USE_CONST
120
121 #else /* ! __cplusplus */
122
123 /* C99 requires __STDC__ to be defined as 1. */
124 #if defined (__STDC__)
125
126 #define YY_USE_CONST
127
128 #endif /* defined (__STDC__) */
129 #endif /* ! __cplusplus */
130
131 #ifdef YY_USE_CONST
132 #define yyconst const
133 #else
134 #define yyconst
135 #endif
136
137 /* Returned upon end-of-file. */
138 #define YY_NULL 0
139
140 /* Promotes a possibly negative, possibly signed char to an unsigned
141 * integer for use as an array index. If the signed char is negative,
142 * we want to instead treat it as an 8-bit unsigned char, hence the
143 * double cast.
144 */
145 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
146
147 /* Enter a start condition. This macro really ought to take a parameter,
148 * but we do it the disgusting crufty way forced on us by the ()-less
149 * definition of BEGIN.
150 */
151 #define BEGIN (yy_start) = 1 + 2 *
152
153 /* Translate the current start state into a value that can be later handed
154 * to BEGIN to return to the state. The YYSTATE alias is for lex
155 * compatibility.
156 */
157 #define YY_START (((yy_start) - 1) / 2)
158 #define YYSTATE YY_START
159
160 /* Action number for EOF rule of a given start state. */
161 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
162
163 /* Special action meaning "start processing a new file". */
164 #define YY_NEW_FILE skslrestart(skslin )
165
166 #define YY_END_OF_BUFFER_CHAR 0
167
168 /* Size of default input buffer. */
169 #ifndef YY_BUF_SIZE
170 #ifdef __ia64__
171 /* On IA-64, the buffer size is 16k, not 8k.
172 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
173 * Ditto for the __ia64__ case accordingly.
174 */
175 #define YY_BUF_SIZE 32768
176 #else
177 #define YY_BUF_SIZE 16384
178 #endif /* __ia64__ */
179 #endif
180
181 /* The state buf must be large enough to hold one state per character in the mai n buffer.
182 */
183 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
184
185 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
186 #define YY_TYPEDEF_YY_BUFFER_STATE
187 typedef struct yy_buffer_state *YY_BUFFER_STATE;
188 #endif
189
190 #ifndef YY_TYPEDEF_YY_SIZE_T
191 #define YY_TYPEDEF_YY_SIZE_T
192 typedef size_t yy_size_t;
193 #endif
194
195 extern yy_size_t skslleng;
196
197 extern FILE *skslin, *skslout;
198
199 #define EOB_ACT_CONTINUE_SCAN 0
200 #define EOB_ACT_END_OF_FILE 1
201 #define EOB_ACT_LAST_MATCH 2
202
203 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
204 * access to the local variable yy_act. Since yyless() is a macro, it would break
205 * existing scanners that call yyless() from OUTSIDE sksllex.
206 * One obvious solution it to make yy_act a global. I tried that, and saw
207 * a 5% performance hit in a non-sksllineno scanner, because yy_act is
208 * normally declared as a register variable-- so it is not worth it.
209 */
210 #define YY_LESS_LINENO(n) \
211 do { \
212 int yyl;\
213 for ( yyl = n; yyl < skslleng; ++yyl )\
214 if ( sksltext[yyl] == '\n' )\
215 --sksllineno;\
216 }while(0)
217 #define YY_LINENO_REWIND_TO(dst) \
218 do {\
219 const char *p;\
220 for ( p = yy_cp-1; p >= (dst); --p)\
221 if ( *p == '\n' )\
222 --sksllineno;\
223 }while(0)
224
225 /* Return all but the first "n" matched characters back to the input stream. */
226 #define yyless(n) \
227 do \
228 { \
229 /* Undo effects of setting up sksltext. */ \
230 int yyless_macro_arg = (n); \
231 YY_LESS_LINENO(yyless_macro_arg);\
232 *yy_cp = (yy_hold_char); \
233 YY_RESTORE_YY_MORE_OFFSET \
234 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
235 YY_DO_BEFORE_ACTION; /* set up sksltext again */ \
236 } \
237 while ( 0 )
238
239 #define unput(c) yyunput( c, (yytext_ptr) )
240
241 #ifndef YY_STRUCT_YY_BUFFER_STATE
242 #define YY_STRUCT_YY_BUFFER_STATE
243 struct yy_buffer_state
244 {
245 FILE *yy_input_file;
246
247 char *yy_ch_buf; /* input buffer */
248 char *yy_buf_pos; /* current position in input buffer */
249
250 /* Size of input buffer in bytes, not including room for EOB
251 * characters.
252 */
253 yy_size_t yy_buf_size;
254
255 /* Number of characters read into yy_ch_buf, not including EOB
256 * characters.
257 */
258 yy_size_t yy_n_chars;
259
260 /* Whether we "own" the buffer - i.e., we know we created it,
261 * and can realloc() it to grow it, and should free() it to
262 * delete it.
263 */
264 int yy_is_our_buffer;
265
266 /* Whether this is an "interactive" input source; if so, and
267 * if we're using stdio for input, then we want to use getc()
268 * instead of fread(), to make sure we stop fetching input after
269 * each newline.
270 */
271 int yy_is_interactive;
272
273 /* Whether we're considered to be at the beginning of a line.
274 * If so, '^' rules will be active on the next match, otherwise
275 * not.
276 */
277 int yy_at_bol;
278
279 int yy_bs_lineno; /**< The line count. */
280 int yy_bs_column; /**< The column count. */
281
282 /* Whether to try to fill the input buffer when we reach the
283 * end of it.
284 */
285 int yy_fill_buffer;
286
287 int yy_buffer_status;
288
289 #define YY_BUFFER_NEW 0
290 #define YY_BUFFER_NORMAL 1
291 /* When an EOF's been seen but there's still some text to process
292 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
293 * shouldn't try reading from the input source any more. We might
294 * still have a bunch of tokens to match, though, because of
295 * possible backing-up.
296 *
297 * When we actually see the EOF, we change the status to "new"
298 * (via skslrestart()), so that the user can continue scanning by
299 * just pointing skslin at a new input file.
300 */
301 #define YY_BUFFER_EOF_PENDING 2
302
303 };
304 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
305
306 /* Stack of input buffers. */
307 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
308 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
309 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
310
311 /* We provide macros for accessing buffer states in case in the
312 * future we want to put the buffer states in a more general
313 * "scanner state".
314 *
315 * Returns the top of the stack, or NULL.
316 */
317 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
318 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
319 : NULL)
320
321 /* Same as previous macro, but useful when we know that the buffer stack is not
322 * NULL or when we need an lvalue. For internal use only.
323 */
324 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
325
326 /* yy_hold_char holds the character lost when sksltext is formed. */
327 static char yy_hold_char;
328 static yy_size_t yy_n_chars; /* number of characters read into yy_ch_ buf */
329 yy_size_t skslleng;
330
331 /* Points to current character in buffer. */
332 static char *yy_c_buf_p = (char *) 0;
333 static int yy_init = 0; /* whether we need to initialize */
334 static int yy_start = 0; /* start state number */
335
336 /* Flag which is used to allow skslwrap()'s to do buffer switches
337 * instead of setting up a fresh skslin. A bit of a hack ...
338 */
339 static int yy_did_buffer_switch_on_eof;
340
341 void skslrestart (FILE *input_file );
342 void sksl_switch_to_buffer (YY_BUFFER_STATE new_buffer );
343 YY_BUFFER_STATE sksl_create_buffer (FILE *file,int size );
344 void sksl_delete_buffer (YY_BUFFER_STATE b );
345 void sksl_flush_buffer (YY_BUFFER_STATE b );
346 void skslpush_buffer_state (YY_BUFFER_STATE new_buffer );
347 void skslpop_buffer_state (void );
348
349 static void skslensure_buffer_stack (void );
350 static void sksl_load_buffer_state (void );
351 static void sksl_init_buffer (YY_BUFFER_STATE b,FILE *file );
352
353 #define YY_FLUSH_BUFFER sksl_flush_buffer(YY_CURRENT_BUFFER )
354
355 YY_BUFFER_STATE sksl_scan_buffer (char *base,yy_size_t size );
356 YY_BUFFER_STATE sksl_scan_string (yyconst char *yy_str );
357 YY_BUFFER_STATE sksl_scan_bytes (yyconst char *bytes,yy_size_t len );
358
359 void *skslalloc (yy_size_t );
360 void *skslrealloc (void *,yy_size_t );
361 void skslfree (void * );
362
363 #define yy_new_buffer sksl_create_buffer
364
365 #define yy_set_interactive(is_interactive) \
366 { \
367 if ( ! YY_CURRENT_BUFFER ){ \
368 skslensure_buffer_stack (); \
369 YY_CURRENT_BUFFER_LVALUE = \
370 sksl_create_buffer(skslin,YY_BUF_SIZE ); \
371 } \
372 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
373 }
374
375 #define yy_set_bol(at_bol) \
376 { \
377 if ( ! YY_CURRENT_BUFFER ){\
378 skslensure_buffer_stack (); \
379 YY_CURRENT_BUFFER_LVALUE = \
380 sksl_create_buffer(skslin,YY_BUF_SIZE ); \
381 } \
382 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
383 }
384
385 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
386
387 /* Begin user sect3 */
388
389 typedef unsigned char YY_CHAR;
390
391 FILE *skslin = (FILE *) 0, *skslout = (FILE *) 0;
392
393 typedef int yy_state_type;
394
395 extern int sksllineno;
396
397 int sksllineno = 1;
398
399 extern char *sksltext;
400 #define yytext_ptr sksltext
401
402 static yy_state_type yy_get_previous_state (void );
403 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
404 static int yy_get_next_buffer (void );
405 static void yy_fatal_error (yyconst char msg[] );
406
407 /* Done after the current pattern has been matched and before the
408 * corresponding action - sets up sksltext.
409 */
410 #define YY_DO_BEFORE_ACTION \
411 (yytext_ptr) = yy_bp; \
412 skslleng = (size_t) (yy_cp - yy_bp); \
413 (yy_hold_char) = *yy_cp; \
414 *yy_cp = '\0'; \
415 (yy_c_buf_p) = yy_cp;
416
417 #define YY_NUM_RULES 80
418 #define YY_END_OF_BUFFER 81
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 yyconst flex_int16_t yy_accept[185] =
427 { 0,
428 0, 0, 81, 79, 78, 78, 52, 79, 27, 43,
429 48, 29, 30, 41, 39, 36, 40, 35, 42, 4,
430 54, 75, 59, 55, 58, 53, 33, 34, 47, 27,
431 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
432 27, 27, 27, 27, 27, 31, 46, 32, 78, 57,
433 28, 27, 66, 51, 71, 64, 37, 62, 38, 63,
434 1, 0, 76, 65, 2, 4, 0, 44, 61, 56,
435 60, 45, 70, 50, 27, 27, 27, 11, 27, 27,
436 27, 27, 7, 16, 27, 27, 27, 27, 27, 27,
437 27, 27, 27, 27, 69, 49, 28, 74, 0, 0,
438
439 0, 76, 1, 0, 0, 3, 67, 68, 73, 27,
440 27, 27, 27, 27, 9, 27, 27, 27, 27, 27,
441 17, 27, 27, 27, 27, 27, 27, 72, 0, 1,
442 77, 0, 0, 2, 27, 27, 27, 27, 8, 27,
443 27, 27, 27, 21, 27, 27, 27, 27, 5, 27,
444 27, 0, 1, 12, 20, 27, 27, 6, 23, 18,
445 27, 27, 27, 27, 27, 27, 10, 27, 27, 25,
446 27, 27, 15, 24, 27, 27, 14, 22, 27, 19,
447 13, 27, 26, 0
448 } ;
449
450 static yyconst flex_int32_t yy_ec[256] =
451 { 0,
452 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
453 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
454 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
455 1, 2, 4, 1, 5, 6, 7, 8, 1, 9,
456 10, 11, 12, 13, 14, 15, 16, 17, 17, 17,
457 17, 17, 17, 17, 17, 17, 17, 18, 19, 20,
458 21, 22, 23, 1, 6, 6, 6, 6, 24, 6,
459 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
460 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
461 25, 1, 26, 27, 6, 1, 28, 29, 30, 31,
462
463 32, 33, 34, 35, 36, 6, 37, 38, 39, 40,
464 41, 42, 6, 43, 44, 45, 46, 6, 47, 6,
465 48, 6, 49, 50, 51, 1, 1, 1, 1, 1,
466 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
467 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
468 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
469 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
470 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
471 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
472 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
473
474 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
475 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
476 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
477 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
478 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
479 1, 1, 1, 1, 1
480 } ;
481
482 static yyconst flex_int32_t yy_meta[52] =
483 { 0,
484 1, 1, 2, 1, 1, 3, 1, 1, 1, 1,
485 1, 1, 1, 1, 1, 1, 4, 1, 1, 1,
486 1, 1, 1, 3, 1, 1, 1, 3, 3, 3,
487 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
488 3, 3, 3, 3, 3, 3, 3, 3, 1, 1,
489 1
490 } ;
491
492 static yyconst flex_int16_t yy_base[190] =
493 { 0,
494 0, 0, 222, 223, 50, 52, 200, 0, 0, 199,
495 48, 223, 223, 198, 45, 223, 44, 201, 51, 44,
496 223, 223, 43, 196, 49, 223, 223, 223, 52, 173,
497 174, 39, 176, 46, 177, 44, 50, 180, 165, 167,
498 177, 163, 164, 166, 170, 223, 39, 223, 79, 223,
499 0, 0, 223, 183, 223, 223, 223, 223, 223, 223,
500 66, 192, 0, 223, 68, 71, 82, 181, 223, 223,
501 223, 180, 223, 179, 167, 158, 153, 0, 152, 157,
502 151, 159, 0, 151, 143, 143, 158, 143, 155, 141,
503 142, 138, 147, 146, 223, 160, 0, 223, 90, 169,
504
505 163, 0, 84, 97, 161, 160, 223, 223, 223, 148,
506 61, 145, 142, 129, 0, 137, 125, 129, 127, 132,
507 0, 137, 120, 119, 132, 130, 124, 223, 144, 143,
508 223, 98, 142, 141, 120, 111, 119, 126, 0, 121,
509 110, 106, 104, 0, 103, 112, 104, 116, 0, 104,
510 112, 126, 125, 0, 0, 101, 97, 0, 0, 0,
511 94, 99, 93, 96, 90, 91, 0, 87, 101, 0,
512 89, 94, 0, 0, 90, 94, 0, 0, 72, 0,
513 0, 57, 0, 223, 90, 114, 116, 120, 124
514 } ;
515
516 static yyconst flex_int16_t yy_def[190] =
517 { 0,
518 184, 1, 184, 184, 184, 184, 184, 185, 186, 184,
519 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
520 184, 184, 184, 184, 184, 184, 184, 184, 184, 186,
521 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
522 186, 186, 186, 186, 186, 184, 184, 184, 184, 184,
523 187, 186, 184, 184, 184, 184, 184, 184, 184, 184,
524 184, 188, 189, 184, 184, 184, 184, 184, 184, 184,
525 184, 184, 184, 184, 186, 186, 186, 186, 186, 186,
526 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
527 186, 186, 186, 186, 184, 184, 187, 184, 184, 188,
528
529 188, 189, 184, 184, 184, 184, 184, 184, 184, 186,
530 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
531 186, 186, 186, 186, 186, 186, 186, 184, 184, 184,
532 184, 184, 184, 184, 186, 186, 186, 186, 186, 186,
533 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
534 186, 184, 184, 186, 186, 186, 186, 186, 186, 186,
535 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
536 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
537 186, 186, 186, 0, 184, 184, 184, 184, 184
538 } ;
539
540 static yyconst flex_int16_t yy_nxt[275] =
541 { 0,
542 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
543 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
544 24, 25, 26, 9, 27, 28, 29, 9, 30, 31,
545 32, 33, 34, 9, 35, 36, 9, 37, 38, 9,
546 39, 40, 41, 42, 43, 44, 45, 9, 46, 47,
547 48, 49, 49, 49, 49, 54, 57, 59, 65, 95,
548 66, 62, 68, 69, 60, 58, 63, 67, 55, 71,
549 72, 64, 73, 80, 77, 67, 83, 85, 74, 78,
550 49, 49, 61, 84, 103, 65, 81, 66, 96, 99,
551 86, 104, 51, 105, 67, 105, 183, 99, 106, 104,
552
553 103, 129, 67, 129, 136, 137, 130, 132, 133, 152,
554 133, 152, 182, 134, 153, 132, 52, 52, 97, 97,
555 100, 100, 100, 100, 102, 181, 102, 102, 180, 179,
556 178, 177, 176, 175, 174, 173, 172, 171, 170, 169,
557 168, 153, 153, 167, 166, 165, 164, 163, 162, 161,
558 160, 159, 158, 157, 156, 155, 154, 134, 134, 130,
559 130, 151, 150, 149, 148, 147, 146, 145, 144, 143,
560 142, 141, 140, 139, 138, 135, 106, 106, 131, 101,
561 128, 127, 126, 125, 124, 123, 122, 121, 120, 119,
562 118, 117, 116, 115, 114, 113, 112, 111, 110, 109,
563
564 108, 107, 101, 98, 94, 93, 92, 91, 90, 89,
565 88, 87, 82, 79, 76, 75, 70, 61, 56, 53,
566 50, 184, 3, 184, 184, 184, 184, 184, 184, 184,
567 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
568 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
569 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
570 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
571 184, 184, 184, 184
572 } ;
573
574 static yyconst flex_int16_t yy_chk[275] =
575 { 0,
576 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
577 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
578 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
579 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
580 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
581 1, 5, 5, 6, 6, 11, 15, 17, 20, 47,
582 20, 19, 23, 23, 17, 15, 19, 20, 11, 25,
583 25, 19, 29, 34, 32, 20, 36, 37, 29, 32,
584 49, 49, 61, 36, 65, 66, 34, 66, 47, 61,
585 37, 65, 185, 67, 66, 67, 182, 61, 67, 65,
586
587 103, 99, 66, 99, 111, 111, 99, 103, 104, 132,
588 104, 132, 179, 104, 132, 103, 186, 186, 187, 187,
589 188, 188, 188, 188, 189, 176, 189, 189, 175, 172,
590 171, 169, 168, 166, 165, 164, 163, 162, 161, 157,
591 156, 153, 152, 151, 150, 148, 147, 146, 145, 143,
592 142, 141, 140, 138, 137, 136, 135, 134, 133, 130,
593 129, 127, 126, 125, 124, 123, 122, 120, 119, 118,
594 117, 116, 114, 113, 112, 110, 106, 105, 101, 100,
595 96, 94, 93, 92, 91, 90, 89, 88, 87, 86,
596 85, 84, 82, 81, 80, 79, 77, 76, 75, 74,
597
598 72, 68, 62, 54, 45, 44, 43, 42, 41, 40,
599 39, 38, 35, 33, 31, 30, 24, 18, 14, 10,
600 7, 3, 184, 184, 184, 184, 184, 184, 184, 184,
601 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
602 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
603 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
604 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
605 184, 184, 184, 184
606 } ;
607
608 /* Table of booleans, true if rule could match eol. */
609 static yyconst flex_int32_t yy_rule_can_match_eol[81] =
610 { 0,
611 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
612 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
613 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
614 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
615 0, };
616
617 static yy_state_type yy_last_accepting_state;
618 static char *yy_last_accepting_cpos;
619
620 extern int sksl_flex_debug;
621 int sksl_flex_debug = 0;
622
623 /* The intent behind this definition is that it'll catch
624 * any uses of REJECT which flex missed.
625 */
626 #define REJECT reject_used_but_not_detected
627 #define yymore() yymore_used_but_not_detected
628 #define YY_MORE_ADJ 0
629 #define YY_RESTORE_YY_MORE_OFFSET
630 char *sksltext;
631 #line 1 "sksl.flex"
632 /*
633
634 This file is IGNORED during the build process!
635
636 As this file is updated so infrequently and flex is not universally pres ent on build machines,
637 the lex.skiasl.cpp file must be manually regenerated if you make any cha nges to this file. Just
638 run:
639
640 flex sksl.flex
641
642 */
643 #define YY_NO_UNISTD_H 1
644 #line 19 "sksl.flex"
645 // generated from scanner.flex
646 // NOT AUTOGENERATED DURING THE BUILD, you must manually run flex on scanner.fle x to regenerate
647 // this file
648 #line 642 "lex.sksl.c"
649
650 #define INITIAL 0
651
652 #ifndef YY_NO_UNISTD_H
653 /* Special case for "unistd.h", since it is non-ANSI. We include it way
654 * down here because we want the user's section 1 to have been scanned first.
655 * The user has a chance to override it with an option.
656 */
657 #include <unistd.h>
658 #endif
659
660 #ifndef YY_EXTRA_TYPE
661 #define YY_EXTRA_TYPE void *
662 #endif
663
664 static int yy_init_globals (void );
665
666 /* Accessor methods to globals.
667 These are made visible to non-reentrant scanners for convenience. */
668
669 int sksllex_destroy (void );
670
671 int skslget_debug (void );
672
673 void skslset_debug (int debug_flag );
674
675 YY_EXTRA_TYPE skslget_extra (void );
676
677 void skslset_extra (YY_EXTRA_TYPE user_defined );
678
679 FILE *skslget_in (void );
680
681 void skslset_in (FILE * in_str );
682
683 FILE *skslget_out (void );
684
685 void skslset_out (FILE * out_str );
686
687 yy_size_t skslget_leng (void );
688
689 char *skslget_text (void );
690
691 int skslget_lineno (void );
692
693 void skslset_lineno (int line_number );
694
695 /* Macros after this point can all be overridden by user definitions in
696 * section 1.
697 */
698
699 #ifndef YY_SKIP_YYWRAP
700 #ifdef __cplusplus
701 extern "C" int skslwrap (void );
702 #else
703 extern int skslwrap (void );
704 #endif
705 #endif
706
707 static void yyunput (int c,char *buf_ptr );
708
709 #ifndef yytext_ptr
710 static void yy_flex_strncpy (char *,yyconst char *,int );
711 #endif
712
713 #ifdef YY_NEED_STRLEN
714 static int yy_flex_strlen (yyconst char * );
715 #endif
716
717 #ifndef YY_NO_INPUT
718
719 #ifdef __cplusplus
720 static int yyinput (void );
721 #else
722 static int input (void );
723 #endif
724
725 #endif
726
727 /* Amount of stuff to slurp up with each read. */
728 #ifndef YY_READ_BUF_SIZE
729 #ifdef __ia64__
730 /* On IA-64, the buffer size is 16k, not 8k */
731 #define YY_READ_BUF_SIZE 16384
732 #else
733 #define YY_READ_BUF_SIZE 8192
734 #endif /* __ia64__ */
735 #endif
736
737 /* Copy whatever the last rule matched to the standard output. */
738 #ifndef ECHO
739 /* This used to be an fputs(), but since the string might contain NUL's,
740 * we now use fwrite().
741 */
742 #define ECHO do { if (fwrite( sksltext, skslleng, 1, skslout )) {} } while (0)
743 #endif
744
745 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
746 * is returned in "result".
747 */
748 #ifndef YY_INPUT
749 #define YY_INPUT(buf,result,max_size) \
750 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
751 { \
752 int c = '*'; \
753 size_t n; \
754 for ( n = 0; n < max_size && \
755 (c = getc( skslin )) != EOF && c != '\n'; ++n ) \
756 buf[n] = (char) c; \
757 if ( c == '\n' ) \
758 buf[n++] = (char) c; \
759 if ( c == EOF && ferror( skslin ) ) \
760 YY_FATAL_ERROR( "input in flex scanner failed" ); \
761 result = n; \
762 } \
763 else \
764 { \
765 errno=0; \
766 while ( (result = fread(buf, 1, max_size, skslin))==0 && ferror( skslin)) \
767 { \
768 if( errno != EINTR) \
769 { \
770 YY_FATAL_ERROR( "input in flex scanner failed" ) ; \
771 break; \
772 } \
773 errno=0; \
774 clearerr(skslin); \
775 } \
776 }\
777 \
778
779 #endif
780
781 /* No semi-colon after return; correct usage is to write "yyterminate();" -
782 * we don't want an extra ';' after the "return" because that will cause
783 * some compilers to complain about unreachable statements.
784 */
785 #ifndef yyterminate
786 #define yyterminate() return YY_NULL
787 #endif
788
789 /* Number of entries by which start-condition stack grows. */
790 #ifndef YY_START_STACK_INCR
791 #define YY_START_STACK_INCR 25
792 #endif
793
794 /* Report a fatal error. */
795 #ifndef YY_FATAL_ERROR
796 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
797 #endif
798
799 /* end tables serialization structures and prototypes */
800
801 /* Default declaration of generated scanner - a define so the user can
802 * easily add parameters.
803 */
804 #ifndef YY_DECL
805 #define YY_DECL_IS_OURS 1
806
807 extern int sksllex (void);
808
809 #define YY_DECL int sksllex (void)
810 #endif /* !YY_DECL */
811
812 /* Code executed at the beginning of each rule, after sksltext and skslleng
813 * have been set up.
814 */
815 #ifndef YY_USER_ACTION
816 #define YY_USER_ACTION
817 #endif
818
819 /* Code executed at the end of each rule. */
820 #ifndef YY_BREAK
821 #define YY_BREAK break;
822 #endif
823
824 #define YY_RULE_SETUP \
825 YY_USER_ACTION
826
827 /** The main scanner function which does all the work.
828 */
829 YY_DECL
830 {
831 register yy_state_type yy_current_state;
832 register char *yy_cp, *yy_bp;
833 register int yy_act;
834
835 if ( !(yy_init) )
836 {
837 (yy_init) = 1;
838
839 #ifdef YY_USER_INIT
840 YY_USER_INIT;
841 #endif
842
843 if ( ! (yy_start) )
844 (yy_start) = 1; /* first start state */
845
846 if ( ! skslin )
847 skslin = stdin;
848
849 if ( ! skslout )
850 skslout = stdout;
851
852 if ( ! YY_CURRENT_BUFFER ) {
853 skslensure_buffer_stack ();
854 YY_CURRENT_BUFFER_LVALUE =
855 sksl_create_buffer(skslin,YY_BUF_SIZE );
856 }
857
858 sksl_load_buffer_state( );
859 }
860
861 {
862 #line 27 "sksl.flex"
863
864
865 #line 859 "lex.sksl.c"
866
867 while ( 1 ) /* loops until end-of-file is reached */
868 {
869 yy_cp = (yy_c_buf_p);
870
871 /* Support of sksltext. */
872 *yy_cp = (yy_hold_char);
873
874 /* yy_bp points to the position in yy_ch_buf of the start of
875 * the current run.
876 */
877 yy_bp = yy_cp;
878
879 yy_current_state = (yy_start);
880 yy_match:
881 do
882 {
883 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
884 if ( yy_accept[yy_current_state] )
885 {
886 (yy_last_accepting_state) = yy_current_state;
887 (yy_last_accepting_cpos) = yy_cp;
888 }
889 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_c urrent_state )
890 {
891 yy_current_state = (int) yy_def[yy_current_state ];
892 if ( yy_current_state >= 185 )
893 yy_c = yy_meta[(unsigned int) yy_c];
894 }
895 yy_current_state = yy_nxt[yy_base[yy_current_state] + (u nsigned int) yy_c];
896 ++yy_cp;
897 }
898 while ( yy_current_state != 184 );
899 yy_cp = (yy_last_accepting_cpos);
900 yy_current_state = (yy_last_accepting_state);
901
902 yy_find_action:
903 yy_act = yy_accept[yy_current_state];
904
905 YY_DO_BEFORE_ACTION;
906
907 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
908 {
909 yy_size_t yyl;
910 for ( yyl = 0; yyl < skslleng; ++yyl )
911 if ( sksltext[yyl] == '\n' )
912
913 sksllineno++;
914 ;
915 }
916
917 do_action: /* This label is used only to access EOF actions. */
918
919 switch ( yy_act )
920 { /* beginning of action switch */
921 case 0: /* must back up */
922 /* undo the effects of YY_DO_BEFORE_ACTION */
923 *yy_cp = (yy_hold_char);
924 yy_cp = (yy_last_accepting_cpos);
925 yy_current_state = (yy_last_accepting_state);
926 goto yy_find_action;
927
928 case 1:
929 YY_RULE_SETUP
930 #line 29 "sksl.flex"
931 { return SkSL::Token::FLOAT_LITERAL; }
932 YY_BREAK
933 case 2:
934 YY_RULE_SETUP
935 #line 31 "sksl.flex"
936 { return SkSL::Token::FLOAT_LITERAL; }
937 YY_BREAK
938 case 3:
939 YY_RULE_SETUP
940 #line 33 "sksl.flex"
941 { return SkSL::Token::FLOAT_LITERAL; }
942 YY_BREAK
943 case 4:
944 YY_RULE_SETUP
945 #line 35 "sksl.flex"
946 { return SkSL::Token::INT_LITERAL; }
947 YY_BREAK
948 case 5:
949 YY_RULE_SETUP
950 #line 37 "sksl.flex"
951 { return SkSL::Token::TRUE_LITERAL; }
952 YY_BREAK
953 case 6:
954 YY_RULE_SETUP
955 #line 39 "sksl.flex"
956 { return SkSL::Token::FALSE_LITERAL; }
957 YY_BREAK
958 case 7:
959 YY_RULE_SETUP
960 #line 41 "sksl.flex"
961 { return SkSL::Token::IF; }
962 YY_BREAK
963 case 8:
964 YY_RULE_SETUP
965 #line 43 "sksl.flex"
966 { return SkSL::Token::ELSE; }
967 YY_BREAK
968 case 9:
969 YY_RULE_SETUP
970 #line 45 "sksl.flex"
971 { return SkSL::Token::FOR; }
972 YY_BREAK
973 case 10:
974 YY_RULE_SETUP
975 #line 47 "sksl.flex"
976 { return SkSL::Token::WHILE; }
977 YY_BREAK
978 case 11:
979 YY_RULE_SETUP
980 #line 49 "sksl.flex"
981 { return SkSL::Token::DO; }
982 YY_BREAK
983 case 12:
984 YY_RULE_SETUP
985 #line 51 "sksl.flex"
986 { return SkSL::Token::BREAK; }
987 YY_BREAK
988 case 13:
989 YY_RULE_SETUP
990 #line 53 "sksl.flex"
991 { return SkSL::Token::CONTINUE; }
992 YY_BREAK
993 case 14:
994 YY_RULE_SETUP
995 #line 55 "sksl.flex"
996 { return SkSL::Token::DISCARD; }
997 YY_BREAK
998 case 15:
999 YY_RULE_SETUP
1000 #line 57 "sksl.flex"
1001 { return SkSL::Token::RETURN; }
1002 YY_BREAK
1003 case 16:
1004 YY_RULE_SETUP
1005 #line 59 "sksl.flex"
1006 { return SkSL::Token::IN; }
1007 YY_BREAK
1008 case 17:
1009 YY_RULE_SETUP
1010 #line 61 "sksl.flex"
1011 { return SkSL::Token::OUT; }
1012 YY_BREAK
1013 case 18:
1014 YY_RULE_SETUP
1015 #line 63 "sksl.flex"
1016 { return SkSL::Token::INOUT; }
1017 YY_BREAK
1018 case 19:
1019 YY_RULE_SETUP
1020 #line 65 "sksl.flex"
1021 { return SkSL::Token::UNIFORM; }
1022 YY_BREAK
1023 case 20:
1024 YY_RULE_SETUP
1025 #line 67 "sksl.flex"
1026 { return SkSL::Token::CONST; }
1027 YY_BREAK
1028 case 21:
1029 YY_RULE_SETUP
1030 #line 69 "sksl.flex"
1031 { return SkSL::Token::LOWP; }
1032 YY_BREAK
1033 case 22:
1034 YY_RULE_SETUP
1035 #line 71 "sksl.flex"
1036 { return SkSL::Token::MEDIUMP; }
1037 YY_BREAK
1038 case 23:
1039 YY_RULE_SETUP
1040 #line 73 "sksl.flex"
1041 { return SkSL::Token::HIGHP; }
1042 YY_BREAK
1043 case 24:
1044 YY_RULE_SETUP
1045 #line 75 "sksl.flex"
1046 { return SkSL::Token::STRUCT; }
1047 YY_BREAK
1048 case 25:
1049 YY_RULE_SETUP
1050 #line 77 "sksl.flex"
1051 { return SkSL::Token::LAYOUT; }
1052 YY_BREAK
1053 case 26:
1054 YY_RULE_SETUP
1055 #line 79 "sksl.flex"
1056 { return SkSL::Token::PRECISION; }
1057 YY_BREAK
1058 case 27:
1059 YY_RULE_SETUP
1060 #line 81 "sksl.flex"
1061 { return SkSL::Token::IDENTIFIER; }
1062 YY_BREAK
1063 case 28:
1064 YY_RULE_SETUP
1065 #line 83 "sksl.flex"
1066 { return SkSL::Token::DIRECTIVE; }
1067 YY_BREAK
1068 case 29:
1069 YY_RULE_SETUP
1070 #line 85 "sksl.flex"
1071 { return SkSL::Token::LPAREN; }
1072 YY_BREAK
1073 case 30:
1074 YY_RULE_SETUP
1075 #line 87 "sksl.flex"
1076 { return SkSL::Token::RPAREN; }
1077 YY_BREAK
1078 case 31:
1079 YY_RULE_SETUP
1080 #line 89 "sksl.flex"
1081 { return SkSL::Token::LBRACE; }
1082 YY_BREAK
1083 case 32:
1084 YY_RULE_SETUP
1085 #line 91 "sksl.flex"
1086 { return SkSL::Token::RBRACE; }
1087 YY_BREAK
1088 case 33:
1089 YY_RULE_SETUP
1090 #line 93 "sksl.flex"
1091 { return SkSL::Token::LBRACKET; }
1092 YY_BREAK
1093 case 34:
1094 YY_RULE_SETUP
1095 #line 95 "sksl.flex"
1096 { return SkSL::Token::RBRACKET; }
1097 YY_BREAK
1098 case 35:
1099 YY_RULE_SETUP
1100 #line 97 "sksl.flex"
1101 { return SkSL::Token::DOT; }
1102 YY_BREAK
1103 case 36:
1104 YY_RULE_SETUP
1105 #line 99 "sksl.flex"
1106 { return SkSL::Token::COMMA; }
1107 YY_BREAK
1108 case 37:
1109 YY_RULE_SETUP
1110 #line 101 "sksl.flex"
1111 { return SkSL::Token::PLUSPLUS; }
1112 YY_BREAK
1113 case 38:
1114 YY_RULE_SETUP
1115 #line 103 "sksl.flex"
1116 { return SkSL::Token::MINUSMINUS; }
1117 YY_BREAK
1118 case 39:
1119 YY_RULE_SETUP
1120 #line 105 "sksl.flex"
1121 { return SkSL::Token::PLUS; }
1122 YY_BREAK
1123 case 40:
1124 YY_RULE_SETUP
1125 #line 107 "sksl.flex"
1126 { return SkSL::Token::MINUS; }
1127 YY_BREAK
1128 case 41:
1129 YY_RULE_SETUP
1130 #line 109 "sksl.flex"
1131 { return SkSL::Token::STAR; }
1132 YY_BREAK
1133 case 42:
1134 YY_RULE_SETUP
1135 #line 111 "sksl.flex"
1136 { return SkSL::Token::SLASH; }
1137 YY_BREAK
1138 case 43:
1139 YY_RULE_SETUP
1140 #line 113 "sksl.flex"
1141 { return SkSL::Token::PERCENT; }
1142 YY_BREAK
1143 case 44:
1144 YY_RULE_SETUP
1145 #line 115 "sksl.flex"
1146 { return SkSL::Token::SHL; }
1147 YY_BREAK
1148 case 45:
1149 YY_RULE_SETUP
1150 #line 117 "sksl.flex"
1151 { return SkSL::Token::SHR; }
1152 YY_BREAK
1153 case 46:
1154 YY_RULE_SETUP
1155 #line 119 "sksl.flex"
1156 { return SkSL::Token::BITWISEOR; }
1157 YY_BREAK
1158 case 47:
1159 YY_RULE_SETUP
1160 #line 121 "sksl.flex"
1161 { return SkSL::Token::BITWISEXOR; }
1162 YY_BREAK
1163 case 48:
1164 YY_RULE_SETUP
1165 #line 123 "sksl.flex"
1166 { return SkSL::Token::BITWISEAND; }
1167 YY_BREAK
1168 case 49:
1169 YY_RULE_SETUP
1170 #line 125 "sksl.flex"
1171 { return SkSL::Token::LOGICALOR; }
1172 YY_BREAK
1173 case 50:
1174 YY_RULE_SETUP
1175 #line 127 "sksl.flex"
1176 { return SkSL::Token::LOGICALXOR; }
1177 YY_BREAK
1178 case 51:
1179 YY_RULE_SETUP
1180 #line 129 "sksl.flex"
1181 { return SkSL::Token::LOGICALAND; }
1182 YY_BREAK
1183 case 52:
1184 YY_RULE_SETUP
1185 #line 131 "sksl.flex"
1186 { return SkSL::Token::NOT; }
1187 YY_BREAK
1188 case 53:
1189 YY_RULE_SETUP
1190 #line 133 "sksl.flex"
1191 { return SkSL::Token::QUESTION; }
1192 YY_BREAK
1193 case 54:
1194 YY_RULE_SETUP
1195 #line 135 "sksl.flex"
1196 { return SkSL::Token::COLON; }
1197 YY_BREAK
1198 case 55:
1199 YY_RULE_SETUP
1200 #line 137 "sksl.flex"
1201 { return SkSL::Token::EQ; }
1202 YY_BREAK
1203 case 56:
1204 YY_RULE_SETUP
1205 #line 139 "sksl.flex"
1206 { return SkSL::Token::EQEQ; }
1207 YY_BREAK
1208 case 57:
1209 YY_RULE_SETUP
1210 #line 141 "sksl.flex"
1211 { return SkSL::Token::NEQ; }
1212 YY_BREAK
1213 case 58:
1214 YY_RULE_SETUP
1215 #line 143 "sksl.flex"
1216 { return SkSL::Token::GT; }
1217 YY_BREAK
1218 case 59:
1219 YY_RULE_SETUP
1220 #line 145 "sksl.flex"
1221 { return SkSL::Token::LT; }
1222 YY_BREAK
1223 case 60:
1224 YY_RULE_SETUP
1225 #line 147 "sksl.flex"
1226 { return SkSL::Token::GTEQ; }
1227 YY_BREAK
1228 case 61:
1229 YY_RULE_SETUP
1230 #line 149 "sksl.flex"
1231 { return SkSL::Token::LTEQ; }
1232 YY_BREAK
1233 case 62:
1234 YY_RULE_SETUP
1235 #line 151 "sksl.flex"
1236 { return SkSL::Token::PLUSEQ; }
1237 YY_BREAK
1238 case 63:
1239 YY_RULE_SETUP
1240 #line 153 "sksl.flex"
1241 { return SkSL::Token::MINUSEQ; }
1242 YY_BREAK
1243 case 64:
1244 YY_RULE_SETUP
1245 #line 155 "sksl.flex"
1246 { return SkSL::Token::STAREQ; }
1247 YY_BREAK
1248 case 65:
1249 YY_RULE_SETUP
1250 #line 157 "sksl.flex"
1251 { return SkSL::Token::SLASHEQ; }
1252 YY_BREAK
1253 case 66:
1254 YY_RULE_SETUP
1255 #line 159 "sksl.flex"
1256 { return SkSL::Token::PERCENTEQ; }
1257 YY_BREAK
1258 case 67:
1259 YY_RULE_SETUP
1260 #line 161 "sksl.flex"
1261 { return SkSL::Token::SHLEQ; }
1262 YY_BREAK
1263 case 68:
1264 YY_RULE_SETUP
1265 #line 163 "sksl.flex"
1266 { return SkSL::Token::SHREQ; }
1267 YY_BREAK
1268 case 69:
1269 YY_RULE_SETUP
1270 #line 165 "sksl.flex"
1271 { return SkSL::Token::BITWISEOREQ; }
1272 YY_BREAK
1273 case 70:
1274 YY_RULE_SETUP
1275 #line 167 "sksl.flex"
1276 { return SkSL::Token::BITWISEXOREQ; }
1277 YY_BREAK
1278 case 71:
1279 YY_RULE_SETUP
1280 #line 169 "sksl.flex"
1281 { return SkSL::Token::BITWISEANDEQ; }
1282 YY_BREAK
1283 case 72:
1284 YY_RULE_SETUP
1285 #line 171 "sksl.flex"
1286 { return SkSL::Token::LOGICALOREQ; }
1287 YY_BREAK
1288 case 73:
1289 YY_RULE_SETUP
1290 #line 173 "sksl.flex"
1291 { return SkSL::Token::LOGICALXOREQ; }
1292 YY_BREAK
1293 case 74:
1294 YY_RULE_SETUP
1295 #line 175 "sksl.flex"
1296 { return SkSL::Token::LOGICALANDEQ; }
1297 YY_BREAK
1298 case 75:
1299 YY_RULE_SETUP
1300 #line 177 "sksl.flex"
1301 { return SkSL::Token::SEMICOLON; }
1302 YY_BREAK
1303 case 76:
1304 YY_RULE_SETUP
1305 #line 179 "sksl.flex"
1306 /* line comment */
1307 YY_BREAK
1308 case 77:
1309 /* rule 77 can match eol */
1310 YY_RULE_SETUP
1311 #line 181 "sksl.flex"
1312 /* block comment */
1313 YY_BREAK
1314 case 78:
1315 /* rule 78 can match eol */
1316 YY_RULE_SETUP
1317 #line 183 "sksl.flex"
1318 /* whitespace */
1319 YY_BREAK
1320 case 79:
1321 YY_RULE_SETUP
1322 #line 185 "sksl.flex"
1323 { return SkSL::Token::INVALID_TOKEN; }
1324 YY_BREAK
1325 case 80:
1326 YY_RULE_SETUP
1327 #line 187 "sksl.flex"
1328 ECHO;
1329 YY_BREAK
1330 #line 1324 "lex.sksl.c"
1331 case YY_STATE_EOF(INITIAL):
1332 yyterminate();
1333
1334 case YY_END_OF_BUFFER:
1335 {
1336 /* Amount of text matched not including the EOB char. */
1337 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1 ;
1338
1339 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1340 *yy_cp = (yy_hold_char);
1341 YY_RESTORE_YY_MORE_OFFSET
1342
1343 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1344 {
1345 /* We're scanning a new file or input source. It's
1346 * possible that this happened because the user
1347 * just pointed skslin at a new source and called
1348 * sksllex(). If so, then we have to assure
1349 * consistency between YY_CURRENT_BUFFER and our
1350 * globals. Here is the right place to do so, because
1351 * this is the first action (other than possibly a
1352 * back-up) that will match for the new input source.
1353 */
1354 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1355 YY_CURRENT_BUFFER_LVALUE->yy_input_file = skslin;
1356 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_N ORMAL;
1357 }
1358
1359 /* Note that here we test for yy_c_buf_p "<=" to the position
1360 * of the first EOB in the buffer, since yy_c_buf_p will
1361 * already have been incremented past the NUL character
1362 * (since all states make transitions on EOB to the
1363 * end-of-buffer state). Contrast this with the test
1364 * in input().
1365 */
1366 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_ chars)] )
1367 { /* This was really a NUL. */
1368 yy_state_type yy_next_state;
1369
1370 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1371
1372 yy_current_state = yy_get_previous_state( );
1373
1374 /* Okay, we're now positioned to make the NUL
1375 * transition. We couldn't have
1376 * yy_get_previous_state() go ahead and do it
1377 * for us because it doesn't know how to deal
1378 * with the possibility of jamming (and we don't
1379 * want to build jamming into it because then it
1380 * will run more slowly).
1381 */
1382
1383 yy_next_state = yy_try_NUL_trans( yy_current_state );
1384
1385 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1386
1387 if ( yy_next_state )
1388 {
1389 /* Consume the NUL. */
1390 yy_cp = ++(yy_c_buf_p);
1391 yy_current_state = yy_next_state;
1392 goto yy_match;
1393 }
1394
1395 else
1396 {
1397 yy_cp = (yy_last_accepting_cpos);
1398 yy_current_state = (yy_last_accepting_state);
1399 goto yy_find_action;
1400 }
1401 }
1402
1403 else switch ( yy_get_next_buffer( ) )
1404 {
1405 case EOB_ACT_END_OF_FILE:
1406 {
1407 (yy_did_buffer_switch_on_eof) = 0;
1408
1409 if ( skslwrap( ) )
1410 {
1411 /* Note: because we've taken care in
1412 * yy_get_next_buffer() to have set up
1413 * sksltext, we can now set up
1414 * yy_c_buf_p so that if some total
1415 * hoser (like flex itself) wants to
1416 * call the scanner after we return the
1417 * YY_NULL, it'll still work - another
1418 * YY_NULL will get returned.
1419 */
1420 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_AD J;
1421
1422 yy_act = YY_STATE_EOF(YY_START);
1423 goto do_action;
1424 }
1425
1426 else
1427 {
1428 if ( ! (yy_did_buffer_switch_on_eof) )
1429 YY_NEW_FILE;
1430 }
1431 break;
1432 }
1433
1434 case EOB_ACT_CONTINUE_SCAN:
1435 (yy_c_buf_p) =
1436 (yytext_ptr) + yy_amount_of_matched_text ;
1437
1438 yy_current_state = yy_get_previous_state( );
1439
1440 yy_cp = (yy_c_buf_p);
1441 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1442 goto yy_match;
1443
1444 case EOB_ACT_LAST_MATCH:
1445 (yy_c_buf_p) =
1446 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars )];
1447
1448 yy_current_state = yy_get_previous_state( );
1449
1450 yy_cp = (yy_c_buf_p);
1451 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1452 goto yy_find_action;
1453 }
1454 break;
1455 }
1456
1457 default:
1458 YY_FATAL_ERROR(
1459 "fatal flex scanner internal error--no action found" );
1460 } /* end of action switch */
1461 } /* end of scanning one token */
1462 } /* end of user's declarations */
1463 } /* end of sksllex */
1464
1465 /* yy_get_next_buffer - try to read in a new buffer
1466 *
1467 * Returns a code representing an action:
1468 * EOB_ACT_LAST_MATCH -
1469 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1470 * EOB_ACT_END_OF_FILE - end of file
1471 */
1472 static int yy_get_next_buffer (void)
1473 {
1474 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1475 register char *source = (yytext_ptr);
1476 register int number_to_move, i;
1477 int ret_val;
1478
1479 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1480 YY_FATAL_ERROR(
1481 "fatal flex scanner internal error--end of buffer missed" );
1482
1483 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1484 { /* Don't try to fill the buffer, so this is an EOF. */
1485 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1486 {
1487 /* We matched a single character, the EOB, so
1488 * treat this as a final EOF.
1489 */
1490 return EOB_ACT_END_OF_FILE;
1491 }
1492
1493 else
1494 {
1495 /* We matched some text prior to the EOB, first
1496 * process it.
1497 */
1498 return EOB_ACT_LAST_MATCH;
1499 }
1500 }
1501
1502 /* Try to read more data. */
1503
1504 /* First move last chars to start of buffer. */
1505 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1506
1507 for ( i = 0; i < number_to_move; ++i )
1508 *(dest++) = *(source++);
1509
1510 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1511 /* don't do the read, it's not guaranteed to return an EOF,
1512 * just force an EOF
1513 */
1514 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1515
1516 else
1517 {
1518 yy_size_t num_to_read =
1519 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1520
1521 while ( num_to_read <= 0 )
1522 { /* Not enough room in the buffer - grow it. */
1523
1524 /* just a shorter name for the current buffer */
1525 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1526
1527 int yy_c_buf_p_offset =
1528 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1529
1530 if ( b->yy_is_our_buffer )
1531 {
1532 yy_size_t new_size = b->yy_buf_size * 2;
1533
1534 if ( new_size <= 0 )
1535 b->yy_buf_size += b->yy_buf_size / 8;
1536 else
1537 b->yy_buf_size *= 2;
1538
1539 b->yy_ch_buf = (char *)
1540 /* Include room in for 2 EOB chars. */
1541 skslrealloc((void *) b->yy_ch_buf,b->yy_ buf_size + 2 );
1542 }
1543 else
1544 /* Can't grow it, we don't own it. */
1545 b->yy_ch_buf = 0;
1546
1547 if ( ! b->yy_ch_buf )
1548 YY_FATAL_ERROR(
1549 "fatal error - scanner input buffer overflow" );
1550
1551 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1552
1553 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1554 number_to_move - 1;
1555
1556 }
1557
1558 if ( num_to_read > YY_READ_BUF_SIZE )
1559 num_to_read = YY_READ_BUF_SIZE;
1560
1561 /* Read in more data. */
1562 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]) ,
1563 (yy_n_chars), num_to_read );
1564
1565 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1566 }
1567
1568 if ( (yy_n_chars) == 0 )
1569 {
1570 if ( number_to_move == YY_MORE_ADJ )
1571 {
1572 ret_val = EOB_ACT_END_OF_FILE;
1573 skslrestart(skslin );
1574 }
1575
1576 else
1577 {
1578 ret_val = EOB_ACT_LAST_MATCH;
1579 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1580 YY_BUFFER_EOF_PENDING;
1581 }
1582 }
1583
1584 else
1585 ret_val = EOB_ACT_CONTINUE_SCAN;
1586
1587 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVAL UE->yy_buf_size) {
1588 /* Extend the array by 50%, plus the number we really need. */
1589 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_char s) >> 1);
1590 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) skslrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1591 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1592 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_bu ffer()" );
1593 }
1594
1595 (yy_n_chars) += number_to_move;
1596 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHA R;
1597 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER _CHAR;
1598
1599 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1600
1601 return ret_val;
1602 }
1603
1604 /* yy_get_previous_state - get the state just before the EOB char was reached */
1605
1606 static yy_state_type yy_get_previous_state (void)
1607 {
1608 register yy_state_type yy_current_state;
1609 register char *yy_cp;
1610
1611 yy_current_state = (yy_start);
1612
1613 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1614 {
1615 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1 );
1616 if ( yy_accept[yy_current_state] )
1617 {
1618 (yy_last_accepting_state) = yy_current_state;
1619 (yy_last_accepting_cpos) = yy_cp;
1620 }
1621 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_s tate )
1622 {
1623 yy_current_state = (int) yy_def[yy_current_state];
1624 if ( yy_current_state >= 185 )
1625 yy_c = yy_meta[(unsigned int) yy_c];
1626 }
1627 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1628 }
1629
1630 return yy_current_state;
1631 }
1632
1633 /* yy_try_NUL_trans - try to make a transition on the NUL character
1634 *
1635 * synopsis
1636 * next_state = yy_try_NUL_trans( current_state );
1637 */
1638 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1639 {
1640 register int yy_is_jam;
1641 register char *yy_cp = (yy_c_buf_p);
1642
1643 register YY_CHAR yy_c = 1;
1644 if ( yy_accept[yy_current_state] )
1645 {
1646 (yy_last_accepting_state) = yy_current_state;
1647 (yy_last_accepting_cpos) = yy_cp;
1648 }
1649 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1650 {
1651 yy_current_state = (int) yy_def[yy_current_state];
1652 if ( yy_current_state >= 185 )
1653 yy_c = yy_meta[(unsigned int) yy_c];
1654 }
1655 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_ c];
1656 yy_is_jam = (yy_current_state == 184);
1657
1658 return yy_is_jam ? 0 : yy_current_state;
1659 }
1660
1661 static void yyunput (int c, register char * yy_bp )
1662 {
1663 register char *yy_cp;
1664
1665 yy_cp = (yy_c_buf_p);
1666
1667 /* undo effects of setting up sksltext */
1668 *yy_cp = (yy_hold_char);
1669
1670 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1671 { /* need to shift things up to make room */
1672 /* +2 for EOB chars. */
1673 register yy_size_t number_to_move = (yy_n_chars) + 2;
1674 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1675 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1676 register char *source =
1677 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_m ove];
1678
1679 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1680 *--dest = *--source;
1681
1682 yy_cp += (int) (dest - source);
1683 yy_bp += (int) (dest - source);
1684 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1685 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1686
1687 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1688 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1689 }
1690
1691 *--yy_cp = (char) c;
1692
1693 if ( c == '\n' ){
1694 --sksllineno;
1695 }
1696
1697 (yytext_ptr) = yy_bp;
1698 (yy_hold_char) = *yy_cp;
1699 (yy_c_buf_p) = yy_cp;
1700 }
1701
1702 #ifndef YY_NO_INPUT
1703 #ifdef __cplusplus
1704 static int yyinput (void)
1705 #else
1706 static int input (void)
1707 #endif
1708
1709 {
1710 int c;
1711
1712 *(yy_c_buf_p) = (yy_hold_char);
1713
1714 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1715 {
1716 /* yy_c_buf_p now points to the character we want to return.
1717 * If this occurs *before* the EOB characters, then it's a
1718 * valid NUL; if not, then we've hit the end of the buffer.
1719 */
1720 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_c hars)] )
1721 /* This was really a NUL. */
1722 *(yy_c_buf_p) = '\0';
1723
1724 else
1725 { /* need more input */
1726 yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
1727 ++(yy_c_buf_p);
1728
1729 switch ( yy_get_next_buffer( ) )
1730 {
1731 case EOB_ACT_LAST_MATCH:
1732 /* This happens because yy_g_n_b()
1733 * sees that we've accumulated a
1734 * token and flags that we need to
1735 * try matching the token before
1736 * proceeding. But for input(),
1737 * there's no matching to consider.
1738 * So convert the EOB_ACT_LAST_MATCH
1739 * to EOB_ACT_END_OF_FILE.
1740 */
1741
1742 /* Reset buffer status. */
1743 skslrestart(skslin );
1744
1745 /*FALLTHROUGH*/
1746
1747 case EOB_ACT_END_OF_FILE:
1748 {
1749 if ( skslwrap( ) )
1750 return EOF;
1751
1752 if ( ! (yy_did_buffer_switch_on_eof) )
1753 YY_NEW_FILE;
1754 #ifdef __cplusplus
1755 return yyinput();
1756 #else
1757 return input();
1758 #endif
1759 }
1760
1761 case EOB_ACT_CONTINUE_SCAN:
1762 (yy_c_buf_p) = (yytext_ptr) + offset;
1763 break;
1764 }
1765 }
1766 }
1767
1768 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1769 *(yy_c_buf_p) = '\0'; /* preserve sksltext */
1770 (yy_hold_char) = *++(yy_c_buf_p);
1771
1772 if ( c == '\n' )
1773
1774 sksllineno++;
1775 ;
1776
1777 return c;
1778 }
1779 #endif /* ifndef YY_NO_INPUT */
1780
1781 /** Immediately switch to a different input stream.
1782 * @param input_file A readable stream.
1783 *
1784 * @note This function does not reset the start condition to @c INITIAL .
1785 */
1786 void skslrestart (FILE * input_file )
1787 {
1788
1789 if ( ! YY_CURRENT_BUFFER ){
1790 skslensure_buffer_stack ();
1791 YY_CURRENT_BUFFER_LVALUE =
1792 sksl_create_buffer(skslin,YY_BUF_SIZE );
1793 }
1794
1795 sksl_init_buffer(YY_CURRENT_BUFFER,input_file );
1796 sksl_load_buffer_state( );
1797 }
1798
1799 /** Switch to a different input buffer.
1800 * @param new_buffer The new input buffer.
1801 *
1802 */
1803 void sksl_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1804 {
1805
1806 /* TODO. We should be able to replace this entire function body
1807 * with
1808 * skslpop_buffer_state();
1809 * skslpush_buffer_state(new_buffer);
1810 */
1811 skslensure_buffer_stack ();
1812 if ( YY_CURRENT_BUFFER == new_buffer )
1813 return;
1814
1815 if ( YY_CURRENT_BUFFER )
1816 {
1817 /* Flush out information for old buffer. */
1818 *(yy_c_buf_p) = (yy_hold_char);
1819 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1820 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1821 }
1822
1823 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1824 sksl_load_buffer_state( );
1825
1826 /* We don't actually know whether we did this switch during
1827 * EOF (skslwrap()) processing, but the only time this flag
1828 * is looked at is after skslwrap() is called, so it's safe
1829 * to go ahead and always set it.
1830 */
1831 (yy_did_buffer_switch_on_eof) = 1;
1832 }
1833
1834 static void sksl_load_buffer_state (void)
1835 {
1836 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1837 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1838 skslin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1839 (yy_hold_char) = *(yy_c_buf_p);
1840 }
1841
1842 /** Allocate and initialize an input buffer state.
1843 * @param file A readable stream.
1844 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_ SIZE.
1845 *
1846 * @return the allocated buffer state.
1847 */
1848 YY_BUFFER_STATE sksl_create_buffer (FILE * file, int size )
1849 {
1850 YY_BUFFER_STATE b;
1851
1852 b = (YY_BUFFER_STATE) skslalloc(sizeof( struct yy_buffer_state ) );
1853 if ( ! b )
1854 YY_FATAL_ERROR( "out of dynamic memory in sksl_create_buffer()" );
1855
1856 b->yy_buf_size = size;
1857
1858 /* yy_ch_buf has to be 2 characters longer than the size given because
1859 * we need to put in 2 end-of-buffer characters.
1860 */
1861 b->yy_ch_buf = (char *) skslalloc(b->yy_buf_size + 2 );
1862 if ( ! b->yy_ch_buf )
1863 YY_FATAL_ERROR( "out of dynamic memory in sksl_create_buffer()" );
1864
1865 b->yy_is_our_buffer = 1;
1866
1867 sksl_init_buffer(b,file );
1868
1869 return b;
1870 }
1871
1872 /** Destroy the buffer.
1873 * @param b a buffer created with sksl_create_buffer()
1874 *
1875 */
1876 void sksl_delete_buffer (YY_BUFFER_STATE b )
1877 {
1878
1879 if ( ! b )
1880 return;
1881
1882 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1883 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1884
1885 if ( b->yy_is_our_buffer )
1886 skslfree((void *) b->yy_ch_buf );
1887
1888 skslfree((void *) b );
1889 }
1890
1891 /* Initializes or reinitializes a buffer.
1892 * This function is sometimes called more than once on the same buffer,
1893 * such as during a skslrestart() or at EOF.
1894 */
1895 static void sksl_init_buffer (YY_BUFFER_STATE b, FILE * file )
1896
1897 {
1898 int oerrno = errno;
1899
1900 sksl_flush_buffer(b );
1901
1902 b->yy_input_file = file;
1903 b->yy_fill_buffer = 1;
1904
1905 /* If b is the current buffer, then sksl_init_buffer was _probably_
1906 * called from skslrestart() or through yy_get_next_buffer.
1907 * In that case, we don't want to reset the lineno or column.
1908 */
1909 if (b != YY_CURRENT_BUFFER){
1910 b->yy_bs_lineno = 1;
1911 b->yy_bs_column = 0;
1912 }
1913
1914 b->yy_is_interactive = 0;
1915
1916 errno = oerrno;
1917 }
1918
1919 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1920 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1921 *
1922 */
1923 void sksl_flush_buffer (YY_BUFFER_STATE b )
1924 {
1925 if ( ! b )
1926 return;
1927
1928 b->yy_n_chars = 0;
1929
1930 /* We always need two end-of-buffer characters. The first causes
1931 * a transition to the end-of-buffer state. The second causes
1932 * a jam in that state.
1933 */
1934 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1935 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1936
1937 b->yy_buf_pos = &b->yy_ch_buf[0];
1938
1939 b->yy_at_bol = 1;
1940 b->yy_buffer_status = YY_BUFFER_NEW;
1941
1942 if ( b == YY_CURRENT_BUFFER )
1943 sksl_load_buffer_state( );
1944 }
1945
1946 /** Pushes the new state onto the stack. The new state becomes
1947 * the current state. This function will allocate the stack
1948 * if necessary.
1949 * @param new_buffer The new state.
1950 *
1951 */
1952 void skslpush_buffer_state (YY_BUFFER_STATE new_buffer )
1953 {
1954 if (new_buffer == NULL)
1955 return;
1956
1957 skslensure_buffer_stack();
1958
1959 /* This block is copied from sksl_switch_to_buffer. */
1960 if ( YY_CURRENT_BUFFER )
1961 {
1962 /* Flush out information for old buffer. */
1963 *(yy_c_buf_p) = (yy_hold_char);
1964 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1965 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1966 }
1967
1968 /* Only push if top exists. Otherwise, replace top. */
1969 if (YY_CURRENT_BUFFER)
1970 (yy_buffer_stack_top)++;
1971 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1972
1973 /* copied from sksl_switch_to_buffer. */
1974 sksl_load_buffer_state( );
1975 (yy_did_buffer_switch_on_eof) = 1;
1976 }
1977
1978 /** Removes and deletes the top of the stack, if present.
1979 * The next element becomes the new top.
1980 *
1981 */
1982 void skslpop_buffer_state (void)
1983 {
1984 if (!YY_CURRENT_BUFFER)
1985 return;
1986
1987 sksl_delete_buffer(YY_CURRENT_BUFFER );
1988 YY_CURRENT_BUFFER_LVALUE = NULL;
1989 if ((yy_buffer_stack_top) > 0)
1990 --(yy_buffer_stack_top);
1991
1992 if (YY_CURRENT_BUFFER) {
1993 sksl_load_buffer_state( );
1994 (yy_did_buffer_switch_on_eof) = 1;
1995 }
1996 }
1997
1998 /* Allocates the stack if it does not exist.
1999 * Guarantees space for at least one push.
2000 */
2001 static void skslensure_buffer_stack (void)
2002 {
2003 yy_size_t num_to_alloc;
2004
2005 if (!(yy_buffer_stack)) {
2006
2007 /* First allocation is just for 2 elements, since we don't know if this
2008 * scanner will even need a stack. We use 2 instead of 1 to avoi d an
2009 * immediate realloc on the next call.
2010 */
2011 num_to_alloc = 1;
2012 (yy_buffer_stack) = (struct yy_buffer_state**)skslalloc
2013 (num_to_alloc * sizeof(struct yy_buffer_state*)
2014 );
2015 if ( ! (yy_buffer_stack) )
2016 YY_FATAL_ERROR( "out of dynamic memory in skslensure_buf fer_stack()" );
2017
2018 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buf fer_state*));
2019
2020 (yy_buffer_stack_max) = num_to_alloc;
2021 (yy_buffer_stack_top) = 0;
2022 return;
2023 }
2024
2025 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2026
2027 /* Increase the buffer to prepare for a possible push. */
2028 int grow_size = 8 /* arbitrary grow size */;
2029
2030 num_to_alloc = (yy_buffer_stack_max) + grow_size;
2031 (yy_buffer_stack) = (struct yy_buffer_state**)skslrealloc
2032 ((yy_buffer_stac k),
2033 num_to_alloc * s izeof(struct yy_buffer_state*)
2034 );
2035 if ( ! (yy_buffer_stack) )
2036 YY_FATAL_ERROR( "out of dynamic memory in skslensure_buf fer_stack()" );
2037
2038 /* zero only the new slots.*/
2039 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2040 (yy_buffer_stack_max) = num_to_alloc;
2041 }
2042 }
2043
2044 /** Setup the input buffer state to scan directly from a user-specified characte r buffer.
2045 * @param base the character buffer
2046 * @param size the size in bytes of the character buffer
2047 *
2048 * @return the newly allocated buffer state object.
2049 */
2050 YY_BUFFER_STATE sksl_scan_buffer (char * base, yy_size_t size )
2051 {
2052 YY_BUFFER_STATE b;
2053
2054 if ( size < 2 ||
2055 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2056 base[size-1] != YY_END_OF_BUFFER_CHAR )
2057 /* They forgot to leave room for the EOB's. */
2058 return 0;
2059
2060 b = (YY_BUFFER_STATE) skslalloc(sizeof( struct yy_buffer_state ) );
2061 if ( ! b )
2062 YY_FATAL_ERROR( "out of dynamic memory in sksl_scan_buffer()" );
2063
2064 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2065 b->yy_buf_pos = b->yy_ch_buf = base;
2066 b->yy_is_our_buffer = 0;
2067 b->yy_input_file = 0;
2068 b->yy_n_chars = b->yy_buf_size;
2069 b->yy_is_interactive = 0;
2070 b->yy_at_bol = 1;
2071 b->yy_fill_buffer = 0;
2072 b->yy_buffer_status = YY_BUFFER_NEW;
2073
2074 sksl_switch_to_buffer(b );
2075
2076 return b;
2077 }
2078
2079 /** Setup the input buffer state to scan a string. The next call to sksllex() wi ll
2080 * scan from a @e copy of @a str.
2081 * @param yystr a NUL-terminated string to scan
2082 *
2083 * @return the newly allocated buffer state object.
2084 * @note If you want to scan bytes that may contain NUL values, then use
2085 * sksl_scan_bytes() instead.
2086 */
2087 YY_BUFFER_STATE sksl_scan_string (yyconst char * yystr )
2088 {
2089
2090 return sksl_scan_bytes(yystr,strlen(yystr) );
2091 }
2092
2093 /** Setup the input buffer state to scan the given bytes. The next call to sksll ex() will
2094 * scan from a @e copy of @a bytes.
2095 * @param yybytes the byte buffer to scan
2096 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2097 *
2098 * @return the newly allocated buffer state object.
2099 */
2100 YY_BUFFER_STATE sksl_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_le n )
2101 {
2102 YY_BUFFER_STATE b;
2103 char *buf;
2104 yy_size_t n;
2105 yy_size_t i;
2106
2107 /* Get memory for full buffer, including space for trailing EOB's. */
2108 n = _yybytes_len + 2;
2109 buf = (char *) skslalloc(n );
2110 if ( ! buf )
2111 YY_FATAL_ERROR( "out of dynamic memory in sksl_scan_bytes()" );
2112
2113 for ( i = 0; i < _yybytes_len; ++i )
2114 buf[i] = yybytes[i];
2115
2116 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2117
2118 b = sksl_scan_buffer(buf,n );
2119 if ( ! b )
2120 YY_FATAL_ERROR( "bad buffer in sksl_scan_bytes()" );
2121
2122 /* It's okay to grow etc. this buffer, and we should throw it
2123 * away when we're done.
2124 */
2125 b->yy_is_our_buffer = 1;
2126
2127 return b;
2128 }
2129
2130 #ifndef YY_EXIT_FAILURE
2131 #define YY_EXIT_FAILURE 2
2132 #endif
2133
2134 static void yy_fatal_error (yyconst char* msg )
2135 {
2136 (void) fprintf( stderr, "%s\n", msg );
2137 exit( YY_EXIT_FAILURE );
2138 }
2139
2140 /* Redefine yyless() so it works in section 3 code. */
2141
2142 #undef yyless
2143 #define yyless(n) \
2144 do \
2145 { \
2146 /* Undo effects of setting up sksltext. */ \
2147 int yyless_macro_arg = (n); \
2148 YY_LESS_LINENO(yyless_macro_arg);\
2149 sksltext[skslleng] = (yy_hold_char); \
2150 (yy_c_buf_p) = sksltext + yyless_macro_arg; \
2151 (yy_hold_char) = *(yy_c_buf_p); \
2152 *(yy_c_buf_p) = '\0'; \
2153 skslleng = yyless_macro_arg; \
2154 } \
2155 while ( 0 )
2156
2157 /* Accessor methods (get/set functions) to struct members. */
2158
2159 /** Get the current line number.
2160 *
2161 */
2162 int skslget_lineno (void)
2163 {
2164
2165 return sksllineno;
2166 }
2167
2168 /** Get the input stream.
2169 *
2170 */
2171 FILE *skslget_in (void)
2172 {
2173 return skslin;
2174 }
2175
2176 /** Get the output stream.
2177 *
2178 */
2179 FILE *skslget_out (void)
2180 {
2181 return skslout;
2182 }
2183
2184 /** Get the length of the current token.
2185 *
2186 */
2187 yy_size_t skslget_leng (void)
2188 {
2189 return skslleng;
2190 }
2191
2192 /** Get the current token.
2193 *
2194 */
2195
2196 char *skslget_text (void)
2197 {
2198 return sksltext;
2199 }
2200
2201 /** Set the current line number.
2202 * @param line_number
2203 *
2204 */
2205 void skslset_lineno (int line_number )
2206 {
2207
2208 sksllineno = line_number;
2209 }
2210
2211 /** Set the input stream. This does not discard the current
2212 * input buffer.
2213 * @param in_str A readable stream.
2214 *
2215 * @see sksl_switch_to_buffer
2216 */
2217 void skslset_in (FILE * in_str )
2218 {
2219 skslin = in_str ;
2220 }
2221
2222 void skslset_out (FILE * out_str )
2223 {
2224 skslout = out_str ;
2225 }
2226
2227 int skslget_debug (void)
2228 {
2229 return sksl_flex_debug;
2230 }
2231
2232 void skslset_debug (int bdebug )
2233 {
2234 sksl_flex_debug = bdebug ;
2235 }
2236
2237 static int yy_init_globals (void)
2238 {
2239 /* Initialization is the same as for the non-reentrant scanner.
2240 * This function is called from sksllex_destroy(), so don't allocate here.
2241 */
2242
2243 /* We do not touch sksllineno unless the option is enabled. */
2244 sksllineno = 1;
2245
2246 (yy_buffer_stack) = 0;
2247 (yy_buffer_stack_top) = 0;
2248 (yy_buffer_stack_max) = 0;
2249 (yy_c_buf_p) = (char *) 0;
2250 (yy_init) = 0;
2251 (yy_start) = 0;
2252
2253 /* Defined in main.c */
2254 #ifdef YY_STDINIT
2255 skslin = stdin;
2256 skslout = stdout;
2257 #else
2258 skslin = (FILE *) 0;
2259 skslout = (FILE *) 0;
2260 #endif
2261
2262 /* For future reference: Set errno on error, since we are called by
2263 * sksllex_init()
2264 */
2265 return 0;
2266 }
2267
2268 /* sksllex_destroy is for both reentrant and non-reentrant scanners. */
2269 int sksllex_destroy (void)
2270 {
2271
2272 /* Pop the buffer stack, destroying each element. */
2273 while(YY_CURRENT_BUFFER){
2274 sksl_delete_buffer(YY_CURRENT_BUFFER );
2275 YY_CURRENT_BUFFER_LVALUE = NULL;
2276 skslpop_buffer_state();
2277 }
2278
2279 /* Destroy the stack itself. */
2280 skslfree((yy_buffer_stack) );
2281 (yy_buffer_stack) = NULL;
2282
2283 /* Reset the globals. This is important in a non-reentrant scanner so the ne xt time
2284 * sksllex() is called, initialization will occur. */
2285 yy_init_globals( );
2286
2287 return 0;
2288 }
2289
2290 /*
2291 * Internal utility routines.
2292 */
2293
2294 #ifndef yytext_ptr
2295 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2296 {
2297 register int i;
2298 for ( i = 0; i < n; ++i )
2299 s1[i] = s2[i];
2300 }
2301 #endif
2302
2303 #ifdef YY_NEED_STRLEN
2304 static int yy_flex_strlen (yyconst char * s )
2305 {
2306 register int n;
2307 for ( n = 0; s[n]; ++n )
2308 ;
2309
2310 return n;
2311 }
2312 #endif
2313
2314 void *skslalloc (yy_size_t size )
2315 {
2316 return (void *) malloc( size );
2317 }
2318
2319 void *skslrealloc (void * ptr, yy_size_t size )
2320 {
2321 /* The cast to (char *) in the following accommodates both
2322 * implementations that use char* generic pointers, and those
2323 * that use void* generic pointers. It works with the latter
2324 * because both ANSI C and C++ allow castless assignment from
2325 * any pointer type to void*, and deal with argument conversions
2326 * as though doing an assignment.
2327 */
2328 return (void *) realloc( (char *) ptr, size );
2329 }
2330
2331 void skslfree (void * ptr )
2332 {
2333 free( (char *) ptr ); /* see skslrealloc() for (char *) cast */
2334 }
2335
2336 #define YYTABLES_NAME "yytables"
2337
2338 #line 186 "sksl.flex"
2339
2340
2341
2342 int skslwrap() {
2343 return 1; // terminate
2344 }
OLDNEW
« src/gpu/vk/GrVkGpu.h ('K') | « src/sksl/ir/SkSLWhileStatement.h ('k') | src/sksl/sksl.flex » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698