blob: 8eacea8fe28c444e4c04fcdbc0fef90e301d7f04 [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
Luc Ferrone49f1e92018-01-24 14:47:55 -050052
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
Luc Ferrone49f1e92018-01-24 14:47:55 -050059
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
Luc Ferrone49f1e92018-01-24 14:47:55 -050066
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
Luc Ferrone49f1e92018-01-24 14:47:55 -050073
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
Luc Ferrone49f1e92018-01-24 14:47:55 -050080
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
Luc Ferrone49f1e92018-01-24 14:47:55 -050087
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
Luc Ferrone49f1e92018-01-24 14:47:55 -050094
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500101
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500108
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500115
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500122
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500129
Corentin Wallez168d5e82017-02-01 12:18:56 -0800130#ifdef yylex
131#define pplex_ALREADY_DEFINED
132#else
133#define yylex pplex
134#endif
135
Luc Ferrone49f1e92018-01-24 14:47:55 -0500136
Corentin Wallez168d5e82017-02-01 12:18:56 -0800137#ifdef yyrestart
138#define pprestart_ALREADY_DEFINED
139#else
140#define yyrestart pprestart
141#endif
142
Luc Ferrone49f1e92018-01-24 14:47:55 -0500143
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500150
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500157
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500164
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500171
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500178
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500185
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500192
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500199
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500206
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500213
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500220
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500227
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500234
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500241
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500248
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500256
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500263
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500271
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500281
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500288
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500298
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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500314
Corentin Wallez168d5e82017-02-01 12:18:56 -0800315#ifdef yyrealloc
316#define pprealloc_ALREADY_DEFINED
317#else
318#define yyrealloc pprealloc
319#endif
320
Luc Ferrone49f1e92018-01-24 14:47:55 -0500321
Corentin Wallez168d5e82017-02-01 12:18:56 -0800322#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,
Luc Ferrone49f1e92018-01-24 14:47:55 -0500356 * if you want the limit (max/min) macros for int types.
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000357 */
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;
Luc Ferrone49f1e92018-01-24 14:47:55 -0500373typedef unsigned char flex_uint8_t;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000374typedef 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
Luc Ferrone49f1e92018-01-24 14:47:55 -0500538
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)
Luc Ferrone49f1e92018-01-24 14:47:55 -0500541
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000542/* 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
Nico Weber41b072b2018-02-09 10:01:32 -0500914#if defined(__clang__)
915// Flex uses `/*FALLTHROUGH*/` instead of dedicated statements.
916#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
917#endif
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +0000918
Jamie Madill2dc8bf82015-04-30 15:56:52 -0400919// Workaround for flex using the register keyword, deprecated in C++11.
920#ifdef __cplusplus
921#if __cplusplus > 199711L
922#define register
923#endif
924#endif
925
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000926typedef std::string YYSTYPE;
alokp@chromium.org2c958ee2012-05-17 20:35:42 +0000927typedef pp::SourceLocation YYLTYPE;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000928
929// Use the unused yycolumn variable to track file (string) number.
930#define yyfileno yycolumn
931
932#define YY_USER_INIT \
933 do { \
934 yyfileno = 0; \
935 yylineno = 1; \
936 yyextra->leadingSpace = false; \
937 yyextra->lineStart = true; \
938 } while(0);
939
alokp@chromium.org19d7aa62012-05-31 17:34:05 +0000940#define YY_USER_ACTION \
941 do \
942 { \
943 pp::Input* input = &yyextra->input; \
944 pp::Input::Location* scanLoc = &yyextra->scanLoc; \
945 while ((scanLoc->sIndex < input->count()) && \
946 (scanLoc->cIndex >= input->length(scanLoc->sIndex))) \
947 { \
948 scanLoc->cIndex -= input->length(scanLoc->sIndex++); \
949 ++yyfileno; yylineno = 1; \
950 } \
951 yylloc->file = yyfileno; \
952 yylloc->line = yylineno; \
953 scanLoc->cIndex += yyleng; \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000954 } while(0);
955
956#define YY_INPUT(buf, result, maxSize) \
Olli Etuaho26e355b2015-08-14 14:16:19 +0300957 result = yyextra->input.read(buf, maxSize, &yylineno);
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000958
Geoff Lang93561c32016-09-20 10:22:55 -0400959
960
961
962
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000963#define INITIAL 0
964#define COMMENT 1
965
Geoff Lang93561c32016-09-20 10:22:55 -0400966
967
968
969
970
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000971#define YY_EXTRA_TYPE pp::Tokenizer::Context*
972
Geoff Lang93561c32016-09-20 10:22:55 -0400973
974
975
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000976/* Holds the entire state of the reentrant scanner. */
977struct yyguts_t
978 {
979
980 /* User-defined. Not touched by flex. */
981 YY_EXTRA_TYPE yyextra_r;
982
983 /* The rest are the same as the globals declared in the non-reentrant scanner. */
984 FILE *yyin_r, *yyout_r;
985 size_t yy_buffer_stack_top; /**< index of top of stack. */
986 size_t yy_buffer_stack_max; /**< capacity of stack. */
987 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
988 char yy_hold_char;
Geoff Lang93561c32016-09-20 10:22:55 -0400989 int yy_n_chars;
990 int yyleng_r;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000991 char *yy_c_buf_p;
992 int yy_init;
993 int yy_start;
994 int yy_did_buffer_switch_on_eof;
995 int yy_start_stack_ptr;
996 int yy_start_stack_depth;
997 int *yy_start_stack;
998 yy_state_type yy_last_accepting_state;
999 char* yy_last_accepting_cpos;
1000
1001 int yylineno_r;
1002 int yy_flex_debug_r;
1003
Geoff Lang93561c32016-09-20 10:22:55 -04001004
1005
1006
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001007 char *yytext_r;
1008 int yy_more_flag;
1009 int yy_more_len;
1010
Geoff Lang93561c32016-09-20 10:22:55 -04001011
1012
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001013 YYSTYPE * yylval_r;
1014
Geoff Lang93561c32016-09-20 10:22:55 -04001015
1016
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001017 YYLTYPE * yylloc_r;
1018
Geoff Lang93561c32016-09-20 10:22:55 -04001019
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001020 }; /* end struct yyguts_t */
1021
Geoff Lang93561c32016-09-20 10:22:55 -04001022
1023
1024
Corentin Wallez168d5e82017-02-01 12:18:56 -08001025static int yy_init_globals ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001026
Luc Ferrone49f1e92018-01-24 14:47:55 -05001027
1028
1029
1030
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001031 /* This must go here because YYSTYPE and YYLTYPE are included
1032 * from bison output in section 1.*/
1033 # define yylval yyg->yylval_r
Luc Ferrone49f1e92018-01-24 14:47:55 -05001034
Geoff Lang93561c32016-09-20 10:22:55 -04001035
Luc Ferrone49f1e92018-01-24 14:47:55 -05001036
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001037 # define yylloc yyg->yylloc_r
Luc Ferrone49f1e92018-01-24 14:47:55 -05001038
1039
Geoff Lang93561c32016-09-20 10:22:55 -04001040
Corentin Wallez168d5e82017-02-01 12:18:56 -08001041int yylex_init (yyscan_t* scanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001042
Corentin Wallez168d5e82017-02-01 12:18:56 -08001043int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001044
Geoff Lang93561c32016-09-20 10:22:55 -04001045
1046
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001047/* Accessor methods to globals.
1048 These are made visible to non-reentrant scanners for convenience. */
1049
Geoff Lang93561c32016-09-20 10:22:55 -04001050
Corentin Wallez168d5e82017-02-01 12:18:56 -08001051int yylex_destroy ( 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 -08001055int yyget_debug ( 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 -08001059void yyset_debug ( int debug_flag , 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 -08001063YY_EXTRA_TYPE yyget_extra ( 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 -08001067void yyset_extra ( YY_EXTRA_TYPE user_defined , 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 -08001071FILE *yyget_in ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001072
Geoff Lang93561c32016-09-20 10:22:55 -04001073
1074
Corentin Wallez168d5e82017-02-01 12:18:56 -08001075void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001076
1077
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001078
Corentin Wallez168d5e82017-02-01 12:18:56 -08001079FILE *yyget_out ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001080
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001081
Geoff Lang93561c32016-09-20 10:22:55 -04001082
Corentin Wallez168d5e82017-02-01 12:18:56 -08001083void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001084
1085
1086
Corentin Wallez168d5e82017-02-01 12:18:56 -08001087 int yyget_leng ( yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001088
1089
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001090
Corentin Wallez168d5e82017-02-01 12:18:56 -08001091char *yyget_text ( 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 -08001095int yyget_lineno ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001096
Geoff Lang93561c32016-09-20 10:22:55 -04001097
1098
Corentin Wallez168d5e82017-02-01 12:18:56 -08001099void yyset_lineno ( int _line_number , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001100
1101
1102
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001103
Corentin Wallez168d5e82017-02-01 12:18:56 -08001104int yyget_column ( yyscan_t yyscanner );
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001105
Geoff Lang93561c32016-09-20 10:22:55 -04001106
1107
1108
1109
Corentin Wallez168d5e82017-02-01 12:18:56 -08001110void yyset_column ( int _column_no , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001111
1112
1113
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001114
Corentin Wallez168d5e82017-02-01 12:18:56 -08001115YYSTYPE * yyget_lval ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001116
Geoff Lang93561c32016-09-20 10:22:55 -04001117
Corentin Wallez168d5e82017-02-01 12:18:56 -08001118void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001119
Geoff Lang93561c32016-09-20 10:22:55 -04001120
Luc Ferrone49f1e92018-01-24 14:47:55 -05001121
1122 YYLTYPE *yyget_lloc ( yyscan_t yyscanner );
1123
1124
1125
Corentin Wallez168d5e82017-02-01 12:18:56 -08001126 void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner );
Luc Ferrone49f1e92018-01-24 14:47:55 -05001127
1128
Geoff Lang93561c32016-09-20 10:22:55 -04001129
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001130/* Macros after this point can all be overridden by user definitions in
1131 * section 1.
1132 */
1133
1134#ifndef YY_SKIP_YYWRAP
1135#ifdef __cplusplus
Corentin Wallez168d5e82017-02-01 12:18:56 -08001136extern "C" int yywrap ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001137#else
Corentin Wallez168d5e82017-02-01 12:18:56 -08001138extern int yywrap ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001139#endif
1140#endif
1141
Geoff Lang93561c32016-09-20 10:22:55 -04001142#ifndef YY_NO_UNPUT
Luc Ferrone49f1e92018-01-24 14:47:55 -05001143
Geoff Lang93561c32016-09-20 10:22:55 -04001144#endif
1145
1146
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001147#ifndef yytext_ptr
Corentin Wallez168d5e82017-02-01 12:18:56 -08001148static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001149#endif
1150
1151#ifdef YY_NEED_STRLEN
Corentin Wallez168d5e82017-02-01 12:18:56 -08001152static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001153#endif
1154
1155#ifndef YY_NO_INPUT
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001156#ifdef __cplusplus
Corentin Wallez168d5e82017-02-01 12:18:56 -08001157static int yyinput ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001158#else
Corentin Wallez168d5e82017-02-01 12:18:56 -08001159static int input ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001160#endif
1161
1162#endif
1163
Geoff Lang93561c32016-09-20 10:22:55 -04001164
1165
1166
1167
1168
1169
1170
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001171/* Amount of stuff to slurp up with each read. */
1172#ifndef YY_READ_BUF_SIZE
Geoff Lang93561c32016-09-20 10:22:55 -04001173#ifdef __ia64__
1174/* On IA-64, the buffer size is 16k, not 8k */
1175#define YY_READ_BUF_SIZE 16384
1176#else
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001177#define YY_READ_BUF_SIZE 8192
Geoff Lang93561c32016-09-20 10:22:55 -04001178#endif /* __ia64__ */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001179#endif
1180
Geoff Lang93561c32016-09-20 10:22:55 -04001181
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001182/* Copy whatever the last rule matched to the standard output. */
1183#ifndef ECHO
1184/* This used to be an fputs(), but since the string might contain NUL's,
1185 * we now use fwrite().
1186 */
Geoff Lang93561c32016-09-20 10:22:55 -04001187#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001188#endif
1189
Geoff Lang93561c32016-09-20 10:22:55 -04001190
1191
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001192/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1193 * is returned in "result".
1194 */
1195#ifndef YY_INPUT
1196#define YY_INPUT(buf,result,max_size) \
1197 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1198 { \
1199 int c = '*'; \
Corentin Wallez168d5e82017-02-01 12:18:56 -08001200 int n; \
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001201 for ( n = 0; n < max_size && \
1202 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1203 buf[n] = (char) c; \
1204 if ( c == '\n' ) \
1205 buf[n++] = (char) c; \
1206 if ( c == EOF && ferror( yyin ) ) \
1207 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1208 result = n; \
1209 } \
1210 else \
1211 { \
1212 errno=0; \
Corentin Wallez168d5e82017-02-01 12:18:56 -08001213 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001214 { \
1215 if( errno != EINTR) \
1216 { \
1217 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1218 break; \
1219 } \
1220 errno=0; \
1221 clearerr(yyin); \
1222 } \
1223 }\
1224\
1225
1226#endif
1227
Geoff Lang93561c32016-09-20 10:22:55 -04001228
1229
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001230/* No semi-colon after return; correct usage is to write "yyterminate();" -
1231 * we don't want an extra ';' after the "return" because that will cause
1232 * some compilers to complain about unreachable statements.
1233 */
1234#ifndef yyterminate
1235#define yyterminate() return YY_NULL
1236#endif
1237
Geoff Lang93561c32016-09-20 10:22:55 -04001238
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001239/* Number of entries by which start-condition stack grows. */
1240#ifndef YY_START_STACK_INCR
1241#define YY_START_STACK_INCR 25
1242#endif
1243
Geoff Lang93561c32016-09-20 10:22:55 -04001244
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001245/* Report a fatal error. */
1246#ifndef YY_FATAL_ERROR
1247#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
1248#endif
1249
Geoff Lang93561c32016-09-20 10:22:55 -04001250
1251
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001252/* end tables serialization structures and prototypes */
1253
Geoff Lang93561c32016-09-20 10:22:55 -04001254
1255
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001256/* Default declaration of generated scanner - a define so the user can
1257 * easily add parameters.
1258 */
1259#ifndef YY_DECL
1260#define YY_DECL_IS_OURS 1
1261
Luc Ferrone49f1e92018-01-24 14:47:55 -05001262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
Corentin Wallez168d5e82017-02-01 12:18:56 -08001278extern int yylex \
1279 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001280
Corentin Wallez168d5e82017-02-01 12:18:56 -08001281#define YY_DECL int yylex \
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001282 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
1283#endif /* !YY_DECL */
1284
Geoff Lang93561c32016-09-20 10:22:55 -04001285
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001286/* Code executed at the beginning of each rule, after yytext and yyleng
1287 * have been set up.
1288 */
1289#ifndef YY_USER_ACTION
1290#define YY_USER_ACTION
1291#endif
1292
Geoff Lang93561c32016-09-20 10:22:55 -04001293
1294
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001295/* Code executed at the end of each rule. */
1296#ifndef YY_BREAK
Geoff Lang93561c32016-09-20 10:22:55 -04001297#define YY_BREAK /*LINTED*/break;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001298#endif
1299
Geoff Lang93561c32016-09-20 10:22:55 -04001300
1301
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001302#define YY_RULE_SETUP \
1303 YY_USER_ACTION
1304
Geoff Lang93561c32016-09-20 10:22:55 -04001305
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001306/** The main scanner function which does all the work.
1307 */
1308YY_DECL
1309{
Geoff Lang93561c32016-09-20 10:22:55 -04001310 yy_state_type yy_current_state;
1311 char *yy_cp, *yy_bp;
1312 int yy_act;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001313 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1314
Geoff Lang93561c32016-09-20 10:22:55 -04001315
1316
1317
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001318 yylval = yylval_param;
1319
Geoff Lang93561c32016-09-20 10:22:55 -04001320
1321
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001322 yylloc = yylloc_param;
1323
Geoff Lang93561c32016-09-20 10:22:55 -04001324
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001325 if ( !yyg->yy_init )
1326 {
1327 yyg->yy_init = 1;
1328
1329#ifdef YY_USER_INIT
1330 YY_USER_INIT;
1331#endif
1332
Geoff Lang93561c32016-09-20 10:22:55 -04001333
1334
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001335 if ( ! yyg->yy_start )
1336 yyg->yy_start = 1; /* first start state */
1337
1338 if ( ! yyin )
1339 yyin = stdin;
1340
1341 if ( ! yyout )
1342 yyout = stdout;
1343
1344 if ( ! YY_CURRENT_BUFFER ) {
Corentin Wallez168d5e82017-02-01 12:18:56 -08001345 yyensure_buffer_stack (yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001346 YY_CURRENT_BUFFER_LVALUE =
Corentin Wallez168d5e82017-02-01 12:18:56 -08001347 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001348 }
1349
Corentin Wallez168d5e82017-02-01 12:18:56 -08001350 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001351 }
1352
Jamie Madill185de882014-12-22 15:17:52 -05001353 {
1354
Geoff Lang93561c32016-09-20 10:22:55 -04001355
Jamie Madill185de882014-12-22 15:17:52 -05001356 /* Line comment */
1357
Geoff Lang93561c32016-09-20 10:22:55 -04001358 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001359 {
1360 yy_cp = yyg->yy_c_buf_p;
1361
1362 /* Support of yytext. */
1363 *yy_cp = yyg->yy_hold_char;
1364
1365 /* yy_bp points to the position in yy_ch_buf of the start of
1366 * the current run.
1367 */
1368 yy_bp = yy_cp;
1369
1370 yy_current_state = yyg->yy_start;
1371yy_match:
1372 do
1373 {
Geoff Lang93561c32016-09-20 10:22:55 -04001374 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001375 if ( yy_accept[yy_current_state] )
1376 {
1377 yyg->yy_last_accepting_state = yy_current_state;
1378 yyg->yy_last_accepting_cpos = yy_cp;
1379 }
1380 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1381 {
1382 yy_current_state = (int) yy_def[yy_current_state];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001383 if ( yy_current_state >= 95 )
Corentin Wallez168d5e82017-02-01 12:18:56 -08001384 yy_c = yy_meta[yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001385 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08001386 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001387 ++yy_cp;
1388 }
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001389 while ( yy_current_state != 94 );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001390 yy_cp = yyg->yy_last_accepting_cpos;
1391 yy_current_state = yyg->yy_last_accepting_state;
1392
1393yy_find_action:
1394 yy_act = yy_accept[yy_current_state];
1395
1396 YY_DO_BEFORE_ACTION;
1397
Geoff Lang93561c32016-09-20 10:22:55 -04001398
1399
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001400do_action: /* This label is used only to access EOF actions. */
1401
Geoff Lang93561c32016-09-20 10:22:55 -04001402
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001403 switch ( yy_act )
1404 { /* beginning of action switch */
1405 case 0: /* must back up */
1406 /* undo the effects of YY_DO_BEFORE_ACTION */
1407 *yy_cp = yyg->yy_hold_char;
1408 yy_cp = yyg->yy_last_accepting_cpos;
1409 yy_current_state = yyg->yy_last_accepting_state;
1410 goto yy_find_action;
1411
1412case 1:
1413YY_RULE_SETUP
1414
1415 YY_BREAK
1416/* Block comment */
1417/* Line breaks are just counted - not returned. */
Jamie Madillb96687d2015-04-30 15:56:51 -04001418/* The comment is replaced by a single space. */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001419case 2:
1420YY_RULE_SETUP
1421{ BEGIN(COMMENT); }
1422 YY_BREAK
1423case 3:
1424YY_RULE_SETUP
1425
1426 YY_BREAK
1427case 4:
1428YY_RULE_SETUP
1429
1430 YY_BREAK
1431case 5:
1432/* rule 5 can match eol */
1433YY_RULE_SETUP
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001434{
1435 if (yylineno == INT_MAX)
1436 {
1437 *yylval = "Integer overflow on line number";
1438 return pp::Token::GOT_ERROR;
1439 }
1440 ++yylineno;
1441}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001442 YY_BREAK
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001443case 6:
1444YY_RULE_SETUP
alokp@chromium.org2c958ee2012-05-17 20:35:42 +00001445{
1446 yyextra->leadingSpace = true;
1447 BEGIN(INITIAL);
1448}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001449 YY_BREAK
1450case 7:
1451YY_RULE_SETUP
1452{
1453 // # is only valid at start of line for preprocessor directives.
alokp@chromium.org432d6fc2012-06-27 22:13:21 +00001454 yylval->assign(1, yytext[0]);
1455 return yyextra->lineStart ? pp::Token::PP_HASH : pp::Token::PP_OTHER;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001456}
1457 YY_BREAK
1458case 8:
1459YY_RULE_SETUP
1460{
1461 yylval->assign(yytext, yyleng);
1462 return pp::Token::IDENTIFIER;
1463}
1464 YY_BREAK
1465case 9:
1466YY_RULE_SETUP
1467{
1468 yylval->assign(yytext, yyleng);
1469 return pp::Token::CONST_INT;
1470}
1471 YY_BREAK
1472case 10:
1473YY_RULE_SETUP
1474{
1475 yylval->assign(yytext, yyleng);
1476 return pp::Token::CONST_FLOAT;
1477}
1478 YY_BREAK
1479/* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */
1480/* Rule to catch all invalid integers and floats. */
1481case 11:
1482YY_RULE_SETUP
1483{
alokp@chromium.org432d6fc2012-06-27 22:13:21 +00001484 yylval->assign(yytext, yyleng);
1485 return pp::Token::PP_NUMBER;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001486}
1487 YY_BREAK
1488case 12:
1489YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001490{
1491 yylval->assign(yytext, yyleng);
1492 return pp::Token::OP_INC;
1493}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001494 YY_BREAK
1495case 13:
1496YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001497{
1498 yylval->assign(yytext, yyleng);
1499 return pp::Token::OP_DEC;
1500}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001501 YY_BREAK
1502case 14:
1503YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001504{
1505 yylval->assign(yytext, yyleng);
1506 return pp::Token::OP_LEFT;
1507}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001508 YY_BREAK
1509case 15:
1510YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001511{
1512 yylval->assign(yytext, yyleng);
1513 return pp::Token::OP_RIGHT;
1514}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001515 YY_BREAK
1516case 16:
1517YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001518{
1519 yylval->assign(yytext, yyleng);
1520 return pp::Token::OP_LE;
1521}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001522 YY_BREAK
1523case 17:
1524YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001525{
1526 yylval->assign(yytext, yyleng);
1527 return pp::Token::OP_GE;
1528}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001529 YY_BREAK
1530case 18:
1531YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001532{
1533 yylval->assign(yytext, yyleng);
1534 return pp::Token::OP_EQ;
1535}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001536 YY_BREAK
1537case 19:
1538YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001539{
1540 yylval->assign(yytext, yyleng);
1541 return pp::Token::OP_NE;
1542}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001543 YY_BREAK
1544case 20:
1545YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001546{
1547 yylval->assign(yytext, yyleng);
1548 return pp::Token::OP_AND;
1549}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001550 YY_BREAK
1551case 21:
1552YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001553{
1554 yylval->assign(yytext, yyleng);
1555 return pp::Token::OP_XOR;
1556}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001557 YY_BREAK
1558case 22:
1559YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001560{
1561 yylval->assign(yytext, yyleng);
1562 return pp::Token::OP_OR;
1563}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001564 YY_BREAK
1565case 23:
1566YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001567{
1568 yylval->assign(yytext, yyleng);
1569 return pp::Token::OP_ADD_ASSIGN;
1570}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001571 YY_BREAK
1572case 24:
1573YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001574{
1575 yylval->assign(yytext, yyleng);
1576 return pp::Token::OP_SUB_ASSIGN;
1577}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001578 YY_BREAK
1579case 25:
1580YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001581{
1582 yylval->assign(yytext, yyleng);
1583 return pp::Token::OP_MUL_ASSIGN;
1584}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001585 YY_BREAK
1586case 26:
1587YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001588{
1589 yylval->assign(yytext, yyleng);
1590 return pp::Token::OP_DIV_ASSIGN;
1591}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001592 YY_BREAK
1593case 27:
1594YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001595{
1596 yylval->assign(yytext, yyleng);
1597 return pp::Token::OP_MOD_ASSIGN;
1598}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001599 YY_BREAK
1600case 28:
1601YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001602{
1603 yylval->assign(yytext, yyleng);
1604 return pp::Token::OP_LEFT_ASSIGN;
1605}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001606 YY_BREAK
1607case 29:
1608YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001609{
1610 yylval->assign(yytext, yyleng);
1611 return pp::Token::OP_RIGHT_ASSIGN;
1612}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001613 YY_BREAK
1614case 30:
1615YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001616{
1617 yylval->assign(yytext, yyleng);
1618 return pp::Token::OP_AND_ASSIGN;
1619}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001620 YY_BREAK
1621case 31:
1622YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001623{
1624 yylval->assign(yytext, yyleng);
1625 return pp::Token::OP_XOR_ASSIGN;
1626}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001627 YY_BREAK
1628case 32:
1629YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001630{
1631 yylval->assign(yytext, yyleng);
1632 return pp::Token::OP_OR_ASSIGN;
1633}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001634 YY_BREAK
1635case 33:
1636YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001637{
1638 yylval->assign(1, yytext[0]);
1639 return yytext[0];
1640}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001641 YY_BREAK
1642case 34:
1643YY_RULE_SETUP
1644{ yyextra->leadingSpace = true; }
1645 YY_BREAK
1646case 35:
1647/* rule 35 can match eol */
1648YY_RULE_SETUP
1649{
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001650 if (yylineno == INT_MAX)
1651 {
1652 *yylval = "Integer overflow on line number";
1653 return pp::Token::GOT_ERROR;
1654 }
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001655 ++yylineno;
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001656 yylval->assign(1, '\n');
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001657 return '\n';
1658}
1659 YY_BREAK
1660case 36:
1661YY_RULE_SETUP
1662{
alokp@chromium.org432d6fc2012-06-27 22:13:21 +00001663 yylval->assign(1, yytext[0]);
1664 return pp::Token::PP_OTHER;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001665}
1666 YY_BREAK
1667case YY_STATE_EOF(INITIAL):
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001668case YY_STATE_EOF(COMMENT):
1669{
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00001670 // YY_USER_ACTION is not invoked for handling EOF.
1671 // Set the location for EOF token manually.
1672 pp::Input* input = &yyextra->input;
1673 pp::Input::Location* scanLoc = &yyextra->scanLoc;
shannon.woods@transgaming.comd64b3da2013-02-28 23:19:26 +00001674 yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00001675 if (scanLoc->sIndex != sIndexMax)
1676 {
1677 // We can only reach here if there are empty strings at the
1678 // end of the input.
1679 scanLoc->sIndex = sIndexMax; scanLoc->cIndex = 0;
shannon.woods@transgaming.comd64b3da2013-02-28 23:19:26 +00001680 // FIXME: this is not 64-bit clean.
1681 yyfileno = static_cast<int>(sIndexMax); yylineno = 1;
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00001682 }
1683 yylloc->file = yyfileno;
1684 yylloc->line = yylineno;
1685 yylval->clear();
1686
Corentin Wallezd78e33a2017-10-30 12:33:52 -04001687 // Line number overflows fake EOFs to exit early, check for this case.
1688 if (yylineno == INT_MAX)
1689 {
1690 yyextra->diagnostics->report(pp::Diagnostics::PP_TOKENIZER_ERROR,
1691 pp::SourceLocation(yyfileno, yylineno),
1692 "Integer overflow on line number");
1693 }
1694 else if (YY_START == COMMENT)
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001695 {
Shannon Woods7f2d7942013-11-19 15:07:58 -05001696 yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001697 pp::SourceLocation(yyfileno, yylineno),
Corentin Wallezd78e33a2017-10-30 12:33:52 -04001698 "EOF while in a comment");
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001699 }
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001700 yyterminate();
1701}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001702 YY_BREAK
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001703case 37:
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001704YY_RULE_SETUP
1705ECHO;
1706 YY_BREAK
1707
1708 case YY_END_OF_BUFFER:
1709 {
1710 /* Amount of text matched not including the EOB char. */
1711 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1712
1713 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1714 *yy_cp = yyg->yy_hold_char;
1715 YY_RESTORE_YY_MORE_OFFSET
1716
1717 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1718 {
1719 /* We're scanning a new file or input source. It's
1720 * possible that this happened because the user
1721 * just pointed yyin at a new source and called
Corentin Wallez168d5e82017-02-01 12:18:56 -08001722 * yylex(). If so, then we have to assure
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001723 * consistency between YY_CURRENT_BUFFER and our
1724 * globals. Here is the right place to do so, because
1725 * this is the first action (other than possibly a
1726 * back-up) that will match for the new input source.
1727 */
1728 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1729 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1730 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1731 }
1732
1733 /* Note that here we test for yy_c_buf_p "<=" to the position
1734 * of the first EOB in the buffer, since yy_c_buf_p will
1735 * already have been incremented past the NUL character
1736 * (since all states make transitions on EOB to the
1737 * end-of-buffer state). Contrast this with the test
1738 * in input().
1739 */
1740 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1741 { /* This was really a NUL. */
1742 yy_state_type yy_next_state;
1743
1744 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1745
1746 yy_current_state = yy_get_previous_state( yyscanner );
1747
1748 /* Okay, we're now positioned to make the NUL
1749 * transition. We couldn't have
1750 * yy_get_previous_state() go ahead and do it
1751 * for us because it doesn't know how to deal
1752 * with the possibility of jamming (and we don't
1753 * want to build jamming into it because then it
1754 * will run more slowly).
1755 */
1756
1757 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1758
1759 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1760
1761 if ( yy_next_state )
1762 {
1763 /* Consume the NUL. */
1764 yy_cp = ++yyg->yy_c_buf_p;
1765 yy_current_state = yy_next_state;
1766 goto yy_match;
1767 }
1768
1769 else
1770 {
1771 yy_cp = yyg->yy_last_accepting_cpos;
1772 yy_current_state = yyg->yy_last_accepting_state;
1773 goto yy_find_action;
1774 }
1775 }
1776
1777 else switch ( yy_get_next_buffer( yyscanner ) )
1778 {
1779 case EOB_ACT_END_OF_FILE:
1780 {
1781 yyg->yy_did_buffer_switch_on_eof = 0;
1782
Corentin Wallez168d5e82017-02-01 12:18:56 -08001783 if ( yywrap( yyscanner ) )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001784 {
1785 /* Note: because we've taken care in
1786 * yy_get_next_buffer() to have set up
1787 * yytext, we can now set up
1788 * yy_c_buf_p so that if some total
1789 * hoser (like flex itself) wants to
1790 * call the scanner after we return the
1791 * YY_NULL, it'll still work - another
1792 * YY_NULL will get returned.
1793 */
1794 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1795
1796 yy_act = YY_STATE_EOF(YY_START);
1797 goto do_action;
1798 }
1799
1800 else
1801 {
1802 if ( ! yyg->yy_did_buffer_switch_on_eof )
1803 YY_NEW_FILE;
1804 }
1805 break;
1806 }
1807
1808 case EOB_ACT_CONTINUE_SCAN:
1809 yyg->yy_c_buf_p =
1810 yyg->yytext_ptr + yy_amount_of_matched_text;
1811
1812 yy_current_state = yy_get_previous_state( yyscanner );
1813
1814 yy_cp = yyg->yy_c_buf_p;
1815 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1816 goto yy_match;
1817
1818 case EOB_ACT_LAST_MATCH:
1819 yyg->yy_c_buf_p =
1820 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1821
1822 yy_current_state = yy_get_previous_state( yyscanner );
1823
1824 yy_cp = yyg->yy_c_buf_p;
1825 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1826 goto yy_find_action;
1827 }
1828 break;
1829 }
1830
1831 default:
1832 YY_FATAL_ERROR(
1833 "fatal flex scanner internal error--no action found" );
1834 } /* end of action switch */
1835 } /* end of scanning one token */
Jamie Madill185de882014-12-22 15:17:52 -05001836 } /* end of user's declarations */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001837} /* end of yylex */
Geoff Lang93561c32016-09-20 10:22:55 -04001838
1839
1840
1841
1842
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001843/* yy_get_next_buffer - try to read in a new buffer
1844 *
1845 * Returns a code representing an action:
1846 * EOB_ACT_LAST_MATCH -
1847 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1848 * EOB_ACT_END_OF_FILE - end of file
1849 */
1850static int yy_get_next_buffer (yyscan_t yyscanner)
1851{
1852 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04001853 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1854 char *source = yyg->yytext_ptr;
Corentin Wallez168d5e82017-02-01 12:18:56 -08001855 int number_to_move, i;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001856 int ret_val;
1857
1858 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1859 YY_FATAL_ERROR(
1860 "fatal flex scanner internal error--end of buffer missed" );
1861
1862 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1863 { /* Don't try to fill the buffer, so this is an EOF. */
1864 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1865 {
1866 /* We matched a single character, the EOB, so
1867 * treat this as a final EOF.
1868 */
1869 return EOB_ACT_END_OF_FILE;
1870 }
1871
1872 else
1873 {
1874 /* We matched some text prior to the EOB, first
1875 * process it.
1876 */
1877 return EOB_ACT_LAST_MATCH;
1878 }
1879 }
1880
1881 /* Try to read more data. */
1882
1883 /* First move last chars to start of buffer. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001884 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001885
1886 for ( i = 0; i < number_to_move; ++i )
1887 *(dest++) = *(source++);
1888
1889 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1890 /* don't do the read, it's not guaranteed to return an EOF,
1891 * just force an EOF
1892 */
1893 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1894
1895 else
1896 {
Geoff Lang93561c32016-09-20 10:22:55 -04001897 int num_to_read =
Corentin Wallez168d5e82017-02-01 12:18:56 -08001898 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001899
1900 while ( num_to_read <= 0 )
1901 { /* Not enough room in the buffer - grow it. */
1902
1903 /* just a shorter name for the current buffer */
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001904 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001905
1906 int yy_c_buf_p_offset =
1907 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1908
1909 if ( b->yy_is_our_buffer )
1910 {
Geoff Lang93561c32016-09-20 10:22:55 -04001911 int new_size = b->yy_buf_size * 2;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001912
1913 if ( new_size <= 0 )
1914 b->yy_buf_size += b->yy_buf_size / 8;
1915 else
1916 b->yy_buf_size *= 2;
1917
1918 b->yy_ch_buf = (char *)
1919 /* Include room in for 2 EOB chars. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001920 yyrealloc( (void *) b->yy_ch_buf,
1921 (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001922 }
1923 else
1924 /* Can't grow it, we don't own it. */
Geoff Lang93561c32016-09-20 10:22:55 -04001925 b->yy_ch_buf = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001926
1927 if ( ! b->yy_ch_buf )
1928 YY_FATAL_ERROR(
1929 "fatal error - scanner input buffer overflow" );
1930
1931 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1932
Corentin Wallez168d5e82017-02-01 12:18:56 -08001933 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1934 number_to_move - 1;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001935
1936 }
1937
1938 if ( num_to_read > YY_READ_BUF_SIZE )
1939 num_to_read = YY_READ_BUF_SIZE;
1940
1941 /* Read in more data. */
Geoff Lang93561c32016-09-20 10:22:55 -04001942 yy_size_t ret = 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001943 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
Geoff Lang93561c32016-09-20 10:22:55 -04001944 ret, num_to_read );
1945 yyg->yy_n_chars = static_cast<int>(ret);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001946
1947 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1948 }
1949
1950 if ( yyg->yy_n_chars == 0 )
1951 {
1952 if ( number_to_move == YY_MORE_ADJ )
1953 {
1954 ret_val = EOB_ACT_END_OF_FILE;
Corentin Wallez168d5e82017-02-01 12:18:56 -08001955 yyrestart( yyin , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001956 }
1957
1958 else
1959 {
1960 ret_val = EOB_ACT_LAST_MATCH;
1961 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1962 YY_BUFFER_EOF_PENDING;
1963 }
1964 }
1965
1966 else
1967 ret_val = EOB_ACT_CONTINUE_SCAN;
1968
Corentin Wallez168d5e82017-02-01 12:18:56 -08001969 if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001970 /* Extend the array by 50%, plus the number we really need. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001971 int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1972 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1973 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001974 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1975 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
Corentin Wallez168d5e82017-02-01 12:18:56 -08001976 /* "- 2" to take care of EOB's */
1977 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001978 }
1979
Corentin Wallez168d5e82017-02-01 12:18:56 -08001980 yyg->yy_n_chars += number_to_move;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001981 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1982 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1983
1984 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1985
1986 return ret_val;
1987}
1988
Geoff Lang93561c32016-09-20 10:22:55 -04001989
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001990/* yy_get_previous_state - get the state just before the EOB char was reached */
1991
1992 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1993{
Geoff Lang93561c32016-09-20 10:22:55 -04001994 yy_state_type yy_current_state;
1995 char *yy_cp;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001996 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1997
1998 yy_current_state = yyg->yy_start;
1999
2000 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
2001 {
Geoff Lang93561c32016-09-20 10:22:55 -04002002 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002003 if ( yy_accept[yy_current_state] )
2004 {
2005 yyg->yy_last_accepting_state = yy_current_state;
2006 yyg->yy_last_accepting_cpos = yy_cp;
2007 }
2008 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2009 {
2010 yy_current_state = (int) yy_def[yy_current_state];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05002011 if ( yy_current_state >= 95 )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002012 yy_c = yy_meta[yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002013 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08002014 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002015 }
2016
2017 return yy_current_state;
2018}
2019
Geoff Lang93561c32016-09-20 10:22:55 -04002020
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002021/* yy_try_NUL_trans - try to make a transition on the NUL character
2022 *
2023 * synopsis
2024 * next_state = yy_try_NUL_trans( current_state );
2025 */
2026 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
2027{
Geoff Lang93561c32016-09-20 10:22:55 -04002028 int yy_is_jam;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002029 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
Geoff Lang93561c32016-09-20 10:22:55 -04002030 char *yy_cp = yyg->yy_c_buf_p;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002031
Geoff Lang93561c32016-09-20 10:22:55 -04002032 YY_CHAR yy_c = 1;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002033 if ( yy_accept[yy_current_state] )
2034 {
2035 yyg->yy_last_accepting_state = yy_current_state;
2036 yyg->yy_last_accepting_cpos = yy_cp;
2037 }
2038 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2039 {
2040 yy_current_state = (int) yy_def[yy_current_state];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05002041 if ( yy_current_state >= 95 )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002042 yy_c = yy_meta[yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002043 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08002044 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05002045 yy_is_jam = (yy_current_state == 94);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002046
Zhenyao Mof1d723c2013-09-23 14:57:07 -04002047 (void)yyg;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002048 return yy_is_jam ? 0 : yy_current_state;
2049}
2050
Geoff Lang93561c32016-09-20 10:22:55 -04002051
2052#ifndef YY_NO_UNPUT
2053
2054#endif
2055
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002056#ifndef YY_NO_INPUT
2057#ifdef __cplusplus
2058 static int yyinput (yyscan_t yyscanner)
2059#else
2060 static int input (yyscan_t yyscanner)
2061#endif
2062
2063{
2064 int c;
2065 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2066
2067 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2068
2069 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2070 {
2071 /* yy_c_buf_p now points to the character we want to return.
2072 * If this occurs *before* the EOB characters, then it's a
2073 * valid NUL; if not, then we've hit the end of the buffer.
2074 */
2075 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
2076 /* This was really a NUL. */
2077 *yyg->yy_c_buf_p = '\0';
2078
2079 else
2080 { /* need more input */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002081 int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002082 ++yyg->yy_c_buf_p;
2083
2084 switch ( yy_get_next_buffer( yyscanner ) )
2085 {
2086 case EOB_ACT_LAST_MATCH:
2087 /* This happens because yy_g_n_b()
2088 * sees that we've accumulated a
2089 * token and flags that we need to
2090 * try matching the token before
2091 * proceeding. But for input(),
2092 * there's no matching to consider.
2093 * So convert the EOB_ACT_LAST_MATCH
2094 * to EOB_ACT_END_OF_FILE.
2095 */
2096
2097 /* Reset buffer status. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002098 yyrestart( yyin , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002099
2100 /*FALLTHROUGH*/
2101
2102 case EOB_ACT_END_OF_FILE:
2103 {
Corentin Wallez168d5e82017-02-01 12:18:56 -08002104 if ( yywrap( yyscanner ) )
Geoff Lang93561c32016-09-20 10:22:55 -04002105 return 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002106
2107 if ( ! yyg->yy_did_buffer_switch_on_eof )
2108 YY_NEW_FILE;
2109#ifdef __cplusplus
2110 return yyinput(yyscanner);
2111#else
2112 return input(yyscanner);
2113#endif
2114 }
2115
2116 case EOB_ACT_CONTINUE_SCAN:
2117 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
2118 break;
2119 }
2120 }
2121 }
2122
2123 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
2124 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
2125 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
2126
Geoff Lang93561c32016-09-20 10:22:55 -04002127
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002128 return c;
2129}
2130#endif /* ifndef YY_NO_INPUT */
2131
2132/** Immediately switch to a different input stream.
2133 * @param input_file A readable stream.
2134 * @param yyscanner The scanner object.
2135 * @note This function does not reset the start condition to @c INITIAL .
2136 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002137 void yyrestart (FILE * input_file , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002138{
2139 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2140
2141 if ( ! YY_CURRENT_BUFFER ){
Corentin Wallez168d5e82017-02-01 12:18:56 -08002142 yyensure_buffer_stack (yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002143 YY_CURRENT_BUFFER_LVALUE =
Corentin Wallez168d5e82017-02-01 12:18:56 -08002144 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002145 }
2146
Corentin Wallez168d5e82017-02-01 12:18:56 -08002147 yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
2148 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002149}
2150
Geoff Lang93561c32016-09-20 10:22:55 -04002151
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002152/** Switch to a different input buffer.
2153 * @param new_buffer The new input buffer.
2154 * @param yyscanner The scanner object.
2155 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002156 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002157{
2158 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2159
2160 /* TODO. We should be able to replace this entire function body
2161 * with
Corentin Wallez168d5e82017-02-01 12:18:56 -08002162 * yypop_buffer_state();
2163 * yypush_buffer_state(new_buffer);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002164 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002165 yyensure_buffer_stack (yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002166 if ( YY_CURRENT_BUFFER == new_buffer )
2167 return;
2168
2169 if ( YY_CURRENT_BUFFER )
2170 {
2171 /* Flush out information for old buffer. */
2172 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2173 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2174 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2175 }
2176
2177 YY_CURRENT_BUFFER_LVALUE = new_buffer;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002178 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002179
2180 /* We don't actually know whether we did this switch during
Corentin Wallez168d5e82017-02-01 12:18:56 -08002181 * EOF (yywrap()) processing, but the only time this flag
2182 * is looked at is after yywrap() is called, so it's safe
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002183 * to go ahead and always set it.
2184 */
2185 yyg->yy_did_buffer_switch_on_eof = 1;
2186}
2187
Geoff Lang93561c32016-09-20 10:22:55 -04002188
Corentin Wallez168d5e82017-02-01 12:18:56 -08002189static void yy_load_buffer_state (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002190{
2191 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2192 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2193 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2194 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2195 yyg->yy_hold_char = *yyg->yy_c_buf_p;
2196}
2197
2198/** Allocate and initialize an input buffer state.
2199 * @param file A readable stream.
2200 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2201 * @param yyscanner The scanner object.
2202 * @return the allocated buffer state.
2203 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002204 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002205{
2206 YY_BUFFER_STATE b;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002207
2208 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002209 if ( ! b )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002210 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002211
Corentin Wallez168d5e82017-02-01 12:18:56 -08002212 b->yy_buf_size = size;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002213
2214 /* yy_ch_buf has to be 2 characters longer than the size given because
2215 * we need to put in 2 end-of-buffer characters.
2216 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002217 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002218 if ( ! b->yy_ch_buf )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002219 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002220
2221 b->yy_is_our_buffer = 1;
2222
Corentin Wallez168d5e82017-02-01 12:18:56 -08002223 yy_init_buffer( b, file , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002224
2225 return b;
2226}
2227
Geoff Lang93561c32016-09-20 10:22:55 -04002228
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002229/** Destroy the buffer.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002230 * @param b a buffer created with yy_create_buffer()
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002231 * @param yyscanner The scanner object.
2232 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002233 void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002234{
2235 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2236
2237 if ( ! b )
2238 return;
2239
2240 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2241 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2242
2243 if ( b->yy_is_our_buffer )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002244 yyfree( (void *) b->yy_ch_buf , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002245
Corentin Wallez168d5e82017-02-01 12:18:56 -08002246 yyfree( (void *) b , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002247}
2248
Geoff Lang93561c32016-09-20 10:22:55 -04002249
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002250/* Initializes or reinitializes a buffer.
2251 * This function is sometimes called more than once on the same buffer,
Corentin Wallez168d5e82017-02-01 12:18:56 -08002252 * such as during a yyrestart() or at EOF.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002253 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002254 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002255
2256{
2257 int oerrno = errno;
2258 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2259
Corentin Wallez168d5e82017-02-01 12:18:56 -08002260 yy_flush_buffer( b , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002261
2262 b->yy_input_file = file;
2263 b->yy_fill_buffer = 1;
2264
Corentin Wallez168d5e82017-02-01 12:18:56 -08002265 /* If b is the current buffer, then yy_init_buffer was _probably_
2266 * called from yyrestart() or through yy_get_next_buffer.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002267 * In that case, we don't want to reset the lineno or column.
2268 */
2269 if (b != YY_CURRENT_BUFFER){
2270 b->yy_bs_lineno = 1;
2271 b->yy_bs_column = 0;
2272 }
2273
Geoff Lang93561c32016-09-20 10:22:55 -04002274
Luc Ferrone49f1e92018-01-24 14:47:55 -05002275
2276 b->yy_is_interactive = 0;
2277
2278
2279 errno = oerrno;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002280}
2281
2282/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2283 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2284 * @param yyscanner The scanner object.
2285 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002286 void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002287{
2288 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2289 if ( ! b )
2290 return;
2291
2292 b->yy_n_chars = 0;
2293
2294 /* We always need two end-of-buffer characters. The first causes
2295 * a transition to the end-of-buffer state. The second causes
2296 * a jam in that state.
2297 */
2298 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2299 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2300
2301 b->yy_buf_pos = &b->yy_ch_buf[0];
2302
2303 b->yy_at_bol = 1;
2304 b->yy_buffer_status = YY_BUFFER_NEW;
2305
2306 if ( b == YY_CURRENT_BUFFER )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002307 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002308}
2309
2310/** Pushes the new state onto the stack. The new state becomes
2311 * the current state. This function will allocate the stack
2312 * if necessary.
2313 * @param new_buffer The new state.
2314 * @param yyscanner The scanner object.
2315 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002316void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002317{
2318 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002319 if (new_buffer == NULL)
2320 return;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002321
Luc Ferrone49f1e92018-01-24 14:47:55 -05002322 yyensure_buffer_stack(yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002323
Luc Ferrone49f1e92018-01-24 14:47:55 -05002324 /* This block is copied from yy_switch_to_buffer. */
2325 if ( YY_CURRENT_BUFFER )
2326 {
2327 /* Flush out information for old buffer. */
2328 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2329 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2330 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002331 }
2332
2333 /* Only push if top exists. Otherwise, replace top. */
2334 if (YY_CURRENT_BUFFER)
2335 yyg->yy_buffer_stack_top++;
2336 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2337
Corentin Wallez168d5e82017-02-01 12:18:56 -08002338 /* copied from yy_switch_to_buffer. */
2339 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002340 yyg->yy_did_buffer_switch_on_eof = 1;
2341}
2342
Geoff Lang93561c32016-09-20 10:22:55 -04002343
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002344/** Removes and deletes the top of the stack, if present.
2345 * The next element becomes the new top.
2346 * @param yyscanner The scanner object.
2347 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002348void yypop_buffer_state (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002349{
2350 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2351 if (!YY_CURRENT_BUFFER)
2352 return;
2353
Corentin Wallez168d5e82017-02-01 12:18:56 -08002354 yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
Luc Ferrone49f1e92018-01-24 14:47:55 -05002355 YY_CURRENT_BUFFER_LVALUE = NULL;
2356 if (yyg->yy_buffer_stack_top > 0)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002357 --yyg->yy_buffer_stack_top;
2358
2359 if (YY_CURRENT_BUFFER) {
Corentin Wallez168d5e82017-02-01 12:18:56 -08002360 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002361 yyg->yy_did_buffer_switch_on_eof = 1;
2362 }
2363}
2364
Geoff Lang93561c32016-09-20 10:22:55 -04002365
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002366/* Allocates the stack if it does not exist.
2367 * Guarantees space for at least one push.
2368 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002369static void yyensure_buffer_stack (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002370{
shannonwoods@chromium.orgb0757162013-05-30 00:21:27 +00002371 yy_size_t num_to_alloc;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002372 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2373
2374 if (!yyg->yy_buffer_stack) {
2375
2376 /* First allocation is just for 2 elements, since we don't know if this
2377 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2378 * immediate realloc on the next call.
2379 */
Geoff Lang93561c32016-09-20 10:22:55 -04002380 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002381 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002382 (num_to_alloc * sizeof(struct yy_buffer_state*)
2383 , yyscanner);
2384 if ( ! yyg->yy_buffer_stack )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002385 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2386
2387
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002388 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
Corentin Wallez168d5e82017-02-01 12:18:56 -08002389
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002390 yyg->yy_buffer_stack_max = num_to_alloc;
2391 yyg->yy_buffer_stack_top = 0;
2392 return;
2393 }
2394
2395 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2396
2397 /* Increase the buffer to prepare for a possible push. */
Geoff Lang93561c32016-09-20 10:22:55 -04002398 yy_size_t grow_size = 8 /* arbitrary grow size */;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002399
2400 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002401 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002402 (yyg->yy_buffer_stack,
2403 num_to_alloc * sizeof(struct yy_buffer_state*)
2404 , yyscanner);
2405 if ( ! yyg->yy_buffer_stack )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002406 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002407
2408 /* zero only the new slots.*/
2409 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
2410 yyg->yy_buffer_stack_max = num_to_alloc;
2411 }
2412}
2413
Geoff Lang93561c32016-09-20 10:22:55 -04002414
2415
2416
2417
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002418/** Setup the input buffer state to scan directly from a user-specified character buffer.
2419 * @param base the character buffer
2420 * @param size the size in bytes of the character buffer
2421 * @param yyscanner The scanner object.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002422 * @return the newly allocated buffer state object.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002423 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002424YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002425{
2426 YY_BUFFER_STATE b;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002427
2428 if ( size < 2 ||
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002429 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2430 base[size-1] != YY_END_OF_BUFFER_CHAR )
2431 /* They forgot to leave room for the EOB's. */
Luc Ferrone49f1e92018-01-24 14:47:55 -05002432 return NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002433
Luc Ferrone49f1e92018-01-24 14:47:55 -05002434 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002435 if ( ! b )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002436 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002437
Corentin Wallez168d5e82017-02-01 12:18:56 -08002438 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002439 b->yy_buf_pos = b->yy_ch_buf = base;
2440 b->yy_is_our_buffer = 0;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002441 b->yy_input_file = NULL;
2442 b->yy_n_chars = b->yy_buf_size;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002443 b->yy_is_interactive = 0;
2444 b->yy_at_bol = 1;
2445 b->yy_fill_buffer = 0;
2446 b->yy_buffer_status = YY_BUFFER_NEW;
2447
Corentin Wallez168d5e82017-02-01 12:18:56 -08002448 yy_switch_to_buffer( b , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002449
2450 return b;
2451}
2452
Geoff Lang93561c32016-09-20 10:22:55 -04002453
2454
2455
Corentin Wallez168d5e82017-02-01 12:18:56 -08002456/** Setup the input buffer state to scan a string. The next call to yylex() will
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002457 * scan from a @e copy of @a str.
2458 * @param yystr a NUL-terminated string to scan
2459 * @param yyscanner The scanner object.
2460 * @return the newly allocated buffer state object.
2461 * @note If you want to scan bytes that may contain NUL values, then use
Corentin Wallez168d5e82017-02-01 12:18:56 -08002462 * yy_scan_bytes() instead.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002463 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002464YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002465{
Luc Ferrone49f1e92018-01-24 14:47:55 -05002466
2467 return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002468}
2469
Geoff Lang93561c32016-09-20 10:22:55 -04002470
2471
2472
Corentin Wallez168d5e82017-02-01 12:18:56 -08002473/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002474 * scan from a @e copy of @a bytes.
Zhenyao Mof1d723c2013-09-23 14:57:07 -04002475 * @param yybytes the byte buffer to scan
2476 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002477 * @param yyscanner The scanner object.
2478 * @return the newly allocated buffer state object.
2479 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002480YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002481{
2482 YY_BUFFER_STATE b;
2483 char *buf;
Zhenyao Mof1d723c2013-09-23 14:57:07 -04002484 yy_size_t n;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002485 int i;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002486
2487 /* Get memory for full buffer, including space for trailing EOB's. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002488 n = (yy_size_t) (_yybytes_len + 2);
2489 buf = (char *) yyalloc( n , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002490 if ( ! buf )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002491 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002492
Corentin Wallez168d5e82017-02-01 12:18:56 -08002493 for ( i = 0; i < _yybytes_len; ++i )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002494 buf[i] = yybytes[i];
2495
2496 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2497
Corentin Wallez168d5e82017-02-01 12:18:56 -08002498 b = yy_scan_buffer( buf, n , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002499 if ( ! b )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002500 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002501
2502 /* It's okay to grow etc. this buffer, and we should throw it
2503 * away when we're done.
2504 */
2505 b->yy_is_our_buffer = 1;
2506
2507 return b;
2508}
2509
Geoff Lang93561c32016-09-20 10:22:55 -04002510
2511
2512
2513
2514
2515
2516
2517
2518
2519
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002520#ifndef YY_EXIT_FAILURE
2521#define YY_EXIT_FAILURE 2
2522#endif
2523
Corentin Wallez168d5e82017-02-01 12:18:56 -08002524static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002525{
Geoff Lang93561c32016-09-20 10:22:55 -04002526 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2527 (void)yyg;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002528 fprintf( stderr, "%s\n", msg );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002529 exit( YY_EXIT_FAILURE );
2530}
2531
2532/* Redefine yyless() so it works in section 3 code. */
2533
2534#undef yyless
2535#define yyless(n) \
2536 do \
2537 { \
2538 /* Undo effects of setting up yytext. */ \
2539 int yyless_macro_arg = (n); \
2540 YY_LESS_LINENO(yyless_macro_arg);\
2541 yytext[yyleng] = yyg->yy_hold_char; \
2542 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2543 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2544 *yyg->yy_c_buf_p = '\0'; \
2545 yyleng = yyless_macro_arg; \
2546 } \
2547 while ( 0 )
2548
Geoff Lang93561c32016-09-20 10:22:55 -04002549
2550
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002551/* Accessor methods (get/set functions) to struct members. */
2552
Geoff Lang93561c32016-09-20 10:22:55 -04002553
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002554/** Get the user-defined data for this scanner.
2555 * @param yyscanner The scanner object.
2556 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002557YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002558{
2559 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2560 return yyextra;
2561}
2562
Geoff Lang93561c32016-09-20 10:22:55 -04002563
2564
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002565/** Get the current line number.
2566 * @param yyscanner The scanner object.
2567 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002568int yyget_lineno (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002569{
2570 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002571
Luc Ferrone49f1e92018-01-24 14:47:55 -05002572
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002573 if (! YY_CURRENT_BUFFER)
2574 return 0;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002575
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002576 return yylineno;
2577}
2578
Geoff Lang93561c32016-09-20 10:22:55 -04002579
2580
2581
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002582/** Get the current column number.
2583 * @param yyscanner The scanner object.
2584 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002585int yyget_column (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002586{
2587 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002588
Luc Ferrone49f1e92018-01-24 14:47:55 -05002589
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002590 if (! YY_CURRENT_BUFFER)
2591 return 0;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002592
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002593 return yycolumn;
2594}
2595
Geoff Lang93561c32016-09-20 10:22:55 -04002596
2597
2598
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002599/** Get the input stream.
2600 * @param yyscanner The scanner object.
2601 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002602FILE *yyget_in (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002603{
2604 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2605 return yyin;
2606}
2607
Geoff Lang93561c32016-09-20 10:22:55 -04002608
2609
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002610/** Get the output stream.
2611 * @param yyscanner The scanner object.
2612 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002613FILE *yyget_out (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002614{
2615 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2616 return yyout;
2617}
2618
Geoff Lang93561c32016-09-20 10:22:55 -04002619
2620
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002621/** Get the length of the current token.
2622 * @param yyscanner The scanner object.
2623 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002624int yyget_leng (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002625{
2626 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2627 return yyleng;
2628}
2629
Geoff Lang93561c32016-09-20 10:22:55 -04002630
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002631/** Get the current token.
2632 * @param yyscanner The scanner object.
2633 */
2634
Corentin Wallez168d5e82017-02-01 12:18:56 -08002635char *yyget_text (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002636{
2637 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2638 return yytext;
2639}
2640
Geoff Lang93561c32016-09-20 10:22:55 -04002641
2642
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002643/** Set the user-defined data. This data is never touched by the scanner.
2644 * @param user_defined The data to be associated with this scanner.
2645 * @param yyscanner The scanner object.
2646 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002647void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002648{
2649 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2650 yyextra = user_defined ;
2651}
2652
Geoff Lang93561c32016-09-20 10:22:55 -04002653
2654
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002655/** Set the current line number.
Geoff Lang93561c32016-09-20 10:22:55 -04002656 * @param _line_number line number
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002657 * @param yyscanner The scanner object.
2658 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002659void yyset_lineno (int _line_number , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002660{
2661 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2662
Luc Ferrone49f1e92018-01-24 14:47:55 -05002663
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002664 /* lineno is only valid if an input buffer exists. */
2665 if (! YY_CURRENT_BUFFER )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002666 YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
Luc Ferrone49f1e92018-01-24 14:47:55 -05002667
Geoff Lang93561c32016-09-20 10:22:55 -04002668 yylineno = _line_number;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002669}
2670
Geoff Lang93561c32016-09-20 10:22:55 -04002671
2672
2673
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002674/** Set the current column.
Geoff Lang93561c32016-09-20 10:22:55 -04002675 * @param _column_no column number
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002676 * @param yyscanner The scanner object.
2677 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002678void yyset_column (int _column_no , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002679{
2680 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2681
Luc Ferrone49f1e92018-01-24 14:47:55 -05002682
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002683 /* column is only valid if an input buffer exists. */
2684 if (! YY_CURRENT_BUFFER )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002685 YY_FATAL_ERROR( "yyset_column called with no buffer" );
Luc Ferrone49f1e92018-01-24 14:47:55 -05002686
Geoff Lang93561c32016-09-20 10:22:55 -04002687 yycolumn = _column_no;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002688}
2689
Geoff Lang93561c32016-09-20 10:22:55 -04002690
2691
2692
2693
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002694/** Set the input stream. This does not discard the current
2695 * input buffer.
Geoff Lang93561c32016-09-20 10:22:55 -04002696 * @param _in_str A readable stream.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002697 * @param yyscanner The scanner object.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002698 * @see yy_switch_to_buffer
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002699 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002700void yyset_in (FILE * _in_str , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002701{
2702 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04002703 yyin = _in_str ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002704}
2705
Geoff Lang93561c32016-09-20 10:22:55 -04002706
2707
Corentin Wallez168d5e82017-02-01 12:18:56 -08002708void yyset_out (FILE * _out_str , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002709{
2710 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04002711 yyout = _out_str ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002712}
2713
Geoff Lang93561c32016-09-20 10:22:55 -04002714
2715
2716
Corentin Wallez168d5e82017-02-01 12:18:56 -08002717int yyget_debug (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002718{
2719 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2720 return yy_flex_debug;
2721}
2722
Geoff Lang93561c32016-09-20 10:22:55 -04002723
2724
Corentin Wallez168d5e82017-02-01 12:18:56 -08002725void yyset_debug (int _bdebug , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002726{
2727 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04002728 yy_flex_debug = _bdebug ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002729}
2730
Geoff Lang93561c32016-09-20 10:22:55 -04002731
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002732/* Accessor methods for yylval and yylloc */
2733
Geoff Lang93561c32016-09-20 10:22:55 -04002734
Corentin Wallez168d5e82017-02-01 12:18:56 -08002735YYSTYPE * yyget_lval (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002736{
2737 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2738 return yylval;
2739}
2740
Geoff Lang93561c32016-09-20 10:22:55 -04002741
2742
Corentin Wallez168d5e82017-02-01 12:18:56 -08002743void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002744{
2745 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2746 yylval = yylval_param;
2747}
2748
Luc Ferrone49f1e92018-01-24 14:47:55 -05002749
2750
2751
Corentin Wallez168d5e82017-02-01 12:18:56 -08002752YYLTYPE *yyget_lloc (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002753{
2754 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2755 return yylloc;
2756}
Luc Ferrone49f1e92018-01-24 14:47:55 -05002757
Geoff Lang93561c32016-09-20 10:22:55 -04002758
Luc Ferrone49f1e92018-01-24 14:47:55 -05002759
Corentin Wallez168d5e82017-02-01 12:18:56 -08002760void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002761{
2762 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2763 yylloc = yylloc_param;
2764}
Luc Ferrone49f1e92018-01-24 14:47:55 -05002765
2766
2767
2768
Geoff Lang93561c32016-09-20 10:22:55 -04002769
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002770/* User-visible API */
2771
Corentin Wallez168d5e82017-02-01 12:18:56 -08002772/* yylex_init is special because it creates the scanner itself, so it is
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002773 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2774 * That's why we explicitly handle the declaration, instead of using our macros.
2775 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002776int yylex_init(yyscan_t* ptr_yy_globals)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002777{
Luc Ferrone49f1e92018-01-24 14:47:55 -05002778 if (ptr_yy_globals == NULL){
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002779 errno = EINVAL;
2780 return 1;
2781 }
2782
Luc Ferrone49f1e92018-01-24 14:47:55 -05002783 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002784
Luc Ferrone49f1e92018-01-24 14:47:55 -05002785 if (*ptr_yy_globals == NULL){
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002786 errno = ENOMEM;
2787 return 1;
2788 }
2789
2790 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2791 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2792
2793 return yy_init_globals ( *ptr_yy_globals );
2794}
2795
Geoff Lang93561c32016-09-20 10:22:55 -04002796
Corentin Wallez168d5e82017-02-01 12:18:56 -08002797/* yylex_init_extra has the same functionality as yylex_init, but follows the
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002798 * convention of taking the scanner as the last argument. Note however, that
2799 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2800 * is the reason, too, why this function also must handle its own declaration).
Corentin Wallez168d5e82017-02-01 12:18:56 -08002801 * The user defined value in the first argument will be available to yyalloc in
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002802 * the yyextra field.
2803 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002804int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002805{
2806 struct yyguts_t dummy_yyguts;
2807
Corentin Wallez168d5e82017-02-01 12:18:56 -08002808 yyset_extra (yy_user_defined, &dummy_yyguts);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002809
Luc Ferrone49f1e92018-01-24 14:47:55 -05002810 if (ptr_yy_globals == NULL){
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002811 errno = EINVAL;
2812 return 1;
2813 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08002814
2815 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2816
Luc Ferrone49f1e92018-01-24 14:47:55 -05002817 if (*ptr_yy_globals == NULL){
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002818 errno = ENOMEM;
2819 return 1;
2820 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08002821
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002822 /* By setting to 0xAA, we expose bugs in
2823 yy_init_globals. Leave at 0x00 for releases. */
2824 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
Corentin Wallez168d5e82017-02-01 12:18:56 -08002825
2826 yyset_extra (yy_user_defined, *ptr_yy_globals);
2827
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002828 return yy_init_globals ( *ptr_yy_globals );
2829}
2830
Geoff Lang93561c32016-09-20 10:22:55 -04002831
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002832static int yy_init_globals (yyscan_t yyscanner)
2833{
2834 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2835 /* Initialization is the same as for the non-reentrant scanner.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002836 * This function is called from yylex_destroy(), so don't allocate here.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002837 */
2838
Luc Ferrone49f1e92018-01-24 14:47:55 -05002839
2840 yyg->yy_buffer_stack = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002841 yyg->yy_buffer_stack_top = 0;
2842 yyg->yy_buffer_stack_max = 0;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002843 yyg->yy_c_buf_p = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002844 yyg->yy_init = 0;
2845 yyg->yy_start = 0;
2846
Geoff Lang93561c32016-09-20 10:22:55 -04002847
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002848 yyg->yy_start_stack_ptr = 0;
2849 yyg->yy_start_stack_depth = 0;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002850 yyg->yy_start_stack = NULL;
2851
2852
2853
2854
2855
Geoff Lang93561c32016-09-20 10:22:55 -04002856
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002857/* Defined in main.c */
2858#ifdef YY_STDINIT
2859 yyin = stdin;
2860 yyout = stdout;
2861#else
Luc Ferrone49f1e92018-01-24 14:47:55 -05002862 yyin = NULL;
2863 yyout = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002864#endif
2865
2866 /* For future reference: Set errno on error, since we are called by
Corentin Wallez168d5e82017-02-01 12:18:56 -08002867 * yylex_init()
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002868 */
2869 return 0;
2870}
2871
Geoff Lang93561c32016-09-20 10:22:55 -04002872
Corentin Wallez168d5e82017-02-01 12:18:56 -08002873/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2874int yylex_destroy (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002875{
2876 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2877
2878 /* Pop the buffer stack, destroying each element. */
2879 while(YY_CURRENT_BUFFER){
Corentin Wallez168d5e82017-02-01 12:18:56 -08002880 yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
Luc Ferrone49f1e92018-01-24 14:47:55 -05002881 YY_CURRENT_BUFFER_LVALUE = NULL;
2882 yypop_buffer_state(yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002883 }
2884
2885 /* Destroy the stack itself. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002886 yyfree(yyg->yy_buffer_stack , yyscanner);
Luc Ferrone49f1e92018-01-24 14:47:55 -05002887 yyg->yy_buffer_stack = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002888
Luc Ferrone49f1e92018-01-24 14:47:55 -05002889
2890 /* Destroy the start condition stack. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002891 yyfree( yyg->yy_start_stack , yyscanner );
Luc Ferrone49f1e92018-01-24 14:47:55 -05002892 yyg->yy_start_stack = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002893
Geoff Lang93561c32016-09-20 10:22:55 -04002894
Luc Ferrone49f1e92018-01-24 14:47:55 -05002895
2896
2897 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2898 * yylex() is called, initialization will occur. */
2899 yy_init_globals( yyscanner);
2900
2901 /* Destroy the main struct (reentrant only). */
2902 yyfree ( yyscanner , yyscanner );
2903 yyscanner = NULL;
2904 return 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002905}
2906
Geoff Lang93561c32016-09-20 10:22:55 -04002907
2908
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002909/*
2910 * Internal utility routines.
2911 */
2912
Geoff Lang93561c32016-09-20 10:22:55 -04002913
2914
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002915#ifndef yytext_ptr
Corentin Wallez168d5e82017-02-01 12:18:56 -08002916static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002917{
Geoff Lang93561c32016-09-20 10:22:55 -04002918 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2919 (void)yyg;
2920
2921 int i;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002922 for ( i = 0; i < n; ++i )
2923 s1[i] = s2[i];
2924}
2925#endif
2926
Geoff Lang93561c32016-09-20 10:22:55 -04002927
2928
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002929#ifdef YY_NEED_STRLEN
Corentin Wallez168d5e82017-02-01 12:18:56 -08002930static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002931{
Geoff Lang93561c32016-09-20 10:22:55 -04002932 int n;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002933 for ( n = 0; s[n]; ++n )
2934 ;
2935
2936 return n;
2937}
2938#endif
2939
Geoff Lang93561c32016-09-20 10:22:55 -04002940
2941
Corentin Wallez168d5e82017-02-01 12:18:56 -08002942void *yyalloc (yy_size_t size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002943{
Geoff Lang93561c32016-09-20 10:22:55 -04002944 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2945 (void)yyg;
2946 return malloc(size);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002947}
2948
Geoff Lang93561c32016-09-20 10:22:55 -04002949
2950
Corentin Wallez168d5e82017-02-01 12:18:56 -08002951void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002952{
Geoff Lang93561c32016-09-20 10:22:55 -04002953 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2954 (void)yyg;
2955
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002956 /* The cast to (char *) in the following accommodates both
2957 * implementations that use char* generic pointers, and those
2958 * that use void* generic pointers. It works with the latter
2959 * because both ANSI C and C++ allow castless assignment from
2960 * any pointer type to void*, and deal with argument conversions
2961 * as though doing an assignment.
2962 */
Geoff Lang93561c32016-09-20 10:22:55 -04002963 return realloc(ptr, size);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002964}
2965
Geoff Lang93561c32016-09-20 10:22:55 -04002966
2967
Corentin Wallez168d5e82017-02-01 12:18:56 -08002968void yyfree (void * ptr , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002969{
Geoff Lang93561c32016-09-20 10:22:55 -04002970 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2971 (void)yyg;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002972 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002973}
2974
Geoff Lang93561c32016-09-20 10:22:55 -04002975
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002976#define YYTABLES_NAME "yytables"
2977
Geoff Lang93561c32016-09-20 10:22:55 -04002978
2979
2980
2981
2982
2983
2984
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002985namespace pp {
2986
Corentin Wallez054f7ed2016-09-20 17:15:59 -04002987Tokenizer::Tokenizer(Diagnostics *diagnostics) : mHandle(nullptr), mMaxTokenSize(256)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002988{
alokp@chromium.org2c958ee2012-05-17 20:35:42 +00002989 mContext.diagnostics = diagnostics;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002990}
2991
2992Tokenizer::~Tokenizer()
2993{
2994 destroyScanner();
2995}
2996
Zhenyao Mod526f982014-05-13 14:51:19 -07002997bool Tokenizer::init(size_t count, const char * const string[], const int length[])
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002998{
Zhenyao Mod526f982014-05-13 14:51:19 -07002999 if ((count > 0) && (string == 0))
3000 return false;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003001
3002 mContext.input = Input(count, string, length);
3003 return initScanner();
3004}
3005
alokp@chromium.org46aa13d2012-06-15 15:40:27 +00003006void Tokenizer::setFileNumber(int file)
3007{
3008 // We use column number as file number.
3009 // See macro yyfileno.
Corentin Wallez168d5e82017-02-01 12:18:56 -08003010 yyset_column(file, mHandle);
alokp@chromium.org46aa13d2012-06-15 15:40:27 +00003011}
3012
3013void Tokenizer::setLineNumber(int line)
3014{
Corentin Wallez168d5e82017-02-01 12:18:56 -08003015 yyset_lineno(line, mHandle);
alokp@chromium.org46aa13d2012-06-15 15:40:27 +00003016}
3017
Jamie Madill5508f392014-02-20 13:31:36 -05003018void Tokenizer::setMaxTokenSize(size_t maxTokenSize)
3019{
3020 mMaxTokenSize = maxTokenSize;
3021}
3022
Zhenyao Mod526f982014-05-13 14:51:19 -07003023void Tokenizer::lex(Token *token)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003024{
Corentin Wallezdc0fa462017-02-01 14:44:43 -05003025 int tokenType = yylex(&token->text, &token->location, mHandle);
3026
3027 if (tokenType == Token::GOT_ERROR)
3028 {
3029 mContext.diagnostics->report(Diagnostics::PP_TOKENIZER_ERROR, token->location, token->text);
3030 token->type = Token::LAST;
3031 }
3032 else
3033 {
3034 token->type = tokenType;
3035 }
3036
Jamie Madill5508f392014-02-20 13:31:36 -05003037 if (token->text.size() > mMaxTokenSize)
alokp@chromium.orgc022c3a2012-07-09 15:56:42 +00003038 {
Shannon Woods7f2d7942013-11-19 15:07:58 -05003039 mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
alokp@chromium.orgc022c3a2012-07-09 15:56:42 +00003040 token->location, token->text);
Jamie Madill5508f392014-02-20 13:31:36 -05003041 token->text.erase(mMaxTokenSize);
alokp@chromium.orgc022c3a2012-07-09 15:56:42 +00003042 }
3043
alokp@chromium.org7fc38dd2012-06-14 18:23:23 +00003044 token->flags = 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003045
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00003046 token->setAtStartOfLine(mContext.lineStart);
3047 mContext.lineStart = token->type == '\n';
3048
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003049 token->setHasLeadingSpace(mContext.leadingSpace);
3050 mContext.leadingSpace = false;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003051}
3052
3053bool Tokenizer::initScanner()
3054{
Corentin Wallez168d5e82017-02-01 12:18:56 -08003055 if ((mHandle == nullptr) && yylex_init_extra(&mContext, &mHandle))
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003056 return false;
3057
Corentin Wallez168d5e82017-02-01 12:18:56 -08003058 yyrestart(0, mHandle);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003059 return true;
3060}
3061
3062void Tokenizer::destroyScanner()
3063{
Corentin Wallez054f7ed2016-09-20 17:15:59 -04003064 if (mHandle == nullptr)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003065 return;
3066
Corentin Wallez168d5e82017-02-01 12:18:56 -08003067 yylex_destroy(mHandle);
Corentin Wallez054f7ed2016-09-20 17:15:59 -04003068 mHandle = nullptr;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003069}
3070
3071} // namespace pp
3072
Geoff Lang93561c32016-09-20 10:22:55 -04003073