blob: 5ef0e5e5c2c463739b702a8a3d4591597a652efe [file] [log] [blame]
shannonwoods@chromium.orgb0757162013-05-30 00:21:27 +00001#line 16 "./Tokenizer.l"
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002//
Jamie Madill88f6e942014-02-19 10:27:53 -05003// Copyright (c) 2011-2014 The ANGLE Project Authors. All rights reserved.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00004// 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
11
alokp@chromium.org04d7d222012-05-16 19:24:07 +000012#define YY_INT_ALIGNED short int
13
14/* A lexical scanner generated by flex */
15
Geoff Lang93561c32016-09-20 10:22:55 -040016
17
18
19
20
21
22
23
24
25
alokp@chromium.org04d7d222012-05-16 19:24:07 +000026#define FLEX_SCANNER
27#define YY_FLEX_MAJOR_VERSION 2
Geoff Lang93561c32016-09-20 10:22:55 -040028#define YY_FLEX_MINOR_VERSION 6
29#define YY_FLEX_SUBMINOR_VERSION 1
alokp@chromium.org04d7d222012-05-16 19:24:07 +000030#if YY_FLEX_SUBMINOR_VERSION > 0
31#define FLEX_BETA
32#endif
33
Geoff Lang93561c32016-09-20 10:22:55 -040034
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000102/* First, we deal with platform-specific or compiler-specific issues. */
103
104/* begin standard C headers. */
105#include <stdio.h>
106#include <string.h>
107#include <errno.h>
108#include <stdlib.h>
109
110/* end standard C headers. */
111
112/* flex integer type definitions */
113
114#ifndef FLEXINT_H
115#define FLEXINT_H
116
117/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
118
119#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
120
121/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
122 * if you want the limit (max/min) macros for int types.
123 */
124#ifndef __STDC_LIMIT_MACROS
125#define __STDC_LIMIT_MACROS 1
126#endif
127
128#include <inttypes.h>
129typedef int8_t flex_int8_t;
130typedef uint8_t flex_uint8_t;
131typedef int16_t flex_int16_t;
132typedef uint16_t flex_uint16_t;
133typedef int32_t flex_int32_t;
134typedef uint32_t flex_uint32_t;
135#else
136typedef signed char flex_int8_t;
137typedef short int flex_int16_t;
138typedef int flex_int32_t;
139typedef unsigned char flex_uint8_t;
140typedef unsigned short int flex_uint16_t;
141typedef unsigned int flex_uint32_t;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000142
143/* Limits of integral types. */
144#ifndef INT8_MIN
145#define INT8_MIN (-128)
146#endif
147#ifndef INT16_MIN
148#define INT16_MIN (-32767-1)
149#endif
150#ifndef INT32_MIN
151#define INT32_MIN (-2147483647-1)
152#endif
153#ifndef INT8_MAX
154#define INT8_MAX (127)
155#endif
156#ifndef INT16_MAX
157#define INT16_MAX (32767)
158#endif
159#ifndef INT32_MAX
160#define INT32_MAX (2147483647)
161#endif
162#ifndef UINT8_MAX
163#define UINT8_MAX (255U)
164#endif
165#ifndef UINT16_MAX
166#define UINT16_MAX (65535U)
167#endif
168#ifndef UINT32_MAX
169#define UINT32_MAX (4294967295U)
170#endif
171
Zhenyao Mof1d723c2013-09-23 14:57:07 -0400172#endif /* ! C99 */
173
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000174#endif /* ! FLEXINT_H */
175
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000176
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000177
Geoff Lang93561c32016-09-20 10:22:55 -0400178/* TODO: this is always defined, so inline it */
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000179#define yyconst const
Geoff Lang93561c32016-09-20 10:22:55 -0400180
181#if defined(__GNUC__) && __GNUC__ >= 3
182#define yynoreturn __attribute__((__noreturn__))
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000183#else
Geoff Lang93561c32016-09-20 10:22:55 -0400184#define yynoreturn
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000185#endif
186
Geoff Lang93561c32016-09-20 10:22:55 -0400187
188
189
190
191
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000192/* Returned upon end-of-file. */
193#define YY_NULL 0
194
Geoff Lang93561c32016-09-20 10:22:55 -0400195
196
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000197/* Promotes a possibly negative, possibly signed char to an unsigned
198 * integer for use as an array index. If the signed char is negative,
199 * we want to instead treat it as an 8-bit unsigned char, hence the
200 * double cast.
201 */
202#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
203
Geoff Lang93561c32016-09-20 10:22:55 -0400204
205
206
207
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000208/* An opaque pointer. */
209#ifndef YY_TYPEDEF_YY_SCANNER_T
210#define YY_TYPEDEF_YY_SCANNER_T
211typedef void* yyscan_t;
212#endif
213
Geoff Lang93561c32016-09-20 10:22:55 -0400214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000232/* For convenience, these vars (plus the bison vars far below)
233 are macros in the reentrant scanner. */
234#define yyin yyg->yyin_r
235#define yyout yyg->yyout_r
236#define yyextra yyg->yyextra_r
237#define yyleng yyg->yyleng_r
238#define yytext yyg->yytext_r
239#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
240#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
241#define yy_flex_debug yyg->yy_flex_debug_r
242
Geoff Lang93561c32016-09-20 10:22:55 -0400243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000258/* Enter a start condition. This macro really ought to take a parameter,
259 * but we do it the disgusting crufty way forced on us by the ()-less
260 * definition of BEGIN.
261 */
262#define BEGIN yyg->yy_start = 1 + 2 *
263
Geoff Lang93561c32016-09-20 10:22:55 -0400264
265
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000266/* Translate the current start state into a value that can be later handed
267 * to BEGIN to return to the state. The YYSTATE alias is for lex
268 * compatibility.
269 */
270#define YY_START ((yyg->yy_start - 1) / 2)
271#define YYSTATE YY_START
272
Geoff Lang93561c32016-09-20 10:22:55 -0400273
274
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000275/* Action number for EOF rule of a given start state. */
276#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
277
Geoff Lang93561c32016-09-20 10:22:55 -0400278
279
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000280/* Special action meaning "start processing a new file". */
281#define YY_NEW_FILE pprestart(yyin ,yyscanner )
282
Geoff Lang93561c32016-09-20 10:22:55 -0400283
284
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000285#define YY_END_OF_BUFFER_CHAR 0
286
Geoff Lang93561c32016-09-20 10:22:55 -0400287
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000288/* Size of default input buffer. */
289#ifndef YY_BUF_SIZE
Geoff Lang93561c32016-09-20 10:22:55 -0400290#ifdef __ia64__
291/* On IA-64, the buffer size is 16k, not 8k.
292 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
293 * Ditto for the __ia64__ case accordingly.
294 */
295#define YY_BUF_SIZE 32768
296#else
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000297#define YY_BUF_SIZE 16384
Geoff Lang93561c32016-09-20 10:22:55 -0400298#endif /* __ia64__ */
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000299#endif
300
Geoff Lang93561c32016-09-20 10:22:55 -0400301
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000302/* The state buf must be large enough to hold one state per character in the main buffer.
303 */
304#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
305
Geoff Lang93561c32016-09-20 10:22:55 -0400306
307
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000308#ifndef YY_TYPEDEF_YY_BUFFER_STATE
309#define YY_TYPEDEF_YY_BUFFER_STATE
310typedef struct yy_buffer_state *YY_BUFFER_STATE;
311#endif
312
shannonwoods@chromium.orgb0757162013-05-30 00:21:27 +0000313#ifndef YY_TYPEDEF_YY_SIZE_T
314#define YY_TYPEDEF_YY_SIZE_T
315typedef size_t yy_size_t;
316#endif
317
Geoff Lang93561c32016-09-20 10:22:55 -0400318
319
Zhenyao Mof1d723c2013-09-23 14:57:07 -0400320
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000321#define EOB_ACT_CONTINUE_SCAN 0
322#define EOB_ACT_END_OF_FILE 1
323#define EOB_ACT_LAST_MATCH 2
324
Geoff Lang93561c32016-09-20 10:22:55 -0400325
326
327
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000328 #define YY_LESS_LINENO(n)
Jamie Madill185de882014-12-22 15:17:52 -0500329 #define YY_LINENO_REWIND_TO(ptr)
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000330
Geoff Lang93561c32016-09-20 10:22:55 -0400331
332
333
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000334/* Return all but the first "n" matched characters back to the input stream. */
335#define yyless(n) \
336 do \
337 { \
338 /* Undo effects of setting up yytext. */ \
339 int yyless_macro_arg = (n); \
340 YY_LESS_LINENO(yyless_macro_arg);\
341 *yy_cp = yyg->yy_hold_char; \
342 YY_RESTORE_YY_MORE_OFFSET \
343 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
344 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
345 } \
346 while ( 0 )
347
Geoff Lang93561c32016-09-20 10:22:55 -0400348
349
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000350#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
351
Geoff Lang93561c32016-09-20 10:22:55 -0400352
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000353#ifndef YY_STRUCT_YY_BUFFER_STATE
354#define YY_STRUCT_YY_BUFFER_STATE
355struct yy_buffer_state
356 {
357 FILE *yy_input_file;
358
Geoff Lang93561c32016-09-20 10:22:55 -0400359
360
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000361 char *yy_ch_buf; /* input buffer */
362 char *yy_buf_pos; /* current position in input buffer */
363
364 /* Size of input buffer in bytes, not including room for EOB
365 * characters.
366 */
Geoff Lang93561c32016-09-20 10:22:55 -0400367 int yy_buf_size;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000368
369 /* Number of characters read into yy_ch_buf, not including EOB
370 * characters.
371 */
Geoff Lang93561c32016-09-20 10:22:55 -0400372 int yy_n_chars;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000373
374 /* Whether we "own" the buffer - i.e., we know we created it,
375 * and can realloc() it to grow it, and should free() it to
376 * delete it.
377 */
378 int yy_is_our_buffer;
379
380 /* Whether this is an "interactive" input source; if so, and
381 * if we're using stdio for input, then we want to use getc()
382 * instead of fread(), to make sure we stop fetching input after
383 * each newline.
384 */
385 int yy_is_interactive;
386
387 /* Whether we're considered to be at the beginning of a line.
388 * If so, '^' rules will be active on the next match, otherwise
389 * not.
390 */
391 int yy_at_bol;
392
393 int yy_bs_lineno; /**< The line count. */
394 int yy_bs_column; /**< The column count. */
395
Geoff Lang93561c32016-09-20 10:22:55 -0400396
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000397 /* Whether to try to fill the input buffer when we reach the
398 * end of it.
399 */
400 int yy_fill_buffer;
401
402 int yy_buffer_status;
403
404#define YY_BUFFER_NEW 0
405#define YY_BUFFER_NORMAL 1
406 /* When an EOF's been seen but there's still some text to process
407 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
408 * shouldn't try reading from the input source any more. We might
409 * still have a bunch of tokens to match, though, because of
410 * possible backing-up.
411 *
412 * When we actually see the EOF, we change the status to "new"
413 * (via pprestart()), so that the user can continue scanning by
414 * just pointing yyin at a new input file.
415 */
416#define YY_BUFFER_EOF_PENDING 2
417
418 };
419#endif /* !YY_STRUCT_YY_BUFFER_STATE */
420
Geoff Lang93561c32016-09-20 10:22:55 -0400421
422
423
424
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000425/* We provide macros for accessing buffer states in case in the
426 * future we want to put the buffer states in a more general
427 * "scanner state".
428 *
429 * Returns the top of the stack, or NULL.
430 */
431#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
432 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
433 : NULL)
434
Geoff Lang93561c32016-09-20 10:22:55 -0400435
436
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000437/* Same as previous macro, but useful when we know that the buffer stack is not
438 * NULL or when we need an lvalue. For internal use only.
439 */
440#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
441
Geoff Lang93561c32016-09-20 10:22:55 -0400442
443
444
445
446
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000447void pprestart (FILE *input_file ,yyscan_t yyscanner );
448void pp_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
449YY_BUFFER_STATE pp_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
450void pp_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
451void pp_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
452void pppush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
453void pppop_buffer_state (yyscan_t yyscanner );
454
Geoff Lang93561c32016-09-20 10:22:55 -0400455
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000456static void ppensure_buffer_stack (yyscan_t yyscanner );
457static void pp_load_buffer_state (yyscan_t yyscanner );
458static void pp_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
459
Geoff Lang93561c32016-09-20 10:22:55 -0400460
461
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000462#define YY_FLUSH_BUFFER pp_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
463
Geoff Lang93561c32016-09-20 10:22:55 -0400464
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000465YY_BUFFER_STATE pp_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
466YY_BUFFER_STATE pp_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -0400467YY_BUFFER_STATE pp_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
468
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000469
470void *ppalloc (yy_size_t ,yyscan_t yyscanner );
471void *pprealloc (void *,yy_size_t ,yyscan_t yyscanner );
472void ppfree (void * ,yyscan_t yyscanner );
473
Geoff Lang93561c32016-09-20 10:22:55 -0400474
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000475#define yy_new_buffer pp_create_buffer
476
Geoff Lang93561c32016-09-20 10:22:55 -0400477
478
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000479#define yy_set_interactive(is_interactive) \
480 { \
481 if ( ! YY_CURRENT_BUFFER ){ \
482 ppensure_buffer_stack (yyscanner); \
483 YY_CURRENT_BUFFER_LVALUE = \
484 pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
485 } \
486 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
487 }
488
Geoff Lang93561c32016-09-20 10:22:55 -0400489
490
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000491#define yy_set_bol(at_bol) \
492 { \
493 if ( ! YY_CURRENT_BUFFER ){\
494 ppensure_buffer_stack (yyscanner); \
495 YY_CURRENT_BUFFER_LVALUE = \
496 pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
497 } \
498 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
499 }
500
Geoff Lang93561c32016-09-20 10:22:55 -0400501
502
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000503#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
504
Geoff Lang93561c32016-09-20 10:22:55 -0400505
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000506/* Begin user sect3 */
507
Geoff Lang93561c32016-09-20 10:22:55 -0400508#define ppwrap(yyscanner) (/*CONSTCOND*/1)
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000509#define YY_SKIP_YYWRAP
510
511typedef unsigned char YY_CHAR;
512
Geoff Lang93561c32016-09-20 10:22:55 -0400513
514
515
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000516typedef int yy_state_type;
517
518#define yytext_ptr yytext_r
519
Geoff Lang93561c32016-09-20 10:22:55 -0400520
521
522
523
524
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000525static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
526static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
527static int yy_get_next_buffer (yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -0400528static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner );
529
530
531
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000532
533/* Done after the current pattern has been matched and before the
534 * corresponding action - sets up yytext.
535 */
536#define YY_DO_BEFORE_ACTION \
537 yyg->yytext_ptr = yy_bp; \
Geoff Lang93561c32016-09-20 10:22:55 -0400538 yyleng = (int) (yy_cp - yy_bp); \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000539 yyg->yy_hold_char = *yy_cp; \
540 *yy_cp = '\0'; \
541 yyg->yy_c_buf_p = yy_cp;
542
Geoff Lang93561c32016-09-20 10:22:55 -0400543
544
shannon.woods%transgaming.com@gtempaccount.combcde56f2013-04-13 03:32:12 +0000545#define YY_NUM_RULES 38
546#define YY_END_OF_BUFFER 39
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000547/* This struct is not used in this scanner,
548 but its presence is necessary. */
549struct yy_trans_info
550 {
551 flex_int32_t yy_verify;
552 flex_int32_t yy_nxt;
553 };
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000554static yyconst flex_int16_t yy_accept[98] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000555 { 0,
shannon.woods%transgaming.com@gtempaccount.combcde56f2013-04-13 03:32:12 +0000556 0, 0, 0, 0, 39, 37, 34, 35, 35, 33,
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000557 7, 33, 33, 33, 33, 33, 33, 33, 33, 9,
shannon.woods%transgaming.com@gtempaccount.combcde56f2013-04-13 03:32:12 +0000558 9, 33, 33, 33, 8, 37, 33, 33, 3, 5,
559 5, 4, 34, 35, 19, 27, 20, 30, 25, 12,
560 23, 13, 24, 10, 2, 1, 26, 10, 9, 11,
shannonwoods@chromium.orgc8100b82013-05-30 00:20:34 +0000561 11, 11, 9, 11, 9, 9, 14, 16, 18, 17,
562 15, 8, 36, 36, 31, 21, 32, 22, 3, 5,
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000563 6, 11, 10, 11, 10, 1, 10, 11, 10, 0,
564 10, 9, 9, 9, 28, 29, 0, 10, 10, 10,
565 10, 9, 10, 10, 9, 10, 0
shannonwoods@chromium.org3f83e292013-05-30 00:21:34 +0000566
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000567 } ;
568
Geoff Lang93561c32016-09-20 10:22:55 -0400569static yyconst YY_CHAR yy_ec[256] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000570 { 0,
571 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
572 2, 2, 4, 1, 1, 1, 1, 1, 1, 1,
573 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
574 1, 2, 5, 1, 6, 1, 7, 8, 1, 9,
575 9, 10, 11, 9, 12, 13, 14, 15, 16, 16,
576 16, 16, 16, 16, 16, 17, 17, 9, 9, 18,
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000577 19, 20, 9, 1, 21, 21, 21, 21, 22, 23,
578 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
579 24, 24, 24, 24, 25, 24, 24, 26, 24, 24,
580 9, 27, 9, 28, 24, 1, 21, 21, 21, 21,
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000581
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000582 22, 23, 24, 24, 24, 24, 24, 24, 24, 24,
583 24, 24, 24, 24, 24, 24, 25, 24, 24, 26,
584 24, 24, 9, 29, 9, 9, 1, 1, 1, 1,
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000585 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
586 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
587 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
588 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
589 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
590 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
591 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
592
593 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
594 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
595 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
596 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
597 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
598 1, 1, 1, 1, 1
599 } ;
600
Geoff Lang93561c32016-09-20 10:22:55 -0400601static yyconst YY_CHAR yy_meta[30] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000602 { 0,
603 1, 1, 2, 2, 1, 1, 1, 1, 1, 3,
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000604 1, 1, 4, 1, 5, 5, 5, 1, 1, 1,
605 5, 5, 5, 5, 5, 5, 1, 1, 1
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000606 } ;
607
Geoff Lang93561c32016-09-20 10:22:55 -0400608static yyconst flex_uint16_t yy_base[103] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000609 { 0,
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000610 0, 0, 27, 29, 137, 194, 133, 194, 117, 100,
611 194, 98, 26, 194, 94, 24, 28, 33, 32, 39,
612 51, 39, 80, 50, 0, 68, 25, 54, 0, 194,
613 88, 71, 80, 194, 194, 194, 194, 194, 194, 194,
614 194, 194, 194, 71, 194, 0, 194, 85, 55, 64,
615 99, 111, 53, 105, 0, 50, 55, 194, 194, 194,
616 40, 0, 194, 38, 194, 194, 194, 194, 0, 194,
617 194, 117, 0, 130, 0, 0, 0, 137, 0, 88,
618 113, 0, 131, 0, 194, 194, 143, 139, 152, 150,
619 0, 13, 153, 194, 0, 194, 194, 176, 31, 181,
shannon.woods%transgaming.com@gtempaccount.combcde56f2013-04-13 03:32:12 +0000620
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000621 186, 188
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000622 } ;
623
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000624static yyconst flex_int16_t yy_def[103] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000625 { 0,
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000626 97, 1, 98, 98, 97, 97, 97, 97, 97, 97,
627 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
628 20, 97, 97, 97, 99, 97, 97, 97, 100, 97,
629 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
630 97, 97, 97, 97, 97, 101, 97, 97, 20, 20,
631 50, 51, 51, 102, 21, 51, 97, 97, 97, 97,
632 97, 99, 97, 97, 97, 97, 97, 97, 100, 97,
633 97, 44, 44, 72, 72, 101, 48, 51, 51, 97,
634 52, 51, 102, 51, 97, 97, 97, 74, 78, 97,
635 51, 51, 97, 97, 51, 97, 0, 97, 97, 97,
shannon.woods%transgaming.com@gtempaccount.combcde56f2013-04-13 03:32:12 +0000636
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000637 97, 97
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000638 } ;
639
Geoff Lang93561c32016-09-20 10:22:55 -0400640static yyconst flex_uint16_t yy_nxt[224] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000641 { 0,
642 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
643 16, 17, 18, 19, 20, 21, 21, 22, 23, 24,
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000644 25, 25, 25, 25, 25, 25, 26, 27, 28, 30,
645 31, 30, 31, 37, 40, 62, 32, 95, 32, 42,
646 63, 45, 41, 65, 38, 46, 43, 44, 44, 44,
647 47, 48, 66, 49, 49, 50, 57, 58, 86, 51,
648 52, 51, 51, 53, 54, 55, 55, 55, 60, 61,
649 63, 64, 67, 85, 84, 56, 51, 82, 50, 50,
650 51, 33, 68, 72, 71, 73, 73, 73, 51, 51,
651 70, 72, 74, 75, 72, 72, 72, 51, 59, 77,
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000652
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000653 77, 77, 90, 90, 90, 51, 78, 79, 51, 51,
654 51, 51, 39, 51, 51, 51, 36, 51, 35, 34,
655 51, 80, 80, 97, 97, 81, 81, 81, 51, 51,
656 51, 72, 72, 72, 33, 91, 97, 97, 72, 72,
657 87, 87, 97, 51, 88, 88, 88, 87, 87, 97,
658 97, 89, 89, 89, 51, 92, 51, 93, 93, 93,
659 97, 75, 97, 97, 90, 90, 90, 93, 93, 93,
660 97, 97, 94, 97, 79, 96, 29, 29, 29, 29,
661 29, 69, 97, 97, 69, 69, 76, 97, 76, 76,
662 76, 83, 83, 5, 97, 97, 97, 97, 97, 97,
shannonwoods@chromium.orgc8100b82013-05-30 00:20:34 +0000663
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000664 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
665 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
666 97, 97, 97
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000667 } ;
668
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000669static yyconst flex_int16_t yy_chk[224] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000670 { 0,
671 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
672 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000673 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
674 3, 4, 4, 13, 16, 99, 3, 92, 4, 17,
675 64, 19, 16, 27, 13, 19, 17, 18, 18, 18,
676 19, 20, 27, 20, 20, 20, 22, 22, 61, 20,
677 20, 20, 20, 20, 20, 21, 21, 21, 24, 24,
678 26, 26, 28, 57, 56, 21, 21, 53, 50, 50,
679 49, 33, 28, 44, 32, 44, 44, 44, 50, 50,
680 31, 44, 44, 44, 44, 44, 44, 48, 23, 48,
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000681
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000682 48, 48, 80, 80, 80, 48, 48, 48, 48, 48,
683 48, 51, 15, 51, 51, 51, 12, 54, 10, 9,
684 51, 52, 52, 81, 81, 52, 52, 52, 54, 54,
685 54, 72, 72, 72, 7, 81, 5, 0, 72, 72,
686 74, 74, 0, 83, 74, 74, 74, 78, 78, 88,
687 88, 78, 78, 78, 83, 83, 83, 87, 87, 87,
688 0, 88, 89, 89, 90, 90, 90, 93, 93, 93,
689 0, 0, 90, 0, 89, 93, 98, 98, 98, 98,
690 98, 100, 0, 0, 100, 100, 101, 0, 101, 101,
691 101, 102, 102, 97, 97, 97, 97, 97, 97, 97,
shannonwoods@chromium.orgc8100b82013-05-30 00:20:34 +0000692
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000693 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
694 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
695 97, 97, 97
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000696 } ;
697
698/* The intent behind this definition is that it'll catch
699 * any uses of REJECT which flex missed.
700 */
701#define REJECT reject_used_but_not_detected
702#define yymore() yymore_used_but_not_detected
703#define YY_MORE_ADJ 0
704#define YY_RESTORE_YY_MORE_OFFSET
705/*
706//
Jamie Madill88f6e942014-02-19 10:27:53 -0500707// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000708// Use of this source code is governed by a BSD-style license that can be
709// found in the LICENSE file.
710//
711
712This file contains the Lex specification for GLSL ES preprocessor.
713Based on Microsoft Visual Studio 2010 Preprocessor Grammar:
714http://msdn.microsoft.com/en-us/library/2scxys89.aspx
715
716IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
717*/
718
Scott Grahama8975422015-05-01 11:09:12 -0700719#if defined(_MSC_VER)
720#pragma warning(disable: 4005)
721#endif
722
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000723#include "Tokenizer.h"
alokp@chromium.org2c958ee2012-05-17 20:35:42 +0000724
daniel@transgaming.comb3077d02013-01-11 04:12:09 +0000725#include "DiagnosticsBase.h"
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000726#include "Token.h"
727
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +0000728#if defined(__GNUC__)
729// Triggered by the auto-generated yy_fatal_error function.
730#pragma GCC diagnostic ignored "-Wmissing-noreturn"
Minmin Gong794e0002015-04-07 18:31:54 -0700731#elif defined(_MSC_VER)
732#pragma warning(disable: 4244)
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +0000733#endif
734
Jamie Madill2dc8bf82015-04-30 15:56:52 -0400735// Workaround for flex using the register keyword, deprecated in C++11.
736#ifdef __cplusplus
737#if __cplusplus > 199711L
738#define register
739#endif
740#endif
741
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000742typedef std::string YYSTYPE;
alokp@chromium.org2c958ee2012-05-17 20:35:42 +0000743typedef pp::SourceLocation YYLTYPE;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000744
745// Use the unused yycolumn variable to track file (string) number.
746#define yyfileno yycolumn
747
748#define YY_USER_INIT \
749 do { \
750 yyfileno = 0; \
751 yylineno = 1; \
752 yyextra->leadingSpace = false; \
753 yyextra->lineStart = true; \
754 } while(0);
755
alokp@chromium.org19d7aa62012-05-31 17:34:05 +0000756#define YY_USER_ACTION \
757 do \
758 { \
759 pp::Input* input = &yyextra->input; \
760 pp::Input::Location* scanLoc = &yyextra->scanLoc; \
761 while ((scanLoc->sIndex < input->count()) && \
762 (scanLoc->cIndex >= input->length(scanLoc->sIndex))) \
763 { \
764 scanLoc->cIndex -= input->length(scanLoc->sIndex++); \
765 ++yyfileno; yylineno = 1; \
766 } \
767 yylloc->file = yyfileno; \
768 yylloc->line = yylineno; \
769 scanLoc->cIndex += yyleng; \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000770 } while(0);
771
772#define YY_INPUT(buf, result, maxSize) \
Olli Etuaho26e355b2015-08-14 14:16:19 +0300773 result = yyextra->input.read(buf, maxSize, &yylineno);
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000774
Geoff Lang93561c32016-09-20 10:22:55 -0400775
776
777
778
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000779#define INITIAL 0
780#define COMMENT 1
781
Geoff Lang93561c32016-09-20 10:22:55 -0400782
783
784
785
786
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000787#define YY_EXTRA_TYPE pp::Tokenizer::Context*
788
Geoff Lang93561c32016-09-20 10:22:55 -0400789
790
791
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000792/* Holds the entire state of the reentrant scanner. */
793struct yyguts_t
794 {
795
796 /* User-defined. Not touched by flex. */
797 YY_EXTRA_TYPE yyextra_r;
798
799 /* The rest are the same as the globals declared in the non-reentrant scanner. */
800 FILE *yyin_r, *yyout_r;
801 size_t yy_buffer_stack_top; /**< index of top of stack. */
802 size_t yy_buffer_stack_max; /**< capacity of stack. */
803 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
804 char yy_hold_char;
Geoff Lang93561c32016-09-20 10:22:55 -0400805 int yy_n_chars;
806 int yyleng_r;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000807 char *yy_c_buf_p;
808 int yy_init;
809 int yy_start;
810 int yy_did_buffer_switch_on_eof;
811 int yy_start_stack_ptr;
812 int yy_start_stack_depth;
813 int *yy_start_stack;
814 yy_state_type yy_last_accepting_state;
815 char* yy_last_accepting_cpos;
816
817 int yylineno_r;
818 int yy_flex_debug_r;
819
Geoff Lang93561c32016-09-20 10:22:55 -0400820
821
822
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000823 char *yytext_r;
824 int yy_more_flag;
825 int yy_more_len;
826
Geoff Lang93561c32016-09-20 10:22:55 -0400827
828
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000829 YYSTYPE * yylval_r;
830
Geoff Lang93561c32016-09-20 10:22:55 -0400831
832
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000833 YYLTYPE * yylloc_r;
834
Geoff Lang93561c32016-09-20 10:22:55 -0400835
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000836 }; /* end struct yyguts_t */
837
Geoff Lang93561c32016-09-20 10:22:55 -0400838
839
840
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000841static int yy_init_globals (yyscan_t yyscanner );
842
Geoff Lang93561c32016-09-20 10:22:55 -0400843
844
845
846
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000847 /* This must go here because YYSTYPE and YYLTYPE are included
848 * from bison output in section 1.*/
849 # define yylval yyg->yylval_r
850
Geoff Lang93561c32016-09-20 10:22:55 -0400851
852
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000853 # define yylloc yyg->yylloc_r
854
Geoff Lang93561c32016-09-20 10:22:55 -0400855
856
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000857int pplex_init (yyscan_t* scanner);
858
859int pplex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
860
Geoff Lang93561c32016-09-20 10:22:55 -0400861
862
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000863/* Accessor methods to globals.
864 These are made visible to non-reentrant scanners for convenience. */
865
Geoff Lang93561c32016-09-20 10:22:55 -0400866
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000867int pplex_destroy (yyscan_t yyscanner );
868
Geoff Lang93561c32016-09-20 10:22:55 -0400869
870
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000871int ppget_debug (yyscan_t yyscanner );
872
Geoff Lang93561c32016-09-20 10:22:55 -0400873
874
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000875void ppset_debug (int debug_flag ,yyscan_t yyscanner );
876
Geoff Lang93561c32016-09-20 10:22:55 -0400877
878
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000879YY_EXTRA_TYPE ppget_extra (yyscan_t yyscanner );
880
Geoff Lang93561c32016-09-20 10:22:55 -0400881
882
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000883void ppset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
884
Geoff Lang93561c32016-09-20 10:22:55 -0400885
886
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000887FILE *ppget_in (yyscan_t yyscanner );
888
Geoff Lang93561c32016-09-20 10:22:55 -0400889
890
891void ppset_in (FILE * _in_str ,yyscan_t yyscanner );
892
893
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000894
895FILE *ppget_out (yyscan_t yyscanner );
896
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000897
Geoff Lang93561c32016-09-20 10:22:55 -0400898
899void ppset_out (FILE * _out_str ,yyscan_t yyscanner );
900
901
902
903 int ppget_leng (yyscan_t yyscanner );
904
905
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000906
907char *ppget_text (yyscan_t yyscanner );
908
Geoff Lang93561c32016-09-20 10:22:55 -0400909
910
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000911int ppget_lineno (yyscan_t yyscanner );
912
Geoff Lang93561c32016-09-20 10:22:55 -0400913
914
915void ppset_lineno (int _line_number ,yyscan_t yyscanner );
916
917
918
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000919
Zhenyao Mof1d723c2013-09-23 14:57:07 -0400920int ppget_column (yyscan_t yyscanner );
921
Geoff Lang93561c32016-09-20 10:22:55 -0400922
923
924
925
926void ppset_column (int _column_no ,yyscan_t yyscanner );
927
928
929
Zhenyao Mof1d723c2013-09-23 14:57:07 -0400930
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000931YYSTYPE * ppget_lval (yyscan_t yyscanner );
932
Geoff Lang93561c32016-09-20 10:22:55 -0400933
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000934void ppset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
935
Geoff Lang93561c32016-09-20 10:22:55 -0400936
937
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000938 YYLTYPE *ppget_lloc (yyscan_t yyscanner );
939
Geoff Lang93561c32016-09-20 10:22:55 -0400940
941
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000942 void ppset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
943
Geoff Lang93561c32016-09-20 10:22:55 -0400944
945
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000946/* Macros after this point can all be overridden by user definitions in
947 * section 1.
948 */
949
950#ifndef YY_SKIP_YYWRAP
951#ifdef __cplusplus
952extern "C" int ppwrap (yyscan_t yyscanner );
953#else
954extern int ppwrap (yyscan_t yyscanner );
955#endif
956#endif
957
Geoff Lang93561c32016-09-20 10:22:55 -0400958
959#ifndef YY_NO_UNPUT
960
961#endif
962
963
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000964#ifndef yytext_ptr
965static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
966#endif
967
968#ifdef YY_NEED_STRLEN
969static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
970#endif
971
972#ifndef YY_NO_INPUT
973
974#ifdef __cplusplus
975static int yyinput (yyscan_t yyscanner );
976#else
977static int input (yyscan_t yyscanner );
978#endif
979
980#endif
981
Geoff Lang93561c32016-09-20 10:22:55 -0400982
983
984
985
986
987
988
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000989/* Amount of stuff to slurp up with each read. */
990#ifndef YY_READ_BUF_SIZE
Geoff Lang93561c32016-09-20 10:22:55 -0400991#ifdef __ia64__
992/* On IA-64, the buffer size is 16k, not 8k */
993#define YY_READ_BUF_SIZE 16384
994#else
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000995#define YY_READ_BUF_SIZE 8192
Geoff Lang93561c32016-09-20 10:22:55 -0400996#endif /* __ia64__ */
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000997#endif
998
Geoff Lang93561c32016-09-20 10:22:55 -0400999
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001000/* Copy whatever the last rule matched to the standard output. */
1001#ifndef ECHO
1002/* This used to be an fputs(), but since the string might contain NUL's,
1003 * we now use fwrite().
1004 */
Geoff Lang93561c32016-09-20 10:22:55 -04001005#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001006#endif
1007
Geoff Lang93561c32016-09-20 10:22:55 -04001008
1009
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001010/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1011 * is returned in "result".
1012 */
1013#ifndef YY_INPUT
1014#define YY_INPUT(buf,result,max_size) \
1015 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1016 { \
1017 int c = '*'; \
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001018 size_t n; \
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001019 for ( n = 0; n < max_size && \
1020 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1021 buf[n] = (char) c; \
1022 if ( c == '\n' ) \
1023 buf[n++] = (char) c; \
1024 if ( c == EOF && ferror( yyin ) ) \
1025 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1026 result = n; \
1027 } \
1028 else \
1029 { \
1030 errno=0; \
Geoff Lang93561c32016-09-20 10:22:55 -04001031 while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001032 { \
1033 if( errno != EINTR) \
1034 { \
1035 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1036 break; \
1037 } \
1038 errno=0; \
1039 clearerr(yyin); \
1040 } \
1041 }\
1042\
1043
1044#endif
1045
Geoff Lang93561c32016-09-20 10:22:55 -04001046
1047
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001048/* No semi-colon after return; correct usage is to write "yyterminate();" -
1049 * we don't want an extra ';' after the "return" because that will cause
1050 * some compilers to complain about unreachable statements.
1051 */
1052#ifndef yyterminate
1053#define yyterminate() return YY_NULL
1054#endif
1055
Geoff Lang93561c32016-09-20 10:22:55 -04001056
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001057/* Number of entries by which start-condition stack grows. */
1058#ifndef YY_START_STACK_INCR
1059#define YY_START_STACK_INCR 25
1060#endif
1061
Geoff Lang93561c32016-09-20 10:22:55 -04001062
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001063/* Report a fatal error. */
1064#ifndef YY_FATAL_ERROR
1065#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
1066#endif
1067
Geoff Lang93561c32016-09-20 10:22:55 -04001068
1069
1070
1071
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001072/* end tables serialization structures and prototypes */
1073
Geoff Lang93561c32016-09-20 10:22:55 -04001074
1075
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001076/* Default declaration of generated scanner - a define so the user can
1077 * easily add parameters.
1078 */
1079#ifndef YY_DECL
1080#define YY_DECL_IS_OURS 1
1081
Geoff Lang93561c32016-09-20 10:22:55 -04001082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001098extern int pplex \
1099 (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
1100
1101#define YY_DECL int pplex \
1102 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
1103#endif /* !YY_DECL */
1104
Geoff Lang93561c32016-09-20 10:22:55 -04001105
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001106/* Code executed at the beginning of each rule, after yytext and yyleng
1107 * have been set up.
1108 */
1109#ifndef YY_USER_ACTION
1110#define YY_USER_ACTION
1111#endif
1112
Geoff Lang93561c32016-09-20 10:22:55 -04001113
1114
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001115/* Code executed at the end of each rule. */
1116#ifndef YY_BREAK
Geoff Lang93561c32016-09-20 10:22:55 -04001117#define YY_BREAK /*LINTED*/break;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001118#endif
1119
Geoff Lang93561c32016-09-20 10:22:55 -04001120
1121
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001122#define YY_RULE_SETUP \
1123 YY_USER_ACTION
1124
Geoff Lang93561c32016-09-20 10:22:55 -04001125
1126
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001127/** The main scanner function which does all the work.
1128 */
1129YY_DECL
1130{
Geoff Lang93561c32016-09-20 10:22:55 -04001131 yy_state_type yy_current_state;
1132 char *yy_cp, *yy_bp;
1133 int yy_act;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001134 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1135
Geoff Lang93561c32016-09-20 10:22:55 -04001136
1137
1138
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001139 yylval = yylval_param;
1140
Geoff Lang93561c32016-09-20 10:22:55 -04001141
1142
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001143 yylloc = yylloc_param;
1144
Geoff Lang93561c32016-09-20 10:22:55 -04001145
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001146 if ( !yyg->yy_init )
1147 {
1148 yyg->yy_init = 1;
1149
1150#ifdef YY_USER_INIT
1151 YY_USER_INIT;
1152#endif
1153
Geoff Lang93561c32016-09-20 10:22:55 -04001154
1155
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001156 if ( ! yyg->yy_start )
1157 yyg->yy_start = 1; /* first start state */
1158
1159 if ( ! yyin )
1160 yyin = stdin;
1161
1162 if ( ! yyout )
1163 yyout = stdout;
1164
1165 if ( ! YY_CURRENT_BUFFER ) {
1166 ppensure_buffer_stack (yyscanner);
1167 YY_CURRENT_BUFFER_LVALUE =
1168 pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1169 }
1170
1171 pp_load_buffer_state(yyscanner );
1172 }
1173
Jamie Madill185de882014-12-22 15:17:52 -05001174 {
1175
Geoff Lang93561c32016-09-20 10:22:55 -04001176
Jamie Madill185de882014-12-22 15:17:52 -05001177 /* Line comment */
1178
Geoff Lang93561c32016-09-20 10:22:55 -04001179 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001180 {
1181 yy_cp = yyg->yy_c_buf_p;
1182
1183 /* Support of yytext. */
1184 *yy_cp = yyg->yy_hold_char;
1185
1186 /* yy_bp points to the position in yy_ch_buf of the start of
1187 * the current run.
1188 */
1189 yy_bp = yy_cp;
1190
1191 yy_current_state = yyg->yy_start;
1192yy_match:
1193 do
1194 {
Geoff Lang93561c32016-09-20 10:22:55 -04001195 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001196 if ( yy_accept[yy_current_state] )
1197 {
1198 yyg->yy_last_accepting_state = yy_current_state;
1199 yyg->yy_last_accepting_cpos = yy_cp;
1200 }
1201 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1202 {
1203 yy_current_state = (int) yy_def[yy_current_state];
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +00001204 if ( yy_current_state >= 98 )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001205 yy_c = yy_meta[(unsigned int) yy_c];
1206 }
Geoff Lang93561c32016-09-20 10:22:55 -04001207 yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001208 ++yy_cp;
1209 }
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +00001210 while ( yy_current_state != 97 );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001211 yy_cp = yyg->yy_last_accepting_cpos;
1212 yy_current_state = yyg->yy_last_accepting_state;
1213
1214yy_find_action:
1215 yy_act = yy_accept[yy_current_state];
1216
1217 YY_DO_BEFORE_ACTION;
1218
Geoff Lang93561c32016-09-20 10:22:55 -04001219
1220
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001221do_action: /* This label is used only to access EOF actions. */
1222
Geoff Lang93561c32016-09-20 10:22:55 -04001223
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001224 switch ( yy_act )
1225 { /* beginning of action switch */
1226 case 0: /* must back up */
1227 /* undo the effects of YY_DO_BEFORE_ACTION */
1228 *yy_cp = yyg->yy_hold_char;
1229 yy_cp = yyg->yy_last_accepting_cpos;
1230 yy_current_state = yyg->yy_last_accepting_state;
1231 goto yy_find_action;
1232
1233case 1:
1234YY_RULE_SETUP
1235
1236 YY_BREAK
1237/* Block comment */
1238/* Line breaks are just counted - not returned. */
Jamie Madillb96687d2015-04-30 15:56:51 -04001239/* The comment is replaced by a single space. */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001240case 2:
1241YY_RULE_SETUP
1242{ BEGIN(COMMENT); }
1243 YY_BREAK
1244case 3:
1245YY_RULE_SETUP
1246
1247 YY_BREAK
1248case 4:
1249YY_RULE_SETUP
1250
1251 YY_BREAK
1252case 5:
1253/* rule 5 can match eol */
1254YY_RULE_SETUP
1255{ ++yylineno; }
1256 YY_BREAK
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001257case 6:
1258YY_RULE_SETUP
alokp@chromium.org2c958ee2012-05-17 20:35:42 +00001259{
1260 yyextra->leadingSpace = true;
1261 BEGIN(INITIAL);
1262}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001263 YY_BREAK
1264case 7:
1265YY_RULE_SETUP
1266{
1267 // # is only valid at start of line for preprocessor directives.
alokp@chromium.org432d6fc2012-06-27 22:13:21 +00001268 yylval->assign(1, yytext[0]);
1269 return yyextra->lineStart ? pp::Token::PP_HASH : pp::Token::PP_OTHER;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001270}
1271 YY_BREAK
1272case 8:
1273YY_RULE_SETUP
1274{
1275 yylval->assign(yytext, yyleng);
1276 return pp::Token::IDENTIFIER;
1277}
1278 YY_BREAK
1279case 9:
1280YY_RULE_SETUP
1281{
1282 yylval->assign(yytext, yyleng);
1283 return pp::Token::CONST_INT;
1284}
1285 YY_BREAK
1286case 10:
1287YY_RULE_SETUP
1288{
1289 yylval->assign(yytext, yyleng);
1290 return pp::Token::CONST_FLOAT;
1291}
1292 YY_BREAK
1293/* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */
1294/* Rule to catch all invalid integers and floats. */
1295case 11:
1296YY_RULE_SETUP
1297{
alokp@chromium.org432d6fc2012-06-27 22:13:21 +00001298 yylval->assign(yytext, yyleng);
1299 return pp::Token::PP_NUMBER;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001300}
1301 YY_BREAK
1302case 12:
1303YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001304{
1305 yylval->assign(yytext, yyleng);
1306 return pp::Token::OP_INC;
1307}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001308 YY_BREAK
1309case 13:
1310YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001311{
1312 yylval->assign(yytext, yyleng);
1313 return pp::Token::OP_DEC;
1314}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001315 YY_BREAK
1316case 14:
1317YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001318{
1319 yylval->assign(yytext, yyleng);
1320 return pp::Token::OP_LEFT;
1321}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001322 YY_BREAK
1323case 15:
1324YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001325{
1326 yylval->assign(yytext, yyleng);
1327 return pp::Token::OP_RIGHT;
1328}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001329 YY_BREAK
1330case 16:
1331YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001332{
1333 yylval->assign(yytext, yyleng);
1334 return pp::Token::OP_LE;
1335}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001336 YY_BREAK
1337case 17:
1338YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001339{
1340 yylval->assign(yytext, yyleng);
1341 return pp::Token::OP_GE;
1342}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001343 YY_BREAK
1344case 18:
1345YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001346{
1347 yylval->assign(yytext, yyleng);
1348 return pp::Token::OP_EQ;
1349}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001350 YY_BREAK
1351case 19:
1352YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001353{
1354 yylval->assign(yytext, yyleng);
1355 return pp::Token::OP_NE;
1356}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001357 YY_BREAK
1358case 20:
1359YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001360{
1361 yylval->assign(yytext, yyleng);
1362 return pp::Token::OP_AND;
1363}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001364 YY_BREAK
1365case 21:
1366YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001367{
1368 yylval->assign(yytext, yyleng);
1369 return pp::Token::OP_XOR;
1370}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001371 YY_BREAK
1372case 22:
1373YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001374{
1375 yylval->assign(yytext, yyleng);
1376 return pp::Token::OP_OR;
1377}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001378 YY_BREAK
1379case 23:
1380YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001381{
1382 yylval->assign(yytext, yyleng);
1383 return pp::Token::OP_ADD_ASSIGN;
1384}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001385 YY_BREAK
1386case 24:
1387YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001388{
1389 yylval->assign(yytext, yyleng);
1390 return pp::Token::OP_SUB_ASSIGN;
1391}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001392 YY_BREAK
1393case 25:
1394YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001395{
1396 yylval->assign(yytext, yyleng);
1397 return pp::Token::OP_MUL_ASSIGN;
1398}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001399 YY_BREAK
1400case 26:
1401YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001402{
1403 yylval->assign(yytext, yyleng);
1404 return pp::Token::OP_DIV_ASSIGN;
1405}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001406 YY_BREAK
1407case 27:
1408YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001409{
1410 yylval->assign(yytext, yyleng);
1411 return pp::Token::OP_MOD_ASSIGN;
1412}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001413 YY_BREAK
1414case 28:
1415YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001416{
1417 yylval->assign(yytext, yyleng);
1418 return pp::Token::OP_LEFT_ASSIGN;
1419}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001420 YY_BREAK
1421case 29:
1422YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001423{
1424 yylval->assign(yytext, yyleng);
1425 return pp::Token::OP_RIGHT_ASSIGN;
1426}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001427 YY_BREAK
1428case 30:
1429YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001430{
1431 yylval->assign(yytext, yyleng);
1432 return pp::Token::OP_AND_ASSIGN;
1433}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001434 YY_BREAK
1435case 31:
1436YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001437{
1438 yylval->assign(yytext, yyleng);
1439 return pp::Token::OP_XOR_ASSIGN;
1440}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001441 YY_BREAK
1442case 32:
1443YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001444{
1445 yylval->assign(yytext, yyleng);
1446 return pp::Token::OP_OR_ASSIGN;
1447}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001448 YY_BREAK
1449case 33:
1450YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001451{
1452 yylval->assign(1, yytext[0]);
1453 return yytext[0];
1454}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001455 YY_BREAK
1456case 34:
1457YY_RULE_SETUP
1458{ yyextra->leadingSpace = true; }
1459 YY_BREAK
1460case 35:
1461/* rule 35 can match eol */
1462YY_RULE_SETUP
1463{
1464 ++yylineno;
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001465 yylval->assign(1, '\n');
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001466 return '\n';
1467}
1468 YY_BREAK
1469case 36:
shannon.woods%transgaming.com@gtempaccount.combcde56f2013-04-13 03:32:12 +00001470/* rule 36 can match eol */
1471YY_RULE_SETUP
1472{ ++yylineno; }
1473 YY_BREAK
1474case 37:
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001475YY_RULE_SETUP
1476{
alokp@chromium.org432d6fc2012-06-27 22:13:21 +00001477 yylval->assign(1, yytext[0]);
1478 return pp::Token::PP_OTHER;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001479}
1480 YY_BREAK
1481case YY_STATE_EOF(INITIAL):
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001482case YY_STATE_EOF(COMMENT):
1483{
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00001484 // YY_USER_ACTION is not invoked for handling EOF.
1485 // Set the location for EOF token manually.
1486 pp::Input* input = &yyextra->input;
1487 pp::Input::Location* scanLoc = &yyextra->scanLoc;
shannon.woods@transgaming.comd64b3da2013-02-28 23:19:26 +00001488 yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00001489 if (scanLoc->sIndex != sIndexMax)
1490 {
1491 // We can only reach here if there are empty strings at the
1492 // end of the input.
1493 scanLoc->sIndex = sIndexMax; scanLoc->cIndex = 0;
shannon.woods@transgaming.comd64b3da2013-02-28 23:19:26 +00001494 // FIXME: this is not 64-bit clean.
1495 yyfileno = static_cast<int>(sIndexMax); yylineno = 1;
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00001496 }
1497 yylloc->file = yyfileno;
1498 yylloc->line = yylineno;
1499 yylval->clear();
1500
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001501 if (YY_START == COMMENT)
1502 {
Shannon Woods7f2d7942013-11-19 15:07:58 -05001503 yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001504 pp::SourceLocation(yyfileno, yylineno),
1505 "");
1506 }
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001507 yyterminate();
1508}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001509 YY_BREAK
shannon.woods%transgaming.com@gtempaccount.combcde56f2013-04-13 03:32:12 +00001510case 38:
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001511YY_RULE_SETUP
1512ECHO;
1513 YY_BREAK
1514
1515 case YY_END_OF_BUFFER:
1516 {
1517 /* Amount of text matched not including the EOB char. */
1518 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1519
1520 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1521 *yy_cp = yyg->yy_hold_char;
1522 YY_RESTORE_YY_MORE_OFFSET
1523
1524 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1525 {
1526 /* We're scanning a new file or input source. It's
1527 * possible that this happened because the user
1528 * just pointed yyin at a new source and called
1529 * pplex(). If so, then we have to assure
1530 * consistency between YY_CURRENT_BUFFER and our
1531 * globals. Here is the right place to do so, because
1532 * this is the first action (other than possibly a
1533 * back-up) that will match for the new input source.
1534 */
1535 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1536 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1537 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1538 }
1539
1540 /* Note that here we test for yy_c_buf_p "<=" to the position
1541 * of the first EOB in the buffer, since yy_c_buf_p will
1542 * already have been incremented past the NUL character
1543 * (since all states make transitions on EOB to the
1544 * end-of-buffer state). Contrast this with the test
1545 * in input().
1546 */
1547 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1548 { /* This was really a NUL. */
1549 yy_state_type yy_next_state;
1550
1551 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1552
1553 yy_current_state = yy_get_previous_state( yyscanner );
1554
1555 /* Okay, we're now positioned to make the NUL
1556 * transition. We couldn't have
1557 * yy_get_previous_state() go ahead and do it
1558 * for us because it doesn't know how to deal
1559 * with the possibility of jamming (and we don't
1560 * want to build jamming into it because then it
1561 * will run more slowly).
1562 */
1563
1564 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1565
1566 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1567
1568 if ( yy_next_state )
1569 {
1570 /* Consume the NUL. */
1571 yy_cp = ++yyg->yy_c_buf_p;
1572 yy_current_state = yy_next_state;
1573 goto yy_match;
1574 }
1575
1576 else
1577 {
1578 yy_cp = yyg->yy_last_accepting_cpos;
1579 yy_current_state = yyg->yy_last_accepting_state;
1580 goto yy_find_action;
1581 }
1582 }
1583
1584 else switch ( yy_get_next_buffer( yyscanner ) )
1585 {
1586 case EOB_ACT_END_OF_FILE:
1587 {
1588 yyg->yy_did_buffer_switch_on_eof = 0;
1589
1590 if ( ppwrap(yyscanner ) )
1591 {
1592 /* Note: because we've taken care in
1593 * yy_get_next_buffer() to have set up
1594 * yytext, we can now set up
1595 * yy_c_buf_p so that if some total
1596 * hoser (like flex itself) wants to
1597 * call the scanner after we return the
1598 * YY_NULL, it'll still work - another
1599 * YY_NULL will get returned.
1600 */
1601 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1602
1603 yy_act = YY_STATE_EOF(YY_START);
1604 goto do_action;
1605 }
1606
1607 else
1608 {
1609 if ( ! yyg->yy_did_buffer_switch_on_eof )
1610 YY_NEW_FILE;
1611 }
1612 break;
1613 }
1614
1615 case EOB_ACT_CONTINUE_SCAN:
1616 yyg->yy_c_buf_p =
1617 yyg->yytext_ptr + yy_amount_of_matched_text;
1618
1619 yy_current_state = yy_get_previous_state( yyscanner );
1620
1621 yy_cp = yyg->yy_c_buf_p;
1622 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1623 goto yy_match;
1624
1625 case EOB_ACT_LAST_MATCH:
1626 yyg->yy_c_buf_p =
1627 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1628
1629 yy_current_state = yy_get_previous_state( yyscanner );
1630
1631 yy_cp = yyg->yy_c_buf_p;
1632 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1633 goto yy_find_action;
1634 }
1635 break;
1636 }
1637
1638 default:
1639 YY_FATAL_ERROR(
1640 "fatal flex scanner internal error--no action found" );
1641 } /* end of action switch */
1642 } /* end of scanning one token */
Jamie Madill185de882014-12-22 15:17:52 -05001643 } /* end of user's declarations */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001644} /* end of pplex */
1645
Geoff Lang93561c32016-09-20 10:22:55 -04001646
1647
1648
1649
1650
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001651/* yy_get_next_buffer - try to read in a new buffer
1652 *
1653 * Returns a code representing an action:
1654 * EOB_ACT_LAST_MATCH -
1655 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1656 * EOB_ACT_END_OF_FILE - end of file
1657 */
1658static int yy_get_next_buffer (yyscan_t yyscanner)
1659{
1660 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04001661 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1662 char *source = yyg->yytext_ptr;
1663 yy_size_t number_to_move, i;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001664 int ret_val;
1665
1666 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1667 YY_FATAL_ERROR(
1668 "fatal flex scanner internal error--end of buffer missed" );
1669
1670 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1671 { /* Don't try to fill the buffer, so this is an EOF. */
1672 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1673 {
1674 /* We matched a single character, the EOB, so
1675 * treat this as a final EOF.
1676 */
1677 return EOB_ACT_END_OF_FILE;
1678 }
1679
1680 else
1681 {
1682 /* We matched some text prior to the EOB, first
1683 * process it.
1684 */
1685 return EOB_ACT_LAST_MATCH;
1686 }
1687 }
1688
1689 /* Try to read more data. */
1690
1691 /* First move last chars to start of buffer. */
Geoff Lang93561c32016-09-20 10:22:55 -04001692 number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001693
1694 for ( i = 0; i < number_to_move; ++i )
1695 *(dest++) = *(source++);
1696
1697 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1698 /* don't do the read, it's not guaranteed to return an EOF,
1699 * just force an EOF
1700 */
1701 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1702
1703 else
1704 {
Geoff Lang93561c32016-09-20 10:22:55 -04001705 int num_to_read =
1706 static_cast<int>(YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001707
1708 while ( num_to_read <= 0 )
1709 { /* Not enough room in the buffer - grow it. */
1710
1711 /* just a shorter name for the current buffer */
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001712 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001713
1714 int yy_c_buf_p_offset =
1715 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1716
1717 if ( b->yy_is_our_buffer )
1718 {
Geoff Lang93561c32016-09-20 10:22:55 -04001719 int new_size = b->yy_buf_size * 2;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001720
1721 if ( new_size <= 0 )
1722 b->yy_buf_size += b->yy_buf_size / 8;
1723 else
1724 b->yy_buf_size *= 2;
1725
1726 b->yy_ch_buf = (char *)
1727 /* Include room in for 2 EOB chars. */
1728 pprealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
1729 }
1730 else
1731 /* Can't grow it, we don't own it. */
Geoff Lang93561c32016-09-20 10:22:55 -04001732 b->yy_ch_buf = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001733
1734 if ( ! b->yy_ch_buf )
1735 YY_FATAL_ERROR(
1736 "fatal error - scanner input buffer overflow" );
1737
1738 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1739
Geoff Lang93561c32016-09-20 10:22:55 -04001740 num_to_read = static_cast<int>(YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1741 number_to_move - 1);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001742
1743 }
1744
1745 if ( num_to_read > YY_READ_BUF_SIZE )
1746 num_to_read = YY_READ_BUF_SIZE;
1747
1748 /* Read in more data. */
Geoff Lang93561c32016-09-20 10:22:55 -04001749 yy_size_t ret = 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001750 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
Geoff Lang93561c32016-09-20 10:22:55 -04001751 ret, num_to_read );
1752 yyg->yy_n_chars = static_cast<int>(ret);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001753
1754 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1755 }
1756
1757 if ( yyg->yy_n_chars == 0 )
1758 {
1759 if ( number_to_move == YY_MORE_ADJ )
1760 {
1761 ret_val = EOB_ACT_END_OF_FILE;
1762 pprestart(yyin ,yyscanner);
1763 }
1764
1765 else
1766 {
1767 ret_val = EOB_ACT_LAST_MATCH;
1768 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1769 YY_BUFFER_EOF_PENDING;
1770 }
1771 }
1772
1773 else
1774 ret_val = EOB_ACT_CONTINUE_SCAN;
1775
Geoff Lang93561c32016-09-20 10:22:55 -04001776 if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001777 /* Extend the array by 50%, plus the number we really need. */
1778 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1779 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) pprealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1780 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1781 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1782 }
1783
Geoff Lang93561c32016-09-20 10:22:55 -04001784 yyg->yy_n_chars += static_cast<int>(number_to_move);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001785 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1786 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1787
1788 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1789
1790 return ret_val;
1791}
1792
Geoff Lang93561c32016-09-20 10:22:55 -04001793
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001794/* yy_get_previous_state - get the state just before the EOB char was reached */
1795
Geoff Lang93561c32016-09-20 10:22:55 -04001796
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001797 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1798{
Geoff Lang93561c32016-09-20 10:22:55 -04001799 yy_state_type yy_current_state;
1800 char *yy_cp;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001801 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1802
1803 yy_current_state = yyg->yy_start;
1804
1805 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1806 {
Geoff Lang93561c32016-09-20 10:22:55 -04001807 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001808 if ( yy_accept[yy_current_state] )
1809 {
1810 yyg->yy_last_accepting_state = yy_current_state;
1811 yyg->yy_last_accepting_cpos = yy_cp;
1812 }
1813 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1814 {
1815 yy_current_state = (int) yy_def[yy_current_state];
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +00001816 if ( yy_current_state >= 98 )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001817 yy_c = yy_meta[(unsigned int) yy_c];
1818 }
Geoff Lang93561c32016-09-20 10:22:55 -04001819 yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001820 }
1821
1822 return yy_current_state;
1823}
1824
Geoff Lang93561c32016-09-20 10:22:55 -04001825
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001826/* yy_try_NUL_trans - try to make a transition on the NUL character
1827 *
1828 * synopsis
1829 * next_state = yy_try_NUL_trans( current_state );
1830 */
1831 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
1832{
Geoff Lang93561c32016-09-20 10:22:55 -04001833 int yy_is_jam;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001834 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
Geoff Lang93561c32016-09-20 10:22:55 -04001835 char *yy_cp = yyg->yy_c_buf_p;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001836
Geoff Lang93561c32016-09-20 10:22:55 -04001837 YY_CHAR yy_c = 1;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001838 if ( yy_accept[yy_current_state] )
1839 {
1840 yyg->yy_last_accepting_state = yy_current_state;
1841 yyg->yy_last_accepting_cpos = yy_cp;
1842 }
1843 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1844 {
1845 yy_current_state = (int) yy_def[yy_current_state];
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +00001846 if ( yy_current_state >= 98 )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001847 yy_c = yy_meta[(unsigned int) yy_c];
1848 }
Geoff Lang93561c32016-09-20 10:22:55 -04001849 yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +00001850 yy_is_jam = (yy_current_state == 97);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001851
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001852 (void)yyg;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001853 return yy_is_jam ? 0 : yy_current_state;
1854}
1855
Geoff Lang93561c32016-09-20 10:22:55 -04001856
1857#ifndef YY_NO_UNPUT
1858
1859#endif
1860
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001861#ifndef YY_NO_INPUT
1862#ifdef __cplusplus
1863 static int yyinput (yyscan_t yyscanner)
1864#else
1865 static int input (yyscan_t yyscanner)
1866#endif
1867
1868{
1869 int c;
1870 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1871
1872 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1873
1874 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1875 {
1876 /* yy_c_buf_p now points to the character we want to return.
1877 * If this occurs *before* the EOB characters, then it's a
1878 * valid NUL; if not, then we've hit the end of the buffer.
1879 */
1880 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1881 /* This was really a NUL. */
1882 *yyg->yy_c_buf_p = '\0';
1883
1884 else
1885 { /* need more input */
Geoff Lang93561c32016-09-20 10:22:55 -04001886 int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001887 ++yyg->yy_c_buf_p;
1888
1889 switch ( yy_get_next_buffer( yyscanner ) )
1890 {
1891 case EOB_ACT_LAST_MATCH:
1892 /* This happens because yy_g_n_b()
1893 * sees that we've accumulated a
1894 * token and flags that we need to
1895 * try matching the token before
1896 * proceeding. But for input(),
1897 * there's no matching to consider.
1898 * So convert the EOB_ACT_LAST_MATCH
1899 * to EOB_ACT_END_OF_FILE.
1900 */
1901
1902 /* Reset buffer status. */
1903 pprestart(yyin ,yyscanner);
1904
1905 /*FALLTHROUGH*/
1906
1907 case EOB_ACT_END_OF_FILE:
1908 {
1909 if ( ppwrap(yyscanner ) )
Geoff Lang93561c32016-09-20 10:22:55 -04001910 return 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001911
1912 if ( ! yyg->yy_did_buffer_switch_on_eof )
1913 YY_NEW_FILE;
1914#ifdef __cplusplus
1915 return yyinput(yyscanner);
1916#else
1917 return input(yyscanner);
1918#endif
1919 }
1920
1921 case EOB_ACT_CONTINUE_SCAN:
1922 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1923 break;
1924 }
1925 }
1926 }
1927
1928 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1929 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
1930 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1931
Geoff Lang93561c32016-09-20 10:22:55 -04001932
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001933 return c;
1934}
1935#endif /* ifndef YY_NO_INPUT */
1936
1937/** Immediately switch to a different input stream.
1938 * @param input_file A readable stream.
1939 * @param yyscanner The scanner object.
1940 * @note This function does not reset the start condition to @c INITIAL .
1941 */
1942 void pprestart (FILE * input_file , yyscan_t yyscanner)
1943{
1944 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1945
1946 if ( ! YY_CURRENT_BUFFER ){
1947 ppensure_buffer_stack (yyscanner);
1948 YY_CURRENT_BUFFER_LVALUE =
1949 pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1950 }
1951
1952 pp_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1953 pp_load_buffer_state(yyscanner );
1954}
1955
Geoff Lang93561c32016-09-20 10:22:55 -04001956
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001957/** Switch to a different input buffer.
1958 * @param new_buffer The new input buffer.
1959 * @param yyscanner The scanner object.
1960 */
1961 void pp_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1962{
1963 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1964
1965 /* TODO. We should be able to replace this entire function body
1966 * with
1967 * pppop_buffer_state();
1968 * pppush_buffer_state(new_buffer);
1969 */
1970 ppensure_buffer_stack (yyscanner);
1971 if ( YY_CURRENT_BUFFER == new_buffer )
1972 return;
1973
1974 if ( YY_CURRENT_BUFFER )
1975 {
1976 /* Flush out information for old buffer. */
1977 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1978 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1979 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1980 }
1981
1982 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1983 pp_load_buffer_state(yyscanner );
1984
1985 /* We don't actually know whether we did this switch during
1986 * EOF (ppwrap()) processing, but the only time this flag
1987 * is looked at is after ppwrap() is called, so it's safe
1988 * to go ahead and always set it.
1989 */
1990 yyg->yy_did_buffer_switch_on_eof = 1;
1991}
1992
Geoff Lang93561c32016-09-20 10:22:55 -04001993
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001994static void pp_load_buffer_state (yyscan_t yyscanner)
1995{
1996 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1997 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1998 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1999 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2000 yyg->yy_hold_char = *yyg->yy_c_buf_p;
2001}
2002
2003/** Allocate and initialize an input buffer state.
2004 * @param file A readable stream.
2005 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2006 * @param yyscanner The scanner object.
2007 * @return the allocated buffer state.
2008 */
2009 YY_BUFFER_STATE pp_create_buffer (FILE * file, int size , yyscan_t yyscanner)
2010{
2011 YY_BUFFER_STATE b;
2012
2013 b = (YY_BUFFER_STATE) ppalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
2014 if ( ! b )
2015 YY_FATAL_ERROR( "out of dynamic memory in pp_create_buffer()" );
2016
Geoff Lang93561c32016-09-20 10:22:55 -04002017 b->yy_buf_size = (yy_size_t)size;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002018
2019 /* yy_ch_buf has to be 2 characters longer than the size given because
2020 * we need to put in 2 end-of-buffer characters.
2021 */
2022 b->yy_ch_buf = (char *) ppalloc(b->yy_buf_size + 2 ,yyscanner );
2023 if ( ! b->yy_ch_buf )
2024 YY_FATAL_ERROR( "out of dynamic memory in pp_create_buffer()" );
2025
2026 b->yy_is_our_buffer = 1;
2027
2028 pp_init_buffer(b,file ,yyscanner);
2029
2030 return b;
2031}
2032
Geoff Lang93561c32016-09-20 10:22:55 -04002033
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002034/** Destroy the buffer.
2035 * @param b a buffer created with pp_create_buffer()
2036 * @param yyscanner The scanner object.
2037 */
2038 void pp_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
2039{
2040 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2041
2042 if ( ! b )
2043 return;
2044
2045 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2046 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2047
2048 if ( b->yy_is_our_buffer )
2049 ppfree((void *) b->yy_ch_buf ,yyscanner );
2050
2051 ppfree((void *) b ,yyscanner );
2052}
2053
Geoff Lang93561c32016-09-20 10:22:55 -04002054
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002055/* Initializes or reinitializes a buffer.
2056 * This function is sometimes called more than once on the same buffer,
2057 * such as during a pprestart() or at EOF.
2058 */
2059 static void pp_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
2060
2061{
2062 int oerrno = errno;
2063 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2064
2065 pp_flush_buffer(b ,yyscanner);
2066
2067 b->yy_input_file = file;
2068 b->yy_fill_buffer = 1;
2069
2070 /* If b is the current buffer, then pp_init_buffer was _probably_
2071 * called from pprestart() or through yy_get_next_buffer.
2072 * In that case, we don't want to reset the lineno or column.
2073 */
2074 if (b != YY_CURRENT_BUFFER){
2075 b->yy_bs_lineno = 1;
2076 b->yy_bs_column = 0;
2077 }
2078
Geoff Lang93561c32016-09-20 10:22:55 -04002079
2080
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002081 b->yy_is_interactive = 0;
2082
Geoff Lang93561c32016-09-20 10:22:55 -04002083
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002084 errno = oerrno;
2085}
2086
2087/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2088 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2089 * @param yyscanner The scanner object.
2090 */
2091 void pp_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
2092{
2093 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2094 if ( ! b )
2095 return;
2096
2097 b->yy_n_chars = 0;
2098
2099 /* We always need two end-of-buffer characters. The first causes
2100 * a transition to the end-of-buffer state. The second causes
2101 * a jam in that state.
2102 */
2103 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2104 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2105
2106 b->yy_buf_pos = &b->yy_ch_buf[0];
2107
2108 b->yy_at_bol = 1;
2109 b->yy_buffer_status = YY_BUFFER_NEW;
2110
2111 if ( b == YY_CURRENT_BUFFER )
2112 pp_load_buffer_state(yyscanner );
2113}
2114
2115/** Pushes the new state onto the stack. The new state becomes
2116 * the current state. This function will allocate the stack
2117 * if necessary.
2118 * @param new_buffer The new state.
2119 * @param yyscanner The scanner object.
2120 */
2121void pppush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
2122{
2123 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2124 if (new_buffer == NULL)
2125 return;
2126
2127 ppensure_buffer_stack(yyscanner);
2128
2129 /* This block is copied from pp_switch_to_buffer. */
2130 if ( YY_CURRENT_BUFFER )
2131 {
2132 /* Flush out information for old buffer. */
2133 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2134 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2135 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2136 }
2137
2138 /* Only push if top exists. Otherwise, replace top. */
2139 if (YY_CURRENT_BUFFER)
2140 yyg->yy_buffer_stack_top++;
2141 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2142
2143 /* copied from pp_switch_to_buffer. */
2144 pp_load_buffer_state(yyscanner );
2145 yyg->yy_did_buffer_switch_on_eof = 1;
2146}
2147
Geoff Lang93561c32016-09-20 10:22:55 -04002148
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002149/** Removes and deletes the top of the stack, if present.
2150 * The next element becomes the new top.
2151 * @param yyscanner The scanner object.
2152 */
2153void pppop_buffer_state (yyscan_t yyscanner)
2154{
2155 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2156 if (!YY_CURRENT_BUFFER)
2157 return;
2158
2159 pp_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
2160 YY_CURRENT_BUFFER_LVALUE = NULL;
2161 if (yyg->yy_buffer_stack_top > 0)
2162 --yyg->yy_buffer_stack_top;
2163
2164 if (YY_CURRENT_BUFFER) {
2165 pp_load_buffer_state(yyscanner );
2166 yyg->yy_did_buffer_switch_on_eof = 1;
2167 }
2168}
2169
Geoff Lang93561c32016-09-20 10:22:55 -04002170
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002171/* Allocates the stack if it does not exist.
2172 * Guarantees space for at least one push.
2173 */
2174static void ppensure_buffer_stack (yyscan_t yyscanner)
2175{
shannonwoods@chromium.orgb0757162013-05-30 00:21:27 +00002176 yy_size_t num_to_alloc;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002177 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2178
2179 if (!yyg->yy_buffer_stack) {
2180
2181 /* First allocation is just for 2 elements, since we don't know if this
2182 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2183 * immediate realloc on the next call.
2184 */
Geoff Lang93561c32016-09-20 10:22:55 -04002185 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002186 yyg->yy_buffer_stack = (struct yy_buffer_state**)ppalloc
2187 (num_to_alloc * sizeof(struct yy_buffer_state*)
2188 , yyscanner);
2189 if ( ! yyg->yy_buffer_stack )
2190 YY_FATAL_ERROR( "out of dynamic memory in ppensure_buffer_stack()" );
2191
Geoff Lang93561c32016-09-20 10:22:55 -04002192
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002193 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2194
2195 yyg->yy_buffer_stack_max = num_to_alloc;
2196 yyg->yy_buffer_stack_top = 0;
2197 return;
2198 }
2199
2200 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2201
2202 /* Increase the buffer to prepare for a possible push. */
Geoff Lang93561c32016-09-20 10:22:55 -04002203 yy_size_t grow_size = 8 /* arbitrary grow size */;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002204
2205 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
2206 yyg->yy_buffer_stack = (struct yy_buffer_state**)pprealloc
2207 (yyg->yy_buffer_stack,
2208 num_to_alloc * sizeof(struct yy_buffer_state*)
2209 , yyscanner);
2210 if ( ! yyg->yy_buffer_stack )
2211 YY_FATAL_ERROR( "out of dynamic memory in ppensure_buffer_stack()" );
2212
2213 /* zero only the new slots.*/
2214 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
2215 yyg->yy_buffer_stack_max = num_to_alloc;
2216 }
2217}
2218
Geoff Lang93561c32016-09-20 10:22:55 -04002219
2220
2221
2222
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002223/** Setup the input buffer state to scan directly from a user-specified character buffer.
2224 * @param base the character buffer
2225 * @param size the size in bytes of the character buffer
2226 * @param yyscanner The scanner object.
2227 * @return the newly allocated buffer state object.
2228 */
2229YY_BUFFER_STATE pp_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
2230{
2231 YY_BUFFER_STATE b;
2232
2233 if ( size < 2 ||
2234 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2235 base[size-1] != YY_END_OF_BUFFER_CHAR )
2236 /* They forgot to leave room for the EOB's. */
Geoff Lang93561c32016-09-20 10:22:55 -04002237 return NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002238
2239 b = (YY_BUFFER_STATE) ppalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
2240 if ( ! b )
2241 YY_FATAL_ERROR( "out of dynamic memory in pp_scan_buffer()" );
2242
Geoff Lang93561c32016-09-20 10:22:55 -04002243 b->yy_buf_size = static_cast<int>(size - 2); /* "- 2" to take care of EOB's */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002244 b->yy_buf_pos = b->yy_ch_buf = base;
2245 b->yy_is_our_buffer = 0;
Geoff Lang93561c32016-09-20 10:22:55 -04002246 b->yy_input_file = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002247 b->yy_n_chars = b->yy_buf_size;
2248 b->yy_is_interactive = 0;
2249 b->yy_at_bol = 1;
2250 b->yy_fill_buffer = 0;
2251 b->yy_buffer_status = YY_BUFFER_NEW;
2252
2253 pp_switch_to_buffer(b ,yyscanner );
2254
2255 return b;
2256}
2257
Geoff Lang93561c32016-09-20 10:22:55 -04002258
2259
2260
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002261/** Setup the input buffer state to scan a string. The next call to pplex() will
2262 * scan from a @e copy of @a str.
2263 * @param yystr a NUL-terminated string to scan
2264 * @param yyscanner The scanner object.
2265 * @return the newly allocated buffer state object.
2266 * @note If you want to scan bytes that may contain NUL values, then use
2267 * pp_scan_bytes() instead.
2268 */
2269YY_BUFFER_STATE pp_scan_string (yyconst char * yystr , yyscan_t yyscanner)
2270{
2271
Geoff Lang93561c32016-09-20 10:22:55 -04002272 return pp_scan_bytes(yystr,(int) strlen(yystr) ,yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002273}
2274
Geoff Lang93561c32016-09-20 10:22:55 -04002275
2276
2277
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002278/** Setup the input buffer state to scan the given bytes. The next call to pplex() will
2279 * scan from a @e copy of @a bytes.
Zhenyao Mof1d723c2013-09-23 14:57:07 -04002280 * @param yybytes the byte buffer to scan
2281 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002282 * @param yyscanner The scanner object.
2283 * @return the newly allocated buffer state object.
2284 */
Geoff Lang93561c32016-09-20 10:22:55 -04002285YY_BUFFER_STATE pp_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002286{
2287 YY_BUFFER_STATE b;
2288 char *buf;
Zhenyao Mof1d723c2013-09-23 14:57:07 -04002289 yy_size_t n;
2290 yy_size_t i;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002291
2292 /* Get memory for full buffer, including space for trailing EOB's. */
Geoff Lang93561c32016-09-20 10:22:55 -04002293 n = (yy_size_t) _yybytes_len + 2;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002294 buf = (char *) ppalloc(n ,yyscanner );
2295 if ( ! buf )
2296 YY_FATAL_ERROR( "out of dynamic memory in pp_scan_bytes()" );
2297
Geoff Lang93561c32016-09-20 10:22:55 -04002298 for ( i = 0; i < static_cast<yy_size_t>(_yybytes_len); ++i )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002299 buf[i] = yybytes[i];
2300
2301 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2302
2303 b = pp_scan_buffer(buf,n ,yyscanner);
2304 if ( ! b )
2305 YY_FATAL_ERROR( "bad buffer in pp_scan_bytes()" );
2306
2307 /* It's okay to grow etc. this buffer, and we should throw it
2308 * away when we're done.
2309 */
2310 b->yy_is_our_buffer = 1;
2311
2312 return b;
2313}
2314
Geoff Lang93561c32016-09-20 10:22:55 -04002315
2316
2317
2318
2319
2320
2321
2322
2323
2324
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002325#ifndef YY_EXIT_FAILURE
2326#define YY_EXIT_FAILURE 2
2327#endif
2328
Geoff Lang93561c32016-09-20 10:22:55 -04002329static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002330{
Geoff Lang93561c32016-09-20 10:22:55 -04002331 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2332 (void)yyg;
2333 (void) fprintf( stderr, "%s\n", msg );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002334 exit( YY_EXIT_FAILURE );
2335}
2336
2337/* Redefine yyless() so it works in section 3 code. */
2338
2339#undef yyless
2340#define yyless(n) \
2341 do \
2342 { \
2343 /* Undo effects of setting up yytext. */ \
2344 int yyless_macro_arg = (n); \
2345 YY_LESS_LINENO(yyless_macro_arg);\
2346 yytext[yyleng] = yyg->yy_hold_char; \
2347 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2348 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2349 *yyg->yy_c_buf_p = '\0'; \
2350 yyleng = yyless_macro_arg; \
2351 } \
2352 while ( 0 )
2353
Geoff Lang93561c32016-09-20 10:22:55 -04002354
2355
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002356/* Accessor methods (get/set functions) to struct members. */
2357
Geoff Lang93561c32016-09-20 10:22:55 -04002358
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002359/** Get the user-defined data for this scanner.
2360 * @param yyscanner The scanner object.
2361 */
2362YY_EXTRA_TYPE ppget_extra (yyscan_t yyscanner)
2363{
2364 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2365 return yyextra;
2366}
2367
Geoff Lang93561c32016-09-20 10:22:55 -04002368
2369
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002370/** Get the current line number.
2371 * @param yyscanner The scanner object.
2372 */
2373int ppget_lineno (yyscan_t yyscanner)
2374{
2375 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2376
Geoff Lang93561c32016-09-20 10:22:55 -04002377
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002378 if (! YY_CURRENT_BUFFER)
2379 return 0;
2380
2381 return yylineno;
2382}
2383
Geoff Lang93561c32016-09-20 10:22:55 -04002384
2385
2386
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002387/** Get the current column number.
2388 * @param yyscanner The scanner object.
2389 */
2390int ppget_column (yyscan_t yyscanner)
2391{
2392 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2393
Geoff Lang93561c32016-09-20 10:22:55 -04002394
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002395 if (! YY_CURRENT_BUFFER)
2396 return 0;
2397
2398 return yycolumn;
2399}
2400
Geoff Lang93561c32016-09-20 10:22:55 -04002401
2402
2403
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002404/** Get the input stream.
2405 * @param yyscanner The scanner object.
2406 */
2407FILE *ppget_in (yyscan_t yyscanner)
2408{
2409 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2410 return yyin;
2411}
2412
Geoff Lang93561c32016-09-20 10:22:55 -04002413
2414
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002415/** Get the output stream.
2416 * @param yyscanner The scanner object.
2417 */
2418FILE *ppget_out (yyscan_t yyscanner)
2419{
2420 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2421 return yyout;
2422}
2423
Geoff Lang93561c32016-09-20 10:22:55 -04002424
2425
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002426/** Get the length of the current token.
2427 * @param yyscanner The scanner object.
2428 */
Geoff Lang93561c32016-09-20 10:22:55 -04002429int ppget_leng (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002430{
2431 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2432 return yyleng;
2433}
2434
Geoff Lang93561c32016-09-20 10:22:55 -04002435
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002436/** Get the current token.
2437 * @param yyscanner The scanner object.
2438 */
2439
2440char *ppget_text (yyscan_t yyscanner)
2441{
2442 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2443 return yytext;
2444}
2445
Geoff Lang93561c32016-09-20 10:22:55 -04002446
2447
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002448/** Set the user-defined data. This data is never touched by the scanner.
2449 * @param user_defined The data to be associated with this scanner.
2450 * @param yyscanner The scanner object.
2451 */
2452void ppset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
2453{
2454 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2455 yyextra = user_defined ;
2456}
2457
Geoff Lang93561c32016-09-20 10:22:55 -04002458
2459
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002460/** Set the current line number.
Geoff Lang93561c32016-09-20 10:22:55 -04002461 * @param _line_number line number
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002462 * @param yyscanner The scanner object.
2463 */
Geoff Lang93561c32016-09-20 10:22:55 -04002464void ppset_lineno (int _line_number , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002465{
2466 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2467
Geoff Lang93561c32016-09-20 10:22:55 -04002468
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002469 /* lineno is only valid if an input buffer exists. */
2470 if (! YY_CURRENT_BUFFER )
Zhenyao Mof1d723c2013-09-23 14:57:07 -04002471 YY_FATAL_ERROR( "ppset_lineno called with no buffer" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002472
Geoff Lang93561c32016-09-20 10:22:55 -04002473 yylineno = _line_number;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002474}
2475
Geoff Lang93561c32016-09-20 10:22:55 -04002476
2477
2478
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002479/** Set the current column.
Geoff Lang93561c32016-09-20 10:22:55 -04002480 * @param _column_no column number
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002481 * @param yyscanner The scanner object.
2482 */
Geoff Lang93561c32016-09-20 10:22:55 -04002483void ppset_column (int _column_no , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002484{
2485 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2486
Geoff Lang93561c32016-09-20 10:22:55 -04002487
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002488 /* column is only valid if an input buffer exists. */
2489 if (! YY_CURRENT_BUFFER )
Zhenyao Mof1d723c2013-09-23 14:57:07 -04002490 YY_FATAL_ERROR( "ppset_column called with no buffer" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002491
Geoff Lang93561c32016-09-20 10:22:55 -04002492 yycolumn = _column_no;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002493}
2494
Geoff Lang93561c32016-09-20 10:22:55 -04002495
2496
2497
2498
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002499/** Set the input stream. This does not discard the current
2500 * input buffer.
Geoff Lang93561c32016-09-20 10:22:55 -04002501 * @param _in_str A readable stream.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002502 * @param yyscanner The scanner object.
2503 * @see pp_switch_to_buffer
2504 */
Geoff Lang93561c32016-09-20 10:22:55 -04002505void ppset_in (FILE * _in_str , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002506{
2507 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04002508 yyin = _in_str ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002509}
2510
Geoff Lang93561c32016-09-20 10:22:55 -04002511
2512
2513void ppset_out (FILE * _out_str , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002514{
2515 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04002516 yyout = _out_str ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002517}
2518
Geoff Lang93561c32016-09-20 10:22:55 -04002519
2520
2521
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002522int ppget_debug (yyscan_t yyscanner)
2523{
2524 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2525 return yy_flex_debug;
2526}
2527
Geoff Lang93561c32016-09-20 10:22:55 -04002528
2529
2530void ppset_debug (int _bdebug , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002531{
2532 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04002533 yy_flex_debug = _bdebug ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002534}
2535
Geoff Lang93561c32016-09-20 10:22:55 -04002536
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002537/* Accessor methods for yylval and yylloc */
2538
Geoff Lang93561c32016-09-20 10:22:55 -04002539
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002540YYSTYPE * ppget_lval (yyscan_t yyscanner)
2541{
2542 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2543 return yylval;
2544}
2545
Geoff Lang93561c32016-09-20 10:22:55 -04002546
2547
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002548void ppset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
2549{
2550 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2551 yylval = yylval_param;
2552}
2553
Geoff Lang93561c32016-09-20 10:22:55 -04002554
2555
2556
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002557YYLTYPE *ppget_lloc (yyscan_t yyscanner)
2558{
2559 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2560 return yylloc;
2561}
2562
Geoff Lang93561c32016-09-20 10:22:55 -04002563
2564
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002565void ppset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
2566{
2567 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2568 yylloc = yylloc_param;
2569}
2570
Geoff Lang93561c32016-09-20 10:22:55 -04002571
2572
2573
2574
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002575/* User-visible API */
2576
2577/* pplex_init is special because it creates the scanner itself, so it is
2578 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2579 * That's why we explicitly handle the declaration, instead of using our macros.
2580 */
2581
2582int pplex_init(yyscan_t* ptr_yy_globals)
2583
2584{
2585 if (ptr_yy_globals == NULL){
2586 errno = EINVAL;
2587 return 1;
2588 }
2589
2590 *ptr_yy_globals = (yyscan_t) ppalloc ( sizeof( struct yyguts_t ), NULL );
2591
2592 if (*ptr_yy_globals == NULL){
2593 errno = ENOMEM;
2594 return 1;
2595 }
2596
2597 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2598 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2599
2600 return yy_init_globals ( *ptr_yy_globals );
2601}
2602
Geoff Lang93561c32016-09-20 10:22:55 -04002603
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002604/* pplex_init_extra has the same functionality as pplex_init, but follows the
2605 * convention of taking the scanner as the last argument. Note however, that
2606 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2607 * is the reason, too, why this function also must handle its own declaration).
2608 * The user defined value in the first argument will be available to ppalloc in
2609 * the yyextra field.
2610 */
2611
2612int pplex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
2613
2614{
2615 struct yyguts_t dummy_yyguts;
2616
2617 ppset_extra (yy_user_defined, &dummy_yyguts);
2618
2619 if (ptr_yy_globals == NULL){
2620 errno = EINVAL;
2621 return 1;
2622 }
2623
2624 *ptr_yy_globals = (yyscan_t) ppalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2625
2626 if (*ptr_yy_globals == NULL){
2627 errno = ENOMEM;
2628 return 1;
2629 }
2630
2631 /* By setting to 0xAA, we expose bugs in
2632 yy_init_globals. Leave at 0x00 for releases. */
2633 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2634
2635 ppset_extra (yy_user_defined, *ptr_yy_globals);
2636
2637 return yy_init_globals ( *ptr_yy_globals );
2638}
2639
Geoff Lang93561c32016-09-20 10:22:55 -04002640
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002641static int yy_init_globals (yyscan_t yyscanner)
2642{
2643 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2644 /* Initialization is the same as for the non-reentrant scanner.
2645 * This function is called from pplex_destroy(), so don't allocate here.
2646 */
2647
Geoff Lang93561c32016-09-20 10:22:55 -04002648
2649 yyg->yy_buffer_stack = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002650 yyg->yy_buffer_stack_top = 0;
2651 yyg->yy_buffer_stack_max = 0;
Geoff Lang93561c32016-09-20 10:22:55 -04002652 yyg->yy_c_buf_p = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002653 yyg->yy_init = 0;
2654 yyg->yy_start = 0;
2655
Geoff Lang93561c32016-09-20 10:22:55 -04002656
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002657 yyg->yy_start_stack_ptr = 0;
2658 yyg->yy_start_stack_depth = 0;
2659 yyg->yy_start_stack = NULL;
2660
Geoff Lang93561c32016-09-20 10:22:55 -04002661
2662
2663
2664
2665
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002666/* Defined in main.c */
2667#ifdef YY_STDINIT
2668 yyin = stdin;
2669 yyout = stdout;
2670#else
Geoff Lang93561c32016-09-20 10:22:55 -04002671 yyin = NULL;
2672 yyout = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002673#endif
2674
2675 /* For future reference: Set errno on error, since we are called by
2676 * pplex_init()
2677 */
2678 return 0;
2679}
2680
Geoff Lang93561c32016-09-20 10:22:55 -04002681
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002682/* pplex_destroy is for both reentrant and non-reentrant scanners. */
2683int pplex_destroy (yyscan_t yyscanner)
2684{
2685 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2686
2687 /* Pop the buffer stack, destroying each element. */
2688 while(YY_CURRENT_BUFFER){
2689 pp_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
2690 YY_CURRENT_BUFFER_LVALUE = NULL;
2691 pppop_buffer_state(yyscanner);
2692 }
2693
2694 /* Destroy the stack itself. */
2695 ppfree(yyg->yy_buffer_stack ,yyscanner);
2696 yyg->yy_buffer_stack = NULL;
2697
Geoff Lang93561c32016-09-20 10:22:55 -04002698
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002699 /* Destroy the start condition stack. */
2700 ppfree(yyg->yy_start_stack ,yyscanner );
2701 yyg->yy_start_stack = NULL;
2702
Geoff Lang93561c32016-09-20 10:22:55 -04002703
2704
2705
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002706 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2707 * pplex() is called, initialization will occur. */
2708 yy_init_globals( yyscanner);
2709
2710 /* Destroy the main struct (reentrant only). */
2711 ppfree ( yyscanner , yyscanner );
2712 yyscanner = NULL;
2713 return 0;
2714}
2715
Geoff Lang93561c32016-09-20 10:22:55 -04002716
2717
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002718/*
2719 * Internal utility routines.
2720 */
2721
Geoff Lang93561c32016-09-20 10:22:55 -04002722
2723
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002724#ifndef yytext_ptr
2725static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2726{
Geoff Lang93561c32016-09-20 10:22:55 -04002727 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2728 (void)yyg;
2729
2730 int i;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002731 for ( i = 0; i < n; ++i )
2732 s1[i] = s2[i];
2733}
2734#endif
2735
Geoff Lang93561c32016-09-20 10:22:55 -04002736
2737
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002738#ifdef YY_NEED_STRLEN
2739static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2740{
Geoff Lang93561c32016-09-20 10:22:55 -04002741 int n;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002742 for ( n = 0; s[n]; ++n )
2743 ;
2744
2745 return n;
2746}
2747#endif
2748
Geoff Lang93561c32016-09-20 10:22:55 -04002749
2750
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002751void *ppalloc (yy_size_t size , yyscan_t yyscanner)
2752{
Geoff Lang93561c32016-09-20 10:22:55 -04002753 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2754 (void)yyg;
2755 return malloc(size);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002756}
2757
Geoff Lang93561c32016-09-20 10:22:55 -04002758
2759
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002760void *pprealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
2761{
Geoff Lang93561c32016-09-20 10:22:55 -04002762 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2763 (void)yyg;
2764
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002765 /* The cast to (char *) in the following accommodates both
2766 * implementations that use char* generic pointers, and those
2767 * that use void* generic pointers. It works with the latter
2768 * because both ANSI C and C++ allow castless assignment from
2769 * any pointer type to void*, and deal with argument conversions
2770 * as though doing an assignment.
2771 */
Geoff Lang93561c32016-09-20 10:22:55 -04002772 return realloc(ptr, size);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002773}
2774
Geoff Lang93561c32016-09-20 10:22:55 -04002775
2776
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002777void ppfree (void * ptr , yyscan_t yyscanner)
2778{
Geoff Lang93561c32016-09-20 10:22:55 -04002779 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2780 (void)yyg;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002781 free( (char *) ptr ); /* see pprealloc() for (char *) cast */
2782}
2783
Geoff Lang93561c32016-09-20 10:22:55 -04002784
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002785#define YYTABLES_NAME "yytables"
2786
Geoff Lang93561c32016-09-20 10:22:55 -04002787
2788
2789
2790
2791
2792
2793
2794
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002795namespace pp {
2796
Zhenyao Mod526f982014-05-13 14:51:19 -07002797Tokenizer::Tokenizer(Diagnostics *diagnostics)
Jamie Madill5508f392014-02-20 13:31:36 -05002798 : mHandle(0),
2799 mMaxTokenSize(256)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002800{
alokp@chromium.org2c958ee2012-05-17 20:35:42 +00002801 mContext.diagnostics = diagnostics;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002802}
2803
2804Tokenizer::~Tokenizer()
2805{
2806 destroyScanner();
2807}
2808
Zhenyao Mod526f982014-05-13 14:51:19 -07002809bool Tokenizer::init(size_t count, const char * const string[], const int length[])
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002810{
Zhenyao Mod526f982014-05-13 14:51:19 -07002811 if ((count > 0) && (string == 0))
2812 return false;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002813
2814 mContext.input = Input(count, string, length);
2815 return initScanner();
2816}
2817
alokp@chromium.org46aa13d2012-06-15 15:40:27 +00002818void Tokenizer::setFileNumber(int file)
2819{
2820 // We use column number as file number.
2821 // See macro yyfileno.
2822 ppset_column(file,mHandle);
2823}
2824
2825void Tokenizer::setLineNumber(int line)
2826{
2827 ppset_lineno(line,mHandle);
2828}
2829
Jamie Madill5508f392014-02-20 13:31:36 -05002830void Tokenizer::setMaxTokenSize(size_t maxTokenSize)
2831{
2832 mMaxTokenSize = maxTokenSize;
2833}
2834
Zhenyao Mod526f982014-05-13 14:51:19 -07002835void Tokenizer::lex(Token *token)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002836{
alokp@chromium.org5b6a68e2012-06-28 20:29:13 +00002837 token->type = pplex(&token->text,&token->location,mHandle);
Jamie Madill5508f392014-02-20 13:31:36 -05002838 if (token->text.size() > mMaxTokenSize)
alokp@chromium.orgc022c3a2012-07-09 15:56:42 +00002839 {
Shannon Woods7f2d7942013-11-19 15:07:58 -05002840 mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
alokp@chromium.orgc022c3a2012-07-09 15:56:42 +00002841 token->location, token->text);
Jamie Madill5508f392014-02-20 13:31:36 -05002842 token->text.erase(mMaxTokenSize);
alokp@chromium.orgc022c3a2012-07-09 15:56:42 +00002843 }
2844
alokp@chromium.org7fc38dd2012-06-14 18:23:23 +00002845 token->flags = 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002846
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00002847 token->setAtStartOfLine(mContext.lineStart);
2848 mContext.lineStart = token->type == '\n';
2849
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002850 token->setHasLeadingSpace(mContext.leadingSpace);
2851 mContext.leadingSpace = false;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002852}
2853
2854bool Tokenizer::initScanner()
2855{
2856 if ((mHandle == NULL) && pplex_init_extra(&mContext,&mHandle))
2857 return false;
2858
2859 pprestart(0,mHandle);
2860 return true;
2861}
2862
2863void Tokenizer::destroyScanner()
2864{
2865 if (mHandle == NULL)
2866 return;
2867
2868 pplex_destroy(mHandle);
2869 mHandle = NULL;
2870}
2871
2872} // namespace pp
2873
Geoff Lang93561c32016-09-20 10:22:55 -04002874