blob: 76b376b9cbd112e338058c29c41b4a38b2c6dc72 [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
alokp@chromium.org04d7d222012-05-16 19:24:07 +000025#define FLEX_SCANNER
26#define YY_FLEX_MAJOR_VERSION 2
Geoff Lang93561c32016-09-20 10:22:55 -040027#define YY_FLEX_MINOR_VERSION 6
Corentin Wallez168d5e82017-02-01 12:18:56 -080028#define YY_FLEX_SUBMINOR_VERSION 4
alokp@chromium.org04d7d222012-05-16 19:24:07 +000029#if YY_FLEX_SUBMINOR_VERSION > 0
30#define FLEX_BETA
31#endif
32
Geoff Lang93561c32016-09-20 10:22:55 -040033
34
35
36
37
38
39
40
41
42
43
44
45
Corentin Wallez168d5e82017-02-01 12:18:56 -080046#ifdef yy_create_buffer
47#define pp_create_buffer_ALREADY_DEFINED
48#else
49#define yy_create_buffer pp_create_buffer
50#endif
51
Geoff Lang93561c32016-09-20 10:22:55 -040052
Corentin Wallez168d5e82017-02-01 12:18:56 -080053#ifdef yy_delete_buffer
54#define pp_delete_buffer_ALREADY_DEFINED
55#else
56#define yy_delete_buffer pp_delete_buffer
57#endif
58
Geoff Lang93561c32016-09-20 10:22:55 -040059
Corentin Wallez168d5e82017-02-01 12:18:56 -080060#ifdef yy_scan_buffer
61#define pp_scan_buffer_ALREADY_DEFINED
62#else
63#define yy_scan_buffer pp_scan_buffer
64#endif
65
Geoff Lang93561c32016-09-20 10:22:55 -040066
Corentin Wallez168d5e82017-02-01 12:18:56 -080067#ifdef yy_scan_string
68#define pp_scan_string_ALREADY_DEFINED
69#else
70#define yy_scan_string pp_scan_string
71#endif
72
Geoff Lang93561c32016-09-20 10:22:55 -040073
Corentin Wallez168d5e82017-02-01 12:18:56 -080074#ifdef yy_scan_bytes
75#define pp_scan_bytes_ALREADY_DEFINED
76#else
77#define yy_scan_bytes pp_scan_bytes
78#endif
79
Geoff Lang93561c32016-09-20 10:22:55 -040080
Corentin Wallez168d5e82017-02-01 12:18:56 -080081#ifdef yy_init_buffer
82#define pp_init_buffer_ALREADY_DEFINED
83#else
84#define yy_init_buffer pp_init_buffer
85#endif
86
Geoff Lang93561c32016-09-20 10:22:55 -040087
Corentin Wallez168d5e82017-02-01 12:18:56 -080088#ifdef yy_flush_buffer
89#define pp_flush_buffer_ALREADY_DEFINED
90#else
91#define yy_flush_buffer pp_flush_buffer
92#endif
93
Geoff Lang93561c32016-09-20 10:22:55 -040094
Corentin Wallez168d5e82017-02-01 12:18:56 -080095#ifdef yy_load_buffer_state
96#define pp_load_buffer_state_ALREADY_DEFINED
97#else
98#define yy_load_buffer_state pp_load_buffer_state
99#endif
100
Geoff Lang93561c32016-09-20 10:22:55 -0400101
Corentin Wallez168d5e82017-02-01 12:18:56 -0800102#ifdef yy_switch_to_buffer
103#define pp_switch_to_buffer_ALREADY_DEFINED
104#else
105#define yy_switch_to_buffer pp_switch_to_buffer
106#endif
107
Geoff Lang93561c32016-09-20 10:22:55 -0400108
Corentin Wallez168d5e82017-02-01 12:18:56 -0800109#ifdef yypush_buffer_state
110#define pppush_buffer_state_ALREADY_DEFINED
111#else
112#define yypush_buffer_state pppush_buffer_state
113#endif
114
Geoff Lang93561c32016-09-20 10:22:55 -0400115
Corentin Wallez168d5e82017-02-01 12:18:56 -0800116#ifdef yypop_buffer_state
117#define pppop_buffer_state_ALREADY_DEFINED
118#else
119#define yypop_buffer_state pppop_buffer_state
120#endif
121
Geoff Lang93561c32016-09-20 10:22:55 -0400122
Corentin Wallez168d5e82017-02-01 12:18:56 -0800123#ifdef yyensure_buffer_stack
124#define ppensure_buffer_stack_ALREADY_DEFINED
125#else
126#define yyensure_buffer_stack ppensure_buffer_stack
127#endif
128
Geoff Lang93561c32016-09-20 10:22:55 -0400129
Corentin Wallez168d5e82017-02-01 12:18:56 -0800130#ifdef yylex
131#define pplex_ALREADY_DEFINED
132#else
133#define yylex pplex
134#endif
135
Geoff Lang93561c32016-09-20 10:22:55 -0400136
Corentin Wallez168d5e82017-02-01 12:18:56 -0800137#ifdef yyrestart
138#define pprestart_ALREADY_DEFINED
139#else
140#define yyrestart pprestart
141#endif
142
Geoff Lang93561c32016-09-20 10:22:55 -0400143
Corentin Wallez168d5e82017-02-01 12:18:56 -0800144#ifdef yylex_init
145#define pplex_init_ALREADY_DEFINED
146#else
147#define yylex_init pplex_init
148#endif
149
Geoff Lang93561c32016-09-20 10:22:55 -0400150
Corentin Wallez168d5e82017-02-01 12:18:56 -0800151#ifdef yylex_init_extra
152#define pplex_init_extra_ALREADY_DEFINED
153#else
154#define yylex_init_extra pplex_init_extra
155#endif
156
Geoff Lang93561c32016-09-20 10:22:55 -0400157
Corentin Wallez168d5e82017-02-01 12:18:56 -0800158#ifdef yylex_destroy
159#define pplex_destroy_ALREADY_DEFINED
160#else
161#define yylex_destroy pplex_destroy
162#endif
163
Geoff Lang93561c32016-09-20 10:22:55 -0400164
Corentin Wallez168d5e82017-02-01 12:18:56 -0800165#ifdef yyget_debug
166#define ppget_debug_ALREADY_DEFINED
167#else
168#define yyget_debug ppget_debug
169#endif
170
Geoff Lang93561c32016-09-20 10:22:55 -0400171
Corentin Wallez168d5e82017-02-01 12:18:56 -0800172#ifdef yyset_debug
173#define ppset_debug_ALREADY_DEFINED
174#else
175#define yyset_debug ppset_debug
176#endif
177
Geoff Lang93561c32016-09-20 10:22:55 -0400178
Corentin Wallez168d5e82017-02-01 12:18:56 -0800179#ifdef yyget_extra
180#define ppget_extra_ALREADY_DEFINED
181#else
182#define yyget_extra ppget_extra
183#endif
184
Geoff Lang93561c32016-09-20 10:22:55 -0400185
Corentin Wallez168d5e82017-02-01 12:18:56 -0800186#ifdef yyset_extra
187#define ppset_extra_ALREADY_DEFINED
188#else
189#define yyset_extra ppset_extra
190#endif
191
Geoff Lang93561c32016-09-20 10:22:55 -0400192
Corentin Wallez168d5e82017-02-01 12:18:56 -0800193#ifdef yyget_in
194#define ppget_in_ALREADY_DEFINED
195#else
196#define yyget_in ppget_in
197#endif
198
Geoff Lang93561c32016-09-20 10:22:55 -0400199
Corentin Wallez168d5e82017-02-01 12:18:56 -0800200#ifdef yyset_in
201#define ppset_in_ALREADY_DEFINED
202#else
203#define yyset_in ppset_in
204#endif
205
Geoff Lang93561c32016-09-20 10:22:55 -0400206
Corentin Wallez168d5e82017-02-01 12:18:56 -0800207#ifdef yyget_out
208#define ppget_out_ALREADY_DEFINED
209#else
210#define yyget_out ppget_out
211#endif
212
Geoff Lang93561c32016-09-20 10:22:55 -0400213
Corentin Wallez168d5e82017-02-01 12:18:56 -0800214#ifdef yyset_out
215#define ppset_out_ALREADY_DEFINED
216#else
217#define yyset_out ppset_out
218#endif
219
Geoff Lang93561c32016-09-20 10:22:55 -0400220
Corentin Wallez168d5e82017-02-01 12:18:56 -0800221#ifdef yyget_leng
222#define ppget_leng_ALREADY_DEFINED
223#else
224#define yyget_leng ppget_leng
225#endif
226
Geoff Lang93561c32016-09-20 10:22:55 -0400227
Corentin Wallez168d5e82017-02-01 12:18:56 -0800228#ifdef yyget_text
229#define ppget_text_ALREADY_DEFINED
230#else
231#define yyget_text ppget_text
232#endif
233
Geoff Lang93561c32016-09-20 10:22:55 -0400234
Corentin Wallez168d5e82017-02-01 12:18:56 -0800235#ifdef yyget_lineno
236#define ppget_lineno_ALREADY_DEFINED
237#else
238#define yyget_lineno ppget_lineno
239#endif
240
Geoff Lang93561c32016-09-20 10:22:55 -0400241
Corentin Wallez168d5e82017-02-01 12:18:56 -0800242#ifdef yyset_lineno
243#define ppset_lineno_ALREADY_DEFINED
244#else
245#define yyset_lineno ppset_lineno
246#endif
247
Geoff Lang93561c32016-09-20 10:22:55 -0400248
249
Corentin Wallez168d5e82017-02-01 12:18:56 -0800250#ifdef yyget_column
251#define ppget_column_ALREADY_DEFINED
252#else
253#define yyget_column ppget_column
254#endif
255
Geoff Lang93561c32016-09-20 10:22:55 -0400256
Corentin Wallez168d5e82017-02-01 12:18:56 -0800257#ifdef yyset_column
258#define ppset_column_ALREADY_DEFINED
259#else
260#define yyset_column ppset_column
261#endif
Geoff Lang93561c32016-09-20 10:22:55 -0400262
263
264
Corentin Wallez168d5e82017-02-01 12:18:56 -0800265#ifdef yywrap
266#define ppwrap_ALREADY_DEFINED
267#else
268#define yywrap ppwrap
269#endif
270
Geoff Lang93561c32016-09-20 10:22:55 -0400271
272
273
274
Corentin Wallez168d5e82017-02-01 12:18:56 -0800275#ifdef yyget_lval
276#define ppget_lval_ALREADY_DEFINED
277#else
278#define yyget_lval ppget_lval
279#endif
280
Geoff Lang93561c32016-09-20 10:22:55 -0400281
Corentin Wallez168d5e82017-02-01 12:18:56 -0800282#ifdef yyset_lval
283#define ppset_lval_ALREADY_DEFINED
284#else
285#define yyset_lval ppset_lval
286#endif
287
Geoff Lang93561c32016-09-20 10:22:55 -0400288
289
290
291
Corentin Wallez168d5e82017-02-01 12:18:56 -0800292#ifdef yyget_lloc
293#define ppget_lloc_ALREADY_DEFINED
294#else
295#define yyget_lloc ppget_lloc
296#endif
297
Geoff Lang93561c32016-09-20 10:22:55 -0400298
Corentin Wallez168d5e82017-02-01 12:18:56 -0800299#ifdef yyset_lloc
300#define ppset_lloc_ALREADY_DEFINED
301#else
302#define yyset_lloc ppset_lloc
303#endif
304
305
306
307
308#ifdef yyalloc
309#define ppalloc_ALREADY_DEFINED
310#else
311#define yyalloc ppalloc
312#endif
313
Geoff Lang93561c32016-09-20 10:22:55 -0400314
Corentin Wallez168d5e82017-02-01 12:18:56 -0800315#ifdef yyrealloc
316#define pprealloc_ALREADY_DEFINED
317#else
318#define yyrealloc pprealloc
319#endif
320
321
322#ifdef yyfree
323#define ppfree_ALREADY_DEFINED
324#else
325#define yyfree ppfree
326#endif
327
328
329
Geoff Lang93561c32016-09-20 10:22:55 -0400330
331
332
333
334
335
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000336/* First, we deal with platform-specific or compiler-specific issues. */
337
338/* begin standard C headers. */
339#include <stdio.h>
340#include <string.h>
341#include <errno.h>
342#include <stdlib.h>
343
344/* end standard C headers. */
345
346/* flex integer type definitions */
347
348#ifndef FLEXINT_H
349#define FLEXINT_H
350
351/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
352
353#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
354
355/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
356 * if you want the limit (max/min) macros for int types.
357 */
358#ifndef __STDC_LIMIT_MACROS
359#define __STDC_LIMIT_MACROS 1
360#endif
361
362#include <inttypes.h>
363typedef int8_t flex_int8_t;
364typedef uint8_t flex_uint8_t;
365typedef int16_t flex_int16_t;
366typedef uint16_t flex_uint16_t;
367typedef int32_t flex_int32_t;
368typedef uint32_t flex_uint32_t;
369#else
370typedef signed char flex_int8_t;
371typedef short int flex_int16_t;
372typedef int flex_int32_t;
373typedef unsigned char flex_uint8_t;
374typedef unsigned short int flex_uint16_t;
375typedef unsigned int flex_uint32_t;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000376
377/* Limits of integral types. */
378#ifndef INT8_MIN
379#define INT8_MIN (-128)
380#endif
381#ifndef INT16_MIN
382#define INT16_MIN (-32767-1)
383#endif
384#ifndef INT32_MIN
385#define INT32_MIN (-2147483647-1)
386#endif
387#ifndef INT8_MAX
388#define INT8_MAX (127)
389#endif
390#ifndef INT16_MAX
391#define INT16_MAX (32767)
392#endif
393#ifndef INT32_MAX
394#define INT32_MAX (2147483647)
395#endif
396#ifndef UINT8_MAX
397#define UINT8_MAX (255U)
398#endif
399#ifndef UINT16_MAX
400#define UINT16_MAX (65535U)
401#endif
402#ifndef UINT32_MAX
403#define UINT32_MAX (4294967295U)
404#endif
405
Corentin Wallez168d5e82017-02-01 12:18:56 -0800406#ifndef SIZE_MAX
407#define SIZE_MAX (~(size_t)0)
408#endif
409
Zhenyao Mof1d723c2013-09-23 14:57:07 -0400410#endif /* ! C99 */
411
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000412#endif /* ! FLEXINT_H */
413
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000414
Corentin Wallez168d5e82017-02-01 12:18:56 -0800415/* begin standard C++ headers. */
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000416
Geoff Lang93561c32016-09-20 10:22:55 -0400417/* TODO: this is always defined, so inline it */
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000418#define yyconst const
Geoff Lang93561c32016-09-20 10:22:55 -0400419
420#if defined(__GNUC__) && __GNUC__ >= 3
421#define yynoreturn __attribute__((__noreturn__))
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000422#else
Geoff Lang93561c32016-09-20 10:22:55 -0400423#define yynoreturn
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000424#endif
425
426/* Returned upon end-of-file. */
427#define YY_NULL 0
428
Geoff Lang93561c32016-09-20 10:22:55 -0400429
Corentin Wallez168d5e82017-02-01 12:18:56 -0800430/* Promotes a possibly negative, possibly signed char to an
431 * integer in range [0..255] for use as an array index.
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000432 */
Corentin Wallez168d5e82017-02-01 12:18:56 -0800433#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000434
Geoff Lang93561c32016-09-20 10:22:55 -0400435
436
437
438
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000439/* An opaque pointer. */
440#ifndef YY_TYPEDEF_YY_SCANNER_T
441#define YY_TYPEDEF_YY_SCANNER_T
442typedef void* yyscan_t;
443#endif
444
Geoff Lang93561c32016-09-20 10:22:55 -0400445
446
447
448
449
450
451
452
Geoff Lang93561c32016-09-20 10:22:55 -0400453
454
455
456
457
458
459
460
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000461/* For convenience, these vars (plus the bison vars far below)
462 are macros in the reentrant scanner. */
463#define yyin yyg->yyin_r
464#define yyout yyg->yyout_r
465#define yyextra yyg->yyextra_r
466#define yyleng yyg->yyleng_r
467#define yytext yyg->yytext_r
468#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
469#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
470#define yy_flex_debug yyg->yy_flex_debug_r
471
Geoff Lang93561c32016-09-20 10:22:55 -0400472
473
474
475
476
477
478
479
Corentin Wallez168d5e82017-02-01 12:18:56 -0800480
Geoff Lang93561c32016-09-20 10:22:55 -0400481
482
483
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000484/* Enter a start condition. This macro really ought to take a parameter,
485 * but we do it the disgusting crufty way forced on us by the ()-less
486 * definition of BEGIN.
487 */
488#define BEGIN yyg->yy_start = 1 + 2 *
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000489/* Translate the current start state into a value that can be later handed
490 * to BEGIN to return to the state. The YYSTATE alias is for lex
491 * compatibility.
492 */
493#define YY_START ((yyg->yy_start - 1) / 2)
494#define YYSTATE YY_START
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000495/* Action number for EOF rule of a given start state. */
496#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000497/* Special action meaning "start processing a new file". */
Corentin Wallez168d5e82017-02-01 12:18:56 -0800498#define YY_NEW_FILE yyrestart( yyin , yyscanner )
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000499#define YY_END_OF_BUFFER_CHAR 0
500
Geoff Lang93561c32016-09-20 10:22:55 -0400501
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000502/* Size of default input buffer. */
503#ifndef YY_BUF_SIZE
Geoff Lang93561c32016-09-20 10:22:55 -0400504#ifdef __ia64__
505/* On IA-64, the buffer size is 16k, not 8k.
506 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
507 * Ditto for the __ia64__ case accordingly.
508 */
509#define YY_BUF_SIZE 32768
510#else
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000511#define YY_BUF_SIZE 16384
Geoff Lang93561c32016-09-20 10:22:55 -0400512#endif /* __ia64__ */
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000513#endif
514
Geoff Lang93561c32016-09-20 10:22:55 -0400515
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000516/* The state buf must be large enough to hold one state per character in the main buffer.
517 */
518#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
519
Geoff Lang93561c32016-09-20 10:22:55 -0400520
521
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000522#ifndef YY_TYPEDEF_YY_BUFFER_STATE
523#define YY_TYPEDEF_YY_BUFFER_STATE
524typedef struct yy_buffer_state *YY_BUFFER_STATE;
525#endif
526
shannonwoods@chromium.orgb0757162013-05-30 00:21:27 +0000527#ifndef YY_TYPEDEF_YY_SIZE_T
528#define YY_TYPEDEF_YY_SIZE_T
529typedef size_t yy_size_t;
530#endif
531
Geoff Lang93561c32016-09-20 10:22:55 -0400532
533
Zhenyao Mof1d723c2013-09-23 14:57:07 -0400534
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000535#define EOB_ACT_CONTINUE_SCAN 0
536#define EOB_ACT_END_OF_FILE 1
537#define EOB_ACT_LAST_MATCH 2
Geoff Lang93561c32016-09-20 10:22:55 -0400538
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000539 #define YY_LESS_LINENO(n)
Jamie Madill185de882014-12-22 15:17:52 -0500540 #define YY_LINENO_REWIND_TO(ptr)
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000541
542/* Return all but the first "n" matched characters back to the input stream. */
543#define yyless(n) \
544 do \
545 { \
546 /* Undo effects of setting up yytext. */ \
547 int yyless_macro_arg = (n); \
548 YY_LESS_LINENO(yyless_macro_arg);\
549 *yy_cp = yyg->yy_hold_char; \
550 YY_RESTORE_YY_MORE_OFFSET \
551 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
552 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
553 } \
554 while ( 0 )
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000555#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
556
Geoff Lang93561c32016-09-20 10:22:55 -0400557
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000558#ifndef YY_STRUCT_YY_BUFFER_STATE
559#define YY_STRUCT_YY_BUFFER_STATE
560struct yy_buffer_state
561 {
562 FILE *yy_input_file;
563
Geoff Lang93561c32016-09-20 10:22:55 -0400564
565
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000566 char *yy_ch_buf; /* input buffer */
567 char *yy_buf_pos; /* current position in input buffer */
568
569 /* Size of input buffer in bytes, not including room for EOB
570 * characters.
571 */
Geoff Lang93561c32016-09-20 10:22:55 -0400572 int yy_buf_size;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000573
574 /* Number of characters read into yy_ch_buf, not including EOB
575 * characters.
576 */
Geoff Lang93561c32016-09-20 10:22:55 -0400577 int yy_n_chars;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000578
579 /* Whether we "own" the buffer - i.e., we know we created it,
580 * and can realloc() it to grow it, and should free() it to
581 * delete it.
582 */
583 int yy_is_our_buffer;
584
585 /* Whether this is an "interactive" input source; if so, and
586 * if we're using stdio for input, then we want to use getc()
587 * instead of fread(), to make sure we stop fetching input after
588 * each newline.
589 */
590 int yy_is_interactive;
591
592 /* Whether we're considered to be at the beginning of a line.
593 * If so, '^' rules will be active on the next match, otherwise
594 * not.
595 */
596 int yy_at_bol;
597
598 int yy_bs_lineno; /**< The line count. */
599 int yy_bs_column; /**< The column count. */
Corentin Wallez168d5e82017-02-01 12:18:56 -0800600
Geoff Lang93561c32016-09-20 10:22:55 -0400601
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000602 /* Whether to try to fill the input buffer when we reach the
603 * end of it.
604 */
605 int yy_fill_buffer;
606
607 int yy_buffer_status;
608
609#define YY_BUFFER_NEW 0
610#define YY_BUFFER_NORMAL 1
611 /* When an EOF's been seen but there's still some text to process
612 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
613 * shouldn't try reading from the input source any more. We might
614 * still have a bunch of tokens to match, though, because of
615 * possible backing-up.
616 *
617 * When we actually see the EOF, we change the status to "new"
Corentin Wallez168d5e82017-02-01 12:18:56 -0800618 * (via yyrestart()), so that the user can continue scanning by
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000619 * just pointing yyin at a new input file.
620 */
621#define YY_BUFFER_EOF_PENDING 2
622
623 };
624#endif /* !YY_STRUCT_YY_BUFFER_STATE */
625
Geoff Lang93561c32016-09-20 10:22:55 -0400626
627
628
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000629/* We provide macros for accessing buffer states in case in the
630 * future we want to put the buffer states in a more general
631 * "scanner state".
632 *
633 * Returns the top of the stack, or NULL.
634 */
635#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
636 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
637 : NULL)
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000638/* Same as previous macro, but useful when we know that the buffer stack is not
639 * NULL or when we need an lvalue. For internal use only.
640 */
641#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
642
Geoff Lang93561c32016-09-20 10:22:55 -0400643
644
645
646
Corentin Wallez168d5e82017-02-01 12:18:56 -0800647void yyrestart ( FILE *input_file , yyscan_t yyscanner );
648void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
649YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
650void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
651void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
652void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
653void yypop_buffer_state ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000654
Geoff Lang93561c32016-09-20 10:22:55 -0400655
Corentin Wallez168d5e82017-02-01 12:18:56 -0800656static void yyensure_buffer_stack ( yyscan_t yyscanner );
657static void yy_load_buffer_state ( yyscan_t yyscanner );
658static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );
659#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000660
Geoff Lang93561c32016-09-20 10:22:55 -0400661
Corentin Wallez168d5e82017-02-01 12:18:56 -0800662YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
663YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
664YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000665
Geoff Lang93561c32016-09-20 10:22:55 -0400666
Corentin Wallez168d5e82017-02-01 12:18:56 -0800667void *yyalloc ( yy_size_t , yyscan_t yyscanner );
668void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
669void yyfree ( void * , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -0400670
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000671
Corentin Wallez168d5e82017-02-01 12:18:56 -0800672#define yy_new_buffer yy_create_buffer
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000673#define yy_set_interactive(is_interactive) \
674 { \
675 if ( ! YY_CURRENT_BUFFER ){ \
Corentin Wallez168d5e82017-02-01 12:18:56 -0800676 yyensure_buffer_stack (yyscanner); \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000677 YY_CURRENT_BUFFER_LVALUE = \
Corentin Wallez168d5e82017-02-01 12:18:56 -0800678 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000679 } \
680 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
681 }
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000682#define yy_set_bol(at_bol) \
683 { \
684 if ( ! YY_CURRENT_BUFFER ){\
Corentin Wallez168d5e82017-02-01 12:18:56 -0800685 yyensure_buffer_stack (yyscanner); \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000686 YY_CURRENT_BUFFER_LVALUE = \
Corentin Wallez168d5e82017-02-01 12:18:56 -0800687 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000688 } \
689 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
690 }
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000691#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
692
Geoff Lang93561c32016-09-20 10:22:55 -0400693
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000694/* Begin user sect3 */
695
Geoff Lang93561c32016-09-20 10:22:55 -0400696#define ppwrap(yyscanner) (/*CONSTCOND*/1)
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000697#define YY_SKIP_YYWRAP
Corentin Wallez168d5e82017-02-01 12:18:56 -0800698typedef flex_uint8_t YY_CHAR;
Geoff Lang93561c32016-09-20 10:22:55 -0400699
700
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000701typedef int yy_state_type;
702
703#define yytext_ptr yytext_r
704
Geoff Lang93561c32016-09-20 10:22:55 -0400705
706
707
708
709
Corentin Wallez168d5e82017-02-01 12:18:56 -0800710static yy_state_type yy_get_previous_state ( yyscan_t yyscanner );
711static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner);
712static int yy_get_next_buffer ( yyscan_t yyscanner );
713static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -0400714
715
716
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000717
718/* Done after the current pattern has been matched and before the
719 * corresponding action - sets up yytext.
720 */
721#define YY_DO_BEFORE_ACTION \
722 yyg->yytext_ptr = yy_bp; \
Geoff Lang93561c32016-09-20 10:22:55 -0400723 yyleng = (int) (yy_cp - yy_bp); \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000724 yyg->yy_hold_char = *yy_cp; \
725 *yy_cp = '\0'; \
726 yyg->yy_c_buf_p = yy_cp;
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500727#define YY_NUM_RULES 37
728#define YY_END_OF_BUFFER 38
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000729/* This struct is not used in this scanner,
730 but its presence is necessary. */
731struct yy_trans_info
732 {
733 flex_int32_t yy_verify;
734 flex_int32_t yy_nxt;
735 };
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500736static const flex_int16_t yy_accept[95] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000737 { 0,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500738 0, 0, 0, 0, 38, 36, 34, 35, 35, 33,
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000739 7, 33, 33, 33, 33, 33, 33, 33, 33, 9,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500740 9, 33, 33, 33, 8, 33, 33, 3, 5, 5,
741 4, 34, 35, 19, 27, 20, 30, 25, 12, 23,
742 13, 24, 10, 2, 1, 26, 10, 9, 11, 11,
743 11, 9, 11, 9, 9, 14, 16, 18, 17, 15,
744 8, 31, 21, 32, 22, 3, 5, 6, 11, 10,
745 11, 10, 1, 10, 11, 10, 0, 10, 9, 9,
746 9, 28, 29, 0, 10, 10, 10, 10, 9, 10,
747 10, 9, 10, 0
shannonwoods@chromium.org3f83e292013-05-30 00:21:34 +0000748
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000749 } ;
750
Corentin Wallez168d5e82017-02-01 12:18:56 -0800751static const YY_CHAR yy_ec[256] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000752 { 0,
753 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
754 2, 2, 4, 1, 1, 1, 1, 1, 1, 1,
755 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
756 1, 2, 5, 1, 6, 1, 7, 8, 1, 9,
757 9, 10, 11, 9, 12, 13, 14, 15, 16, 16,
758 16, 16, 16, 16, 16, 17, 17, 9, 9, 18,
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000759 19, 20, 9, 1, 21, 21, 21, 21, 22, 23,
760 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
761 24, 24, 24, 24, 25, 24, 24, 26, 24, 24,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500762 9, 1, 9, 27, 24, 1, 21, 21, 21, 21,
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000763
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000764 22, 23, 24, 24, 24, 24, 24, 24, 24, 24,
765 24, 24, 24, 24, 24, 24, 25, 24, 24, 26,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500766 24, 24, 9, 28, 9, 9, 1, 1, 1, 1,
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000767 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
768 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
769 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
770 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
771 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
772 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
773 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
774
775 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
776 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
777 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
778 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
779 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
780 1, 1, 1, 1, 1
781 } ;
782
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500783static const YY_CHAR yy_meta[29] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000784 { 0,
785 1, 1, 2, 2, 1, 1, 1, 1, 1, 3,
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000786 1, 1, 4, 1, 5, 5, 5, 1, 1, 1,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500787 5, 5, 5, 5, 5, 5, 1, 1
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000788 } ;
789
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500790static const flex_int16_t yy_base[100] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000791 { 0,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500792 0, 0, 26, 28, 133, 195, 130, 195, 128, 105,
793 195, 104, 25, 195, 100, 23, 27, 32, 31, 38,
794 50, 38, 93, 49, 0, 16, 51, 0, 195, 105,
795 87, 93, 195, 195, 195, 195, 195, 195, 195, 195,
796 195, 195, 67, 195, 0, 195, 81, 55, 84, 98,
797 110, 53, 61, 0, 52, 39, 195, 195, 195, 33,
798 0, 195, 195, 195, 195, 0, 195, 195, 113, 0,
799 126, 0, 0, 0, 133, 0, 56, 128, 0, 133,
800 0, 195, 195, 101, 141, 143, 145, 0, 15, 154,
801 195, 0, 195, 195, 177, 32, 182, 187, 189
shannon.woods%transgaming.com@gtempaccount.combcde56f2013-04-13 03:32:12 +0000802
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000803 } ;
804
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500805static const flex_int16_t yy_def[100] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000806 { 0,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500807 94, 1, 95, 95, 94, 94, 94, 94, 94, 94,
808 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
809 20, 94, 94, 94, 96, 94, 94, 97, 94, 94,
810 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
811 94, 94, 94, 94, 98, 94, 94, 20, 20, 49,
812 50, 50, 99, 21, 50, 94, 94, 94, 94, 94,
813 96, 94, 94, 94, 94, 97, 94, 94, 43, 43,
814 69, 69, 98, 47, 50, 50, 94, 51, 50, 99,
815 50, 94, 94, 94, 71, 75, 94, 50, 50, 94,
816 94, 50, 94, 0, 94, 94, 94, 94, 94
shannon.woods%transgaming.com@gtempaccount.combcde56f2013-04-13 03:32:12 +0000817
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000818 } ;
819
Corentin Wallez168d5e82017-02-01 12:18:56 -0800820static const flex_int16_t yy_nxt[224] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000821 { 0,
822 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
823 16, 17, 18, 19, 20, 21, 21, 22, 23, 24,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500824 25, 25, 25, 25, 25, 25, 26, 27, 29, 30,
825 29, 30, 36, 39, 62, 31, 61, 31, 41, 92,
826 44, 40, 63, 37, 45, 42, 43, 43, 43, 46,
827 47, 83, 48, 48, 49, 56, 57, 82, 50, 51,
828 50, 50, 52, 53, 54, 54, 54, 59, 60, 64,
829 87, 87, 87, 50, 55, 50, 81, 79, 65, 69,
830 50, 70, 70, 70, 50, 50, 50, 69, 71, 72,
831 69, 69, 69, 50, 32, 74, 74, 74, 49, 49,
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000832
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500833 68, 50, 75, 76, 50, 50, 50, 67, 50, 50,
834 50, 58, 50, 50, 50, 90, 90, 90, 38, 50,
835 77, 77, 35, 34, 78, 78, 78, 69, 69, 69,
836 33, 32, 94, 94, 69, 69, 84, 84, 94, 94,
837 85, 85, 85, 84, 84, 50, 94, 86, 86, 86,
838 88, 94, 94, 94, 94, 94, 50, 89, 50, 87,
839 87, 87, 94, 72, 94, 76, 94, 91, 90, 90,
840 90, 94, 94, 94, 94, 94, 93, 28, 28, 28,
841 28, 28, 66, 94, 94, 66, 66, 73, 94, 73,
842 73, 73, 80, 80, 5, 94, 94, 94, 94, 94,
shannonwoods@chromium.orgc8100b82013-05-30 00:20:34 +0000843
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500844 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
845 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
846 94, 94, 94
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000847 } ;
848
Corentin Wallez168d5e82017-02-01 12:18:56 -0800849static const flex_int16_t yy_chk[224] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000850 { 0,
851 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
852 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500853 1, 1, 1, 1, 1, 1, 1, 1, 3, 3,
854 4, 4, 13, 16, 26, 3, 96, 4, 17, 89,
855 19, 16, 26, 13, 19, 17, 18, 18, 18, 19,
856 20, 60, 20, 20, 20, 22, 22, 56, 20, 20,
857 20, 20, 20, 20, 21, 21, 21, 24, 24, 27,
858 77, 77, 77, 53, 21, 21, 55, 52, 27, 43,
859 48, 43, 43, 43, 53, 53, 53, 43, 43, 43,
860 43, 43, 43, 47, 32, 47, 47, 47, 49, 49,
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000861
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500862 31, 47, 47, 47, 47, 47, 47, 30, 49, 49,
863 50, 23, 50, 50, 50, 84, 84, 84, 15, 50,
864 51, 51, 12, 10, 51, 51, 51, 69, 69, 69,
865 9, 7, 5, 0, 69, 69, 71, 71, 78, 78,
866 71, 71, 71, 75, 75, 80, 0, 75, 75, 75,
867 78, 85, 85, 86, 86, 0, 80, 80, 80, 87,
868 87, 87, 0, 85, 0, 86, 0, 87, 90, 90,
869 90, 0, 0, 0, 0, 0, 90, 95, 95, 95,
870 95, 95, 97, 0, 0, 97, 97, 98, 0, 98,
871 98, 98, 99, 99, 94, 94, 94, 94, 94, 94,
shannonwoods@chromium.orgc8100b82013-05-30 00:20:34 +0000872
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500873 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
874 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
875 94, 94, 94
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000876 } ;
877
878/* The intent behind this definition is that it'll catch
879 * any uses of REJECT which flex missed.
880 */
881#define REJECT reject_used_but_not_detected
882#define yymore() yymore_used_but_not_detected
883#define YY_MORE_ADJ 0
884#define YY_RESTORE_YY_MORE_OFFSET
885/*
886//
Jamie Madill88f6e942014-02-19 10:27:53 -0500887// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000888// Use of this source code is governed by a BSD-style license that can be
889// found in the LICENSE file.
890//
891
892This file contains the Lex specification for GLSL ES preprocessor.
893Based on Microsoft Visual Studio 2010 Preprocessor Grammar:
894http://msdn.microsoft.com/en-us/library/2scxys89.aspx
895
896IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
897*/
898
Scott Grahama8975422015-05-01 11:09:12 -0700899#if defined(_MSC_VER)
900#pragma warning(disable: 4005)
901#endif
902
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400903#include "compiler/preprocessor/Tokenizer.h"
alokp@chromium.org2c958ee2012-05-17 20:35:42 +0000904
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400905#include "compiler/preprocessor/DiagnosticsBase.h"
906#include "compiler/preprocessor/Token.h"
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000907
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +0000908#if defined(__GNUC__)
909// Triggered by the auto-generated yy_fatal_error function.
910#pragma GCC diagnostic ignored "-Wmissing-noreturn"
Minmin Gong794e0002015-04-07 18:31:54 -0700911#elif defined(_MSC_VER)
912#pragma warning(disable: 4244)
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +0000913#endif
914
Jamie Madill2dc8bf82015-04-30 15:56:52 -0400915// Workaround for flex using the register keyword, deprecated in C++11.
916#ifdef __cplusplus
917#if __cplusplus > 199711L
918#define register
919#endif
920#endif
921
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000922typedef std::string YYSTYPE;
alokp@chromium.org2c958ee2012-05-17 20:35:42 +0000923typedef pp::SourceLocation YYLTYPE;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000924
925// Use the unused yycolumn variable to track file (string) number.
926#define yyfileno yycolumn
927
928#define YY_USER_INIT \
929 do { \
930 yyfileno = 0; \
931 yylineno = 1; \
932 yyextra->leadingSpace = false; \
933 yyextra->lineStart = true; \
934 } while(0);
935
alokp@chromium.org19d7aa62012-05-31 17:34:05 +0000936#define YY_USER_ACTION \
937 do \
938 { \
939 pp::Input* input = &yyextra->input; \
940 pp::Input::Location* scanLoc = &yyextra->scanLoc; \
941 while ((scanLoc->sIndex < input->count()) && \
942 (scanLoc->cIndex >= input->length(scanLoc->sIndex))) \
943 { \
944 scanLoc->cIndex -= input->length(scanLoc->sIndex++); \
945 ++yyfileno; yylineno = 1; \
946 } \
947 yylloc->file = yyfileno; \
948 yylloc->line = yylineno; \
949 scanLoc->cIndex += yyleng; \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000950 } while(0);
951
952#define YY_INPUT(buf, result, maxSize) \
Olli Etuaho26e355b2015-08-14 14:16:19 +0300953 result = yyextra->input.read(buf, maxSize, &yylineno);
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000954
Geoff Lang93561c32016-09-20 10:22:55 -0400955
956
957
958
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000959#define INITIAL 0
960#define COMMENT 1
961
Geoff Lang93561c32016-09-20 10:22:55 -0400962
963
964
965
966
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000967#define YY_EXTRA_TYPE pp::Tokenizer::Context*
968
Geoff Lang93561c32016-09-20 10:22:55 -0400969
970
971
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000972/* Holds the entire state of the reentrant scanner. */
973struct yyguts_t
974 {
975
976 /* User-defined. Not touched by flex. */
977 YY_EXTRA_TYPE yyextra_r;
978
979 /* The rest are the same as the globals declared in the non-reentrant scanner. */
980 FILE *yyin_r, *yyout_r;
981 size_t yy_buffer_stack_top; /**< index of top of stack. */
982 size_t yy_buffer_stack_max; /**< capacity of stack. */
983 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
984 char yy_hold_char;
Geoff Lang93561c32016-09-20 10:22:55 -0400985 int yy_n_chars;
986 int yyleng_r;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000987 char *yy_c_buf_p;
988 int yy_init;
989 int yy_start;
990 int yy_did_buffer_switch_on_eof;
991 int yy_start_stack_ptr;
992 int yy_start_stack_depth;
993 int *yy_start_stack;
994 yy_state_type yy_last_accepting_state;
995 char* yy_last_accepting_cpos;
996
997 int yylineno_r;
998 int yy_flex_debug_r;
999
Geoff Lang93561c32016-09-20 10:22:55 -04001000
1001
1002
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001003 char *yytext_r;
1004 int yy_more_flag;
1005 int yy_more_len;
1006
Geoff Lang93561c32016-09-20 10:22:55 -04001007
1008
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001009 YYSTYPE * yylval_r;
1010
Geoff Lang93561c32016-09-20 10:22:55 -04001011
1012
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001013 YYLTYPE * yylloc_r;
1014
Geoff Lang93561c32016-09-20 10:22:55 -04001015
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001016 }; /* end struct yyguts_t */
1017
Geoff Lang93561c32016-09-20 10:22:55 -04001018
1019
1020
Corentin Wallez168d5e82017-02-01 12:18:56 -08001021static int yy_init_globals ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001022
Geoff Lang93561c32016-09-20 10:22:55 -04001023
1024
1025
1026
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001027 /* This must go here because YYSTYPE and YYLTYPE are included
1028 * from bison output in section 1.*/
1029 # define yylval yyg->yylval_r
1030
Geoff Lang93561c32016-09-20 10:22:55 -04001031
1032
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001033 # define yylloc yyg->yylloc_r
1034
Geoff Lang93561c32016-09-20 10:22:55 -04001035
1036
Corentin Wallez168d5e82017-02-01 12:18:56 -08001037int yylex_init (yyscan_t* scanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001038
Corentin Wallez168d5e82017-02-01 12:18:56 -08001039int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001040
Geoff Lang93561c32016-09-20 10:22:55 -04001041
1042
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001043/* Accessor methods to globals.
1044 These are made visible to non-reentrant scanners for convenience. */
1045
Geoff Lang93561c32016-09-20 10:22:55 -04001046
Corentin Wallez168d5e82017-02-01 12:18:56 -08001047int yylex_destroy ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001048
Geoff Lang93561c32016-09-20 10:22:55 -04001049
1050
Corentin Wallez168d5e82017-02-01 12:18:56 -08001051int yyget_debug ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001052
Geoff Lang93561c32016-09-20 10:22:55 -04001053
1054
Corentin Wallez168d5e82017-02-01 12:18:56 -08001055void yyset_debug ( int debug_flag , yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001056
Geoff Lang93561c32016-09-20 10:22:55 -04001057
1058
Corentin Wallez168d5e82017-02-01 12:18:56 -08001059YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001060
Geoff Lang93561c32016-09-20 10:22:55 -04001061
1062
Corentin Wallez168d5e82017-02-01 12:18:56 -08001063void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001064
Geoff Lang93561c32016-09-20 10:22:55 -04001065
1066
Corentin Wallez168d5e82017-02-01 12:18:56 -08001067FILE *yyget_in ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001068
Geoff Lang93561c32016-09-20 10:22:55 -04001069
1070
Corentin Wallez168d5e82017-02-01 12:18:56 -08001071void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001072
1073
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001074
Corentin Wallez168d5e82017-02-01 12:18:56 -08001075FILE *yyget_out ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001076
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001077
Geoff Lang93561c32016-09-20 10:22:55 -04001078
Corentin Wallez168d5e82017-02-01 12:18:56 -08001079void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001080
1081
1082
Corentin Wallez168d5e82017-02-01 12:18:56 -08001083 int yyget_leng ( yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001084
1085
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001086
Corentin Wallez168d5e82017-02-01 12:18:56 -08001087char *yyget_text ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001088
Geoff Lang93561c32016-09-20 10:22:55 -04001089
1090
Corentin Wallez168d5e82017-02-01 12:18:56 -08001091int yyget_lineno ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001092
Geoff Lang93561c32016-09-20 10:22:55 -04001093
1094
Corentin Wallez168d5e82017-02-01 12:18:56 -08001095void yyset_lineno ( int _line_number , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001096
1097
1098
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001099
Corentin Wallez168d5e82017-02-01 12:18:56 -08001100int yyget_column ( yyscan_t yyscanner );
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001101
Geoff Lang93561c32016-09-20 10:22:55 -04001102
1103
1104
1105
Corentin Wallez168d5e82017-02-01 12:18:56 -08001106void yyset_column ( int _column_no , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001107
1108
1109
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001110
Corentin Wallez168d5e82017-02-01 12:18:56 -08001111YYSTYPE * yyget_lval ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001112
Geoff Lang93561c32016-09-20 10:22:55 -04001113
Corentin Wallez168d5e82017-02-01 12:18:56 -08001114void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001115
Geoff Lang93561c32016-09-20 10:22:55 -04001116
1117
Corentin Wallez168d5e82017-02-01 12:18:56 -08001118 YYLTYPE *yyget_lloc ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001119
Geoff Lang93561c32016-09-20 10:22:55 -04001120
1121
Corentin Wallez168d5e82017-02-01 12:18:56 -08001122 void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001123
Geoff Lang93561c32016-09-20 10:22:55 -04001124
1125
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001126/* Macros after this point can all be overridden by user definitions in
1127 * section 1.
1128 */
1129
1130#ifndef YY_SKIP_YYWRAP
1131#ifdef __cplusplus
Corentin Wallez168d5e82017-02-01 12:18:56 -08001132extern "C" int yywrap ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001133#else
Corentin Wallez168d5e82017-02-01 12:18:56 -08001134extern int yywrap ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001135#endif
1136#endif
1137
Geoff Lang93561c32016-09-20 10:22:55 -04001138#ifndef YY_NO_UNPUT
1139
1140#endif
1141
1142
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001143#ifndef yytext_ptr
Corentin Wallez168d5e82017-02-01 12:18:56 -08001144static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001145#endif
1146
1147#ifdef YY_NEED_STRLEN
Corentin Wallez168d5e82017-02-01 12:18:56 -08001148static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001149#endif
1150
1151#ifndef YY_NO_INPUT
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001152#ifdef __cplusplus
Corentin Wallez168d5e82017-02-01 12:18:56 -08001153static int yyinput ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001154#else
Corentin Wallez168d5e82017-02-01 12:18:56 -08001155static int input ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001156#endif
1157
1158#endif
1159
Geoff Lang93561c32016-09-20 10:22:55 -04001160
1161
1162
1163
1164
1165
1166
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001167/* Amount of stuff to slurp up with each read. */
1168#ifndef YY_READ_BUF_SIZE
Geoff Lang93561c32016-09-20 10:22:55 -04001169#ifdef __ia64__
1170/* On IA-64, the buffer size is 16k, not 8k */
1171#define YY_READ_BUF_SIZE 16384
1172#else
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001173#define YY_READ_BUF_SIZE 8192
Geoff Lang93561c32016-09-20 10:22:55 -04001174#endif /* __ia64__ */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001175#endif
1176
Geoff Lang93561c32016-09-20 10:22:55 -04001177
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001178/* Copy whatever the last rule matched to the standard output. */
1179#ifndef ECHO
1180/* This used to be an fputs(), but since the string might contain NUL's,
1181 * we now use fwrite().
1182 */
Geoff Lang93561c32016-09-20 10:22:55 -04001183#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001184#endif
1185
Geoff Lang93561c32016-09-20 10:22:55 -04001186
1187
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001188/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1189 * is returned in "result".
1190 */
1191#ifndef YY_INPUT
1192#define YY_INPUT(buf,result,max_size) \
1193 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1194 { \
1195 int c = '*'; \
Corentin Wallez168d5e82017-02-01 12:18:56 -08001196 int n; \
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001197 for ( n = 0; n < max_size && \
1198 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1199 buf[n] = (char) c; \
1200 if ( c == '\n' ) \
1201 buf[n++] = (char) c; \
1202 if ( c == EOF && ferror( yyin ) ) \
1203 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1204 result = n; \
1205 } \
1206 else \
1207 { \
1208 errno=0; \
Corentin Wallez168d5e82017-02-01 12:18:56 -08001209 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001210 { \
1211 if( errno != EINTR) \
1212 { \
1213 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1214 break; \
1215 } \
1216 errno=0; \
1217 clearerr(yyin); \
1218 } \
1219 }\
1220\
1221
1222#endif
1223
Geoff Lang93561c32016-09-20 10:22:55 -04001224
1225
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001226/* No semi-colon after return; correct usage is to write "yyterminate();" -
1227 * we don't want an extra ';' after the "return" because that will cause
1228 * some compilers to complain about unreachable statements.
1229 */
1230#ifndef yyterminate
1231#define yyterminate() return YY_NULL
1232#endif
1233
Geoff Lang93561c32016-09-20 10:22:55 -04001234
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001235/* Number of entries by which start-condition stack grows. */
1236#ifndef YY_START_STACK_INCR
1237#define YY_START_STACK_INCR 25
1238#endif
1239
Geoff Lang93561c32016-09-20 10:22:55 -04001240
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001241/* Report a fatal error. */
1242#ifndef YY_FATAL_ERROR
1243#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
1244#endif
1245
Geoff Lang93561c32016-09-20 10:22:55 -04001246
1247
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001248/* end tables serialization structures and prototypes */
1249
Geoff Lang93561c32016-09-20 10:22:55 -04001250
1251
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001252/* Default declaration of generated scanner - a define so the user can
1253 * easily add parameters.
1254 */
1255#ifndef YY_DECL
1256#define YY_DECL_IS_OURS 1
1257
Geoff Lang93561c32016-09-20 10:22:55 -04001258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
Corentin Wallez168d5e82017-02-01 12:18:56 -08001274extern int yylex \
1275 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001276
Corentin Wallez168d5e82017-02-01 12:18:56 -08001277#define YY_DECL int yylex \
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001278 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
1279#endif /* !YY_DECL */
1280
Geoff Lang93561c32016-09-20 10:22:55 -04001281
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001282/* Code executed at the beginning of each rule, after yytext and yyleng
1283 * have been set up.
1284 */
1285#ifndef YY_USER_ACTION
1286#define YY_USER_ACTION
1287#endif
1288
Geoff Lang93561c32016-09-20 10:22:55 -04001289
1290
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001291/* Code executed at the end of each rule. */
1292#ifndef YY_BREAK
Geoff Lang93561c32016-09-20 10:22:55 -04001293#define YY_BREAK /*LINTED*/break;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001294#endif
1295
Geoff Lang93561c32016-09-20 10:22:55 -04001296
1297
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001298#define YY_RULE_SETUP \
1299 YY_USER_ACTION
1300
Geoff Lang93561c32016-09-20 10:22:55 -04001301
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001302/** The main scanner function which does all the work.
1303 */
1304YY_DECL
1305{
Geoff Lang93561c32016-09-20 10:22:55 -04001306 yy_state_type yy_current_state;
1307 char *yy_cp, *yy_bp;
1308 int yy_act;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001309 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1310
Geoff Lang93561c32016-09-20 10:22:55 -04001311
1312
1313
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001314 yylval = yylval_param;
1315
Geoff Lang93561c32016-09-20 10:22:55 -04001316
1317
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001318 yylloc = yylloc_param;
1319
Geoff Lang93561c32016-09-20 10:22:55 -04001320
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001321 if ( !yyg->yy_init )
1322 {
1323 yyg->yy_init = 1;
1324
1325#ifdef YY_USER_INIT
1326 YY_USER_INIT;
1327#endif
1328
Geoff Lang93561c32016-09-20 10:22:55 -04001329
1330
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001331 if ( ! yyg->yy_start )
1332 yyg->yy_start = 1; /* first start state */
1333
1334 if ( ! yyin )
1335 yyin = stdin;
1336
1337 if ( ! yyout )
1338 yyout = stdout;
1339
1340 if ( ! YY_CURRENT_BUFFER ) {
Corentin Wallez168d5e82017-02-01 12:18:56 -08001341 yyensure_buffer_stack (yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001342 YY_CURRENT_BUFFER_LVALUE =
Corentin Wallez168d5e82017-02-01 12:18:56 -08001343 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001344 }
1345
Corentin Wallez168d5e82017-02-01 12:18:56 -08001346 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001347 }
1348
Jamie Madill185de882014-12-22 15:17:52 -05001349 {
1350
Geoff Lang93561c32016-09-20 10:22:55 -04001351
Jamie Madill185de882014-12-22 15:17:52 -05001352 /* Line comment */
1353
Geoff Lang93561c32016-09-20 10:22:55 -04001354 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001355 {
1356 yy_cp = yyg->yy_c_buf_p;
1357
1358 /* Support of yytext. */
1359 *yy_cp = yyg->yy_hold_char;
1360
1361 /* yy_bp points to the position in yy_ch_buf of the start of
1362 * the current run.
1363 */
1364 yy_bp = yy_cp;
1365
1366 yy_current_state = yyg->yy_start;
1367yy_match:
1368 do
1369 {
Geoff Lang93561c32016-09-20 10:22:55 -04001370 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001371 if ( yy_accept[yy_current_state] )
1372 {
1373 yyg->yy_last_accepting_state = yy_current_state;
1374 yyg->yy_last_accepting_cpos = yy_cp;
1375 }
1376 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1377 {
1378 yy_current_state = (int) yy_def[yy_current_state];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001379 if ( yy_current_state >= 95 )
Corentin Wallez168d5e82017-02-01 12:18:56 -08001380 yy_c = yy_meta[yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001381 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08001382 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001383 ++yy_cp;
1384 }
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001385 while ( yy_current_state != 94 );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001386 yy_cp = yyg->yy_last_accepting_cpos;
1387 yy_current_state = yyg->yy_last_accepting_state;
1388
1389yy_find_action:
1390 yy_act = yy_accept[yy_current_state];
1391
1392 YY_DO_BEFORE_ACTION;
1393
Geoff Lang93561c32016-09-20 10:22:55 -04001394
1395
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001396do_action: /* This label is used only to access EOF actions. */
1397
Geoff Lang93561c32016-09-20 10:22:55 -04001398
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001399 switch ( yy_act )
1400 { /* beginning of action switch */
1401 case 0: /* must back up */
1402 /* undo the effects of YY_DO_BEFORE_ACTION */
1403 *yy_cp = yyg->yy_hold_char;
1404 yy_cp = yyg->yy_last_accepting_cpos;
1405 yy_current_state = yyg->yy_last_accepting_state;
1406 goto yy_find_action;
1407
1408case 1:
1409YY_RULE_SETUP
1410
1411 YY_BREAK
1412/* Block comment */
1413/* Line breaks are just counted - not returned. */
Jamie Madillb96687d2015-04-30 15:56:51 -04001414/* The comment is replaced by a single space. */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001415case 2:
1416YY_RULE_SETUP
1417{ BEGIN(COMMENT); }
1418 YY_BREAK
1419case 3:
1420YY_RULE_SETUP
1421
1422 YY_BREAK
1423case 4:
1424YY_RULE_SETUP
1425
1426 YY_BREAK
1427case 5:
1428/* rule 5 can match eol */
1429YY_RULE_SETUP
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001430{
1431 if (yylineno == INT_MAX)
1432 {
1433 *yylval = "Integer overflow on line number";
1434 return pp::Token::GOT_ERROR;
1435 }
1436 ++yylineno;
1437}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001438 YY_BREAK
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001439case 6:
1440YY_RULE_SETUP
alokp@chromium.org2c958ee2012-05-17 20:35:42 +00001441{
1442 yyextra->leadingSpace = true;
1443 BEGIN(INITIAL);
1444}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001445 YY_BREAK
1446case 7:
1447YY_RULE_SETUP
1448{
1449 // # is only valid at start of line for preprocessor directives.
alokp@chromium.org432d6fc2012-06-27 22:13:21 +00001450 yylval->assign(1, yytext[0]);
1451 return yyextra->lineStart ? pp::Token::PP_HASH : pp::Token::PP_OTHER;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001452}
1453 YY_BREAK
1454case 8:
1455YY_RULE_SETUP
1456{
1457 yylval->assign(yytext, yyleng);
1458 return pp::Token::IDENTIFIER;
1459}
1460 YY_BREAK
1461case 9:
1462YY_RULE_SETUP
1463{
1464 yylval->assign(yytext, yyleng);
1465 return pp::Token::CONST_INT;
1466}
1467 YY_BREAK
1468case 10:
1469YY_RULE_SETUP
1470{
1471 yylval->assign(yytext, yyleng);
1472 return pp::Token::CONST_FLOAT;
1473}
1474 YY_BREAK
1475/* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */
1476/* Rule to catch all invalid integers and floats. */
1477case 11:
1478YY_RULE_SETUP
1479{
alokp@chromium.org432d6fc2012-06-27 22:13:21 +00001480 yylval->assign(yytext, yyleng);
1481 return pp::Token::PP_NUMBER;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001482}
1483 YY_BREAK
1484case 12:
1485YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001486{
1487 yylval->assign(yytext, yyleng);
1488 return pp::Token::OP_INC;
1489}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001490 YY_BREAK
1491case 13:
1492YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001493{
1494 yylval->assign(yytext, yyleng);
1495 return pp::Token::OP_DEC;
1496}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001497 YY_BREAK
1498case 14:
1499YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001500{
1501 yylval->assign(yytext, yyleng);
1502 return pp::Token::OP_LEFT;
1503}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001504 YY_BREAK
1505case 15:
1506YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001507{
1508 yylval->assign(yytext, yyleng);
1509 return pp::Token::OP_RIGHT;
1510}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001511 YY_BREAK
1512case 16:
1513YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001514{
1515 yylval->assign(yytext, yyleng);
1516 return pp::Token::OP_LE;
1517}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001518 YY_BREAK
1519case 17:
1520YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001521{
1522 yylval->assign(yytext, yyleng);
1523 return pp::Token::OP_GE;
1524}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001525 YY_BREAK
1526case 18:
1527YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001528{
1529 yylval->assign(yytext, yyleng);
1530 return pp::Token::OP_EQ;
1531}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001532 YY_BREAK
1533case 19:
1534YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001535{
1536 yylval->assign(yytext, yyleng);
1537 return pp::Token::OP_NE;
1538}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001539 YY_BREAK
1540case 20:
1541YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001542{
1543 yylval->assign(yytext, yyleng);
1544 return pp::Token::OP_AND;
1545}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001546 YY_BREAK
1547case 21:
1548YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001549{
1550 yylval->assign(yytext, yyleng);
1551 return pp::Token::OP_XOR;
1552}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001553 YY_BREAK
1554case 22:
1555YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001556{
1557 yylval->assign(yytext, yyleng);
1558 return pp::Token::OP_OR;
1559}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001560 YY_BREAK
1561case 23:
1562YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001563{
1564 yylval->assign(yytext, yyleng);
1565 return pp::Token::OP_ADD_ASSIGN;
1566}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001567 YY_BREAK
1568case 24:
1569YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001570{
1571 yylval->assign(yytext, yyleng);
1572 return pp::Token::OP_SUB_ASSIGN;
1573}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001574 YY_BREAK
1575case 25:
1576YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001577{
1578 yylval->assign(yytext, yyleng);
1579 return pp::Token::OP_MUL_ASSIGN;
1580}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001581 YY_BREAK
1582case 26:
1583YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001584{
1585 yylval->assign(yytext, yyleng);
1586 return pp::Token::OP_DIV_ASSIGN;
1587}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001588 YY_BREAK
1589case 27:
1590YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001591{
1592 yylval->assign(yytext, yyleng);
1593 return pp::Token::OP_MOD_ASSIGN;
1594}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001595 YY_BREAK
1596case 28:
1597YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001598{
1599 yylval->assign(yytext, yyleng);
1600 return pp::Token::OP_LEFT_ASSIGN;
1601}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001602 YY_BREAK
1603case 29:
1604YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001605{
1606 yylval->assign(yytext, yyleng);
1607 return pp::Token::OP_RIGHT_ASSIGN;
1608}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001609 YY_BREAK
1610case 30:
1611YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001612{
1613 yylval->assign(yytext, yyleng);
1614 return pp::Token::OP_AND_ASSIGN;
1615}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001616 YY_BREAK
1617case 31:
1618YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001619{
1620 yylval->assign(yytext, yyleng);
1621 return pp::Token::OP_XOR_ASSIGN;
1622}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001623 YY_BREAK
1624case 32:
1625YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001626{
1627 yylval->assign(yytext, yyleng);
1628 return pp::Token::OP_OR_ASSIGN;
1629}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001630 YY_BREAK
1631case 33:
1632YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001633{
1634 yylval->assign(1, yytext[0]);
1635 return yytext[0];
1636}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001637 YY_BREAK
1638case 34:
1639YY_RULE_SETUP
1640{ yyextra->leadingSpace = true; }
1641 YY_BREAK
1642case 35:
1643/* rule 35 can match eol */
1644YY_RULE_SETUP
1645{
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001646 if (yylineno == INT_MAX)
1647 {
1648 *yylval = "Integer overflow on line number";
1649 return pp::Token::GOT_ERROR;
1650 }
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001651 ++yylineno;
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001652 yylval->assign(1, '\n');
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001653 return '\n';
1654}
1655 YY_BREAK
1656case 36:
1657YY_RULE_SETUP
1658{
alokp@chromium.org432d6fc2012-06-27 22:13:21 +00001659 yylval->assign(1, yytext[0]);
1660 return pp::Token::PP_OTHER;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001661}
1662 YY_BREAK
1663case YY_STATE_EOF(INITIAL):
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001664case YY_STATE_EOF(COMMENT):
1665{
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00001666 // YY_USER_ACTION is not invoked for handling EOF.
1667 // Set the location for EOF token manually.
1668 pp::Input* input = &yyextra->input;
1669 pp::Input::Location* scanLoc = &yyextra->scanLoc;
shannon.woods@transgaming.comd64b3da2013-02-28 23:19:26 +00001670 yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00001671 if (scanLoc->sIndex != sIndexMax)
1672 {
1673 // We can only reach here if there are empty strings at the
1674 // end of the input.
1675 scanLoc->sIndex = sIndexMax; scanLoc->cIndex = 0;
shannon.woods@transgaming.comd64b3da2013-02-28 23:19:26 +00001676 // FIXME: this is not 64-bit clean.
1677 yyfileno = static_cast<int>(sIndexMax); yylineno = 1;
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00001678 }
1679 yylloc->file = yyfileno;
1680 yylloc->line = yylineno;
1681 yylval->clear();
1682
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001683 if (YY_START == COMMENT)
1684 {
Shannon Woods7f2d7942013-11-19 15:07:58 -05001685 yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001686 pp::SourceLocation(yyfileno, yylineno),
1687 "");
1688 }
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001689 yyterminate();
1690}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001691 YY_BREAK
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001692case 37:
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001693YY_RULE_SETUP
1694ECHO;
1695 YY_BREAK
1696
1697 case YY_END_OF_BUFFER:
1698 {
1699 /* Amount of text matched not including the EOB char. */
1700 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1701
1702 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1703 *yy_cp = yyg->yy_hold_char;
1704 YY_RESTORE_YY_MORE_OFFSET
1705
1706 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1707 {
1708 /* We're scanning a new file or input source. It's
1709 * possible that this happened because the user
1710 * just pointed yyin at a new source and called
Corentin Wallez168d5e82017-02-01 12:18:56 -08001711 * yylex(). If so, then we have to assure
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001712 * consistency between YY_CURRENT_BUFFER and our
1713 * globals. Here is the right place to do so, because
1714 * this is the first action (other than possibly a
1715 * back-up) that will match for the new input source.
1716 */
1717 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1718 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1719 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1720 }
1721
1722 /* Note that here we test for yy_c_buf_p "<=" to the position
1723 * of the first EOB in the buffer, since yy_c_buf_p will
1724 * already have been incremented past the NUL character
1725 * (since all states make transitions on EOB to the
1726 * end-of-buffer state). Contrast this with the test
1727 * in input().
1728 */
1729 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1730 { /* This was really a NUL. */
1731 yy_state_type yy_next_state;
1732
1733 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1734
1735 yy_current_state = yy_get_previous_state( yyscanner );
1736
1737 /* Okay, we're now positioned to make the NUL
1738 * transition. We couldn't have
1739 * yy_get_previous_state() go ahead and do it
1740 * for us because it doesn't know how to deal
1741 * with the possibility of jamming (and we don't
1742 * want to build jamming into it because then it
1743 * will run more slowly).
1744 */
1745
1746 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1747
1748 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1749
1750 if ( yy_next_state )
1751 {
1752 /* Consume the NUL. */
1753 yy_cp = ++yyg->yy_c_buf_p;
1754 yy_current_state = yy_next_state;
1755 goto yy_match;
1756 }
1757
1758 else
1759 {
1760 yy_cp = yyg->yy_last_accepting_cpos;
1761 yy_current_state = yyg->yy_last_accepting_state;
1762 goto yy_find_action;
1763 }
1764 }
1765
1766 else switch ( yy_get_next_buffer( yyscanner ) )
1767 {
1768 case EOB_ACT_END_OF_FILE:
1769 {
1770 yyg->yy_did_buffer_switch_on_eof = 0;
1771
Corentin Wallez168d5e82017-02-01 12:18:56 -08001772 if ( yywrap( yyscanner ) )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001773 {
1774 /* Note: because we've taken care in
1775 * yy_get_next_buffer() to have set up
1776 * yytext, we can now set up
1777 * yy_c_buf_p so that if some total
1778 * hoser (like flex itself) wants to
1779 * call the scanner after we return the
1780 * YY_NULL, it'll still work - another
1781 * YY_NULL will get returned.
1782 */
1783 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1784
1785 yy_act = YY_STATE_EOF(YY_START);
1786 goto do_action;
1787 }
1788
1789 else
1790 {
1791 if ( ! yyg->yy_did_buffer_switch_on_eof )
1792 YY_NEW_FILE;
1793 }
1794 break;
1795 }
1796
1797 case EOB_ACT_CONTINUE_SCAN:
1798 yyg->yy_c_buf_p =
1799 yyg->yytext_ptr + yy_amount_of_matched_text;
1800
1801 yy_current_state = yy_get_previous_state( yyscanner );
1802
1803 yy_cp = yyg->yy_c_buf_p;
1804 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1805 goto yy_match;
1806
1807 case EOB_ACT_LAST_MATCH:
1808 yyg->yy_c_buf_p =
1809 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1810
1811 yy_current_state = yy_get_previous_state( yyscanner );
1812
1813 yy_cp = yyg->yy_c_buf_p;
1814 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1815 goto yy_find_action;
1816 }
1817 break;
1818 }
1819
1820 default:
1821 YY_FATAL_ERROR(
1822 "fatal flex scanner internal error--no action found" );
1823 } /* end of action switch */
1824 } /* end of scanning one token */
Jamie Madill185de882014-12-22 15:17:52 -05001825 } /* end of user's declarations */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001826} /* end of yylex */
Geoff Lang93561c32016-09-20 10:22:55 -04001827
1828
1829
1830
1831
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001832/* yy_get_next_buffer - try to read in a new buffer
1833 *
1834 * Returns a code representing an action:
1835 * EOB_ACT_LAST_MATCH -
1836 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1837 * EOB_ACT_END_OF_FILE - end of file
1838 */
1839static int yy_get_next_buffer (yyscan_t yyscanner)
1840{
1841 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04001842 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1843 char *source = yyg->yytext_ptr;
Corentin Wallez168d5e82017-02-01 12:18:56 -08001844 int number_to_move, i;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001845 int ret_val;
1846
1847 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1848 YY_FATAL_ERROR(
1849 "fatal flex scanner internal error--end of buffer missed" );
1850
1851 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1852 { /* Don't try to fill the buffer, so this is an EOF. */
1853 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1854 {
1855 /* We matched a single character, the EOB, so
1856 * treat this as a final EOF.
1857 */
1858 return EOB_ACT_END_OF_FILE;
1859 }
1860
1861 else
1862 {
1863 /* We matched some text prior to the EOB, first
1864 * process it.
1865 */
1866 return EOB_ACT_LAST_MATCH;
1867 }
1868 }
1869
1870 /* Try to read more data. */
1871
1872 /* First move last chars to start of buffer. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001873 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001874
1875 for ( i = 0; i < number_to_move; ++i )
1876 *(dest++) = *(source++);
1877
1878 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1879 /* don't do the read, it's not guaranteed to return an EOF,
1880 * just force an EOF
1881 */
1882 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1883
1884 else
1885 {
Geoff Lang93561c32016-09-20 10:22:55 -04001886 int num_to_read =
Corentin Wallez168d5e82017-02-01 12:18:56 -08001887 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001888
1889 while ( num_to_read <= 0 )
1890 { /* Not enough room in the buffer - grow it. */
1891
1892 /* just a shorter name for the current buffer */
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001893 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001894
1895 int yy_c_buf_p_offset =
1896 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1897
1898 if ( b->yy_is_our_buffer )
1899 {
Geoff Lang93561c32016-09-20 10:22:55 -04001900 int new_size = b->yy_buf_size * 2;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001901
1902 if ( new_size <= 0 )
1903 b->yy_buf_size += b->yy_buf_size / 8;
1904 else
1905 b->yy_buf_size *= 2;
1906
1907 b->yy_ch_buf = (char *)
1908 /* Include room in for 2 EOB chars. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001909 yyrealloc( (void *) b->yy_ch_buf,
1910 (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001911 }
1912 else
1913 /* Can't grow it, we don't own it. */
Geoff Lang93561c32016-09-20 10:22:55 -04001914 b->yy_ch_buf = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001915
1916 if ( ! b->yy_ch_buf )
1917 YY_FATAL_ERROR(
1918 "fatal error - scanner input buffer overflow" );
1919
1920 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1921
Corentin Wallez168d5e82017-02-01 12:18:56 -08001922 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1923 number_to_move - 1;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001924
1925 }
1926
1927 if ( num_to_read > YY_READ_BUF_SIZE )
1928 num_to_read = YY_READ_BUF_SIZE;
1929
1930 /* Read in more data. */
Geoff Lang93561c32016-09-20 10:22:55 -04001931 yy_size_t ret = 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001932 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
Geoff Lang93561c32016-09-20 10:22:55 -04001933 ret, num_to_read );
1934 yyg->yy_n_chars = static_cast<int>(ret);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001935
1936 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1937 }
1938
1939 if ( yyg->yy_n_chars == 0 )
1940 {
1941 if ( number_to_move == YY_MORE_ADJ )
1942 {
1943 ret_val = EOB_ACT_END_OF_FILE;
Corentin Wallez168d5e82017-02-01 12:18:56 -08001944 yyrestart( yyin , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001945 }
1946
1947 else
1948 {
1949 ret_val = EOB_ACT_LAST_MATCH;
1950 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1951 YY_BUFFER_EOF_PENDING;
1952 }
1953 }
1954
1955 else
1956 ret_val = EOB_ACT_CONTINUE_SCAN;
1957
Corentin Wallez168d5e82017-02-01 12:18:56 -08001958 if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001959 /* Extend the array by 50%, plus the number we really need. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001960 int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1961 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1962 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001963 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1964 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
Corentin Wallez168d5e82017-02-01 12:18:56 -08001965 /* "- 2" to take care of EOB's */
1966 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001967 }
1968
Corentin Wallez168d5e82017-02-01 12:18:56 -08001969 yyg->yy_n_chars += number_to_move;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001970 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1971 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1972
1973 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1974
1975 return ret_val;
1976}
1977
Geoff Lang93561c32016-09-20 10:22:55 -04001978
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001979/* yy_get_previous_state - get the state just before the EOB char was reached */
1980
1981 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1982{
Geoff Lang93561c32016-09-20 10:22:55 -04001983 yy_state_type yy_current_state;
1984 char *yy_cp;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001985 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1986
1987 yy_current_state = yyg->yy_start;
1988
1989 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1990 {
Geoff Lang93561c32016-09-20 10:22:55 -04001991 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001992 if ( yy_accept[yy_current_state] )
1993 {
1994 yyg->yy_last_accepting_state = yy_current_state;
1995 yyg->yy_last_accepting_cpos = yy_cp;
1996 }
1997 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1998 {
1999 yy_current_state = (int) yy_def[yy_current_state];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05002000 if ( yy_current_state >= 95 )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002001 yy_c = yy_meta[yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002002 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08002003 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002004 }
2005
2006 return yy_current_state;
2007}
2008
Geoff Lang93561c32016-09-20 10:22:55 -04002009
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002010/* yy_try_NUL_trans - try to make a transition on the NUL character
2011 *
2012 * synopsis
2013 * next_state = yy_try_NUL_trans( current_state );
2014 */
2015 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
2016{
Geoff Lang93561c32016-09-20 10:22:55 -04002017 int yy_is_jam;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002018 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
Geoff Lang93561c32016-09-20 10:22:55 -04002019 char *yy_cp = yyg->yy_c_buf_p;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002020
Geoff Lang93561c32016-09-20 10:22:55 -04002021 YY_CHAR yy_c = 1;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002022 if ( yy_accept[yy_current_state] )
2023 {
2024 yyg->yy_last_accepting_state = yy_current_state;
2025 yyg->yy_last_accepting_cpos = yy_cp;
2026 }
2027 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2028 {
2029 yy_current_state = (int) yy_def[yy_current_state];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05002030 if ( yy_current_state >= 95 )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002031 yy_c = yy_meta[yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002032 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08002033 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05002034 yy_is_jam = (yy_current_state == 94);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002035
Zhenyao Mof1d723c2013-09-23 14:57:07 -04002036 (void)yyg;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002037 return yy_is_jam ? 0 : yy_current_state;
2038}
2039
Geoff Lang93561c32016-09-20 10:22:55 -04002040
2041#ifndef YY_NO_UNPUT
2042
2043#endif
2044
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002045#ifndef YY_NO_INPUT
2046#ifdef __cplusplus
2047 static int yyinput (yyscan_t yyscanner)
2048#else
2049 static int input (yyscan_t yyscanner)
2050#endif
2051
2052{
2053 int c;
2054 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2055
2056 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2057
2058 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2059 {
2060 /* yy_c_buf_p now points to the character we want to return.
2061 * If this occurs *before* the EOB characters, then it's a
2062 * valid NUL; if not, then we've hit the end of the buffer.
2063 */
2064 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
2065 /* This was really a NUL. */
2066 *yyg->yy_c_buf_p = '\0';
2067
2068 else
2069 { /* need more input */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002070 int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002071 ++yyg->yy_c_buf_p;
2072
2073 switch ( yy_get_next_buffer( yyscanner ) )
2074 {
2075 case EOB_ACT_LAST_MATCH:
2076 /* This happens because yy_g_n_b()
2077 * sees that we've accumulated a
2078 * token and flags that we need to
2079 * try matching the token before
2080 * proceeding. But for input(),
2081 * there's no matching to consider.
2082 * So convert the EOB_ACT_LAST_MATCH
2083 * to EOB_ACT_END_OF_FILE.
2084 */
2085
2086 /* Reset buffer status. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002087 yyrestart( yyin , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002088
2089 /*FALLTHROUGH*/
2090
2091 case EOB_ACT_END_OF_FILE:
2092 {
Corentin Wallez168d5e82017-02-01 12:18:56 -08002093 if ( yywrap( yyscanner ) )
Geoff Lang93561c32016-09-20 10:22:55 -04002094 return 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002095
2096 if ( ! yyg->yy_did_buffer_switch_on_eof )
2097 YY_NEW_FILE;
2098#ifdef __cplusplus
2099 return yyinput(yyscanner);
2100#else
2101 return input(yyscanner);
2102#endif
2103 }
2104
2105 case EOB_ACT_CONTINUE_SCAN:
2106 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
2107 break;
2108 }
2109 }
2110 }
2111
2112 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
2113 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
2114 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
2115
Geoff Lang93561c32016-09-20 10:22:55 -04002116
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002117 return c;
2118}
2119#endif /* ifndef YY_NO_INPUT */
2120
2121/** Immediately switch to a different input stream.
2122 * @param input_file A readable stream.
2123 * @param yyscanner The scanner object.
2124 * @note This function does not reset the start condition to @c INITIAL .
2125 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002126 void yyrestart (FILE * input_file , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002127{
2128 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2129
2130 if ( ! YY_CURRENT_BUFFER ){
Corentin Wallez168d5e82017-02-01 12:18:56 -08002131 yyensure_buffer_stack (yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002132 YY_CURRENT_BUFFER_LVALUE =
Corentin Wallez168d5e82017-02-01 12:18:56 -08002133 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002134 }
2135
Corentin Wallez168d5e82017-02-01 12:18:56 -08002136 yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
2137 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002138}
2139
Geoff Lang93561c32016-09-20 10:22:55 -04002140
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002141/** Switch to a different input buffer.
2142 * @param new_buffer The new input buffer.
2143 * @param yyscanner The scanner object.
2144 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002145 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002146{
2147 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2148
2149 /* TODO. We should be able to replace this entire function body
2150 * with
Corentin Wallez168d5e82017-02-01 12:18:56 -08002151 * yypop_buffer_state();
2152 * yypush_buffer_state(new_buffer);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002153 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002154 yyensure_buffer_stack (yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002155 if ( YY_CURRENT_BUFFER == new_buffer )
2156 return;
2157
2158 if ( YY_CURRENT_BUFFER )
2159 {
2160 /* Flush out information for old buffer. */
2161 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2162 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2163 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2164 }
2165
2166 YY_CURRENT_BUFFER_LVALUE = new_buffer;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002167 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002168
2169 /* We don't actually know whether we did this switch during
Corentin Wallez168d5e82017-02-01 12:18:56 -08002170 * EOF (yywrap()) processing, but the only time this flag
2171 * is looked at is after yywrap() is called, so it's safe
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002172 * to go ahead and always set it.
2173 */
2174 yyg->yy_did_buffer_switch_on_eof = 1;
2175}
2176
Geoff Lang93561c32016-09-20 10:22:55 -04002177
Corentin Wallez168d5e82017-02-01 12:18:56 -08002178static void yy_load_buffer_state (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002179{
2180 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2181 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2182 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2183 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2184 yyg->yy_hold_char = *yyg->yy_c_buf_p;
2185}
2186
2187/** Allocate and initialize an input buffer state.
2188 * @param file A readable stream.
2189 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2190 * @param yyscanner The scanner object.
2191 * @return the allocated buffer state.
2192 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002193 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002194{
2195 YY_BUFFER_STATE b;
2196
Corentin Wallez168d5e82017-02-01 12:18:56 -08002197 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002198 if ( ! b )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002199 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002200
Corentin Wallez168d5e82017-02-01 12:18:56 -08002201 b->yy_buf_size = size;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002202
2203 /* yy_ch_buf has to be 2 characters longer than the size given because
2204 * we need to put in 2 end-of-buffer characters.
2205 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002206 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002207 if ( ! b->yy_ch_buf )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002208 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002209
2210 b->yy_is_our_buffer = 1;
2211
Corentin Wallez168d5e82017-02-01 12:18:56 -08002212 yy_init_buffer( b, file , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002213
2214 return b;
2215}
2216
Geoff Lang93561c32016-09-20 10:22:55 -04002217
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002218/** Destroy the buffer.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002219 * @param b a buffer created with yy_create_buffer()
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002220 * @param yyscanner The scanner object.
2221 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002222 void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002223{
2224 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2225
2226 if ( ! b )
2227 return;
2228
2229 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2230 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2231
2232 if ( b->yy_is_our_buffer )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002233 yyfree( (void *) b->yy_ch_buf , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002234
Corentin Wallez168d5e82017-02-01 12:18:56 -08002235 yyfree( (void *) b , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002236}
2237
Geoff Lang93561c32016-09-20 10:22:55 -04002238
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002239/* Initializes or reinitializes a buffer.
2240 * This function is sometimes called more than once on the same buffer,
Corentin Wallez168d5e82017-02-01 12:18:56 -08002241 * such as during a yyrestart() or at EOF.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002242 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002243 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002244
2245{
2246 int oerrno = errno;
2247 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2248
Corentin Wallez168d5e82017-02-01 12:18:56 -08002249 yy_flush_buffer( b , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002250
2251 b->yy_input_file = file;
2252 b->yy_fill_buffer = 1;
2253
Corentin Wallez168d5e82017-02-01 12:18:56 -08002254 /* If b is the current buffer, then yy_init_buffer was _probably_
2255 * called from yyrestart() or through yy_get_next_buffer.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002256 * In that case, we don't want to reset the lineno or column.
2257 */
2258 if (b != YY_CURRENT_BUFFER){
2259 b->yy_bs_lineno = 1;
2260 b->yy_bs_column = 0;
2261 }
2262
Geoff Lang93561c32016-09-20 10:22:55 -04002263
2264
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002265 b->yy_is_interactive = 0;
2266
Geoff Lang93561c32016-09-20 10:22:55 -04002267
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002268 errno = oerrno;
2269}
2270
2271/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2272 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2273 * @param yyscanner The scanner object.
2274 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002275 void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002276{
2277 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2278 if ( ! b )
2279 return;
2280
2281 b->yy_n_chars = 0;
2282
2283 /* We always need two end-of-buffer characters. The first causes
2284 * a transition to the end-of-buffer state. The second causes
2285 * a jam in that state.
2286 */
2287 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2288 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2289
2290 b->yy_buf_pos = &b->yy_ch_buf[0];
2291
2292 b->yy_at_bol = 1;
2293 b->yy_buffer_status = YY_BUFFER_NEW;
2294
2295 if ( b == YY_CURRENT_BUFFER )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002296 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002297}
2298
2299/** Pushes the new state onto the stack. The new state becomes
2300 * the current state. This function will allocate the stack
2301 * if necessary.
2302 * @param new_buffer The new state.
2303 * @param yyscanner The scanner object.
2304 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002305void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002306{
2307 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2308 if (new_buffer == NULL)
2309 return;
2310
Corentin Wallez168d5e82017-02-01 12:18:56 -08002311 yyensure_buffer_stack(yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002312
Corentin Wallez168d5e82017-02-01 12:18:56 -08002313 /* This block is copied from yy_switch_to_buffer. */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002314 if ( YY_CURRENT_BUFFER )
2315 {
2316 /* Flush out information for old buffer. */
2317 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2318 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2319 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2320 }
2321
2322 /* Only push if top exists. Otherwise, replace top. */
2323 if (YY_CURRENT_BUFFER)
2324 yyg->yy_buffer_stack_top++;
2325 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2326
Corentin Wallez168d5e82017-02-01 12:18:56 -08002327 /* copied from yy_switch_to_buffer. */
2328 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002329 yyg->yy_did_buffer_switch_on_eof = 1;
2330}
2331
Geoff Lang93561c32016-09-20 10:22:55 -04002332
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002333/** Removes and deletes the top of the stack, if present.
2334 * The next element becomes the new top.
2335 * @param yyscanner The scanner object.
2336 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002337void yypop_buffer_state (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002338{
2339 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2340 if (!YY_CURRENT_BUFFER)
2341 return;
2342
Corentin Wallez168d5e82017-02-01 12:18:56 -08002343 yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002344 YY_CURRENT_BUFFER_LVALUE = NULL;
2345 if (yyg->yy_buffer_stack_top > 0)
2346 --yyg->yy_buffer_stack_top;
2347
2348 if (YY_CURRENT_BUFFER) {
Corentin Wallez168d5e82017-02-01 12:18:56 -08002349 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002350 yyg->yy_did_buffer_switch_on_eof = 1;
2351 }
2352}
2353
Geoff Lang93561c32016-09-20 10:22:55 -04002354
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002355/* Allocates the stack if it does not exist.
2356 * Guarantees space for at least one push.
2357 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002358static void yyensure_buffer_stack (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002359{
shannonwoods@chromium.orgb0757162013-05-30 00:21:27 +00002360 yy_size_t num_to_alloc;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002361 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2362
2363 if (!yyg->yy_buffer_stack) {
2364
2365 /* First allocation is just for 2 elements, since we don't know if this
2366 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2367 * immediate realloc on the next call.
2368 */
Geoff Lang93561c32016-09-20 10:22:55 -04002369 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002370 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002371 (num_to_alloc * sizeof(struct yy_buffer_state*)
2372 , yyscanner);
2373 if ( ! yyg->yy_buffer_stack )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002374 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2375
2376
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002377 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
Corentin Wallez168d5e82017-02-01 12:18:56 -08002378
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002379 yyg->yy_buffer_stack_max = num_to_alloc;
2380 yyg->yy_buffer_stack_top = 0;
2381 return;
2382 }
2383
2384 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2385
2386 /* Increase the buffer to prepare for a possible push. */
Geoff Lang93561c32016-09-20 10:22:55 -04002387 yy_size_t grow_size = 8 /* arbitrary grow size */;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002388
2389 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002390 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002391 (yyg->yy_buffer_stack,
2392 num_to_alloc * sizeof(struct yy_buffer_state*)
2393 , yyscanner);
2394 if ( ! yyg->yy_buffer_stack )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002395 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002396
2397 /* zero only the new slots.*/
2398 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
2399 yyg->yy_buffer_stack_max = num_to_alloc;
2400 }
2401}
2402
Geoff Lang93561c32016-09-20 10:22:55 -04002403
2404
2405
2406
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002407/** Setup the input buffer state to scan directly from a user-specified character buffer.
2408 * @param base the character buffer
2409 * @param size the size in bytes of the character buffer
2410 * @param yyscanner The scanner object.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002411 * @return the newly allocated buffer state object.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002412 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002413YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002414{
2415 YY_BUFFER_STATE b;
2416
2417 if ( size < 2 ||
2418 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2419 base[size-1] != YY_END_OF_BUFFER_CHAR )
2420 /* They forgot to leave room for the EOB's. */
Geoff Lang93561c32016-09-20 10:22:55 -04002421 return NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002422
Corentin Wallez168d5e82017-02-01 12:18:56 -08002423 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002424 if ( ! b )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002425 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002426
Corentin Wallez168d5e82017-02-01 12:18:56 -08002427 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002428 b->yy_buf_pos = b->yy_ch_buf = base;
2429 b->yy_is_our_buffer = 0;
Geoff Lang93561c32016-09-20 10:22:55 -04002430 b->yy_input_file = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002431 b->yy_n_chars = b->yy_buf_size;
2432 b->yy_is_interactive = 0;
2433 b->yy_at_bol = 1;
2434 b->yy_fill_buffer = 0;
2435 b->yy_buffer_status = YY_BUFFER_NEW;
2436
Corentin Wallez168d5e82017-02-01 12:18:56 -08002437 yy_switch_to_buffer( b , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002438
2439 return b;
2440}
2441
Geoff Lang93561c32016-09-20 10:22:55 -04002442
2443
2444
Corentin Wallez168d5e82017-02-01 12:18:56 -08002445/** Setup the input buffer state to scan a string. The next call to yylex() will
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002446 * scan from a @e copy of @a str.
2447 * @param yystr a NUL-terminated string to scan
2448 * @param yyscanner The scanner object.
2449 * @return the newly allocated buffer state object.
2450 * @note If you want to scan bytes that may contain NUL values, then use
Corentin Wallez168d5e82017-02-01 12:18:56 -08002451 * yy_scan_bytes() instead.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002452 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002453YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002454{
2455
Corentin Wallez168d5e82017-02-01 12:18:56 -08002456 return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002457}
2458
Geoff Lang93561c32016-09-20 10:22:55 -04002459
2460
2461
Corentin Wallez168d5e82017-02-01 12:18:56 -08002462/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002463 * scan from a @e copy of @a bytes.
Zhenyao Mof1d723c2013-09-23 14:57:07 -04002464 * @param yybytes the byte buffer to scan
2465 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002466 * @param yyscanner The scanner object.
2467 * @return the newly allocated buffer state object.
2468 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002469YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002470{
2471 YY_BUFFER_STATE b;
2472 char *buf;
Zhenyao Mof1d723c2013-09-23 14:57:07 -04002473 yy_size_t n;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002474 int i;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002475
2476 /* Get memory for full buffer, including space for trailing EOB's. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002477 n = (yy_size_t) (_yybytes_len + 2);
2478 buf = (char *) yyalloc( n , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002479 if ( ! buf )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002480 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002481
Corentin Wallez168d5e82017-02-01 12:18:56 -08002482 for ( i = 0; i < _yybytes_len; ++i )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002483 buf[i] = yybytes[i];
2484
2485 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2486
Corentin Wallez168d5e82017-02-01 12:18:56 -08002487 b = yy_scan_buffer( buf, n , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002488 if ( ! b )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002489 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002490
2491 /* It's okay to grow etc. this buffer, and we should throw it
2492 * away when we're done.
2493 */
2494 b->yy_is_our_buffer = 1;
2495
2496 return b;
2497}
2498
Geoff Lang93561c32016-09-20 10:22:55 -04002499
2500
2501
2502
2503
2504
2505
2506
2507
2508
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002509#ifndef YY_EXIT_FAILURE
2510#define YY_EXIT_FAILURE 2
2511#endif
2512
Corentin Wallez168d5e82017-02-01 12:18:56 -08002513static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002514{
Geoff Lang93561c32016-09-20 10:22:55 -04002515 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2516 (void)yyg;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002517 fprintf( stderr, "%s\n", msg );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002518 exit( YY_EXIT_FAILURE );
2519}
2520
2521/* Redefine yyless() so it works in section 3 code. */
2522
2523#undef yyless
2524#define yyless(n) \
2525 do \
2526 { \
2527 /* Undo effects of setting up yytext. */ \
2528 int yyless_macro_arg = (n); \
2529 YY_LESS_LINENO(yyless_macro_arg);\
2530 yytext[yyleng] = yyg->yy_hold_char; \
2531 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2532 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2533 *yyg->yy_c_buf_p = '\0'; \
2534 yyleng = yyless_macro_arg; \
2535 } \
2536 while ( 0 )
2537
Geoff Lang93561c32016-09-20 10:22:55 -04002538
2539
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002540/* Accessor methods (get/set functions) to struct members. */
2541
Geoff Lang93561c32016-09-20 10:22:55 -04002542
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002543/** Get the user-defined data for this scanner.
2544 * @param yyscanner The scanner object.
2545 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002546YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002547{
2548 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2549 return yyextra;
2550}
2551
Geoff Lang93561c32016-09-20 10:22:55 -04002552
2553
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002554/** Get the current line number.
2555 * @param yyscanner The scanner object.
2556 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002557int yyget_lineno (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002558{
2559 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002560
Geoff Lang93561c32016-09-20 10:22:55 -04002561
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002562 if (! YY_CURRENT_BUFFER)
2563 return 0;
2564
2565 return yylineno;
2566}
2567
Geoff Lang93561c32016-09-20 10:22:55 -04002568
2569
2570
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002571/** Get the current column number.
2572 * @param yyscanner The scanner object.
2573 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002574int yyget_column (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002575{
2576 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002577
Geoff Lang93561c32016-09-20 10:22:55 -04002578
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002579 if (! YY_CURRENT_BUFFER)
2580 return 0;
2581
2582 return yycolumn;
2583}
2584
Geoff Lang93561c32016-09-20 10:22:55 -04002585
2586
2587
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002588/** Get the input stream.
2589 * @param yyscanner The scanner object.
2590 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002591FILE *yyget_in (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002592{
2593 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2594 return yyin;
2595}
2596
Geoff Lang93561c32016-09-20 10:22:55 -04002597
2598
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002599/** Get the output stream.
2600 * @param yyscanner The scanner object.
2601 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002602FILE *yyget_out (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002603{
2604 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2605 return yyout;
2606}
2607
Geoff Lang93561c32016-09-20 10:22:55 -04002608
2609
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002610/** Get the length of the current token.
2611 * @param yyscanner The scanner object.
2612 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002613int yyget_leng (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002614{
2615 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2616 return yyleng;
2617}
2618
Geoff Lang93561c32016-09-20 10:22:55 -04002619
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002620/** Get the current token.
2621 * @param yyscanner The scanner object.
2622 */
2623
Corentin Wallez168d5e82017-02-01 12:18:56 -08002624char *yyget_text (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002625{
2626 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2627 return yytext;
2628}
2629
Geoff Lang93561c32016-09-20 10:22:55 -04002630
2631
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002632/** Set the user-defined data. This data is never touched by the scanner.
2633 * @param user_defined The data to be associated with this scanner.
2634 * @param yyscanner The scanner object.
2635 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002636void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002637{
2638 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2639 yyextra = user_defined ;
2640}
2641
Geoff Lang93561c32016-09-20 10:22:55 -04002642
2643
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002644/** Set the current line number.
Geoff Lang93561c32016-09-20 10:22:55 -04002645 * @param _line_number line number
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002646 * @param yyscanner The scanner object.
2647 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002648void yyset_lineno (int _line_number , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002649{
2650 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2651
Geoff Lang93561c32016-09-20 10:22:55 -04002652
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002653 /* lineno is only valid if an input buffer exists. */
2654 if (! YY_CURRENT_BUFFER )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002655 YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002656
Geoff Lang93561c32016-09-20 10:22:55 -04002657 yylineno = _line_number;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002658}
2659
Geoff Lang93561c32016-09-20 10:22:55 -04002660
2661
2662
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002663/** Set the current column.
Geoff Lang93561c32016-09-20 10:22:55 -04002664 * @param _column_no column number
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002665 * @param yyscanner The scanner object.
2666 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002667void yyset_column (int _column_no , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002668{
2669 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2670
Geoff Lang93561c32016-09-20 10:22:55 -04002671
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002672 /* column is only valid if an input buffer exists. */
2673 if (! YY_CURRENT_BUFFER )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002674 YY_FATAL_ERROR( "yyset_column called with no buffer" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002675
Geoff Lang93561c32016-09-20 10:22:55 -04002676 yycolumn = _column_no;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002677}
2678
Geoff Lang93561c32016-09-20 10:22:55 -04002679
2680
2681
2682
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002683/** Set the input stream. This does not discard the current
2684 * input buffer.
Geoff Lang93561c32016-09-20 10:22:55 -04002685 * @param _in_str A readable stream.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002686 * @param yyscanner The scanner object.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002687 * @see yy_switch_to_buffer
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002688 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002689void yyset_in (FILE * _in_str , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002690{
2691 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04002692 yyin = _in_str ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002693}
2694
Geoff Lang93561c32016-09-20 10:22:55 -04002695
2696
Corentin Wallez168d5e82017-02-01 12:18:56 -08002697void yyset_out (FILE * _out_str , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002698{
2699 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04002700 yyout = _out_str ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002701}
2702
Geoff Lang93561c32016-09-20 10:22:55 -04002703
2704
2705
Corentin Wallez168d5e82017-02-01 12:18:56 -08002706int yyget_debug (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002707{
2708 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2709 return yy_flex_debug;
2710}
2711
Geoff Lang93561c32016-09-20 10:22:55 -04002712
2713
Corentin Wallez168d5e82017-02-01 12:18:56 -08002714void yyset_debug (int _bdebug , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002715{
2716 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04002717 yy_flex_debug = _bdebug ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002718}
2719
Geoff Lang93561c32016-09-20 10:22:55 -04002720
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002721/* Accessor methods for yylval and yylloc */
2722
Geoff Lang93561c32016-09-20 10:22:55 -04002723
Corentin Wallez168d5e82017-02-01 12:18:56 -08002724YYSTYPE * yyget_lval (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002725{
2726 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2727 return yylval;
2728}
2729
Geoff Lang93561c32016-09-20 10:22:55 -04002730
2731
Corentin Wallez168d5e82017-02-01 12:18:56 -08002732void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002733{
2734 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2735 yylval = yylval_param;
2736}
2737
Geoff Lang93561c32016-09-20 10:22:55 -04002738
2739
2740
Corentin Wallez168d5e82017-02-01 12:18:56 -08002741YYLTYPE *yyget_lloc (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002742{
2743 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2744 return yylloc;
2745}
2746
Geoff Lang93561c32016-09-20 10:22:55 -04002747
2748
Corentin Wallez168d5e82017-02-01 12:18:56 -08002749void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002750{
2751 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2752 yylloc = yylloc_param;
2753}
2754
Geoff Lang93561c32016-09-20 10:22:55 -04002755
2756
2757
2758
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002759/* User-visible API */
2760
Corentin Wallez168d5e82017-02-01 12:18:56 -08002761/* yylex_init is special because it creates the scanner itself, so it is
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002762 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2763 * That's why we explicitly handle the declaration, instead of using our macros.
2764 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002765int yylex_init(yyscan_t* ptr_yy_globals)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002766{
2767 if (ptr_yy_globals == NULL){
2768 errno = EINVAL;
2769 return 1;
2770 }
2771
Corentin Wallez168d5e82017-02-01 12:18:56 -08002772 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002773
2774 if (*ptr_yy_globals == NULL){
2775 errno = ENOMEM;
2776 return 1;
2777 }
2778
2779 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2780 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2781
2782 return yy_init_globals ( *ptr_yy_globals );
2783}
2784
Geoff Lang93561c32016-09-20 10:22:55 -04002785
Corentin Wallez168d5e82017-02-01 12:18:56 -08002786/* yylex_init_extra has the same functionality as yylex_init, but follows the
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002787 * convention of taking the scanner as the last argument. Note however, that
2788 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2789 * is the reason, too, why this function also must handle its own declaration).
Corentin Wallez168d5e82017-02-01 12:18:56 -08002790 * The user defined value in the first argument will be available to yyalloc in
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002791 * the yyextra field.
2792 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002793int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002794{
2795 struct yyguts_t dummy_yyguts;
2796
Corentin Wallez168d5e82017-02-01 12:18:56 -08002797 yyset_extra (yy_user_defined, &dummy_yyguts);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002798
2799 if (ptr_yy_globals == NULL){
2800 errno = EINVAL;
2801 return 1;
2802 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08002803
2804 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2805
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002806 if (*ptr_yy_globals == NULL){
2807 errno = ENOMEM;
2808 return 1;
2809 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08002810
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002811 /* By setting to 0xAA, we expose bugs in
2812 yy_init_globals. Leave at 0x00 for releases. */
2813 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
Corentin Wallez168d5e82017-02-01 12:18:56 -08002814
2815 yyset_extra (yy_user_defined, *ptr_yy_globals);
2816
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002817 return yy_init_globals ( *ptr_yy_globals );
2818}
2819
Geoff Lang93561c32016-09-20 10:22:55 -04002820
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002821static int yy_init_globals (yyscan_t yyscanner)
2822{
2823 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2824 /* Initialization is the same as for the non-reentrant scanner.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002825 * This function is called from yylex_destroy(), so don't allocate here.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002826 */
2827
Geoff Lang93561c32016-09-20 10:22:55 -04002828
2829 yyg->yy_buffer_stack = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002830 yyg->yy_buffer_stack_top = 0;
2831 yyg->yy_buffer_stack_max = 0;
Geoff Lang93561c32016-09-20 10:22:55 -04002832 yyg->yy_c_buf_p = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002833 yyg->yy_init = 0;
2834 yyg->yy_start = 0;
2835
Geoff Lang93561c32016-09-20 10:22:55 -04002836
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002837 yyg->yy_start_stack_ptr = 0;
2838 yyg->yy_start_stack_depth = 0;
2839 yyg->yy_start_stack = NULL;
2840
Geoff Lang93561c32016-09-20 10:22:55 -04002841
2842
2843
2844
2845
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002846/* Defined in main.c */
2847#ifdef YY_STDINIT
2848 yyin = stdin;
2849 yyout = stdout;
2850#else
Geoff Lang93561c32016-09-20 10:22:55 -04002851 yyin = NULL;
2852 yyout = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002853#endif
2854
2855 /* For future reference: Set errno on error, since we are called by
Corentin Wallez168d5e82017-02-01 12:18:56 -08002856 * yylex_init()
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002857 */
2858 return 0;
2859}
2860
Geoff Lang93561c32016-09-20 10:22:55 -04002861
Corentin Wallez168d5e82017-02-01 12:18:56 -08002862/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2863int yylex_destroy (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002864{
2865 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2866
2867 /* Pop the buffer stack, destroying each element. */
2868 while(YY_CURRENT_BUFFER){
Corentin Wallez168d5e82017-02-01 12:18:56 -08002869 yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002870 YY_CURRENT_BUFFER_LVALUE = NULL;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002871 yypop_buffer_state(yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002872 }
2873
2874 /* Destroy the stack itself. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002875 yyfree(yyg->yy_buffer_stack , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002876 yyg->yy_buffer_stack = NULL;
2877
Geoff Lang93561c32016-09-20 10:22:55 -04002878
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002879 /* Destroy the start condition stack. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002880 yyfree( yyg->yy_start_stack , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002881 yyg->yy_start_stack = NULL;
2882
Geoff Lang93561c32016-09-20 10:22:55 -04002883
2884
2885
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002886 /* Reset the globals. This is important in a non-reentrant scanner so the next time
Corentin Wallez168d5e82017-02-01 12:18:56 -08002887 * yylex() is called, initialization will occur. */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002888 yy_init_globals( yyscanner);
2889
2890 /* Destroy the main struct (reentrant only). */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002891 yyfree ( yyscanner , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002892 yyscanner = NULL;
2893 return 0;
2894}
2895
Geoff Lang93561c32016-09-20 10:22:55 -04002896
2897
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002898/*
2899 * Internal utility routines.
2900 */
2901
Geoff Lang93561c32016-09-20 10:22:55 -04002902
2903
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002904#ifndef yytext_ptr
Corentin Wallez168d5e82017-02-01 12:18:56 -08002905static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002906{
Geoff Lang93561c32016-09-20 10:22:55 -04002907 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2908 (void)yyg;
2909
2910 int i;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002911 for ( i = 0; i < n; ++i )
2912 s1[i] = s2[i];
2913}
2914#endif
2915
Geoff Lang93561c32016-09-20 10:22:55 -04002916
2917
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002918#ifdef YY_NEED_STRLEN
Corentin Wallez168d5e82017-02-01 12:18:56 -08002919static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002920{
Geoff Lang93561c32016-09-20 10:22:55 -04002921 int n;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002922 for ( n = 0; s[n]; ++n )
2923 ;
2924
2925 return n;
2926}
2927#endif
2928
Geoff Lang93561c32016-09-20 10:22:55 -04002929
2930
Corentin Wallez168d5e82017-02-01 12:18:56 -08002931void *yyalloc (yy_size_t size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002932{
Geoff Lang93561c32016-09-20 10:22:55 -04002933 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2934 (void)yyg;
2935 return malloc(size);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002936}
2937
Geoff Lang93561c32016-09-20 10:22:55 -04002938
2939
Corentin Wallez168d5e82017-02-01 12:18:56 -08002940void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002941{
Geoff Lang93561c32016-09-20 10:22:55 -04002942 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2943 (void)yyg;
2944
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002945 /* The cast to (char *) in the following accommodates both
2946 * implementations that use char* generic pointers, and those
2947 * that use void* generic pointers. It works with the latter
2948 * because both ANSI C and C++ allow castless assignment from
2949 * any pointer type to void*, and deal with argument conversions
2950 * as though doing an assignment.
2951 */
Geoff Lang93561c32016-09-20 10:22:55 -04002952 return realloc(ptr, size);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002953}
2954
Geoff Lang93561c32016-09-20 10:22:55 -04002955
2956
Corentin Wallez168d5e82017-02-01 12:18:56 -08002957void yyfree (void * ptr , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002958{
Geoff Lang93561c32016-09-20 10:22:55 -04002959 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2960 (void)yyg;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002961 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002962}
2963
Geoff Lang93561c32016-09-20 10:22:55 -04002964
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002965#define YYTABLES_NAME "yytables"
2966
Geoff Lang93561c32016-09-20 10:22:55 -04002967
2968
2969
2970
2971
2972
2973
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002974namespace pp {
2975
Corentin Wallez054f7ed2016-09-20 17:15:59 -04002976Tokenizer::Tokenizer(Diagnostics *diagnostics) : mHandle(nullptr), mMaxTokenSize(256)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002977{
alokp@chromium.org2c958ee2012-05-17 20:35:42 +00002978 mContext.diagnostics = diagnostics;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002979}
2980
2981Tokenizer::~Tokenizer()
2982{
2983 destroyScanner();
2984}
2985
Zhenyao Mod526f982014-05-13 14:51:19 -07002986bool Tokenizer::init(size_t count, const char * const string[], const int length[])
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002987{
Zhenyao Mod526f982014-05-13 14:51:19 -07002988 if ((count > 0) && (string == 0))
2989 return false;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002990
2991 mContext.input = Input(count, string, length);
2992 return initScanner();
2993}
2994
alokp@chromium.org46aa13d2012-06-15 15:40:27 +00002995void Tokenizer::setFileNumber(int file)
2996{
2997 // We use column number as file number.
2998 // See macro yyfileno.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002999 yyset_column(file, mHandle);
alokp@chromium.org46aa13d2012-06-15 15:40:27 +00003000}
3001
3002void Tokenizer::setLineNumber(int line)
3003{
Corentin Wallez168d5e82017-02-01 12:18:56 -08003004 yyset_lineno(line, mHandle);
alokp@chromium.org46aa13d2012-06-15 15:40:27 +00003005}
3006
Jamie Madill5508f392014-02-20 13:31:36 -05003007void Tokenizer::setMaxTokenSize(size_t maxTokenSize)
3008{
3009 mMaxTokenSize = maxTokenSize;
3010}
3011
Zhenyao Mod526f982014-05-13 14:51:19 -07003012void Tokenizer::lex(Token *token)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003013{
Corentin Wallezdc0fa462017-02-01 14:44:43 -05003014 int tokenType = yylex(&token->text, &token->location, mHandle);
3015
3016 if (tokenType == Token::GOT_ERROR)
3017 {
3018 mContext.diagnostics->report(Diagnostics::PP_TOKENIZER_ERROR, token->location, token->text);
3019 token->type = Token::LAST;
3020 }
3021 else
3022 {
3023 token->type = tokenType;
3024 }
3025
Jamie Madill5508f392014-02-20 13:31:36 -05003026 if (token->text.size() > mMaxTokenSize)
alokp@chromium.orgc022c3a2012-07-09 15:56:42 +00003027 {
Shannon Woods7f2d7942013-11-19 15:07:58 -05003028 mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
alokp@chromium.orgc022c3a2012-07-09 15:56:42 +00003029 token->location, token->text);
Jamie Madill5508f392014-02-20 13:31:36 -05003030 token->text.erase(mMaxTokenSize);
alokp@chromium.orgc022c3a2012-07-09 15:56:42 +00003031 }
3032
alokp@chromium.org7fc38dd2012-06-14 18:23:23 +00003033 token->flags = 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003034
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00003035 token->setAtStartOfLine(mContext.lineStart);
3036 mContext.lineStart = token->type == '\n';
3037
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003038 token->setHasLeadingSpace(mContext.leadingSpace);
3039 mContext.leadingSpace = false;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003040}
3041
3042bool Tokenizer::initScanner()
3043{
Corentin Wallez168d5e82017-02-01 12:18:56 -08003044 if ((mHandle == nullptr) && yylex_init_extra(&mContext, &mHandle))
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003045 return false;
3046
Corentin Wallez168d5e82017-02-01 12:18:56 -08003047 yyrestart(0, mHandle);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003048 return true;
3049}
3050
3051void Tokenizer::destroyScanner()
3052{
Corentin Wallez054f7ed2016-09-20 17:15:59 -04003053 if (mHandle == nullptr)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003054 return;
3055
Corentin Wallez168d5e82017-02-01 12:18:56 -08003056 yylex_destroy(mHandle);
Corentin Wallez054f7ed2016-09-20 17:15:59 -04003057 mHandle = nullptr;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003058}
3059
3060} // namespace pp
3061
Geoff Lang93561c32016-09-20 10:22:55 -04003062