1 | #line 16 "./Tokenizer.l" |
2 | // |
3 | // Copyright (c) 2011-2014 The ANGLE Project Authors. All rights reserved. |
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 | // This file is auto-generated by generate_parser.sh. DO NOT EDIT! |
9 | |
10 | #define YY_INT_ALIGNED short int |
11 | |
12 | /* A lexical scanner generated by flex */ |
13 | |
14 | #define FLEX_SCANNER |
15 | #define YY_FLEX_MAJOR_VERSION 2 |
16 | #define YY_FLEX_MINOR_VERSION 6 |
17 | #define YY_FLEX_SUBMINOR_VERSION 4 |
18 | #if YY_FLEX_SUBMINOR_VERSION > 0 |
19 | # define FLEX_BETA |
20 | #endif |
21 | |
22 | #ifdef yy_create_buffer |
23 | # define pp_create_buffer_ALREADY_DEFINED |
24 | #else |
25 | # define yy_create_buffer pp_create_buffer |
26 | #endif |
27 | |
28 | #ifdef yy_delete_buffer |
29 | # define pp_delete_buffer_ALREADY_DEFINED |
30 | #else |
31 | # define yy_delete_buffer pp_delete_buffer |
32 | #endif |
33 | |
34 | #ifdef yy_scan_buffer |
35 | # define pp_scan_buffer_ALREADY_DEFINED |
36 | #else |
37 | # define yy_scan_buffer pp_scan_buffer |
38 | #endif |
39 | |
40 | #ifdef yy_scan_string |
41 | # define pp_scan_string_ALREADY_DEFINED |
42 | #else |
43 | # define yy_scan_string pp_scan_string |
44 | #endif |
45 | |
46 | #ifdef yy_scan_bytes |
47 | # define pp_scan_bytes_ALREADY_DEFINED |
48 | #else |
49 | # define yy_scan_bytes pp_scan_bytes |
50 | #endif |
51 | |
52 | #ifdef yy_init_buffer |
53 | # define pp_init_buffer_ALREADY_DEFINED |
54 | #else |
55 | # define yy_init_buffer pp_init_buffer |
56 | #endif |
57 | |
58 | #ifdef yy_flush_buffer |
59 | # define pp_flush_buffer_ALREADY_DEFINED |
60 | #else |
61 | # define yy_flush_buffer pp_flush_buffer |
62 | #endif |
63 | |
64 | #ifdef yy_load_buffer_state |
65 | # define pp_load_buffer_state_ALREADY_DEFINED |
66 | #else |
67 | # define yy_load_buffer_state pp_load_buffer_state |
68 | #endif |
69 | |
70 | #ifdef yy_switch_to_buffer |
71 | # define pp_switch_to_buffer_ALREADY_DEFINED |
72 | #else |
73 | # define yy_switch_to_buffer pp_switch_to_buffer |
74 | #endif |
75 | |
76 | #ifdef yypush_buffer_state |
77 | # define pppush_buffer_state_ALREADY_DEFINED |
78 | #else |
79 | # define yypush_buffer_state pppush_buffer_state |
80 | #endif |
81 | |
82 | #ifdef yypop_buffer_state |
83 | # define pppop_buffer_state_ALREADY_DEFINED |
84 | #else |
85 | # define yypop_buffer_state pppop_buffer_state |
86 | #endif |
87 | |
88 | #ifdef yyensure_buffer_stack |
89 | # define ppensure_buffer_stack_ALREADY_DEFINED |
90 | #else |
91 | # define yyensure_buffer_stack ppensure_buffer_stack |
92 | #endif |
93 | |
94 | #ifdef yylex |
95 | # define pplex_ALREADY_DEFINED |
96 | #else |
97 | # define yylex pplex |
98 | #endif |
99 | |
100 | #ifdef yyrestart |
101 | # define pprestart_ALREADY_DEFINED |
102 | #else |
103 | # define yyrestart pprestart |
104 | #endif |
105 | |
106 | #ifdef yylex_init |
107 | # define pplex_init_ALREADY_DEFINED |
108 | #else |
109 | # define yylex_init pplex_init |
110 | #endif |
111 | |
112 | #ifdef yylex_init_extra |
113 | # define pplex_init_extra_ALREADY_DEFINED |
114 | #else |
115 | # define |
116 | #endif |
117 | |
118 | #ifdef yylex_destroy |
119 | # define pplex_destroy_ALREADY_DEFINED |
120 | #else |
121 | # define yylex_destroy pplex_destroy |
122 | #endif |
123 | |
124 | #ifdef yyget_debug |
125 | # define ppget_debug_ALREADY_DEFINED |
126 | #else |
127 | # define yyget_debug ppget_debug |
128 | #endif |
129 | |
130 | #ifdef yyset_debug |
131 | # define ppset_debug_ALREADY_DEFINED |
132 | #else |
133 | # define yyset_debug ppset_debug |
134 | #endif |
135 | |
136 | #ifdef yyget_extra |
137 | # define ppget_extra_ALREADY_DEFINED |
138 | #else |
139 | # define |
140 | #endif |
141 | |
142 | #ifdef yyset_extra |
143 | # define ppset_extra_ALREADY_DEFINED |
144 | #else |
145 | # define |
146 | #endif |
147 | |
148 | #ifdef yyget_in |
149 | # define ppget_in_ALREADY_DEFINED |
150 | #else |
151 | # define yyget_in ppget_in |
152 | #endif |
153 | |
154 | #ifdef yyset_in |
155 | # define ppset_in_ALREADY_DEFINED |
156 | #else |
157 | # define yyset_in ppset_in |
158 | #endif |
159 | |
160 | #ifdef yyget_out |
161 | # define ppget_out_ALREADY_DEFINED |
162 | #else |
163 | # define yyget_out ppget_out |
164 | #endif |
165 | |
166 | #ifdef yyset_out |
167 | # define ppset_out_ALREADY_DEFINED |
168 | #else |
169 | # define yyset_out ppset_out |
170 | #endif |
171 | |
172 | #ifdef yyget_leng |
173 | # define ppget_leng_ALREADY_DEFINED |
174 | #else |
175 | # define yyget_leng ppget_leng |
176 | #endif |
177 | |
178 | #ifdef yyget_text |
179 | # define ppget_text_ALREADY_DEFINED |
180 | #else |
181 | # define yyget_text ppget_text |
182 | #endif |
183 | |
184 | #ifdef yyget_lineno |
185 | # define ppget_lineno_ALREADY_DEFINED |
186 | #else |
187 | # define yyget_lineno ppget_lineno |
188 | #endif |
189 | |
190 | #ifdef yyset_lineno |
191 | # define ppset_lineno_ALREADY_DEFINED |
192 | #else |
193 | # define yyset_lineno ppset_lineno |
194 | #endif |
195 | |
196 | #ifdef yyget_column |
197 | # define ppget_column_ALREADY_DEFINED |
198 | #else |
199 | # define yyget_column ppget_column |
200 | #endif |
201 | |
202 | #ifdef yyset_column |
203 | # define ppset_column_ALREADY_DEFINED |
204 | #else |
205 | # define yyset_column ppset_column |
206 | #endif |
207 | |
208 | #ifdef yywrap |
209 | # define ppwrap_ALREADY_DEFINED |
210 | #else |
211 | # define yywrap ppwrap |
212 | #endif |
213 | |
214 | #ifdef yyget_lval |
215 | # define ppget_lval_ALREADY_DEFINED |
216 | #else |
217 | # define yyget_lval ppget_lval |
218 | #endif |
219 | |
220 | #ifdef yyset_lval |
221 | # define ppset_lval_ALREADY_DEFINED |
222 | #else |
223 | # define yyset_lval ppset_lval |
224 | #endif |
225 | |
226 | #ifdef yyget_lloc |
227 | # define ppget_lloc_ALREADY_DEFINED |
228 | #else |
229 | # define yyget_lloc ppget_lloc |
230 | #endif |
231 | |
232 | #ifdef yyset_lloc |
233 | # define ppset_lloc_ALREADY_DEFINED |
234 | #else |
235 | # define yyset_lloc ppset_lloc |
236 | #endif |
237 | |
238 | #ifdef yyalloc |
239 | # define ppalloc_ALREADY_DEFINED |
240 | #else |
241 | # define yyalloc ppalloc |
242 | #endif |
243 | |
244 | #ifdef yyrealloc |
245 | # define pprealloc_ALREADY_DEFINED |
246 | #else |
247 | # define yyrealloc pprealloc |
248 | #endif |
249 | |
250 | #ifdef yyfree |
251 | # define ppfree_ALREADY_DEFINED |
252 | #else |
253 | # define yyfree ppfree |
254 | #endif |
255 | |
256 | /* First, we deal with platform-specific or compiler-specific issues. */ |
257 | |
258 | /* begin standard C headers. */ |
259 | #include <errno.h> |
260 | #include <stdio.h> |
261 | #include <stdlib.h> |
262 | #include <string.h> |
263 | |
264 | /* end standard C headers. */ |
265 | |
266 | /* flex integer type definitions */ |
267 | |
268 | #ifndef FLEXINT_H |
269 | # define FLEXINT_H |
270 | |
271 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ |
272 | |
273 | # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
274 | |
275 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, |
276 | * if you want the limit (max/min) macros for int types. |
277 | */ |
278 | # ifndef __STDC_LIMIT_MACROS |
279 | # define __STDC_LIMIT_MACROS 1 |
280 | # endif |
281 | |
282 | # include <inttypes.h> |
283 | typedef int8_t flex_int8_t; |
284 | typedef uint8_t flex_uint8_t; |
285 | typedef int16_t flex_int16_t; |
286 | typedef uint16_t flex_uint16_t; |
287 | typedef int32_t flex_int32_t; |
288 | typedef uint32_t flex_uint32_t; |
289 | # else |
290 | typedef signed char flex_int8_t; |
291 | typedef short int flex_int16_t; |
292 | typedef int flex_int32_t; |
293 | typedef unsigned char flex_uint8_t; |
294 | typedef unsigned short int flex_uint16_t; |
295 | typedef unsigned int flex_uint32_t; |
296 | |
297 | /* Limits of integral types. */ |
298 | # ifndef INT8_MIN |
299 | # define INT8_MIN (-128) |
300 | # endif |
301 | # ifndef INT16_MIN |
302 | # define INT16_MIN (-32767 - 1) |
303 | # endif |
304 | # ifndef INT32_MIN |
305 | # define INT32_MIN (-2147483647 - 1) |
306 | # endif |
307 | # ifndef INT8_MAX |
308 | # define INT8_MAX (127) |
309 | # endif |
310 | # ifndef INT16_MAX |
311 | # define INT16_MAX (32767) |
312 | # endif |
313 | # ifndef INT32_MAX |
314 | # define INT32_MAX (2147483647) |
315 | # endif |
316 | # ifndef UINT8_MAX |
317 | # define UINT8_MAX (255U) |
318 | # endif |
319 | # ifndef UINT16_MAX |
320 | # define UINT16_MAX (65535U) |
321 | # endif |
322 | # ifndef UINT32_MAX |
323 | # define UINT32_MAX (4294967295U) |
324 | # endif |
325 | |
326 | # ifndef SIZE_MAX |
327 | # define SIZE_MAX (~(size_t)0) |
328 | # endif |
329 | |
330 | # endif /* ! C99 */ |
331 | |
332 | #endif /* ! FLEXINT_H */ |
333 | |
334 | /* begin standard C++ headers. */ |
335 | |
336 | /* TODO: this is always defined, so inline it */ |
337 | #define yyconst const |
338 | |
339 | #if defined(__GNUC__) && __GNUC__ >= 3 |
340 | # define yynoreturn __attribute__((__noreturn__)) |
341 | #else |
342 | # define yynoreturn |
343 | #endif |
344 | |
345 | /* Returned upon end-of-file. */ |
346 | #define YY_NULL 0 |
347 | |
348 | /* Promotes a possibly negative, possibly signed char to an |
349 | * integer in range [0..255] for use as an array index. |
350 | */ |
351 | #define YY_SC_TO_UI(c) ((YY_CHAR)(c)) |
352 | |
353 | /* An opaque pointer. */ |
354 | #ifndef YY_TYPEDEF_YY_SCANNER_T |
355 | # define YY_TYPEDEF_YY_SCANNER_T |
356 | typedef void *yyscan_t; |
357 | #endif |
358 | |
359 | /* For convenience, these vars (plus the bison vars far below) |
360 | are macros in the reentrant scanner. */ |
361 | #define yyin yyg->yyin_r |
362 | #define yyout yyg->yyout_r |
363 | #define yyg->yyextra_r |
364 | #define yyleng yyg->yyleng_r |
365 | #define yytext yyg->yytext_r |
366 | #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) |
367 | #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) |
368 | #define yy_flex_debug yyg->yy_flex_debug_r |
369 | |
370 | /* Enter a start condition. This macro really ought to take a parameter, |
371 | * but we do it the disgusting crufty way forced on us by the ()-less |
372 | * definition of BEGIN. |
373 | */ |
374 | #define BEGIN yyg->yy_start = 1 + 2 * |
375 | /* Translate the current start state into a value that can be later handed |
376 | * to BEGIN to return to the state. The YYSTATE alias is for lex |
377 | * compatibility. |
378 | */ |
379 | #define YY_START ((yyg->yy_start - 1) / 2) |
380 | #define YYSTATE YY_START |
381 | /* Action number for EOF rule of a given start state. */ |
382 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) |
383 | /* Special action meaning "start processing a new file". */ |
384 | #define YY_NEW_FILE yyrestart(yyin, yyscanner) |
385 | #define YY_END_OF_BUFFER_CHAR 0 |
386 | |
387 | /* Size of default input buffer. */ |
388 | #ifndef YY_BUF_SIZE |
389 | # ifdef __ia64__ |
390 | /* On IA-64, the buffer size is 16k, not 8k. |
391 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. |
392 | * Ditto for the __ia64__ case accordingly. |
393 | */ |
394 | # define YY_BUF_SIZE 32768 |
395 | # else |
396 | # define YY_BUF_SIZE 16384 |
397 | # endif /* __ia64__ */ |
398 | #endif |
399 | |
400 | /* The state buf must be large enough to hold one state per character in the main buffer. |
401 | */ |
402 | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) |
403 | |
404 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE |
405 | # define YY_TYPEDEF_YY_BUFFER_STATE |
406 | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
407 | #endif |
408 | |
409 | #ifndef YY_TYPEDEF_YY_SIZE_T |
410 | # define YY_TYPEDEF_YY_SIZE_T |
411 | typedef size_t yy_size_t; |
412 | #endif |
413 | |
414 | #define EOB_ACT_CONTINUE_SCAN 0 |
415 | #define EOB_ACT_END_OF_FILE 1 |
416 | #define EOB_ACT_LAST_MATCH 2 |
417 | |
418 | #define YY_LESS_LINENO(n) |
419 | #define YY_LINENO_REWIND_TO(ptr) |
420 | |
421 | /* Return all but the first "n" matched characters back to the input stream. */ |
422 | #define yyless(n) \ |
423 | do \ |
424 | { \ |
425 | /* Undo effects of setting up yytext. */ \ |
426 | int yyless_macro_arg = (n); \ |
427 | YY_LESS_LINENO(yyless_macro_arg); \ |
428 | *yy_cp = yyg->yy_hold_char; \ |
429 | YY_RESTORE_YY_MORE_OFFSET \ |
430 | yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ |
431 | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ |
432 | } while (0) |
433 | #define unput(c) yyunput(c, yyg->yytext_ptr, yyscanner) |
434 | |
435 | #ifndef YY_STRUCT_YY_BUFFER_STATE |
436 | # define YY_STRUCT_YY_BUFFER_STATE |
437 | struct yy_buffer_state |
438 | { |
439 | FILE *yy_input_file; |
440 | |
441 | char *yy_ch_buf; /* input buffer */ |
442 | char *yy_buf_pos; /* current position in input buffer */ |
443 | |
444 | /* Size of input buffer in bytes, not including room for EOB |
445 | * characters. |
446 | */ |
447 | int yy_buf_size; |
448 | |
449 | /* Number of characters read into yy_ch_buf, not including EOB |
450 | * characters. |
451 | */ |
452 | int yy_n_chars; |
453 | |
454 | /* Whether we "own" the buffer - i.e., we know we created it, |
455 | * and can realloc() it to grow it, and should free() it to |
456 | * delete it. |
457 | */ |
458 | int yy_is_our_buffer; |
459 | |
460 | /* Whether this is an "interactive" input source; if so, and |
461 | * if we're using stdio for input, then we want to use getc() |
462 | * instead of fread(), to make sure we stop fetching input after |
463 | * each newline. |
464 | */ |
465 | int yy_is_interactive; |
466 | |
467 | /* Whether we're considered to be at the beginning of a line. |
468 | * If so, '^' rules will be active on the next match, otherwise |
469 | * not. |
470 | */ |
471 | int yy_at_bol; |
472 | |
473 | int yy_bs_lineno; /**< The line count. */ |
474 | int yy_bs_column; /**< The column count. */ |
475 | |
476 | /* Whether to try to fill the input buffer when we reach the |
477 | * end of it. |
478 | */ |
479 | int yy_fill_buffer; |
480 | |
481 | int yy_buffer_status; |
482 | |
483 | # define YY_BUFFER_NEW 0 |
484 | # define YY_BUFFER_NORMAL 1 |
485 | /* When an EOF's been seen but there's still some text to process |
486 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we |
487 | * shouldn't try reading from the input source any more. We might |
488 | * still have a bunch of tokens to match, though, because of |
489 | * possible backing-up. |
490 | * |
491 | * When we actually see the EOF, we change the status to "new" |
492 | * (via yyrestart()), so that the user can continue scanning by |
493 | * just pointing yyin at a new input file. |
494 | */ |
495 | # define YY_BUFFER_EOF_PENDING 2 |
496 | }; |
497 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ |
498 | |
499 | /* We provide macros for accessing buffer states in case in the |
500 | * future we want to put the buffer states in a more general |
501 | * "scanner state". |
502 | * |
503 | * Returns the top of the stack, or NULL. |
504 | */ |
505 | #define YY_CURRENT_BUFFER \ |
506 | (yyg->yy_buffer_stack ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] : NULL) |
507 | /* Same as previous macro, but useful when we know that the buffer stack is not |
508 | * NULL or when we need an lvalue. For internal use only. |
509 | */ |
510 | #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] |
511 | |
512 | void yyrestart(FILE *input_file, yyscan_t yyscanner); |
513 | void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner); |
514 | YY_BUFFER_STATE yy_create_buffer(FILE *file, int size, yyscan_t yyscanner); |
515 | void yy_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner); |
516 | void yy_flush_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner); |
517 | void yypush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner); |
518 | void yypop_buffer_state(yyscan_t yyscanner); |
519 | |
520 | static void yyensure_buffer_stack(yyscan_t yyscanner); |
521 | static void yy_load_buffer_state(yyscan_t yyscanner); |
522 | static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file, yyscan_t yyscanner); |
523 | #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER, yyscanner) |
524 | |
525 | YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner); |
526 | YY_BUFFER_STATE yy_scan_string(const char *yy_str, yyscan_t yyscanner); |
527 | YY_BUFFER_STATE yy_scan_bytes(const char *bytes, int len, yyscan_t yyscanner); |
528 | |
529 | void *yyalloc(yy_size_t, yyscan_t yyscanner); |
530 | void *yyrealloc(void *, yy_size_t, yyscan_t yyscanner); |
531 | void yyfree(void *, yyscan_t yyscanner); |
532 | |
533 | #define yy_new_buffer yy_create_buffer |
534 | #define yy_set_interactive(is_interactive) \ |
535 | { \ |
536 | if (!YY_CURRENT_BUFFER) \ |
537 | { \ |
538 | yyensure_buffer_stack(yyscanner); \ |
539 | YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); \ |
540 | } \ |
541 | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ |
542 | } |
543 | #define yy_set_bol(at_bol) \ |
544 | { \ |
545 | if (!YY_CURRENT_BUFFER) \ |
546 | { \ |
547 | yyensure_buffer_stack(yyscanner); \ |
548 | YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); \ |
549 | } \ |
550 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ |
551 | } |
552 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) |
553 | |
554 | /* Begin user sect3 */ |
555 | |
556 | #define ppwrap(yyscanner) (/*CONSTCOND*/ 1) |
557 | #define YY_SKIP_YYWRAP |
558 | typedef flex_uint8_t YY_CHAR; |
559 | |
560 | typedef int yy_state_type; |
561 | |
562 | #define yytext_ptr yytext_r |
563 | |
564 | static yy_state_type yy_get_previous_state(yyscan_t yyscanner); |
565 | static yy_state_type yy_try_NUL_trans(yy_state_type current_state, yyscan_t yyscanner); |
566 | static int yy_get_next_buffer(yyscan_t yyscanner); |
567 | static void yynoreturn yy_fatal_error(const char *msg, yyscan_t yyscanner); |
568 | |
569 | /* Done after the current pattern has been matched and before the |
570 | * corresponding action - sets up yytext. |
571 | */ |
572 | #define YY_DO_BEFORE_ACTION \ |
573 | yyg->yytext_ptr = yy_bp; \ |
574 | yyleng = (int)(yy_cp - yy_bp); \ |
575 | yyg->yy_hold_char = *yy_cp; \ |
576 | *yy_cp = '\0'; \ |
577 | yyg->yy_c_buf_p = yy_cp; |
578 | #define YY_NUM_RULES 37 |
579 | #define YY_END_OF_BUFFER 38 |
580 | /* This struct is not used in this scanner, |
581 | but its presence is necessary. */ |
582 | struct yy_trans_info |
583 | { |
584 | flex_int32_t yy_verify; |
585 | flex_int32_t yy_nxt; |
586 | }; |
587 | static const flex_int16_t yy_accept[95] = { |
588 | 0, 0, 0, 0, 0, 38, 36, 34, 35, 35, 33, 7, 33, 33, 33, 33, 33, 33, 33, 33, 9, 9, 33, 33, |
589 | 33, 8, 33, 33, 3, 5, 5, 4, 34, 35, 19, 27, 20, 30, 25, 12, 23, 13, 24, 10, 2, 1, 26, 10, |
590 | 9, 11, 11, 11, 9, 11, 9, 9, 14, 16, 18, 17, 15, 8, 31, 21, 32, 22, 3, 5, 6, 11, 10, 11, |
591 | 10, 1, 10, 11, 10, 0, 10, 9, 9, 9, 28, 29, 0, 10, 10, 10, 10, 9, 10, 10, 9, 10, 0 |
592 | |
593 | }; |
594 | |
595 | static const YY_CHAR yy_ec[256] = { |
596 | 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, |
597 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 1, 6, 1, 7, 8, 1, 9, 9, |
598 | 10, 11, 9, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 9, 9, 18, 19, 20, |
599 | 9, 1, 21, 21, 21, 21, 22, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, |
600 | 24, 25, 24, 24, 26, 24, 24, 9, 1, 9, 27, 24, 1, 21, 21, 21, 21, |
601 | |
602 | 22, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 24, 24, 26, 24, |
603 | 24, 9, 28, 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
604 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
605 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
606 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
607 | |
608 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
609 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
610 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; |
611 | |
612 | static const YY_CHAR yy_meta[29] = {0, 1, 1, 2, 2, 1, 1, 1, 1, 1, 3, 1, 1, 4, 1, |
613 | 5, 5, 5, 1, 1, 1, 5, 5, 5, 5, 5, 5, 1, 1}; |
614 | |
615 | static const flex_int16_t yy_base[100] = { |
616 | 0, 0, 0, 26, 28, 133, 195, 130, 195, 128, 105, 195, 104, 25, 195, 100, 23, |
617 | 27, 32, 31, 38, 50, 38, 93, 49, 0, 16, 51, 0, 195, 105, 87, 93, 195, |
618 | 195, 195, 195, 195, 195, 195, 195, 195, 195, 67, 195, 0, 195, 81, 55, 84, 98, |
619 | 110, 53, 61, 0, 52, 39, 195, 195, 195, 33, 0, 195, 195, 195, 195, 0, 195, |
620 | 195, 113, 0, 126, 0, 0, 0, 133, 0, 56, 128, 0, 133, 0, 195, 195, 101, |
621 | 141, 143, 145, 0, 15, 154, 195, 0, 195, 195, 177, 32, 182, 187, 189 |
622 | |
623 | }; |
624 | |
625 | static const flex_int16_t yy_def[100] = { |
626 | 0, 94, 1, 95, 95, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, |
627 | 20, 94, 94, 94, 96, 94, 94, 97, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, |
628 | 94, 94, 94, 98, 94, 94, 20, 20, 49, 50, 50, 99, 21, 50, 94, 94, 94, 94, 94, 96, 94, |
629 | 94, 94, 94, 97, 94, 94, 43, 43, 69, 69, 98, 47, 50, 50, 94, 51, 50, 99, 50, 94, 94, |
630 | 94, 71, 75, 94, 50, 50, 94, 94, 50, 94, 0, 94, 94, 94, 94, 94 |
631 | |
632 | }; |
633 | |
634 | static const flex_int16_t yy_nxt[224] = { |
635 | 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 25, 25, |
636 | 25, 25, 25, 25, 26, 27, 29, 30, 29, 30, 36, 39, 62, 31, 61, 31, 41, 92, 44, 40, 63, 37, 45, |
637 | 42, 43, 43, 43, 46, 47, 83, 48, 48, 49, 56, 57, 82, 50, 51, 50, 50, 52, 53, 54, 54, 54, 59, |
638 | 60, 64, 87, 87, 87, 50, 55, 50, 81, 79, 65, 69, 50, 70, 70, 70, 50, 50, 50, 69, 71, 72, 69, |
639 | 69, 69, 50, 32, 74, 74, 74, 49, 49, |
640 | |
641 | 68, 50, 75, 76, 50, 50, 50, 67, 50, 50, 50, 58, 50, 50, 50, 90, 90, 90, 38, 50, 77, 77, 35, |
642 | 34, 78, 78, 78, 69, 69, 69, 33, 32, 94, 94, 69, 69, 84, 84, 94, 94, 85, 85, 85, 84, 84, 50, |
643 | 94, 86, 86, 86, 88, 94, 94, 94, 94, 94, 50, 89, 50, 87, 87, 87, 94, 72, 94, 76, 94, 91, 90, |
644 | 90, 90, 94, 94, 94, 94, 94, 93, 28, 28, 28, 28, 28, 66, 94, 94, 66, 66, 73, 94, 73, 73, 73, |
645 | 80, 80, 5, 94, 94, 94, 94, 94, |
646 | |
647 | 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94}; |
648 | |
649 | static const flex_int16_t yy_chk[224] = { |
650 | 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
651 | 1, 1, 1, 1, 1, 1, 3, 3, 4, 4, 13, 16, 26, 3, 96, 4, 17, 89, 19, 16, 26, 13, 19, |
652 | 17, 18, 18, 18, 19, 20, 60, 20, 20, 20, 22, 22, 56, 20, 20, 20, 20, 20, 20, 21, 21, 21, 24, |
653 | 24, 27, 77, 77, 77, 53, 21, 21, 55, 52, 27, 43, 48, 43, 43, 43, 53, 53, 53, 43, 43, 43, 43, |
654 | 43, 43, 47, 32, 47, 47, 47, 49, 49, |
655 | |
656 | 31, 47, 47, 47, 47, 47, 47, 30, 49, 49, 50, 23, 50, 50, 50, 84, 84, 84, 15, 50, 51, 51, 12, |
657 | 10, 51, 51, 51, 69, 69, 69, 9, 7, 5, 0, 69, 69, 71, 71, 78, 78, 71, 71, 71, 75, 75, 80, |
658 | 0, 75, 75, 75, 78, 85, 85, 86, 86, 0, 80, 80, 80, 87, 87, 87, 0, 85, 0, 86, 0, 87, 90, |
659 | 90, 90, 0, 0, 0, 0, 0, 90, 95, 95, 95, 95, 95, 97, 0, 0, 97, 97, 98, 0, 98, 98, 98, |
660 | 99, 99, 94, 94, 94, 94, 94, 94, |
661 | |
662 | 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94}; |
663 | |
664 | /* The intent behind this definition is that it'll catch |
665 | * any uses of REJECT which flex missed. |
666 | */ |
667 | #define REJECT reject_used_but_not_detected |
668 | #define yymore() yymore_used_but_not_detected |
669 | #define YY_MORE_ADJ 0 |
670 | #define YY_RESTORE_YY_MORE_OFFSET |
671 | /* |
672 | // |
673 | // Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved. |
674 | // Use of this source code is governed by a BSD-style license that can be |
675 | // found in the LICENSE file. |
676 | // |
677 | |
678 | This file contains the Lex specification for GLSL ES preprocessor. |
679 | Based on Microsoft Visual Studio 2010 Preprocessor Grammar: |
680 | http://msdn.microsoft.com/en-us/library/2scxys89.aspx |
681 | |
682 | IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh. |
683 | */ |
684 | |
685 | #if defined(_MSC_VER) |
686 | # pragma warning(disable : 4005) |
687 | #endif |
688 | |
689 | #include "compiler/preprocessor/Tokenizer.h" |
690 | |
691 | #include "compiler/preprocessor/DiagnosticsBase.h" |
692 | #include "compiler/preprocessor/Token.h" |
693 | |
694 | #if defined(__GNUC__) |
695 | // Triggered by the auto-generated yy_fatal_error function. |
696 | # pragma GCC diagnostic ignored "-Wmissing-noreturn" |
697 | #elif defined(_MSC_VER) |
698 | # pragma warning(disable : 4244) |
699 | #endif |
700 | #if defined(__clang__) |
701 | // Flex uses `/*FALLTHROUGH*/` instead of dedicated statements. |
702 | # pragma GCC diagnostic ignored "-Wimplicit-fallthrough" |
703 | #endif |
704 | |
705 | // Workaround for flex using the register keyword, deprecated in C++11. |
706 | #ifdef __cplusplus |
707 | # if __cplusplus > 199711L |
708 | # define register |
709 | # endif |
710 | #endif |
711 | |
712 | typedef std::string YYSTYPE; |
713 | typedef angle::pp::SourceLocation YYLTYPE; |
714 | |
715 | // Use the unused yycolumn variable to track file (string) number. |
716 | #define yyfileno yycolumn |
717 | |
718 | #define YY_USER_INIT \ |
719 | do \ |
720 | { \ |
721 | yyfileno = 0; \ |
722 | yylineno = 1; \ |
723 | yyextra->leadingSpace = false; \ |
724 | yyextra->lineStart = true; \ |
725 | } while (0); |
726 | |
727 | #define YY_NO_INPUT |
728 | #define YY_USER_ACTION \ |
729 | do \ |
730 | { \ |
731 | angle::pp::Input *input = &yyextra->input; \ |
732 | angle::pp::Input::Location *scanLoc = &yyextra->scanLoc; \ |
733 | while ((scanLoc->sIndex < input->count()) && \ |
734 | (scanLoc->cIndex >= input->length(scanLoc->sIndex))) \ |
735 | { \ |
736 | scanLoc->cIndex -= input->length(scanLoc->sIndex++); \ |
737 | ++yyfileno; \ |
738 | yylineno = 1; \ |
739 | } \ |
740 | yylloc->file = yyfileno; \ |
741 | yylloc->line = yylineno; \ |
742 | scanLoc->cIndex += yyleng; \ |
743 | } while (0); |
744 | |
745 | #define YY_INPUT(buf, result, maxSize) result = yyextra->input.read(buf, maxSize, &yylineno); |
746 | |
747 | #define INITIAL 0 |
748 | #define 1 |
749 | |
750 | #define angle::pp::Tokenizer::Context * |
751 | |
752 | /* Holds the entire state of the reentrant scanner. */ |
753 | struct yyguts_t |
754 | { |
755 | |
756 | /* User-defined. Not touched by flex. */ |
757 | YY_EXTRA_TYPE ; |
758 | |
759 | /* The rest are the same as the globals declared in the non-reentrant scanner. */ |
760 | FILE *yyin_r, *yyout_r; |
761 | size_t yy_buffer_stack_top; /**< index of top of stack. */ |
762 | size_t yy_buffer_stack_max; /**< capacity of stack. */ |
763 | YY_BUFFER_STATE *yy_buffer_stack; /**< Stack as an array. */ |
764 | char yy_hold_char; |
765 | int yy_n_chars; |
766 | int yyleng_r; |
767 | char *yy_c_buf_p; |
768 | int yy_init; |
769 | int yy_start; |
770 | int yy_did_buffer_switch_on_eof; |
771 | int yy_start_stack_ptr; |
772 | int yy_start_stack_depth; |
773 | int *yy_start_stack; |
774 | yy_state_type yy_last_accepting_state; |
775 | char *yy_last_accepting_cpos; |
776 | |
777 | int yylineno_r; |
778 | int yy_flex_debug_r; |
779 | |
780 | char *yytext_r; |
781 | int yy_more_flag; |
782 | int yy_more_len; |
783 | |
784 | YYSTYPE *yylval_r; |
785 | |
786 | YYLTYPE *yylloc_r; |
787 | |
788 | }; /* end struct yyguts_t */ |
789 | |
790 | static int yy_init_globals(yyscan_t yyscanner); |
791 | |
792 | /* This must go here because YYSTYPE and YYLTYPE are included |
793 | * from bison output in section 1.*/ |
794 | #define yylval yyg->yylval_r |
795 | |
796 | #define yylloc yyg->yylloc_r |
797 | |
798 | int yylex_init(yyscan_t *scanner); |
799 | |
800 | int yylex_init_extra(YY_EXTRA_TYPE user_defined, yyscan_t *scanner); |
801 | |
802 | /* Accessor methods to globals. |
803 | These are made visible to non-reentrant scanners for convenience. */ |
804 | |
805 | int yylex_destroy(yyscan_t yyscanner); |
806 | |
807 | int yyget_debug(yyscan_t yyscanner); |
808 | |
809 | void yyset_debug(int debug_flag, yyscan_t yyscanner); |
810 | |
811 | YY_EXTRA_TYPE yyget_extra(yyscan_t yyscanner); |
812 | |
813 | void yyset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner); |
814 | |
815 | FILE *yyget_in(yyscan_t yyscanner); |
816 | |
817 | void yyset_in(FILE *_in_str, yyscan_t yyscanner); |
818 | |
819 | FILE *yyget_out(yyscan_t yyscanner); |
820 | |
821 | void yyset_out(FILE *_out_str, yyscan_t yyscanner); |
822 | |
823 | int yyget_leng(yyscan_t yyscanner); |
824 | |
825 | char *yyget_text(yyscan_t yyscanner); |
826 | |
827 | int yyget_lineno(yyscan_t yyscanner); |
828 | |
829 | void yyset_lineno(int _line_number, yyscan_t yyscanner); |
830 | |
831 | int yyget_column(yyscan_t yyscanner); |
832 | |
833 | void yyset_column(int _column_no, yyscan_t yyscanner); |
834 | |
835 | YYSTYPE *yyget_lval(yyscan_t yyscanner); |
836 | |
837 | void yyset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner); |
838 | |
839 | YYLTYPE *yyget_lloc(yyscan_t yyscanner); |
840 | |
841 | void yyset_lloc(YYLTYPE *yylloc_param, yyscan_t yyscanner); |
842 | |
843 | /* Macros after this point can all be overridden by user definitions in |
844 | * section 1. |
845 | */ |
846 | |
847 | #ifndef YY_SKIP_YYWRAP |
848 | # ifdef __cplusplus |
849 | extern "C" int yywrap(yyscan_t yyscanner); |
850 | # else |
851 | extern int yywrap(yyscan_t yyscanner); |
852 | # endif |
853 | #endif |
854 | |
855 | #ifndef YY_NO_UNPUT |
856 | |
857 | #endif |
858 | |
859 | #ifndef yytext_ptr |
860 | static void yy_flex_strncpy(char *, const char *, int, yyscan_t yyscanner); |
861 | #endif |
862 | |
863 | #ifdef YY_NEED_STRLEN |
864 | static int yy_flex_strlen(const char *, yyscan_t yyscanner); |
865 | #endif |
866 | |
867 | #ifndef YY_NO_INPUT |
868 | # ifdef __cplusplus |
869 | static int yyinput(yyscan_t yyscanner); |
870 | # else |
871 | static int input(yyscan_t yyscanner); |
872 | # endif |
873 | |
874 | #endif |
875 | |
876 | /* Amount of stuff to slurp up with each read. */ |
877 | #ifndef YY_READ_BUF_SIZE |
878 | # ifdef __ia64__ |
879 | /* On IA-64, the buffer size is 16k, not 8k */ |
880 | # define YY_READ_BUF_SIZE 16384 |
881 | # else |
882 | # define YY_READ_BUF_SIZE 8192 |
883 | # endif /* __ia64__ */ |
884 | #endif |
885 | |
886 | /* Copy whatever the last rule matched to the standard output. */ |
887 | #ifndef ECHO |
888 | /* This used to be an fputs(), but since the string might contain NUL's, |
889 | * we now use fwrite(). |
890 | */ |
891 | # define ECHO \ |
892 | do \ |
893 | { \ |
894 | if (fwrite(yytext, (size_t)yyleng, 1, yyout)) \ |
895 | { \ |
896 | } \ |
897 | } while (0) |
898 | #endif |
899 | |
900 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
901 | * is returned in "result". |
902 | */ |
903 | #ifndef YY_INPUT |
904 | # define YY_INPUT(buf, result, max_size) \ |
905 | if (YY_CURRENT_BUFFER_LVALUE->yy_is_interactive) \ |
906 | { \ |
907 | int c = '*'; \ |
908 | int n; \ |
909 | for (n = 0; n < max_size && (c = getc(yyin)) != EOF && c != '\n'; ++n) \ |
910 | buf[n] = (char)c; \ |
911 | if (c == '\n') \ |
912 | buf[n++] = (char)c; \ |
913 | if (c == EOF && ferror(yyin)) \ |
914 | YY_FATAL_ERROR("input in flex scanner failed"); \ |
915 | result = n; \ |
916 | } \ |
917 | else \ |
918 | { \ |
919 | errno = 0; \ |
920 | while ((result = (int)fread(buf, 1, (yy_size_t)max_size, yyin)) == 0 && ferror(yyin)) \ |
921 | { \ |
922 | if (errno != EINTR) \ |
923 | { \ |
924 | YY_FATAL_ERROR("input in flex scanner failed"); \ |
925 | break; \ |
926 | } \ |
927 | errno = 0; \ |
928 | clearerr(yyin); \ |
929 | } \ |
930 | } |
931 | |
932 | #endif |
933 | |
934 | /* No semi-colon after return; correct usage is to write "yyterminate();" - |
935 | * we don't want an extra ';' after the "return" because that will cause |
936 | * some compilers to complain about unreachable statements. |
937 | */ |
938 | #ifndef yyterminate |
939 | # define yyterminate() return YY_NULL |
940 | #endif |
941 | |
942 | /* Number of entries by which start-condition stack grows. */ |
943 | #ifndef YY_START_STACK_INCR |
944 | # define YY_START_STACK_INCR 25 |
945 | #endif |
946 | |
947 | /* Report a fatal error. */ |
948 | #ifndef YY_FATAL_ERROR |
949 | # define YY_FATAL_ERROR(msg) yy_fatal_error(msg, yyscanner) |
950 | #endif |
951 | |
952 | /* end tables serialization structures and prototypes */ |
953 | |
954 | /* Default declaration of generated scanner - a define so the user can |
955 | * easily add parameters. |
956 | */ |
957 | #ifndef YY_DECL |
958 | # define YY_DECL_IS_OURS 1 |
959 | |
960 | extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner); |
961 | |
962 | # define YY_DECL int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner) |
963 | #endif /* !YY_DECL */ |
964 | |
965 | /* Code executed at the beginning of each rule, after yytext and yyleng |
966 | * have been set up. |
967 | */ |
968 | #ifndef YY_USER_ACTION |
969 | # define YY_USER_ACTION |
970 | #endif |
971 | |
972 | /* Code executed at the end of each rule. */ |
973 | #ifndef YY_BREAK |
974 | # define YY_BREAK /*LINTED*/ break; |
975 | #endif |
976 | |
977 | #define YY_RULE_SETUP YY_USER_ACTION |
978 | |
979 | /** The main scanner function which does all the work. |
980 | */ |
981 | YY_DECL |
982 | { |
983 | yy_state_type yy_current_state; |
984 | char *yy_cp, *yy_bp; |
985 | int yy_act; |
986 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
987 | |
988 | yylval = yylval_param; |
989 | |
990 | yylloc = yylloc_param; |
991 | |
992 | if (!yyg->yy_init) |
993 | { |
994 | yyg->yy_init = 1; |
995 | |
996 | #ifdef YY_USER_INIT |
997 | YY_USER_INIT; |
998 | #endif |
999 | |
1000 | if (!yyg->yy_start) |
1001 | yyg->yy_start = 1; /* first start state */ |
1002 | |
1003 | if (!yyin) |
1004 | yyin = stdin; |
1005 | |
1006 | if (!yyout) |
1007 | yyout = stdout; |
1008 | |
1009 | if (!YY_CURRENT_BUFFER) |
1010 | { |
1011 | yyensure_buffer_stack(yyscanner); |
1012 | YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); |
1013 | } |
1014 | |
1015 | yy_load_buffer_state(yyscanner); |
1016 | } |
1017 | |
1018 | { |
1019 | |
1020 | /* Line comment */ |
1021 | |
1022 | while (/*CONSTCOND*/ 1) /* loops until end-of-file is reached */ |
1023 | { |
1024 | yy_cp = yyg->yy_c_buf_p; |
1025 | |
1026 | /* Support of yytext. */ |
1027 | *yy_cp = yyg->yy_hold_char; |
1028 | |
1029 | /* yy_bp points to the position in yy_ch_buf of the start of |
1030 | * the current run. |
1031 | */ |
1032 | yy_bp = yy_cp; |
1033 | |
1034 | yy_current_state = yyg->yy_start; |
1035 | yy_match: |
1036 | do |
1037 | { |
1038 | YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; |
1039 | if (yy_accept[yy_current_state]) |
1040 | { |
1041 | yyg->yy_last_accepting_state = yy_current_state; |
1042 | yyg->yy_last_accepting_cpos = yy_cp; |
1043 | } |
1044 | while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) |
1045 | { |
1046 | yy_current_state = (int)yy_def[yy_current_state]; |
1047 | if (yy_current_state >= 95) |
1048 | yy_c = yy_meta[yy_c]; |
1049 | } |
1050 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
1051 | ++yy_cp; |
1052 | } while (yy_current_state != 94); |
1053 | yy_cp = yyg->yy_last_accepting_cpos; |
1054 | yy_current_state = yyg->yy_last_accepting_state; |
1055 | |
1056 | yy_find_action: |
1057 | yy_act = yy_accept[yy_current_state]; |
1058 | |
1059 | YY_DO_BEFORE_ACTION; |
1060 | |
1061 | do_action: /* This label is used only to access EOF actions. */ |
1062 | |
1063 | switch (yy_act) |
1064 | { /* beginning of action switch */ |
1065 | case 0: /* must back up */ |
1066 | /* undo the effects of YY_DO_BEFORE_ACTION */ |
1067 | *yy_cp = yyg->yy_hold_char; |
1068 | yy_cp = yyg->yy_last_accepting_cpos; |
1069 | yy_current_state = yyg->yy_last_accepting_state; |
1070 | goto yy_find_action; |
1071 | |
1072 | case 1: |
1073 | YY_RULE_SETUP |
1074 | |
1075 | YY_BREAK |
1076 | /* Block comment */ |
1077 | /* Line breaks are just counted - not returned. */ |
1078 | /* The comment is replaced by a single space. */ |
1079 | case 2: |
1080 | YY_RULE_SETUP { BEGIN(COMMENT); } |
1081 | YY_BREAK |
1082 | case 3: |
1083 | YY_RULE_SETUP |
1084 | |
1085 | YY_BREAK |
1086 | case 4: |
1087 | YY_RULE_SETUP |
1088 | |
1089 | YY_BREAK |
1090 | case 5: |
1091 | /* rule 5 can match eol */ |
1092 | YY_RULE_SETUP |
1093 | { |
1094 | if (yylineno == INT_MAX) |
1095 | { |
1096 | *yylval = "Integer overflow on line number" ; |
1097 | return angle::pp::Token::GOT_ERROR; |
1098 | } |
1099 | ++yylineno; |
1100 | } |
1101 | YY_BREAK |
1102 | case 6: |
1103 | YY_RULE_SETUP |
1104 | { |
1105 | yyextra->leadingSpace = true; |
1106 | BEGIN(INITIAL); |
1107 | } |
1108 | YY_BREAK |
1109 | case 7: |
1110 | YY_RULE_SETUP |
1111 | { |
1112 | // # is only valid at start of line for preprocessor directives. |
1113 | yylval->assign(1, yytext[0]); |
1114 | return yyextra->lineStart ? angle::pp::Token::PP_HASH |
1115 | : angle::pp::Token::PP_OTHER; |
1116 | } |
1117 | YY_BREAK |
1118 | case 8: |
1119 | YY_RULE_SETUP |
1120 | { |
1121 | yylval->assign(yytext, yyleng); |
1122 | return angle::pp::Token::IDENTIFIER; |
1123 | } |
1124 | YY_BREAK |
1125 | case 9: |
1126 | YY_RULE_SETUP |
1127 | { |
1128 | yylval->assign(yytext, yyleng); |
1129 | return angle::pp::Token::CONST_INT; |
1130 | } |
1131 | YY_BREAK |
1132 | case 10: |
1133 | YY_RULE_SETUP |
1134 | { |
1135 | yylval->assign(yytext, yyleng); |
1136 | return angle::pp::Token::CONST_FLOAT; |
1137 | } |
1138 | YY_BREAK |
1139 | /* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */ |
1140 | /* Rule to catch all invalid integers and floats. */ |
1141 | case 11: |
1142 | YY_RULE_SETUP |
1143 | { |
1144 | yylval->assign(yytext, yyleng); |
1145 | return angle::pp::Token::PP_NUMBER; |
1146 | } |
1147 | YY_BREAK |
1148 | case 12: |
1149 | YY_RULE_SETUP |
1150 | { |
1151 | yylval->assign(yytext, yyleng); |
1152 | return angle::pp::Token::OP_INC; |
1153 | } |
1154 | YY_BREAK |
1155 | case 13: |
1156 | YY_RULE_SETUP |
1157 | { |
1158 | yylval->assign(yytext, yyleng); |
1159 | return angle::pp::Token::OP_DEC; |
1160 | } |
1161 | YY_BREAK |
1162 | case 14: |
1163 | YY_RULE_SETUP |
1164 | { |
1165 | yylval->assign(yytext, yyleng); |
1166 | return angle::pp::Token::OP_LEFT; |
1167 | } |
1168 | YY_BREAK |
1169 | case 15: |
1170 | YY_RULE_SETUP |
1171 | { |
1172 | yylval->assign(yytext, yyleng); |
1173 | return angle::pp::Token::OP_RIGHT; |
1174 | } |
1175 | YY_BREAK |
1176 | case 16: |
1177 | YY_RULE_SETUP |
1178 | { |
1179 | yylval->assign(yytext, yyleng); |
1180 | return angle::pp::Token::OP_LE; |
1181 | } |
1182 | YY_BREAK |
1183 | case 17: |
1184 | YY_RULE_SETUP |
1185 | { |
1186 | yylval->assign(yytext, yyleng); |
1187 | return angle::pp::Token::OP_GE; |
1188 | } |
1189 | YY_BREAK |
1190 | case 18: |
1191 | YY_RULE_SETUP |
1192 | { |
1193 | yylval->assign(yytext, yyleng); |
1194 | return angle::pp::Token::OP_EQ; |
1195 | } |
1196 | YY_BREAK |
1197 | case 19: |
1198 | YY_RULE_SETUP |
1199 | { |
1200 | yylval->assign(yytext, yyleng); |
1201 | return angle::pp::Token::OP_NE; |
1202 | } |
1203 | YY_BREAK |
1204 | case 20: |
1205 | YY_RULE_SETUP |
1206 | { |
1207 | yylval->assign(yytext, yyleng); |
1208 | return angle::pp::Token::OP_AND; |
1209 | } |
1210 | YY_BREAK |
1211 | case 21: |
1212 | YY_RULE_SETUP |
1213 | { |
1214 | yylval->assign(yytext, yyleng); |
1215 | return angle::pp::Token::OP_XOR; |
1216 | } |
1217 | YY_BREAK |
1218 | case 22: |
1219 | YY_RULE_SETUP |
1220 | { |
1221 | yylval->assign(yytext, yyleng); |
1222 | return angle::pp::Token::OP_OR; |
1223 | } |
1224 | YY_BREAK |
1225 | case 23: |
1226 | YY_RULE_SETUP |
1227 | { |
1228 | yylval->assign(yytext, yyleng); |
1229 | return angle::pp::Token::OP_ADD_ASSIGN; |
1230 | } |
1231 | YY_BREAK |
1232 | case 24: |
1233 | YY_RULE_SETUP |
1234 | { |
1235 | yylval->assign(yytext, yyleng); |
1236 | return angle::pp::Token::OP_SUB_ASSIGN; |
1237 | } |
1238 | YY_BREAK |
1239 | case 25: |
1240 | YY_RULE_SETUP |
1241 | { |
1242 | yylval->assign(yytext, yyleng); |
1243 | return angle::pp::Token::OP_MUL_ASSIGN; |
1244 | } |
1245 | YY_BREAK |
1246 | case 26: |
1247 | YY_RULE_SETUP |
1248 | { |
1249 | yylval->assign(yytext, yyleng); |
1250 | return angle::pp::Token::OP_DIV_ASSIGN; |
1251 | } |
1252 | YY_BREAK |
1253 | case 27: |
1254 | YY_RULE_SETUP |
1255 | { |
1256 | yylval->assign(yytext, yyleng); |
1257 | return angle::pp::Token::OP_MOD_ASSIGN; |
1258 | } |
1259 | YY_BREAK |
1260 | case 28: |
1261 | YY_RULE_SETUP |
1262 | { |
1263 | yylval->assign(yytext, yyleng); |
1264 | return angle::pp::Token::OP_LEFT_ASSIGN; |
1265 | } |
1266 | YY_BREAK |
1267 | case 29: |
1268 | YY_RULE_SETUP |
1269 | { |
1270 | yylval->assign(yytext, yyleng); |
1271 | return angle::pp::Token::OP_RIGHT_ASSIGN; |
1272 | } |
1273 | YY_BREAK |
1274 | case 30: |
1275 | YY_RULE_SETUP |
1276 | { |
1277 | yylval->assign(yytext, yyleng); |
1278 | return angle::pp::Token::OP_AND_ASSIGN; |
1279 | } |
1280 | YY_BREAK |
1281 | case 31: |
1282 | YY_RULE_SETUP |
1283 | { |
1284 | yylval->assign(yytext, yyleng); |
1285 | return angle::pp::Token::OP_XOR_ASSIGN; |
1286 | } |
1287 | YY_BREAK |
1288 | case 32: |
1289 | YY_RULE_SETUP |
1290 | { |
1291 | yylval->assign(yytext, yyleng); |
1292 | return angle::pp::Token::OP_OR_ASSIGN; |
1293 | } |
1294 | YY_BREAK |
1295 | case 33: |
1296 | YY_RULE_SETUP |
1297 | { |
1298 | yylval->assign(1, yytext[0]); |
1299 | return yytext[0]; |
1300 | } |
1301 | YY_BREAK |
1302 | case 34: |
1303 | YY_RULE_SETUP { yyextra->leadingSpace = true; } |
1304 | YY_BREAK |
1305 | case 35: |
1306 | /* rule 35 can match eol */ |
1307 | YY_RULE_SETUP |
1308 | { |
1309 | if (yylineno == INT_MAX) |
1310 | { |
1311 | *yylval = "Integer overflow on line number" ; |
1312 | return angle::pp::Token::GOT_ERROR; |
1313 | } |
1314 | ++yylineno; |
1315 | yylval->assign(1, '\n'); |
1316 | return '\n'; |
1317 | } |
1318 | YY_BREAK |
1319 | case 36: |
1320 | YY_RULE_SETUP |
1321 | { |
1322 | yylval->assign(1, yytext[0]); |
1323 | return angle::pp::Token::PP_OTHER; |
1324 | } |
1325 | YY_BREAK |
1326 | case YY_STATE_EOF(INITIAL): |
1327 | case YY_STATE_EOF(COMMENT): |
1328 | { |
1329 | // YY_USER_ACTION is not invoked for handling EOF. |
1330 | // Set the location for EOF token manually. |
1331 | angle::pp::Input *input = &yyextra->input; |
1332 | angle::pp::Input::Location *scanLoc = &yyextra->scanLoc; |
1333 | yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0; |
1334 | if (scanLoc->sIndex != sIndexMax) |
1335 | { |
1336 | // We can only reach here if there are empty strings at the |
1337 | // end of the input. |
1338 | scanLoc->sIndex = sIndexMax; |
1339 | scanLoc->cIndex = 0; |
1340 | // FIXME: this is not 64-bit clean. |
1341 | yyfileno = static_cast<int>(sIndexMax); |
1342 | yylineno = 1; |
1343 | } |
1344 | yylloc->file = yyfileno; |
1345 | yylloc->line = yylineno; |
1346 | yylval->clear(); |
1347 | |
1348 | // Line number overflows fake EOFs to exit early, check for this case. |
1349 | if (yylineno == INT_MAX) |
1350 | { |
1351 | yyextra->diagnostics->report(angle::pp::Diagnostics::PP_TOKENIZER_ERROR, |
1352 | angle::pp::SourceLocation(yyfileno, yylineno), |
1353 | "Integer overflow on line number" ); |
1354 | } |
1355 | else if (YY_START == COMMENT) |
1356 | { |
1357 | yyextra->diagnostics->report(angle::pp::Diagnostics::PP_EOF_IN_COMMENT, |
1358 | angle::pp::SourceLocation(yyfileno, yylineno), |
1359 | "EOF while in a comment" ); |
1360 | } |
1361 | yyterminate(); |
1362 | } |
1363 | YY_BREAK |
1364 | case 37: |
1365 | YY_RULE_SETUP |
1366 | ECHO; |
1367 | YY_BREAK |
1368 | |
1369 | case YY_END_OF_BUFFER: |
1370 | { |
1371 | /* Amount of text matched not including the EOB char. */ |
1372 | int yy_amount_of_matched_text = (int)(yy_cp - yyg->yytext_ptr) - 1; |
1373 | |
1374 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ |
1375 | *yy_cp = yyg->yy_hold_char; |
1376 | YY_RESTORE_YY_MORE_OFFSET |
1377 | |
1378 | if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW) |
1379 | { |
1380 | /* We're scanning a new file or input source. It's |
1381 | * possible that this happened because the user |
1382 | * just pointed yyin at a new source and called |
1383 | * yylex(). If so, then we have to assure |
1384 | * consistency between YY_CURRENT_BUFFER and our |
1385 | * globals. Here is the right place to do so, because |
1386 | * this is the first action (other than possibly a |
1387 | * back-up) that will match for the new input source. |
1388 | */ |
1389 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
1390 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; |
1391 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; |
1392 | } |
1393 | |
1394 | /* Note that here we test for yy_c_buf_p "<=" to the position |
1395 | * of the first EOB in the buffer, since yy_c_buf_p will |
1396 | * already have been incremented past the NUL character |
1397 | * (since all states make transitions on EOB to the |
1398 | * end-of-buffer state). Contrast this with the test |
1399 | * in input(). |
1400 | */ |
1401 | if (yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]) |
1402 | { /* This was really a NUL. */ |
1403 | yy_state_type yy_next_state; |
1404 | |
1405 | yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; |
1406 | |
1407 | yy_current_state = yy_get_previous_state(yyscanner); |
1408 | |
1409 | /* Okay, we're now positioned to make the NUL |
1410 | * transition. We couldn't have |
1411 | * yy_get_previous_state() go ahead and do it |
1412 | * for us because it doesn't know how to deal |
1413 | * with the possibility of jamming (and we don't |
1414 | * want to build jamming into it because then it |
1415 | * will run more slowly). |
1416 | */ |
1417 | |
1418 | yy_next_state = yy_try_NUL_trans(yy_current_state, yyscanner); |
1419 | |
1420 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
1421 | |
1422 | if (yy_next_state) |
1423 | { |
1424 | /* Consume the NUL. */ |
1425 | yy_cp = ++yyg->yy_c_buf_p; |
1426 | yy_current_state = yy_next_state; |
1427 | goto yy_match; |
1428 | } |
1429 | |
1430 | else |
1431 | { |
1432 | yy_cp = yyg->yy_last_accepting_cpos; |
1433 | yy_current_state = yyg->yy_last_accepting_state; |
1434 | goto yy_find_action; |
1435 | } |
1436 | } |
1437 | |
1438 | else |
1439 | switch (yy_get_next_buffer(yyscanner)) |
1440 | { |
1441 | case EOB_ACT_END_OF_FILE: |
1442 | { |
1443 | yyg->yy_did_buffer_switch_on_eof = 0; |
1444 | |
1445 | if (yywrap(yyscanner)) |
1446 | { |
1447 | /* Note: because we've taken care in |
1448 | * yy_get_next_buffer() to have set up |
1449 | * yytext, we can now set up |
1450 | * yy_c_buf_p so that if some total |
1451 | * hoser (like flex itself) wants to |
1452 | * call the scanner after we return the |
1453 | * YY_NULL, it'll still work - another |
1454 | * YY_NULL will get returned. |
1455 | */ |
1456 | yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; |
1457 | |
1458 | yy_act = YY_STATE_EOF(YY_START); |
1459 | goto do_action; |
1460 | } |
1461 | |
1462 | else |
1463 | { |
1464 | if (!yyg->yy_did_buffer_switch_on_eof) |
1465 | YY_NEW_FILE; |
1466 | } |
1467 | break; |
1468 | } |
1469 | |
1470 | case EOB_ACT_CONTINUE_SCAN: |
1471 | yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; |
1472 | |
1473 | yy_current_state = yy_get_previous_state(yyscanner); |
1474 | |
1475 | yy_cp = yyg->yy_c_buf_p; |
1476 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
1477 | goto yy_match; |
1478 | |
1479 | case EOB_ACT_LAST_MATCH: |
1480 | yyg->yy_c_buf_p = |
1481 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; |
1482 | |
1483 | yy_current_state = yy_get_previous_state(yyscanner); |
1484 | |
1485 | yy_cp = yyg->yy_c_buf_p; |
1486 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
1487 | goto yy_find_action; |
1488 | } |
1489 | break; |
1490 | } |
1491 | |
1492 | default: |
1493 | YY_FATAL_ERROR("fatal flex scanner internal error--no action found" ); |
1494 | } /* end of action switch */ |
1495 | } /* end of scanning one token */ |
1496 | } /* end of user's declarations */ |
1497 | } /* end of yylex */ |
1498 | |
1499 | /* yy_get_next_buffer - try to read in a new buffer |
1500 | * |
1501 | * Returns a code representing an action: |
1502 | * EOB_ACT_LAST_MATCH - |
1503 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
1504 | * EOB_ACT_END_OF_FILE - end of file |
1505 | */ |
1506 | static int yy_get_next_buffer(yyscan_t yyscanner) |
1507 | { |
1508 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
1509 | char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; |
1510 | char *source = yyg->yytext_ptr; |
1511 | int number_to_move, i; |
1512 | int ret_val; |
1513 | |
1514 | if (yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1]) |
1515 | YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed" ); |
1516 | |
1517 | if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0) |
1518 | { /* Don't try to fill the buffer, so this is an EOF. */ |
1519 | if (yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1) |
1520 | { |
1521 | /* We matched a single character, the EOB, so |
1522 | * treat this as a final EOF. |
1523 | */ |
1524 | return EOB_ACT_END_OF_FILE; |
1525 | } |
1526 | |
1527 | else |
1528 | { |
1529 | /* We matched some text prior to the EOB, first |
1530 | * process it. |
1531 | */ |
1532 | return EOB_ACT_LAST_MATCH; |
1533 | } |
1534 | } |
1535 | |
1536 | /* Try to read more data. */ |
1537 | |
1538 | /* First move last chars to start of buffer. */ |
1539 | number_to_move = (int)(yyg->yy_c_buf_p - yyg->yytext_ptr - 1); |
1540 | |
1541 | for (i = 0; i < number_to_move; ++i) |
1542 | *(dest++) = *(source++); |
1543 | |
1544 | if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING) |
1545 | /* don't do the read, it's not guaranteed to return an EOF, |
1546 | * just force an EOF |
1547 | */ |
1548 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; |
1549 | |
1550 | else |
1551 | { |
1552 | int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
1553 | |
1554 | while (num_to_read <= 0) |
1555 | { /* Not enough room in the buffer - grow it. */ |
1556 | |
1557 | /* just a shorter name for the current buffer */ |
1558 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; |
1559 | |
1560 | int yy_c_buf_p_offset = (int)(yyg->yy_c_buf_p - b->yy_ch_buf); |
1561 | |
1562 | if (b->yy_is_our_buffer) |
1563 | { |
1564 | int new_size = b->yy_buf_size * 2; |
1565 | |
1566 | if (new_size <= 0) |
1567 | b->yy_buf_size += b->yy_buf_size / 8; |
1568 | else |
1569 | b->yy_buf_size *= 2; |
1570 | |
1571 | b->yy_ch_buf = (char *) |
1572 | /* Include room in for 2 EOB chars. */ |
1573 | yyrealloc((void *)b->yy_ch_buf, (yy_size_t)(b->yy_buf_size + 2), yyscanner); |
1574 | } |
1575 | else |
1576 | /* Can't grow it, we don't own it. */ |
1577 | b->yy_ch_buf = NULL; |
1578 | |
1579 | if (!b->yy_ch_buf) |
1580 | YY_FATAL_ERROR("fatal error - scanner input buffer overflow" ); |
1581 | |
1582 | yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; |
1583 | |
1584 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
1585 | } |
1586 | |
1587 | if (num_to_read > YY_READ_BUF_SIZE) |
1588 | num_to_read = YY_READ_BUF_SIZE; |
1589 | |
1590 | /* Read in more data. */ |
1591 | yy_size_t ret = 0; |
1592 | YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), ret, num_to_read); |
1593 | yyg->yy_n_chars = static_cast<int>(ret); |
1594 | |
1595 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
1596 | } |
1597 | |
1598 | if (yyg->yy_n_chars == 0) |
1599 | { |
1600 | if (number_to_move == YY_MORE_ADJ) |
1601 | { |
1602 | ret_val = EOB_ACT_END_OF_FILE; |
1603 | yyrestart(yyin, yyscanner); |
1604 | } |
1605 | |
1606 | else |
1607 | { |
1608 | ret_val = EOB_ACT_LAST_MATCH; |
1609 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; |
1610 | } |
1611 | } |
1612 | |
1613 | else |
1614 | ret_val = EOB_ACT_CONTINUE_SCAN; |
1615 | |
1616 | if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) |
1617 | { |
1618 | /* Extend the array by 50%, plus the number we really need. */ |
1619 | int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); |
1620 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *)yyrealloc( |
1621 | (void *)YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t)new_size, yyscanner); |
1622 | if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) |
1623 | YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()" ); |
1624 | /* "- 2" to take care of EOB's */ |
1625 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int)(new_size - 2); |
1626 | } |
1627 | |
1628 | yyg->yy_n_chars += number_to_move; |
1629 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; |
1630 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; |
1631 | |
1632 | yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; |
1633 | |
1634 | return ret_val; |
1635 | } |
1636 | |
1637 | /* yy_get_previous_state - get the state just before the EOB char was reached */ |
1638 | |
1639 | static yy_state_type yy_get_previous_state(yyscan_t yyscanner) |
1640 | { |
1641 | yy_state_type yy_current_state; |
1642 | char *yy_cp; |
1643 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
1644 | |
1645 | yy_current_state = yyg->yy_start; |
1646 | |
1647 | for (yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp) |
1648 | { |
1649 | YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); |
1650 | if (yy_accept[yy_current_state]) |
1651 | { |
1652 | yyg->yy_last_accepting_state = yy_current_state; |
1653 | yyg->yy_last_accepting_cpos = yy_cp; |
1654 | } |
1655 | while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) |
1656 | { |
1657 | yy_current_state = (int)yy_def[yy_current_state]; |
1658 | if (yy_current_state >= 95) |
1659 | yy_c = yy_meta[yy_c]; |
1660 | } |
1661 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
1662 | } |
1663 | |
1664 | return yy_current_state; |
1665 | } |
1666 | |
1667 | /* yy_try_NUL_trans - try to make a transition on the NUL character |
1668 | * |
1669 | * synopsis |
1670 | * next_state = yy_try_NUL_trans( current_state ); |
1671 | */ |
1672 | static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state, yyscan_t yyscanner) |
1673 | { |
1674 | int yy_is_jam; |
1675 | struct yyguts_t *yyg = |
1676 | (struct yyguts_t *)yyscanner; /* This var may be unused depending upon options. */ |
1677 | char *yy_cp = yyg->yy_c_buf_p; |
1678 | |
1679 | YY_CHAR yy_c = 1; |
1680 | if (yy_accept[yy_current_state]) |
1681 | { |
1682 | yyg->yy_last_accepting_state = yy_current_state; |
1683 | yyg->yy_last_accepting_cpos = yy_cp; |
1684 | } |
1685 | while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) |
1686 | { |
1687 | yy_current_state = (int)yy_def[yy_current_state]; |
1688 | if (yy_current_state >= 95) |
1689 | yy_c = yy_meta[yy_c]; |
1690 | } |
1691 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
1692 | yy_is_jam = (yy_current_state == 94); |
1693 | |
1694 | (void)yyg; |
1695 | return yy_is_jam ? 0 : yy_current_state; |
1696 | } |
1697 | |
1698 | #ifndef YY_NO_UNPUT |
1699 | |
1700 | #endif |
1701 | |
1702 | #ifndef YY_NO_INPUT |
1703 | # ifdef __cplusplus |
1704 | static int yyinput(yyscan_t yyscanner) |
1705 | # else |
1706 | static int input(yyscan_t yyscanner) |
1707 | # endif |
1708 | |
1709 | { |
1710 | int c; |
1711 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
1712 | |
1713 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
1714 | |
1715 | if (*yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR) |
1716 | { |
1717 | /* yy_c_buf_p now points to the character we want to return. |
1718 | * If this occurs *before* the EOB characters, then it's a |
1719 | * valid NUL; if not, then we've hit the end of the buffer. |
1720 | */ |
1721 | if (yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]) |
1722 | /* This was really a NUL. */ |
1723 | *yyg->yy_c_buf_p = '\0'; |
1724 | |
1725 | else |
1726 | { /* need more input */ |
1727 | int offset = (int)(yyg->yy_c_buf_p - yyg->yytext_ptr); |
1728 | ++yyg->yy_c_buf_p; |
1729 | |
1730 | switch (yy_get_next_buffer(yyscanner)) |
1731 | { |
1732 | case EOB_ACT_LAST_MATCH: |
1733 | /* This happens because yy_g_n_b() |
1734 | * sees that we've accumulated a |
1735 | * token and flags that we need to |
1736 | * try matching the token before |
1737 | * proceeding. But for input(), |
1738 | * there's no matching to consider. |
1739 | * So convert the EOB_ACT_LAST_MATCH |
1740 | * to EOB_ACT_END_OF_FILE. |
1741 | */ |
1742 | |
1743 | /* Reset buffer status. */ |
1744 | yyrestart(yyin, yyscanner); |
1745 | |
1746 | /*FALLTHROUGH*/ |
1747 | |
1748 | case EOB_ACT_END_OF_FILE: |
1749 | { |
1750 | if (yywrap(yyscanner)) |
1751 | return 0; |
1752 | |
1753 | if (!yyg->yy_did_buffer_switch_on_eof) |
1754 | YY_NEW_FILE; |
1755 | # ifdef __cplusplus |
1756 | return yyinput(yyscanner); |
1757 | # else |
1758 | return input(yyscanner); |
1759 | # endif |
1760 | } |
1761 | |
1762 | case EOB_ACT_CONTINUE_SCAN: |
1763 | yyg->yy_c_buf_p = yyg->yytext_ptr + offset; |
1764 | break; |
1765 | } |
1766 | } |
1767 | } |
1768 | |
1769 | c = *(unsigned char *)yyg->yy_c_buf_p; /* cast for 8-bit char's */ |
1770 | *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ |
1771 | yyg->yy_hold_char = *++yyg->yy_c_buf_p; |
1772 | |
1773 | return c; |
1774 | } |
1775 | #endif /* ifndef YY_NO_INPUT */ |
1776 | |
1777 | /** Immediately switch to a different input stream. |
1778 | * @param input_file A readable stream. |
1779 | * @param yyscanner The scanner object. |
1780 | * @note This function does not reset the start condition to @c INITIAL . |
1781 | */ |
1782 | void yyrestart(FILE *input_file, yyscan_t yyscanner) |
1783 | { |
1784 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
1785 | |
1786 | if (!YY_CURRENT_BUFFER) |
1787 | { |
1788 | yyensure_buffer_stack(yyscanner); |
1789 | YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); |
1790 | } |
1791 | |
1792 | yy_init_buffer(YY_CURRENT_BUFFER, input_file, yyscanner); |
1793 | yy_load_buffer_state(yyscanner); |
1794 | } |
1795 | |
1796 | /** Switch to a different input buffer. |
1797 | * @param new_buffer The new input buffer. |
1798 | * @param yyscanner The scanner object. |
1799 | */ |
1800 | void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner) |
1801 | { |
1802 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
1803 | |
1804 | /* TODO. We should be able to replace this entire function body |
1805 | * with |
1806 | * yypop_buffer_state(); |
1807 | * yypush_buffer_state(new_buffer); |
1808 | */ |
1809 | yyensure_buffer_stack(yyscanner); |
1810 | if (YY_CURRENT_BUFFER == new_buffer) |
1811 | return; |
1812 | |
1813 | if (YY_CURRENT_BUFFER) |
1814 | { |
1815 | /* Flush out information for old buffer. */ |
1816 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
1817 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
1818 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
1819 | } |
1820 | |
1821 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
1822 | yy_load_buffer_state(yyscanner); |
1823 | |
1824 | /* We don't actually know whether we did this switch during |
1825 | * EOF (yywrap()) processing, but the only time this flag |
1826 | * is looked at is after yywrap() is called, so it's safe |
1827 | * to go ahead and always set it. |
1828 | */ |
1829 | yyg->yy_did_buffer_switch_on_eof = 1; |
1830 | } |
1831 | |
1832 | static void yy_load_buffer_state(yyscan_t yyscanner) |
1833 | { |
1834 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
1835 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
1836 | yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; |
1837 | yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; |
1838 | yyg->yy_hold_char = *yyg->yy_c_buf_p; |
1839 | } |
1840 | |
1841 | /** Allocate and initialize an input buffer state. |
1842 | * @param file A readable stream. |
1843 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. |
1844 | * @param yyscanner The scanner object. |
1845 | * @return the allocated buffer state. |
1846 | */ |
1847 | YY_BUFFER_STATE yy_create_buffer(FILE *file, int size, yyscan_t yyscanner) |
1848 | { |
1849 | YY_BUFFER_STATE b; |
1850 | |
1851 | b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state), yyscanner); |
1852 | if (!b) |
1853 | YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()" ); |
1854 | |
1855 | b->yy_buf_size = size; |
1856 | |
1857 | /* yy_ch_buf has to be 2 characters longer than the size given because |
1858 | * we need to put in 2 end-of-buffer characters. |
1859 | */ |
1860 | b->yy_ch_buf = (char *)yyalloc((yy_size_t)(b->yy_buf_size + 2), yyscanner); |
1861 | if (!b->yy_ch_buf) |
1862 | YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()" ); |
1863 | |
1864 | b->yy_is_our_buffer = 1; |
1865 | |
1866 | yy_init_buffer(b, file, yyscanner); |
1867 | |
1868 | return b; |
1869 | } |
1870 | |
1871 | /** Destroy the buffer. |
1872 | * @param b a buffer created with yy_create_buffer() |
1873 | * @param yyscanner The scanner object. |
1874 | */ |
1875 | void yy_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner) |
1876 | { |
1877 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
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 | yyfree((void *)b->yy_ch_buf, yyscanner); |
1887 | |
1888 | yyfree((void *)b, yyscanner); |
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 yyrestart() or at EOF. |
1894 | */ |
1895 | static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file, yyscan_t yyscanner) |
1896 | |
1897 | { |
1898 | int oerrno = errno; |
1899 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
1900 | |
1901 | yy_flush_buffer(b, yyscanner); |
1902 | |
1903 | b->yy_input_file = file; |
1904 | b->yy_fill_buffer = 1; |
1905 | |
1906 | /* If b is the current buffer, then yy_init_buffer was _probably_ |
1907 | * called from yyrestart() or through yy_get_next_buffer. |
1908 | * In that case, we don't want to reset the lineno or column. |
1909 | */ |
1910 | if (b != YY_CURRENT_BUFFER) |
1911 | { |
1912 | b->yy_bs_lineno = 1; |
1913 | b->yy_bs_column = 0; |
1914 | } |
1915 | |
1916 | b->yy_is_interactive = 0; |
1917 | |
1918 | errno = oerrno; |
1919 | } |
1920 | |
1921 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. |
1922 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. |
1923 | * @param yyscanner The scanner object. |
1924 | */ |
1925 | void yy_flush_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner) |
1926 | { |
1927 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
1928 | if (!b) |
1929 | return; |
1930 | |
1931 | b->yy_n_chars = 0; |
1932 | |
1933 | /* We always need two end-of-buffer characters. The first causes |
1934 | * a transition to the end-of-buffer state. The second causes |
1935 | * a jam in that state. |
1936 | */ |
1937 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; |
1938 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; |
1939 | |
1940 | b->yy_buf_pos = &b->yy_ch_buf[0]; |
1941 | |
1942 | b->yy_at_bol = 1; |
1943 | b->yy_buffer_status = YY_BUFFER_NEW; |
1944 | |
1945 | if (b == YY_CURRENT_BUFFER) |
1946 | yy_load_buffer_state(yyscanner); |
1947 | } |
1948 | |
1949 | /** Pushes the new state onto the stack. The new state becomes |
1950 | * the current state. This function will allocate the stack |
1951 | * if necessary. |
1952 | * @param new_buffer The new state. |
1953 | * @param yyscanner The scanner object. |
1954 | */ |
1955 | void yypush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner) |
1956 | { |
1957 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
1958 | if (new_buffer == NULL) |
1959 | return; |
1960 | |
1961 | yyensure_buffer_stack(yyscanner); |
1962 | |
1963 | /* This block is copied from yy_switch_to_buffer. */ |
1964 | if (YY_CURRENT_BUFFER) |
1965 | { |
1966 | /* Flush out information for old buffer. */ |
1967 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
1968 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
1969 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
1970 | } |
1971 | |
1972 | /* Only push if top exists. Otherwise, replace top. */ |
1973 | if (YY_CURRENT_BUFFER) |
1974 | yyg->yy_buffer_stack_top++; |
1975 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
1976 | |
1977 | /* copied from yy_switch_to_buffer. */ |
1978 | yy_load_buffer_state(yyscanner); |
1979 | yyg->yy_did_buffer_switch_on_eof = 1; |
1980 | } |
1981 | |
1982 | /** Removes and deletes the top of the stack, if present. |
1983 | * The next element becomes the new top. |
1984 | * @param yyscanner The scanner object. |
1985 | */ |
1986 | void yypop_buffer_state(yyscan_t yyscanner) |
1987 | { |
1988 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
1989 | if (!YY_CURRENT_BUFFER) |
1990 | return; |
1991 | |
1992 | yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner); |
1993 | YY_CURRENT_BUFFER_LVALUE = NULL; |
1994 | if (yyg->yy_buffer_stack_top > 0) |
1995 | --yyg->yy_buffer_stack_top; |
1996 | |
1997 | if (YY_CURRENT_BUFFER) |
1998 | { |
1999 | yy_load_buffer_state(yyscanner); |
2000 | yyg->yy_did_buffer_switch_on_eof = 1; |
2001 | } |
2002 | } |
2003 | |
2004 | /* Allocates the stack if it does not exist. |
2005 | * Guarantees space for at least one push. |
2006 | */ |
2007 | static void yyensure_buffer_stack(yyscan_t yyscanner) |
2008 | { |
2009 | yy_size_t num_to_alloc; |
2010 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2011 | |
2012 | if (!yyg->yy_buffer_stack) |
2013 | { |
2014 | |
2015 | /* First allocation is just for 2 elements, since we don't know if this |
2016 | * scanner will even need a stack. We use 2 instead of 1 to avoid an |
2017 | * immediate realloc on the next call. |
2018 | */ |
2019 | num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ |
2020 | yyg->yy_buffer_stack = (struct yy_buffer_state **)yyalloc( |
2021 | num_to_alloc * sizeof(struct yy_buffer_state *), yyscanner); |
2022 | if (!yyg->yy_buffer_stack) |
2023 | YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()" ); |
2024 | |
2025 | memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state *)); |
2026 | |
2027 | yyg->yy_buffer_stack_max = num_to_alloc; |
2028 | yyg->yy_buffer_stack_top = 0; |
2029 | return; |
2030 | } |
2031 | |
2032 | if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1) |
2033 | { |
2034 | |
2035 | /* Increase the buffer to prepare for a possible push. */ |
2036 | yy_size_t grow_size = 8 /* arbitrary grow size */; |
2037 | |
2038 | num_to_alloc = yyg->yy_buffer_stack_max + grow_size; |
2039 | yyg->yy_buffer_stack = (struct yy_buffer_state **)yyrealloc( |
2040 | yyg->yy_buffer_stack, num_to_alloc * sizeof(struct yy_buffer_state *), yyscanner); |
2041 | if (!yyg->yy_buffer_stack) |
2042 | YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()" ); |
2043 | |
2044 | /* zero only the new slots.*/ |
2045 | memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, |
2046 | grow_size * sizeof(struct yy_buffer_state *)); |
2047 | yyg->yy_buffer_stack_max = num_to_alloc; |
2048 | } |
2049 | } |
2050 | |
2051 | /** Setup the input buffer state to scan directly from a user-specified character buffer. |
2052 | * @param base the character buffer |
2053 | * @param size the size in bytes of the character buffer |
2054 | * @param yyscanner The scanner object. |
2055 | * @return the newly allocated buffer state object. |
2056 | */ |
2057 | YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner) |
2058 | { |
2059 | YY_BUFFER_STATE b; |
2060 | |
2061 | if (size < 2 || base[size - 2] != YY_END_OF_BUFFER_CHAR || |
2062 | base[size - 1] != YY_END_OF_BUFFER_CHAR) |
2063 | /* They forgot to leave room for the EOB's. */ |
2064 | return NULL; |
2065 | |
2066 | b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state), yyscanner); |
2067 | if (!b) |
2068 | YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()" ); |
2069 | |
2070 | b->yy_buf_size = (int)(size - 2); /* "- 2" to take care of EOB's */ |
2071 | b->yy_buf_pos = b->yy_ch_buf = base; |
2072 | b->yy_is_our_buffer = 0; |
2073 | b->yy_input_file = NULL; |
2074 | b->yy_n_chars = b->yy_buf_size; |
2075 | b->yy_is_interactive = 0; |
2076 | b->yy_at_bol = 1; |
2077 | b->yy_fill_buffer = 0; |
2078 | b->yy_buffer_status = YY_BUFFER_NEW; |
2079 | |
2080 | yy_switch_to_buffer(b, yyscanner); |
2081 | |
2082 | return b; |
2083 | } |
2084 | |
2085 | /** Setup the input buffer state to scan a string. The next call to yylex() will |
2086 | * scan from a @e copy of @a str. |
2087 | * @param yystr a NUL-terminated string to scan |
2088 | * @param yyscanner The scanner object. |
2089 | * @return the newly allocated buffer state object. |
2090 | * @note If you want to scan bytes that may contain NUL values, then use |
2091 | * yy_scan_bytes() instead. |
2092 | */ |
2093 | YY_BUFFER_STATE yy_scan_string(const char *yystr, yyscan_t yyscanner) |
2094 | { |
2095 | |
2096 | return yy_scan_bytes(yystr, (int)strlen(yystr), yyscanner); |
2097 | } |
2098 | |
2099 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will |
2100 | * scan from a @e copy of @a bytes. |
2101 | * @param yybytes the byte buffer to scan |
2102 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
2103 | * @param yyscanner The scanner object. |
2104 | * @return the newly allocated buffer state object. |
2105 | */ |
2106 | YY_BUFFER_STATE yy_scan_bytes(const char *yybytes, int _yybytes_len, yyscan_t yyscanner) |
2107 | { |
2108 | YY_BUFFER_STATE b; |
2109 | char *buf; |
2110 | yy_size_t n; |
2111 | int i; |
2112 | |
2113 | /* Get memory for full buffer, including space for trailing EOB's. */ |
2114 | n = (yy_size_t)(_yybytes_len + 2); |
2115 | buf = (char *)yyalloc(n, yyscanner); |
2116 | if (!buf) |
2117 | YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()" ); |
2118 | |
2119 | for (i = 0; i < _yybytes_len; ++i) |
2120 | buf[i] = yybytes[i]; |
2121 | |
2122 | buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR; |
2123 | |
2124 | b = yy_scan_buffer(buf, n, yyscanner); |
2125 | if (!b) |
2126 | YY_FATAL_ERROR("bad buffer in yy_scan_bytes()" ); |
2127 | |
2128 | /* It's okay to grow etc. this buffer, and we should throw it |
2129 | * away when we're done. |
2130 | */ |
2131 | b->yy_is_our_buffer = 1; |
2132 | |
2133 | return b; |
2134 | } |
2135 | |
2136 | #ifndef YY_EXIT_FAILURE |
2137 | # define YY_EXIT_FAILURE 2 |
2138 | #endif |
2139 | |
2140 | static void yynoreturn yy_fatal_error(const char *msg, yyscan_t yyscanner) |
2141 | { |
2142 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2143 | (void)yyg; |
2144 | fprintf(stderr, "%s\n" , msg); |
2145 | exit(YY_EXIT_FAILURE); |
2146 | } |
2147 | |
2148 | /* Redefine yyless() so it works in section 3 code. */ |
2149 | |
2150 | #undef yyless |
2151 | #define yyless(n) \ |
2152 | do \ |
2153 | { \ |
2154 | /* Undo effects of setting up yytext. */ \ |
2155 | int yyless_macro_arg = (n); \ |
2156 | YY_LESS_LINENO(yyless_macro_arg); \ |
2157 | yytext[yyleng] = yyg->yy_hold_char; \ |
2158 | yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ |
2159 | yyg->yy_hold_char = *yyg->yy_c_buf_p; \ |
2160 | *yyg->yy_c_buf_p = '\0'; \ |
2161 | yyleng = yyless_macro_arg; \ |
2162 | } while (0) |
2163 | |
2164 | /* Accessor methods (get/set functions) to struct members. */ |
2165 | |
2166 | /** Get the user-defined data for this scanner. |
2167 | * @param yyscanner The scanner object. |
2168 | */ |
2169 | YY_EXTRA_TYPE yyget_extra(yyscan_t yyscanner) |
2170 | { |
2171 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2172 | return yyextra; |
2173 | } |
2174 | |
2175 | /** Get the current line number. |
2176 | * @param yyscanner The scanner object. |
2177 | */ |
2178 | int yyget_lineno(yyscan_t yyscanner) |
2179 | { |
2180 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2181 | |
2182 | if (!YY_CURRENT_BUFFER) |
2183 | return 0; |
2184 | |
2185 | return yylineno; |
2186 | } |
2187 | |
2188 | /** Get the current column number. |
2189 | * @param yyscanner The scanner object. |
2190 | */ |
2191 | int yyget_column(yyscan_t yyscanner) |
2192 | { |
2193 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2194 | |
2195 | if (!YY_CURRENT_BUFFER) |
2196 | return 0; |
2197 | |
2198 | return yycolumn; |
2199 | } |
2200 | |
2201 | /** Get the input stream. |
2202 | * @param yyscanner The scanner object. |
2203 | */ |
2204 | FILE *yyget_in(yyscan_t yyscanner) |
2205 | { |
2206 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2207 | return yyin; |
2208 | } |
2209 | |
2210 | /** Get the output stream. |
2211 | * @param yyscanner The scanner object. |
2212 | */ |
2213 | FILE *yyget_out(yyscan_t yyscanner) |
2214 | { |
2215 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2216 | return yyout; |
2217 | } |
2218 | |
2219 | /** Get the length of the current token. |
2220 | * @param yyscanner The scanner object. |
2221 | */ |
2222 | int yyget_leng(yyscan_t yyscanner) |
2223 | { |
2224 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2225 | return yyleng; |
2226 | } |
2227 | |
2228 | /** Get the current token. |
2229 | * @param yyscanner The scanner object. |
2230 | */ |
2231 | |
2232 | char *yyget_text(yyscan_t yyscanner) |
2233 | { |
2234 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2235 | return yytext; |
2236 | } |
2237 | |
2238 | /** Set the user-defined data. This data is never touched by the scanner. |
2239 | * @param user_defined The data to be associated with this scanner. |
2240 | * @param yyscanner The scanner object. |
2241 | */ |
2242 | void yyset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner) |
2243 | { |
2244 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2245 | yyextra = user_defined; |
2246 | } |
2247 | |
2248 | /** Set the current line number. |
2249 | * @param _line_number line number |
2250 | * @param yyscanner The scanner object. |
2251 | */ |
2252 | void yyset_lineno(int _line_number, yyscan_t yyscanner) |
2253 | { |
2254 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2255 | |
2256 | /* lineno is only valid if an input buffer exists. */ |
2257 | if (!YY_CURRENT_BUFFER) |
2258 | YY_FATAL_ERROR("yyset_lineno called with no buffer" ); |
2259 | |
2260 | yylineno = _line_number; |
2261 | } |
2262 | |
2263 | /** Set the current column. |
2264 | * @param _column_no column number |
2265 | * @param yyscanner The scanner object. |
2266 | */ |
2267 | void yyset_column(int _column_no, yyscan_t yyscanner) |
2268 | { |
2269 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2270 | |
2271 | /* column is only valid if an input buffer exists. */ |
2272 | if (!YY_CURRENT_BUFFER) |
2273 | YY_FATAL_ERROR("yyset_column called with no buffer" ); |
2274 | |
2275 | yycolumn = _column_no; |
2276 | } |
2277 | |
2278 | /** Set the input stream. This does not discard the current |
2279 | * input buffer. |
2280 | * @param _in_str A readable stream. |
2281 | * @param yyscanner The scanner object. |
2282 | * @see yy_switch_to_buffer |
2283 | */ |
2284 | void yyset_in(FILE *_in_str, yyscan_t yyscanner) |
2285 | { |
2286 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2287 | yyin = _in_str; |
2288 | } |
2289 | |
2290 | void yyset_out(FILE *_out_str, yyscan_t yyscanner) |
2291 | { |
2292 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2293 | yyout = _out_str; |
2294 | } |
2295 | |
2296 | int yyget_debug(yyscan_t yyscanner) |
2297 | { |
2298 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2299 | return yy_flex_debug; |
2300 | } |
2301 | |
2302 | void yyset_debug(int _bdebug, yyscan_t yyscanner) |
2303 | { |
2304 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2305 | yy_flex_debug = _bdebug; |
2306 | } |
2307 | |
2308 | /* Accessor methods for yylval and yylloc */ |
2309 | |
2310 | YYSTYPE *yyget_lval(yyscan_t yyscanner) |
2311 | { |
2312 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2313 | return yylval; |
2314 | } |
2315 | |
2316 | void yyset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner) |
2317 | { |
2318 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2319 | yylval = yylval_param; |
2320 | } |
2321 | |
2322 | YYLTYPE *yyget_lloc(yyscan_t yyscanner) |
2323 | { |
2324 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2325 | return yylloc; |
2326 | } |
2327 | |
2328 | void yyset_lloc(YYLTYPE *yylloc_param, yyscan_t yyscanner) |
2329 | { |
2330 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2331 | yylloc = yylloc_param; |
2332 | } |
2333 | |
2334 | /* User-visible API */ |
2335 | |
2336 | /* yylex_init is special because it creates the scanner itself, so it is |
2337 | * the ONLY reentrant function that doesn't take the scanner as the last argument. |
2338 | * That's why we explicitly handle the declaration, instead of using our macros. |
2339 | */ |
2340 | int yylex_init(yyscan_t *ptr_yy_globals) |
2341 | { |
2342 | if (ptr_yy_globals == NULL) |
2343 | { |
2344 | errno = EINVAL; |
2345 | return 1; |
2346 | } |
2347 | |
2348 | *ptr_yy_globals = (yyscan_t)yyalloc(sizeof(struct yyguts_t), NULL); |
2349 | |
2350 | if (*ptr_yy_globals == NULL) |
2351 | { |
2352 | errno = ENOMEM; |
2353 | return 1; |
2354 | } |
2355 | |
2356 | /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ |
2357 | memset(*ptr_yy_globals, 0x00, sizeof(struct yyguts_t)); |
2358 | |
2359 | return yy_init_globals(*ptr_yy_globals); |
2360 | } |
2361 | |
2362 | /* yylex_init_extra has the same functionality as yylex_init, but follows the |
2363 | * convention of taking the scanner as the last argument. Note however, that |
2364 | * this is a *pointer* to a scanner, as it will be allocated by this call (and |
2365 | * is the reason, too, why this function also must handle its own declaration). |
2366 | * The user defined value in the first argument will be available to yyalloc in |
2367 | * the yyextra field. |
2368 | */ |
2369 | int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined, yyscan_t *ptr_yy_globals) |
2370 | { |
2371 | struct yyguts_t dummy_yyguts; |
2372 | |
2373 | yyset_extra(yy_user_defined, &dummy_yyguts); |
2374 | |
2375 | if (ptr_yy_globals == NULL) |
2376 | { |
2377 | errno = EINVAL; |
2378 | return 1; |
2379 | } |
2380 | |
2381 | *ptr_yy_globals = (yyscan_t)yyalloc(sizeof(struct yyguts_t), &dummy_yyguts); |
2382 | |
2383 | if (*ptr_yy_globals == NULL) |
2384 | { |
2385 | errno = ENOMEM; |
2386 | return 1; |
2387 | } |
2388 | |
2389 | /* By setting to 0xAA, we expose bugs in |
2390 | yy_init_globals. Leave at 0x00 for releases. */ |
2391 | memset(*ptr_yy_globals, 0x00, sizeof(struct yyguts_t)); |
2392 | |
2393 | yyset_extra(yy_user_defined, *ptr_yy_globals); |
2394 | |
2395 | return yy_init_globals(*ptr_yy_globals); |
2396 | } |
2397 | |
2398 | static int yy_init_globals(yyscan_t yyscanner) |
2399 | { |
2400 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2401 | /* Initialization is the same as for the non-reentrant scanner. |
2402 | * This function is called from yylex_destroy(), so don't allocate here. |
2403 | */ |
2404 | |
2405 | yyg->yy_buffer_stack = NULL; |
2406 | yyg->yy_buffer_stack_top = 0; |
2407 | yyg->yy_buffer_stack_max = 0; |
2408 | yyg->yy_c_buf_p = NULL; |
2409 | yyg->yy_init = 0; |
2410 | yyg->yy_start = 0; |
2411 | |
2412 | yyg->yy_start_stack_ptr = 0; |
2413 | yyg->yy_start_stack_depth = 0; |
2414 | yyg->yy_start_stack = NULL; |
2415 | |
2416 | /* Defined in main.c */ |
2417 | #ifdef YY_STDINIT |
2418 | yyin = stdin; |
2419 | yyout = stdout; |
2420 | #else |
2421 | yyin = NULL; |
2422 | yyout = NULL; |
2423 | #endif |
2424 | |
2425 | /* For future reference: Set errno on error, since we are called by |
2426 | * yylex_init() |
2427 | */ |
2428 | return 0; |
2429 | } |
2430 | |
2431 | /* yylex_destroy is for both reentrant and non-reentrant scanners. */ |
2432 | int yylex_destroy(yyscan_t yyscanner) |
2433 | { |
2434 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2435 | |
2436 | /* Pop the buffer stack, destroying each element. */ |
2437 | while (YY_CURRENT_BUFFER) |
2438 | { |
2439 | yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner); |
2440 | YY_CURRENT_BUFFER_LVALUE = NULL; |
2441 | yypop_buffer_state(yyscanner); |
2442 | } |
2443 | |
2444 | /* Destroy the stack itself. */ |
2445 | yyfree(yyg->yy_buffer_stack, yyscanner); |
2446 | yyg->yy_buffer_stack = NULL; |
2447 | |
2448 | /* Destroy the start condition stack. */ |
2449 | yyfree(yyg->yy_start_stack, yyscanner); |
2450 | yyg->yy_start_stack = NULL; |
2451 | |
2452 | /* Reset the globals. This is important in a non-reentrant scanner so the next time |
2453 | * yylex() is called, initialization will occur. */ |
2454 | yy_init_globals(yyscanner); |
2455 | |
2456 | /* Destroy the main struct (reentrant only). */ |
2457 | yyfree(yyscanner, yyscanner); |
2458 | yyscanner = NULL; |
2459 | return 0; |
2460 | } |
2461 | |
2462 | /* |
2463 | * Internal utility routines. |
2464 | */ |
2465 | |
2466 | #ifndef yytext_ptr |
2467 | static void yy_flex_strncpy(char *s1, const char *s2, int n, yyscan_t yyscanner) |
2468 | { |
2469 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2470 | (void)yyg; |
2471 | |
2472 | int i; |
2473 | for (i = 0; i < n; ++i) |
2474 | s1[i] = s2[i]; |
2475 | } |
2476 | #endif |
2477 | |
2478 | #ifdef YY_NEED_STRLEN |
2479 | static int yy_flex_strlen(const char *s, yyscan_t yyscanner) |
2480 | { |
2481 | int n; |
2482 | for (n = 0; s[n]; ++n) |
2483 | ; |
2484 | |
2485 | return n; |
2486 | } |
2487 | #endif |
2488 | |
2489 | void *yyalloc(yy_size_t size, yyscan_t yyscanner) |
2490 | { |
2491 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2492 | (void)yyg; |
2493 | return malloc(size); |
2494 | } |
2495 | |
2496 | void *yyrealloc(void *ptr, yy_size_t size, yyscan_t yyscanner) |
2497 | { |
2498 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2499 | (void)yyg; |
2500 | |
2501 | /* The cast to (char *) in the following accommodates both |
2502 | * implementations that use char* generic pointers, and those |
2503 | * that use void* generic pointers. It works with the latter |
2504 | * because both ANSI C and C++ allow castless assignment from |
2505 | * any pointer type to void*, and deal with argument conversions |
2506 | * as though doing an assignment. |
2507 | */ |
2508 | return realloc(ptr, size); |
2509 | } |
2510 | |
2511 | void yyfree(void *ptr, yyscan_t yyscanner) |
2512 | { |
2513 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
2514 | (void)yyg; |
2515 | free((char *)ptr); /* see yyrealloc() for (char *) cast */ |
2516 | } |
2517 | |
2518 | #define YYTABLES_NAME "yytables" |
2519 | |
2520 | namespace angle |
2521 | { |
2522 | |
2523 | namespace pp |
2524 | { |
2525 | |
2526 | Tokenizer::Tokenizer(Diagnostics *diagnostics) : mHandle(nullptr), mMaxTokenSize(256) |
2527 | { |
2528 | mContext.diagnostics = diagnostics; |
2529 | } |
2530 | |
2531 | Tokenizer::~Tokenizer() |
2532 | { |
2533 | destroyScanner(); |
2534 | } |
2535 | |
2536 | bool Tokenizer::init(size_t count, const char *const string[], const int length[]) |
2537 | { |
2538 | if ((count > 0) && (string == 0)) |
2539 | return false; |
2540 | |
2541 | mContext.input = Input(count, string, length); |
2542 | return initScanner(); |
2543 | } |
2544 | |
2545 | void Tokenizer::setFileNumber(int file) |
2546 | { |
2547 | // We use column number as file number. |
2548 | // See macro yyfileno. |
2549 | yyset_column(file, mHandle); |
2550 | } |
2551 | |
2552 | void Tokenizer::setLineNumber(int line) |
2553 | { |
2554 | yyset_lineno(line, mHandle); |
2555 | } |
2556 | |
2557 | void Tokenizer::setMaxTokenSize(size_t maxTokenSize) |
2558 | { |
2559 | mMaxTokenSize = maxTokenSize; |
2560 | } |
2561 | |
2562 | void Tokenizer::lex(Token *token) |
2563 | { |
2564 | int tokenType = yylex(&token->text, &token->location, mHandle); |
2565 | |
2566 | if (tokenType == Token::GOT_ERROR) |
2567 | { |
2568 | mContext.diagnostics->report(Diagnostics::PP_TOKENIZER_ERROR, token->location, token->text); |
2569 | token->type = Token::LAST; |
2570 | } |
2571 | else |
2572 | { |
2573 | token->type = tokenType; |
2574 | } |
2575 | |
2576 | if (token->text.size() > mMaxTokenSize) |
2577 | { |
2578 | mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG, token->location, token->text); |
2579 | token->text.erase(mMaxTokenSize); |
2580 | } |
2581 | |
2582 | token->flags = 0; |
2583 | |
2584 | token->setAtStartOfLine(mContext.lineStart); |
2585 | mContext.lineStart = token->type == '\n'; |
2586 | |
2587 | token->setHasLeadingSpace(mContext.leadingSpace); |
2588 | mContext.leadingSpace = false; |
2589 | } |
2590 | |
2591 | bool Tokenizer::initScanner() |
2592 | { |
2593 | if ((mHandle == nullptr) && yylex_init_extra(&mContext, &mHandle)) |
2594 | return false; |
2595 | |
2596 | yyrestart(0, mHandle); |
2597 | return true; |
2598 | } |
2599 | |
2600 | void Tokenizer::destroyScanner() |
2601 | { |
2602 | if (mHandle == nullptr) |
2603 | return; |
2604 | |
2605 | yylex_destroy(mHandle); |
2606 | mHandle = nullptr; |
2607 | } |
2608 | |
2609 | } // namespace pp |
2610 | |
2611 | } // namespace angle |
2612 | |