blob: d8a9b9a123991a554933b1f97255fde18f258536 [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
914
Jamie Madill2dc8bf82015-04-30 15:56:52 -0400915// Workaround for flex using the register keyword, deprecated in C++11.
916#ifdef __cplusplus
917#if __cplusplus > 199711L
918#define register
919#endif
920#endif
921
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000922typedef std::string YYSTYPE;
alokp@chromium.org2c958ee2012-05-17 20:35:42 +0000923typedef pp::SourceLocation YYLTYPE;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000924
925// Use the unused yycolumn variable to track file (string) number.
926#define yyfileno yycolumn
927
928#define YY_USER_INIT \
929 do { \
930 yyfileno = 0; \
931 yylineno = 1; \
932 yyextra->leadingSpace = false; \
933 yyextra->lineStart = true; \
934 } while(0);
935
alokp@chromium.org19d7aa62012-05-31 17:34:05 +0000936#define YY_USER_ACTION \
937 do \
938 { \
939 pp::Input* input = &yyextra->input; \
940 pp::Input::Location* scanLoc = &yyextra->scanLoc; \
941 while ((scanLoc->sIndex < input->count()) && \
942 (scanLoc->cIndex >= input->length(scanLoc->sIndex))) \
943 { \
944 scanLoc->cIndex -= input->length(scanLoc->sIndex++); \
945 ++yyfileno; yylineno = 1; \
946 } \
947 yylloc->file = yyfileno; \
948 yylloc->line = yylineno; \
949 scanLoc->cIndex += yyleng; \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000950 } while(0);
951
952#define YY_INPUT(buf, result, maxSize) \
Olli Etuaho26e355b2015-08-14 14:16:19 +0300953 result = yyextra->input.read(buf, maxSize, &yylineno);
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000954
Geoff Lang93561c32016-09-20 10:22:55 -0400955
956
957
958
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000959#define INITIAL 0
960#define COMMENT 1
961
Geoff Lang93561c32016-09-20 10:22:55 -0400962
963
964
965
966
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000967#define YY_EXTRA_TYPE pp::Tokenizer::Context*
968
Geoff Lang93561c32016-09-20 10:22:55 -0400969
970
971
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000972/* Holds the entire state of the reentrant scanner. */
973struct yyguts_t
974 {
975
976 /* User-defined. Not touched by flex. */
977 YY_EXTRA_TYPE yyextra_r;
978
979 /* The rest are the same as the globals declared in the non-reentrant scanner. */
980 FILE *yyin_r, *yyout_r;
981 size_t yy_buffer_stack_top; /**< index of top of stack. */
982 size_t yy_buffer_stack_max; /**< capacity of stack. */
983 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
984 char yy_hold_char;
Geoff Lang93561c32016-09-20 10:22:55 -0400985 int yy_n_chars;
986 int yyleng_r;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000987 char *yy_c_buf_p;
988 int yy_init;
989 int yy_start;
990 int yy_did_buffer_switch_on_eof;
991 int yy_start_stack_ptr;
992 int yy_start_stack_depth;
993 int *yy_start_stack;
994 yy_state_type yy_last_accepting_state;
995 char* yy_last_accepting_cpos;
996
997 int yylineno_r;
998 int yy_flex_debug_r;
999
Geoff Lang93561c32016-09-20 10:22:55 -04001000
1001
1002
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001003 char *yytext_r;
1004 int yy_more_flag;
1005 int yy_more_len;
1006
Geoff Lang93561c32016-09-20 10:22:55 -04001007
1008
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001009 YYSTYPE * yylval_r;
1010
Geoff Lang93561c32016-09-20 10:22:55 -04001011
1012
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001013 YYLTYPE * yylloc_r;
1014
Geoff Lang93561c32016-09-20 10:22:55 -04001015
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001016 }; /* end struct yyguts_t */
1017
Geoff Lang93561c32016-09-20 10:22:55 -04001018
1019
1020
Corentin Wallez168d5e82017-02-01 12:18:56 -08001021static int yy_init_globals ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001022
Luc Ferrone49f1e92018-01-24 14:47:55 -05001023
1024
1025
1026
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001027 /* This must go here because YYSTYPE and YYLTYPE are included
1028 * from bison output in section 1.*/
1029 # define yylval yyg->yylval_r
Luc Ferrone49f1e92018-01-24 14:47:55 -05001030
Geoff Lang93561c32016-09-20 10:22:55 -04001031
Luc Ferrone49f1e92018-01-24 14:47:55 -05001032
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001033 # define yylloc yyg->yylloc_r
Luc Ferrone49f1e92018-01-24 14:47:55 -05001034
1035
Geoff Lang93561c32016-09-20 10:22:55 -04001036
Corentin Wallez168d5e82017-02-01 12:18:56 -08001037int yylex_init (yyscan_t* scanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001038
Corentin Wallez168d5e82017-02-01 12:18:56 -08001039int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001040
Geoff Lang93561c32016-09-20 10:22:55 -04001041
1042
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001043/* Accessor methods to globals.
1044 These are made visible to non-reentrant scanners for convenience. */
1045
Geoff Lang93561c32016-09-20 10:22:55 -04001046
Corentin Wallez168d5e82017-02-01 12:18:56 -08001047int yylex_destroy ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001048
Geoff Lang93561c32016-09-20 10:22:55 -04001049
1050
Corentin Wallez168d5e82017-02-01 12:18:56 -08001051int yyget_debug ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001052
Geoff Lang93561c32016-09-20 10:22:55 -04001053
1054
Corentin Wallez168d5e82017-02-01 12:18:56 -08001055void yyset_debug ( int debug_flag , yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001056
Geoff Lang93561c32016-09-20 10:22:55 -04001057
1058
Corentin Wallez168d5e82017-02-01 12:18:56 -08001059YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001060
Geoff Lang93561c32016-09-20 10:22:55 -04001061
1062
Corentin Wallez168d5e82017-02-01 12:18:56 -08001063void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001064
Geoff Lang93561c32016-09-20 10:22:55 -04001065
1066
Corentin Wallez168d5e82017-02-01 12:18:56 -08001067FILE *yyget_in ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001068
Geoff Lang93561c32016-09-20 10:22:55 -04001069
1070
Corentin Wallez168d5e82017-02-01 12:18:56 -08001071void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001072
1073
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001074
Corentin Wallez168d5e82017-02-01 12:18:56 -08001075FILE *yyget_out ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001076
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001077
Geoff Lang93561c32016-09-20 10:22:55 -04001078
Corentin Wallez168d5e82017-02-01 12:18:56 -08001079void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001080
1081
1082
Corentin Wallez168d5e82017-02-01 12:18:56 -08001083 int yyget_leng ( yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001084
1085
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001086
Corentin Wallez168d5e82017-02-01 12:18:56 -08001087char *yyget_text ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001088
Geoff Lang93561c32016-09-20 10:22:55 -04001089
1090
Corentin Wallez168d5e82017-02-01 12:18:56 -08001091int yyget_lineno ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001092
Geoff Lang93561c32016-09-20 10:22:55 -04001093
1094
Corentin Wallez168d5e82017-02-01 12:18:56 -08001095void yyset_lineno ( int _line_number , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001096
1097
1098
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001099
Corentin Wallez168d5e82017-02-01 12:18:56 -08001100int yyget_column ( yyscan_t yyscanner );
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001101
Geoff Lang93561c32016-09-20 10:22:55 -04001102
1103
1104
1105
Corentin Wallez168d5e82017-02-01 12:18:56 -08001106void yyset_column ( int _column_no , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001107
1108
1109
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001110
Corentin Wallez168d5e82017-02-01 12:18:56 -08001111YYSTYPE * yyget_lval ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001112
Geoff Lang93561c32016-09-20 10:22:55 -04001113
Corentin Wallez168d5e82017-02-01 12:18:56 -08001114void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001115
Geoff Lang93561c32016-09-20 10:22:55 -04001116
Luc Ferrone49f1e92018-01-24 14:47:55 -05001117
1118 YYLTYPE *yyget_lloc ( yyscan_t yyscanner );
1119
1120
1121
Corentin Wallez168d5e82017-02-01 12:18:56 -08001122 void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner );
Luc Ferrone49f1e92018-01-24 14:47:55 -05001123
1124
Geoff Lang93561c32016-09-20 10:22:55 -04001125
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001126/* Macros after this point can all be overridden by user definitions in
1127 * section 1.
1128 */
1129
1130#ifndef YY_SKIP_YYWRAP
1131#ifdef __cplusplus
Corentin Wallez168d5e82017-02-01 12:18:56 -08001132extern "C" int yywrap ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001133#else
Corentin Wallez168d5e82017-02-01 12:18:56 -08001134extern int yywrap ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001135#endif
1136#endif
1137
Geoff Lang93561c32016-09-20 10:22:55 -04001138#ifndef YY_NO_UNPUT
Luc Ferrone49f1e92018-01-24 14:47:55 -05001139
Geoff Lang93561c32016-09-20 10:22:55 -04001140#endif
1141
1142
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001143#ifndef yytext_ptr
Corentin Wallez168d5e82017-02-01 12:18:56 -08001144static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001145#endif
1146
1147#ifdef YY_NEED_STRLEN
Corentin Wallez168d5e82017-02-01 12:18:56 -08001148static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001149#endif
1150
1151#ifndef YY_NO_INPUT
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001152#ifdef __cplusplus
Corentin Wallez168d5e82017-02-01 12:18:56 -08001153static int yyinput ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001154#else
Corentin Wallez168d5e82017-02-01 12:18:56 -08001155static int input ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001156#endif
1157
1158#endif
1159
Geoff Lang93561c32016-09-20 10:22:55 -04001160
1161
1162
1163
1164
1165
1166
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001167/* Amount of stuff to slurp up with each read. */
1168#ifndef YY_READ_BUF_SIZE
Geoff Lang93561c32016-09-20 10:22:55 -04001169#ifdef __ia64__
1170/* On IA-64, the buffer size is 16k, not 8k */
1171#define YY_READ_BUF_SIZE 16384
1172#else
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001173#define YY_READ_BUF_SIZE 8192
Geoff Lang93561c32016-09-20 10:22:55 -04001174#endif /* __ia64__ */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001175#endif
1176
Geoff Lang93561c32016-09-20 10:22:55 -04001177
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001178/* Copy whatever the last rule matched to the standard output. */
1179#ifndef ECHO
1180/* This used to be an fputs(), but since the string might contain NUL's,
1181 * we now use fwrite().
1182 */
Geoff Lang93561c32016-09-20 10:22:55 -04001183#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001184#endif
1185
Geoff Lang93561c32016-09-20 10:22:55 -04001186
1187
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001188/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1189 * is returned in "result".
1190 */
1191#ifndef YY_INPUT
1192#define YY_INPUT(buf,result,max_size) \
1193 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1194 { \
1195 int c = '*'; \
Corentin Wallez168d5e82017-02-01 12:18:56 -08001196 int n; \
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001197 for ( n = 0; n < max_size && \
1198 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1199 buf[n] = (char) c; \
1200 if ( c == '\n' ) \
1201 buf[n++] = (char) c; \
1202 if ( c == EOF && ferror( yyin ) ) \
1203 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1204 result = n; \
1205 } \
1206 else \
1207 { \
1208 errno=0; \
Corentin Wallez168d5e82017-02-01 12:18:56 -08001209 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001210 { \
1211 if( errno != EINTR) \
1212 { \
1213 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1214 break; \
1215 } \
1216 errno=0; \
1217 clearerr(yyin); \
1218 } \
1219 }\
1220\
1221
1222#endif
1223
Geoff Lang93561c32016-09-20 10:22:55 -04001224
1225
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001226/* No semi-colon after return; correct usage is to write "yyterminate();" -
1227 * we don't want an extra ';' after the "return" because that will cause
1228 * some compilers to complain about unreachable statements.
1229 */
1230#ifndef yyterminate
1231#define yyterminate() return YY_NULL
1232#endif
1233
Geoff Lang93561c32016-09-20 10:22:55 -04001234
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001235/* Number of entries by which start-condition stack grows. */
1236#ifndef YY_START_STACK_INCR
1237#define YY_START_STACK_INCR 25
1238#endif
1239
Geoff Lang93561c32016-09-20 10:22:55 -04001240
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001241/* Report a fatal error. */
1242#ifndef YY_FATAL_ERROR
1243#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
1244#endif
1245
Geoff Lang93561c32016-09-20 10:22:55 -04001246
1247
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001248/* end tables serialization structures and prototypes */
1249
Geoff Lang93561c32016-09-20 10:22:55 -04001250
1251
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001252/* Default declaration of generated scanner - a define so the user can
1253 * easily add parameters.
1254 */
1255#ifndef YY_DECL
1256#define YY_DECL_IS_OURS 1
1257
Luc Ferrone49f1e92018-01-24 14:47:55 -05001258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
Corentin Wallez168d5e82017-02-01 12:18:56 -08001274extern int yylex \
1275 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001276
Corentin Wallez168d5e82017-02-01 12:18:56 -08001277#define YY_DECL int yylex \
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001278 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
1279#endif /* !YY_DECL */
1280
Geoff Lang93561c32016-09-20 10:22:55 -04001281
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001282/* Code executed at the beginning of each rule, after yytext and yyleng
1283 * have been set up.
1284 */
1285#ifndef YY_USER_ACTION
1286#define YY_USER_ACTION
1287#endif
1288
Geoff Lang93561c32016-09-20 10:22:55 -04001289
1290
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001291/* Code executed at the end of each rule. */
1292#ifndef YY_BREAK
Geoff Lang93561c32016-09-20 10:22:55 -04001293#define YY_BREAK /*LINTED*/break;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001294#endif
1295
Geoff Lang93561c32016-09-20 10:22:55 -04001296
1297
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001298#define YY_RULE_SETUP \
1299 YY_USER_ACTION
1300
Geoff Lang93561c32016-09-20 10:22:55 -04001301
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001302/** The main scanner function which does all the work.
1303 */
1304YY_DECL
1305{
Geoff Lang93561c32016-09-20 10:22:55 -04001306 yy_state_type yy_current_state;
1307 char *yy_cp, *yy_bp;
1308 int yy_act;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001309 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1310
Geoff Lang93561c32016-09-20 10:22:55 -04001311
1312
1313
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001314 yylval = yylval_param;
1315
Geoff Lang93561c32016-09-20 10:22:55 -04001316
1317
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001318 yylloc = yylloc_param;
1319
Geoff Lang93561c32016-09-20 10:22:55 -04001320
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001321 if ( !yyg->yy_init )
1322 {
1323 yyg->yy_init = 1;
1324
1325#ifdef YY_USER_INIT
1326 YY_USER_INIT;
1327#endif
1328
Geoff Lang93561c32016-09-20 10:22:55 -04001329
1330
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001331 if ( ! yyg->yy_start )
1332 yyg->yy_start = 1; /* first start state */
1333
1334 if ( ! yyin )
1335 yyin = stdin;
1336
1337 if ( ! yyout )
1338 yyout = stdout;
1339
1340 if ( ! YY_CURRENT_BUFFER ) {
Corentin Wallez168d5e82017-02-01 12:18:56 -08001341 yyensure_buffer_stack (yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001342 YY_CURRENT_BUFFER_LVALUE =
Corentin Wallez168d5e82017-02-01 12:18:56 -08001343 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001344 }
1345
Corentin Wallez168d5e82017-02-01 12:18:56 -08001346 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001347 }
1348
Jamie Madill185de882014-12-22 15:17:52 -05001349 {
1350
Geoff Lang93561c32016-09-20 10:22:55 -04001351
Jamie Madill185de882014-12-22 15:17:52 -05001352 /* Line comment */
1353
Geoff Lang93561c32016-09-20 10:22:55 -04001354 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001355 {
1356 yy_cp = yyg->yy_c_buf_p;
1357
1358 /* Support of yytext. */
1359 *yy_cp = yyg->yy_hold_char;
1360
1361 /* yy_bp points to the position in yy_ch_buf of the start of
1362 * the current run.
1363 */
1364 yy_bp = yy_cp;
1365
1366 yy_current_state = yyg->yy_start;
1367yy_match:
1368 do
1369 {
Geoff Lang93561c32016-09-20 10:22:55 -04001370 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001371 if ( yy_accept[yy_current_state] )
1372 {
1373 yyg->yy_last_accepting_state = yy_current_state;
1374 yyg->yy_last_accepting_cpos = yy_cp;
1375 }
1376 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1377 {
1378 yy_current_state = (int) yy_def[yy_current_state];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001379 if ( yy_current_state >= 95 )
Corentin Wallez168d5e82017-02-01 12:18:56 -08001380 yy_c = yy_meta[yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001381 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08001382 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001383 ++yy_cp;
1384 }
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001385 while ( yy_current_state != 94 );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001386 yy_cp = yyg->yy_last_accepting_cpos;
1387 yy_current_state = yyg->yy_last_accepting_state;
1388
1389yy_find_action:
1390 yy_act = yy_accept[yy_current_state];
1391
1392 YY_DO_BEFORE_ACTION;
1393
Geoff Lang93561c32016-09-20 10:22:55 -04001394
1395
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001396do_action: /* This label is used only to access EOF actions. */
1397
Geoff Lang93561c32016-09-20 10:22:55 -04001398
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001399 switch ( yy_act )
1400 { /* beginning of action switch */
1401 case 0: /* must back up */
1402 /* undo the effects of YY_DO_BEFORE_ACTION */
1403 *yy_cp = yyg->yy_hold_char;
1404 yy_cp = yyg->yy_last_accepting_cpos;
1405 yy_current_state = yyg->yy_last_accepting_state;
1406 goto yy_find_action;
1407
1408case 1:
1409YY_RULE_SETUP
1410
1411 YY_BREAK
1412/* Block comment */
1413/* Line breaks are just counted - not returned. */
Jamie Madillb96687d2015-04-30 15:56:51 -04001414/* The comment is replaced by a single space. */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001415case 2:
1416YY_RULE_SETUP
1417{ BEGIN(COMMENT); }
1418 YY_BREAK
1419case 3:
1420YY_RULE_SETUP
1421
1422 YY_BREAK
1423case 4:
1424YY_RULE_SETUP
1425
1426 YY_BREAK
1427case 5:
1428/* rule 5 can match eol */
1429YY_RULE_SETUP
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001430{
1431 if (yylineno == INT_MAX)
1432 {
1433 *yylval = "Integer overflow on line number";
1434 return pp::Token::GOT_ERROR;
1435 }
1436 ++yylineno;
1437}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001438 YY_BREAK
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001439case 6:
1440YY_RULE_SETUP
alokp@chromium.org2c958ee2012-05-17 20:35:42 +00001441{
1442 yyextra->leadingSpace = true;
1443 BEGIN(INITIAL);
1444}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001445 YY_BREAK
1446case 7:
1447YY_RULE_SETUP
1448{
1449 // # is only valid at start of line for preprocessor directives.
alokp@chromium.org432d6fc2012-06-27 22:13:21 +00001450 yylval->assign(1, yytext[0]);
1451 return yyextra->lineStart ? pp::Token::PP_HASH : pp::Token::PP_OTHER;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001452}
1453 YY_BREAK
1454case 8:
1455YY_RULE_SETUP
1456{
1457 yylval->assign(yytext, yyleng);
1458 return pp::Token::IDENTIFIER;
1459}
1460 YY_BREAK
1461case 9:
1462YY_RULE_SETUP
1463{
1464 yylval->assign(yytext, yyleng);
1465 return pp::Token::CONST_INT;
1466}
1467 YY_BREAK
1468case 10:
1469YY_RULE_SETUP
1470{
1471 yylval->assign(yytext, yyleng);
1472 return pp::Token::CONST_FLOAT;
1473}
1474 YY_BREAK
1475/* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */
1476/* Rule to catch all invalid integers and floats. */
1477case 11:
1478YY_RULE_SETUP
1479{
alokp@chromium.org432d6fc2012-06-27 22:13:21 +00001480 yylval->assign(yytext, yyleng);
1481 return pp::Token::PP_NUMBER;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001482}
1483 YY_BREAK
1484case 12:
1485YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001486{
1487 yylval->assign(yytext, yyleng);
1488 return pp::Token::OP_INC;
1489}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001490 YY_BREAK
1491case 13:
1492YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001493{
1494 yylval->assign(yytext, yyleng);
1495 return pp::Token::OP_DEC;
1496}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001497 YY_BREAK
1498case 14:
1499YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001500{
1501 yylval->assign(yytext, yyleng);
1502 return pp::Token::OP_LEFT;
1503}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001504 YY_BREAK
1505case 15:
1506YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001507{
1508 yylval->assign(yytext, yyleng);
1509 return pp::Token::OP_RIGHT;
1510}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001511 YY_BREAK
1512case 16:
1513YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001514{
1515 yylval->assign(yytext, yyleng);
1516 return pp::Token::OP_LE;
1517}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001518 YY_BREAK
1519case 17:
1520YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001521{
1522 yylval->assign(yytext, yyleng);
1523 return pp::Token::OP_GE;
1524}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001525 YY_BREAK
1526case 18:
1527YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001528{
1529 yylval->assign(yytext, yyleng);
1530 return pp::Token::OP_EQ;
1531}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001532 YY_BREAK
1533case 19:
1534YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001535{
1536 yylval->assign(yytext, yyleng);
1537 return pp::Token::OP_NE;
1538}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001539 YY_BREAK
1540case 20:
1541YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001542{
1543 yylval->assign(yytext, yyleng);
1544 return pp::Token::OP_AND;
1545}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001546 YY_BREAK
1547case 21:
1548YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001549{
1550 yylval->assign(yytext, yyleng);
1551 return pp::Token::OP_XOR;
1552}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001553 YY_BREAK
1554case 22:
1555YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001556{
1557 yylval->assign(yytext, yyleng);
1558 return pp::Token::OP_OR;
1559}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001560 YY_BREAK
1561case 23:
1562YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001563{
1564 yylval->assign(yytext, yyleng);
1565 return pp::Token::OP_ADD_ASSIGN;
1566}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001567 YY_BREAK
1568case 24:
1569YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001570{
1571 yylval->assign(yytext, yyleng);
1572 return pp::Token::OP_SUB_ASSIGN;
1573}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001574 YY_BREAK
1575case 25:
1576YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001577{
1578 yylval->assign(yytext, yyleng);
1579 return pp::Token::OP_MUL_ASSIGN;
1580}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001581 YY_BREAK
1582case 26:
1583YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001584{
1585 yylval->assign(yytext, yyleng);
1586 return pp::Token::OP_DIV_ASSIGN;
1587}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001588 YY_BREAK
1589case 27:
1590YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001591{
1592 yylval->assign(yytext, yyleng);
1593 return pp::Token::OP_MOD_ASSIGN;
1594}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001595 YY_BREAK
1596case 28:
1597YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001598{
1599 yylval->assign(yytext, yyleng);
1600 return pp::Token::OP_LEFT_ASSIGN;
1601}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001602 YY_BREAK
1603case 29:
1604YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001605{
1606 yylval->assign(yytext, yyleng);
1607 return pp::Token::OP_RIGHT_ASSIGN;
1608}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001609 YY_BREAK
1610case 30:
1611YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001612{
1613 yylval->assign(yytext, yyleng);
1614 return pp::Token::OP_AND_ASSIGN;
1615}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001616 YY_BREAK
1617case 31:
1618YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001619{
1620 yylval->assign(yytext, yyleng);
1621 return pp::Token::OP_XOR_ASSIGN;
1622}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001623 YY_BREAK
1624case 32:
1625YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001626{
1627 yylval->assign(yytext, yyleng);
1628 return pp::Token::OP_OR_ASSIGN;
1629}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001630 YY_BREAK
1631case 33:
1632YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001633{
1634 yylval->assign(1, yytext[0]);
1635 return yytext[0];
1636}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001637 YY_BREAK
1638case 34:
1639YY_RULE_SETUP
1640{ yyextra->leadingSpace = true; }
1641 YY_BREAK
1642case 35:
1643/* rule 35 can match eol */
1644YY_RULE_SETUP
1645{
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001646 if (yylineno == INT_MAX)
1647 {
1648 *yylval = "Integer overflow on line number";
1649 return pp::Token::GOT_ERROR;
1650 }
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001651 ++yylineno;
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001652 yylval->assign(1, '\n');
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001653 return '\n';
1654}
1655 YY_BREAK
1656case 36:
1657YY_RULE_SETUP
1658{
alokp@chromium.org432d6fc2012-06-27 22:13:21 +00001659 yylval->assign(1, yytext[0]);
1660 return pp::Token::PP_OTHER;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001661}
1662 YY_BREAK
1663case YY_STATE_EOF(INITIAL):
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001664case YY_STATE_EOF(COMMENT):
1665{
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00001666 // YY_USER_ACTION is not invoked for handling EOF.
1667 // Set the location for EOF token manually.
1668 pp::Input* input = &yyextra->input;
1669 pp::Input::Location* scanLoc = &yyextra->scanLoc;
shannon.woods@transgaming.comd64b3da2013-02-28 23:19:26 +00001670 yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00001671 if (scanLoc->sIndex != sIndexMax)
1672 {
1673 // We can only reach here if there are empty strings at the
1674 // end of the input.
1675 scanLoc->sIndex = sIndexMax; scanLoc->cIndex = 0;
shannon.woods@transgaming.comd64b3da2013-02-28 23:19:26 +00001676 // FIXME: this is not 64-bit clean.
1677 yyfileno = static_cast<int>(sIndexMax); yylineno = 1;
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00001678 }
1679 yylloc->file = yyfileno;
1680 yylloc->line = yylineno;
1681 yylval->clear();
1682
Corentin Wallezd78e33a2017-10-30 12:33:52 -04001683 // Line number overflows fake EOFs to exit early, check for this case.
1684 if (yylineno == INT_MAX)
1685 {
1686 yyextra->diagnostics->report(pp::Diagnostics::PP_TOKENIZER_ERROR,
1687 pp::SourceLocation(yyfileno, yylineno),
1688 "Integer overflow on line number");
1689 }
1690 else if (YY_START == COMMENT)
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001691 {
Shannon Woods7f2d7942013-11-19 15:07:58 -05001692 yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001693 pp::SourceLocation(yyfileno, yylineno),
Corentin Wallezd78e33a2017-10-30 12:33:52 -04001694 "EOF while in a comment");
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001695 }
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001696 yyterminate();
1697}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001698 YY_BREAK
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001699case 37:
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001700YY_RULE_SETUP
1701ECHO;
1702 YY_BREAK
1703
1704 case YY_END_OF_BUFFER:
1705 {
1706 /* Amount of text matched not including the EOB char. */
1707 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1708
1709 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1710 *yy_cp = yyg->yy_hold_char;
1711 YY_RESTORE_YY_MORE_OFFSET
1712
1713 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1714 {
1715 /* We're scanning a new file or input source. It's
1716 * possible that this happened because the user
1717 * just pointed yyin at a new source and called
Corentin Wallez168d5e82017-02-01 12:18:56 -08001718 * yylex(). If so, then we have to assure
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001719 * consistency between YY_CURRENT_BUFFER and our
1720 * globals. Here is the right place to do so, because
1721 * this is the first action (other than possibly a
1722 * back-up) that will match for the new input source.
1723 */
1724 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1725 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1726 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1727 }
1728
1729 /* Note that here we test for yy_c_buf_p "<=" to the position
1730 * of the first EOB in the buffer, since yy_c_buf_p will
1731 * already have been incremented past the NUL character
1732 * (since all states make transitions on EOB to the
1733 * end-of-buffer state). Contrast this with the test
1734 * in input().
1735 */
1736 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1737 { /* This was really a NUL. */
1738 yy_state_type yy_next_state;
1739
1740 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1741
1742 yy_current_state = yy_get_previous_state( yyscanner );
1743
1744 /* Okay, we're now positioned to make the NUL
1745 * transition. We couldn't have
1746 * yy_get_previous_state() go ahead and do it
1747 * for us because it doesn't know how to deal
1748 * with the possibility of jamming (and we don't
1749 * want to build jamming into it because then it
1750 * will run more slowly).
1751 */
1752
1753 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1754
1755 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1756
1757 if ( yy_next_state )
1758 {
1759 /* Consume the NUL. */
1760 yy_cp = ++yyg->yy_c_buf_p;
1761 yy_current_state = yy_next_state;
1762 goto yy_match;
1763 }
1764
1765 else
1766 {
1767 yy_cp = yyg->yy_last_accepting_cpos;
1768 yy_current_state = yyg->yy_last_accepting_state;
1769 goto yy_find_action;
1770 }
1771 }
1772
1773 else switch ( yy_get_next_buffer( yyscanner ) )
1774 {
1775 case EOB_ACT_END_OF_FILE:
1776 {
1777 yyg->yy_did_buffer_switch_on_eof = 0;
1778
Corentin Wallez168d5e82017-02-01 12:18:56 -08001779 if ( yywrap( yyscanner ) )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001780 {
1781 /* Note: because we've taken care in
1782 * yy_get_next_buffer() to have set up
1783 * yytext, we can now set up
1784 * yy_c_buf_p so that if some total
1785 * hoser (like flex itself) wants to
1786 * call the scanner after we return the
1787 * YY_NULL, it'll still work - another
1788 * YY_NULL will get returned.
1789 */
1790 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1791
1792 yy_act = YY_STATE_EOF(YY_START);
1793 goto do_action;
1794 }
1795
1796 else
1797 {
1798 if ( ! yyg->yy_did_buffer_switch_on_eof )
1799 YY_NEW_FILE;
1800 }
1801 break;
1802 }
1803
1804 case EOB_ACT_CONTINUE_SCAN:
1805 yyg->yy_c_buf_p =
1806 yyg->yytext_ptr + yy_amount_of_matched_text;
1807
1808 yy_current_state = yy_get_previous_state( yyscanner );
1809
1810 yy_cp = yyg->yy_c_buf_p;
1811 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1812 goto yy_match;
1813
1814 case EOB_ACT_LAST_MATCH:
1815 yyg->yy_c_buf_p =
1816 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1817
1818 yy_current_state = yy_get_previous_state( yyscanner );
1819
1820 yy_cp = yyg->yy_c_buf_p;
1821 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1822 goto yy_find_action;
1823 }
1824 break;
1825 }
1826
1827 default:
1828 YY_FATAL_ERROR(
1829 "fatal flex scanner internal error--no action found" );
1830 } /* end of action switch */
1831 } /* end of scanning one token */
Jamie Madill185de882014-12-22 15:17:52 -05001832 } /* end of user's declarations */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001833} /* end of yylex */
Geoff Lang93561c32016-09-20 10:22:55 -04001834
1835
1836
1837
1838
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001839/* yy_get_next_buffer - try to read in a new buffer
1840 *
1841 * Returns a code representing an action:
1842 * EOB_ACT_LAST_MATCH -
1843 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1844 * EOB_ACT_END_OF_FILE - end of file
1845 */
1846static int yy_get_next_buffer (yyscan_t yyscanner)
1847{
1848 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04001849 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1850 char *source = yyg->yytext_ptr;
Corentin Wallez168d5e82017-02-01 12:18:56 -08001851 int number_to_move, i;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001852 int ret_val;
1853
1854 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1855 YY_FATAL_ERROR(
1856 "fatal flex scanner internal error--end of buffer missed" );
1857
1858 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1859 { /* Don't try to fill the buffer, so this is an EOF. */
1860 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1861 {
1862 /* We matched a single character, the EOB, so
1863 * treat this as a final EOF.
1864 */
1865 return EOB_ACT_END_OF_FILE;
1866 }
1867
1868 else
1869 {
1870 /* We matched some text prior to the EOB, first
1871 * process it.
1872 */
1873 return EOB_ACT_LAST_MATCH;
1874 }
1875 }
1876
1877 /* Try to read more data. */
1878
1879 /* First move last chars to start of buffer. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001880 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001881
1882 for ( i = 0; i < number_to_move; ++i )
1883 *(dest++) = *(source++);
1884
1885 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1886 /* don't do the read, it's not guaranteed to return an EOF,
1887 * just force an EOF
1888 */
1889 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1890
1891 else
1892 {
Geoff Lang93561c32016-09-20 10:22:55 -04001893 int num_to_read =
Corentin Wallez168d5e82017-02-01 12:18:56 -08001894 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001895
1896 while ( num_to_read <= 0 )
1897 { /* Not enough room in the buffer - grow it. */
1898
1899 /* just a shorter name for the current buffer */
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001900 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001901
1902 int yy_c_buf_p_offset =
1903 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1904
1905 if ( b->yy_is_our_buffer )
1906 {
Geoff Lang93561c32016-09-20 10:22:55 -04001907 int new_size = b->yy_buf_size * 2;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001908
1909 if ( new_size <= 0 )
1910 b->yy_buf_size += b->yy_buf_size / 8;
1911 else
1912 b->yy_buf_size *= 2;
1913
1914 b->yy_ch_buf = (char *)
1915 /* Include room in for 2 EOB chars. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001916 yyrealloc( (void *) b->yy_ch_buf,
1917 (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001918 }
1919 else
1920 /* Can't grow it, we don't own it. */
Geoff Lang93561c32016-09-20 10:22:55 -04001921 b->yy_ch_buf = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001922
1923 if ( ! b->yy_ch_buf )
1924 YY_FATAL_ERROR(
1925 "fatal error - scanner input buffer overflow" );
1926
1927 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1928
Corentin Wallez168d5e82017-02-01 12:18:56 -08001929 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1930 number_to_move - 1;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001931
1932 }
1933
1934 if ( num_to_read > YY_READ_BUF_SIZE )
1935 num_to_read = YY_READ_BUF_SIZE;
1936
1937 /* Read in more data. */
Geoff Lang93561c32016-09-20 10:22:55 -04001938 yy_size_t ret = 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001939 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
Geoff Lang93561c32016-09-20 10:22:55 -04001940 ret, num_to_read );
1941 yyg->yy_n_chars = static_cast<int>(ret);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001942
1943 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1944 }
1945
1946 if ( yyg->yy_n_chars == 0 )
1947 {
1948 if ( number_to_move == YY_MORE_ADJ )
1949 {
1950 ret_val = EOB_ACT_END_OF_FILE;
Corentin Wallez168d5e82017-02-01 12:18:56 -08001951 yyrestart( yyin , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001952 }
1953
1954 else
1955 {
1956 ret_val = EOB_ACT_LAST_MATCH;
1957 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1958 YY_BUFFER_EOF_PENDING;
1959 }
1960 }
1961
1962 else
1963 ret_val = EOB_ACT_CONTINUE_SCAN;
1964
Corentin Wallez168d5e82017-02-01 12:18:56 -08001965 if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001966 /* Extend the array by 50%, plus the number we really need. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001967 int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1968 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1969 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001970 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1971 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
Corentin Wallez168d5e82017-02-01 12:18:56 -08001972 /* "- 2" to take care of EOB's */
1973 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001974 }
1975
Corentin Wallez168d5e82017-02-01 12:18:56 -08001976 yyg->yy_n_chars += number_to_move;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001977 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1978 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1979
1980 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1981
1982 return ret_val;
1983}
1984
Geoff Lang93561c32016-09-20 10:22:55 -04001985
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001986/* yy_get_previous_state - get the state just before the EOB char was reached */
1987
1988 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1989{
Geoff Lang93561c32016-09-20 10:22:55 -04001990 yy_state_type yy_current_state;
1991 char *yy_cp;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001992 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1993
1994 yy_current_state = yyg->yy_start;
1995
1996 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1997 {
Geoff Lang93561c32016-09-20 10:22:55 -04001998 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001999 if ( yy_accept[yy_current_state] )
2000 {
2001 yyg->yy_last_accepting_state = yy_current_state;
2002 yyg->yy_last_accepting_cpos = yy_cp;
2003 }
2004 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2005 {
2006 yy_current_state = (int) yy_def[yy_current_state];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05002007 if ( yy_current_state >= 95 )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002008 yy_c = yy_meta[yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002009 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08002010 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002011 }
2012
2013 return yy_current_state;
2014}
2015
Geoff Lang93561c32016-09-20 10:22:55 -04002016
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002017/* yy_try_NUL_trans - try to make a transition on the NUL character
2018 *
2019 * synopsis
2020 * next_state = yy_try_NUL_trans( current_state );
2021 */
2022 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
2023{
Geoff Lang93561c32016-09-20 10:22:55 -04002024 int yy_is_jam;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002025 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
Geoff Lang93561c32016-09-20 10:22:55 -04002026 char *yy_cp = yyg->yy_c_buf_p;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002027
Geoff Lang93561c32016-09-20 10:22:55 -04002028 YY_CHAR yy_c = 1;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002029 if ( yy_accept[yy_current_state] )
2030 {
2031 yyg->yy_last_accepting_state = yy_current_state;
2032 yyg->yy_last_accepting_cpos = yy_cp;
2033 }
2034 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2035 {
2036 yy_current_state = (int) yy_def[yy_current_state];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05002037 if ( yy_current_state >= 95 )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002038 yy_c = yy_meta[yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002039 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08002040 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05002041 yy_is_jam = (yy_current_state == 94);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002042
Zhenyao Mof1d723c2013-09-23 14:57:07 -04002043 (void)yyg;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002044 return yy_is_jam ? 0 : yy_current_state;
2045}
2046
Geoff Lang93561c32016-09-20 10:22:55 -04002047
2048#ifndef YY_NO_UNPUT
2049
2050#endif
2051
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002052#ifndef YY_NO_INPUT
2053#ifdef __cplusplus
2054 static int yyinput (yyscan_t yyscanner)
2055#else
2056 static int input (yyscan_t yyscanner)
2057#endif
2058
2059{
2060 int c;
2061 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2062
2063 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2064
2065 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2066 {
2067 /* yy_c_buf_p now points to the character we want to return.
2068 * If this occurs *before* the EOB characters, then it's a
2069 * valid NUL; if not, then we've hit the end of the buffer.
2070 */
2071 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
2072 /* This was really a NUL. */
2073 *yyg->yy_c_buf_p = '\0';
2074
2075 else
2076 { /* need more input */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002077 int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002078 ++yyg->yy_c_buf_p;
2079
2080 switch ( yy_get_next_buffer( yyscanner ) )
2081 {
2082 case EOB_ACT_LAST_MATCH:
2083 /* This happens because yy_g_n_b()
2084 * sees that we've accumulated a
2085 * token and flags that we need to
2086 * try matching the token before
2087 * proceeding. But for input(),
2088 * there's no matching to consider.
2089 * So convert the EOB_ACT_LAST_MATCH
2090 * to EOB_ACT_END_OF_FILE.
2091 */
2092
2093 /* Reset buffer status. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002094 yyrestart( yyin , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002095
2096 /*FALLTHROUGH*/
2097
2098 case EOB_ACT_END_OF_FILE:
2099 {
Corentin Wallez168d5e82017-02-01 12:18:56 -08002100 if ( yywrap( yyscanner ) )
Geoff Lang93561c32016-09-20 10:22:55 -04002101 return 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002102
2103 if ( ! yyg->yy_did_buffer_switch_on_eof )
2104 YY_NEW_FILE;
2105#ifdef __cplusplus
2106 return yyinput(yyscanner);
2107#else
2108 return input(yyscanner);
2109#endif
2110 }
2111
2112 case EOB_ACT_CONTINUE_SCAN:
2113 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
2114 break;
2115 }
2116 }
2117 }
2118
2119 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
2120 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
2121 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
2122
Geoff Lang93561c32016-09-20 10:22:55 -04002123
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002124 return c;
2125}
2126#endif /* ifndef YY_NO_INPUT */
2127
2128/** Immediately switch to a different input stream.
2129 * @param input_file A readable stream.
2130 * @param yyscanner The scanner object.
2131 * @note This function does not reset the start condition to @c INITIAL .
2132 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002133 void yyrestart (FILE * input_file , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002134{
2135 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2136
2137 if ( ! YY_CURRENT_BUFFER ){
Corentin Wallez168d5e82017-02-01 12:18:56 -08002138 yyensure_buffer_stack (yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002139 YY_CURRENT_BUFFER_LVALUE =
Corentin Wallez168d5e82017-02-01 12:18:56 -08002140 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002141 }
2142
Corentin Wallez168d5e82017-02-01 12:18:56 -08002143 yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
2144 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002145}
2146
Geoff Lang93561c32016-09-20 10:22:55 -04002147
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002148/** Switch to a different input buffer.
2149 * @param new_buffer The new input buffer.
2150 * @param yyscanner The scanner object.
2151 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002152 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002153{
2154 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2155
2156 /* TODO. We should be able to replace this entire function body
2157 * with
Corentin Wallez168d5e82017-02-01 12:18:56 -08002158 * yypop_buffer_state();
2159 * yypush_buffer_state(new_buffer);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002160 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002161 yyensure_buffer_stack (yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002162 if ( YY_CURRENT_BUFFER == new_buffer )
2163 return;
2164
2165 if ( YY_CURRENT_BUFFER )
2166 {
2167 /* Flush out information for old buffer. */
2168 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2169 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2170 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2171 }
2172
2173 YY_CURRENT_BUFFER_LVALUE = new_buffer;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002174 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002175
2176 /* We don't actually know whether we did this switch during
Corentin Wallez168d5e82017-02-01 12:18:56 -08002177 * EOF (yywrap()) processing, but the only time this flag
2178 * is looked at is after yywrap() is called, so it's safe
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002179 * to go ahead and always set it.
2180 */
2181 yyg->yy_did_buffer_switch_on_eof = 1;
2182}
2183
Geoff Lang93561c32016-09-20 10:22:55 -04002184
Corentin Wallez168d5e82017-02-01 12:18:56 -08002185static void yy_load_buffer_state (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002186{
2187 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2188 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2189 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2190 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2191 yyg->yy_hold_char = *yyg->yy_c_buf_p;
2192}
2193
2194/** Allocate and initialize an input buffer state.
2195 * @param file A readable stream.
2196 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2197 * @param yyscanner The scanner object.
2198 * @return the allocated buffer state.
2199 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002200 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002201{
2202 YY_BUFFER_STATE b;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002203
2204 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002205 if ( ! b )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002206 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002207
Corentin Wallez168d5e82017-02-01 12:18:56 -08002208 b->yy_buf_size = size;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002209
2210 /* yy_ch_buf has to be 2 characters longer than the size given because
2211 * we need to put in 2 end-of-buffer characters.
2212 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002213 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002214 if ( ! b->yy_ch_buf )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002215 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002216
2217 b->yy_is_our_buffer = 1;
2218
Corentin Wallez168d5e82017-02-01 12:18:56 -08002219 yy_init_buffer( b, file , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002220
2221 return b;
2222}
2223
Geoff Lang93561c32016-09-20 10:22:55 -04002224
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002225/** Destroy the buffer.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002226 * @param b a buffer created with yy_create_buffer()
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002227 * @param yyscanner The scanner object.
2228 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002229 void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002230{
2231 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2232
2233 if ( ! b )
2234 return;
2235
2236 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2237 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2238
2239 if ( b->yy_is_our_buffer )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002240 yyfree( (void *) b->yy_ch_buf , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002241
Corentin Wallez168d5e82017-02-01 12:18:56 -08002242 yyfree( (void *) b , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002243}
2244
Geoff Lang93561c32016-09-20 10:22:55 -04002245
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002246/* Initializes or reinitializes a buffer.
2247 * This function is sometimes called more than once on the same buffer,
Corentin Wallez168d5e82017-02-01 12:18:56 -08002248 * such as during a yyrestart() or at EOF.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002249 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002250 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002251
2252{
2253 int oerrno = errno;
2254 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2255
Corentin Wallez168d5e82017-02-01 12:18:56 -08002256 yy_flush_buffer( b , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002257
2258 b->yy_input_file = file;
2259 b->yy_fill_buffer = 1;
2260
Corentin Wallez168d5e82017-02-01 12:18:56 -08002261 /* If b is the current buffer, then yy_init_buffer was _probably_
2262 * called from yyrestart() or through yy_get_next_buffer.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002263 * In that case, we don't want to reset the lineno or column.
2264 */
2265 if (b != YY_CURRENT_BUFFER){
2266 b->yy_bs_lineno = 1;
2267 b->yy_bs_column = 0;
2268 }
2269
Geoff Lang93561c32016-09-20 10:22:55 -04002270
Luc Ferrone49f1e92018-01-24 14:47:55 -05002271
2272 b->yy_is_interactive = 0;
2273
2274
2275 errno = oerrno;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002276}
2277
2278/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2279 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2280 * @param yyscanner The scanner object.
2281 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002282 void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002283{
2284 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2285 if ( ! b )
2286 return;
2287
2288 b->yy_n_chars = 0;
2289
2290 /* We always need two end-of-buffer characters. The first causes
2291 * a transition to the end-of-buffer state. The second causes
2292 * a jam in that state.
2293 */
2294 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2295 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2296
2297 b->yy_buf_pos = &b->yy_ch_buf[0];
2298
2299 b->yy_at_bol = 1;
2300 b->yy_buffer_status = YY_BUFFER_NEW;
2301
2302 if ( b == YY_CURRENT_BUFFER )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002303 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002304}
2305
2306/** Pushes the new state onto the stack. The new state becomes
2307 * the current state. This function will allocate the stack
2308 * if necessary.
2309 * @param new_buffer The new state.
2310 * @param yyscanner The scanner object.
2311 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002312void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002313{
2314 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002315 if (new_buffer == NULL)
2316 return;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002317
Luc Ferrone49f1e92018-01-24 14:47:55 -05002318 yyensure_buffer_stack(yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002319
Luc Ferrone49f1e92018-01-24 14:47:55 -05002320 /* This block is copied from yy_switch_to_buffer. */
2321 if ( YY_CURRENT_BUFFER )
2322 {
2323 /* Flush out information for old buffer. */
2324 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2325 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2326 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002327 }
2328
2329 /* Only push if top exists. Otherwise, replace top. */
2330 if (YY_CURRENT_BUFFER)
2331 yyg->yy_buffer_stack_top++;
2332 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2333
Corentin Wallez168d5e82017-02-01 12:18:56 -08002334 /* copied from yy_switch_to_buffer. */
2335 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002336 yyg->yy_did_buffer_switch_on_eof = 1;
2337}
2338
Geoff Lang93561c32016-09-20 10:22:55 -04002339
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002340/** Removes and deletes the top of the stack, if present.
2341 * The next element becomes the new top.
2342 * @param yyscanner The scanner object.
2343 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002344void yypop_buffer_state (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002345{
2346 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2347 if (!YY_CURRENT_BUFFER)
2348 return;
2349
Corentin Wallez168d5e82017-02-01 12:18:56 -08002350 yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
Luc Ferrone49f1e92018-01-24 14:47:55 -05002351 YY_CURRENT_BUFFER_LVALUE = NULL;
2352 if (yyg->yy_buffer_stack_top > 0)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002353 --yyg->yy_buffer_stack_top;
2354
2355 if (YY_CURRENT_BUFFER) {
Corentin Wallez168d5e82017-02-01 12:18:56 -08002356 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002357 yyg->yy_did_buffer_switch_on_eof = 1;
2358 }
2359}
2360
Geoff Lang93561c32016-09-20 10:22:55 -04002361
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002362/* Allocates the stack if it does not exist.
2363 * Guarantees space for at least one push.
2364 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002365static void yyensure_buffer_stack (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002366{
shannonwoods@chromium.orgb0757162013-05-30 00:21:27 +00002367 yy_size_t num_to_alloc;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002368 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2369
2370 if (!yyg->yy_buffer_stack) {
2371
2372 /* First allocation is just for 2 elements, since we don't know if this
2373 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2374 * immediate realloc on the next call.
2375 */
Geoff Lang93561c32016-09-20 10:22:55 -04002376 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002377 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002378 (num_to_alloc * sizeof(struct yy_buffer_state*)
2379 , yyscanner);
2380 if ( ! yyg->yy_buffer_stack )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002381 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2382
2383
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002384 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
Corentin Wallez168d5e82017-02-01 12:18:56 -08002385
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002386 yyg->yy_buffer_stack_max = num_to_alloc;
2387 yyg->yy_buffer_stack_top = 0;
2388 return;
2389 }
2390
2391 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2392
2393 /* Increase the buffer to prepare for a possible push. */
Geoff Lang93561c32016-09-20 10:22:55 -04002394 yy_size_t grow_size = 8 /* arbitrary grow size */;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002395
2396 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002397 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002398 (yyg->yy_buffer_stack,
2399 num_to_alloc * sizeof(struct yy_buffer_state*)
2400 , yyscanner);
2401 if ( ! yyg->yy_buffer_stack )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002402 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002403
2404 /* zero only the new slots.*/
2405 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
2406 yyg->yy_buffer_stack_max = num_to_alloc;
2407 }
2408}
2409
Geoff Lang93561c32016-09-20 10:22:55 -04002410
2411
2412
2413
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002414/** Setup the input buffer state to scan directly from a user-specified character buffer.
2415 * @param base the character buffer
2416 * @param size the size in bytes of the character buffer
2417 * @param yyscanner The scanner object.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002418 * @return the newly allocated buffer state object.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002419 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002420YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002421{
2422 YY_BUFFER_STATE b;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002423
2424 if ( size < 2 ||
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002425 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2426 base[size-1] != YY_END_OF_BUFFER_CHAR )
2427 /* They forgot to leave room for the EOB's. */
Luc Ferrone49f1e92018-01-24 14:47:55 -05002428 return NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002429
Luc Ferrone49f1e92018-01-24 14:47:55 -05002430 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002431 if ( ! b )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002432 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002433
Corentin Wallez168d5e82017-02-01 12:18:56 -08002434 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002435 b->yy_buf_pos = b->yy_ch_buf = base;
2436 b->yy_is_our_buffer = 0;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002437 b->yy_input_file = NULL;
2438 b->yy_n_chars = b->yy_buf_size;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002439 b->yy_is_interactive = 0;
2440 b->yy_at_bol = 1;
2441 b->yy_fill_buffer = 0;
2442 b->yy_buffer_status = YY_BUFFER_NEW;
2443
Corentin Wallez168d5e82017-02-01 12:18:56 -08002444 yy_switch_to_buffer( b , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002445
2446 return b;
2447}
2448
Geoff Lang93561c32016-09-20 10:22:55 -04002449
2450
2451
Corentin Wallez168d5e82017-02-01 12:18:56 -08002452/** Setup the input buffer state to scan a string. The next call to yylex() will
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002453 * scan from a @e copy of @a str.
2454 * @param yystr a NUL-terminated string to scan
2455 * @param yyscanner The scanner object.
2456 * @return the newly allocated buffer state object.
2457 * @note If you want to scan bytes that may contain NUL values, then use
Corentin Wallez168d5e82017-02-01 12:18:56 -08002458 * yy_scan_bytes() instead.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002459 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002460YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002461{
Luc Ferrone49f1e92018-01-24 14:47:55 -05002462
2463 return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002464}
2465
Geoff Lang93561c32016-09-20 10:22:55 -04002466
2467
2468
Corentin Wallez168d5e82017-02-01 12:18:56 -08002469/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002470 * scan from a @e copy of @a bytes.
Zhenyao Mof1d723c2013-09-23 14:57:07 -04002471 * @param yybytes the byte buffer to scan
2472 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002473 * @param yyscanner The scanner object.
2474 * @return the newly allocated buffer state object.
2475 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002476YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002477{
2478 YY_BUFFER_STATE b;
2479 char *buf;
Zhenyao Mof1d723c2013-09-23 14:57:07 -04002480 yy_size_t n;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002481 int i;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002482
2483 /* Get memory for full buffer, including space for trailing EOB's. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002484 n = (yy_size_t) (_yybytes_len + 2);
2485 buf = (char *) yyalloc( n , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002486 if ( ! buf )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002487 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002488
Corentin Wallez168d5e82017-02-01 12:18:56 -08002489 for ( i = 0; i < _yybytes_len; ++i )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002490 buf[i] = yybytes[i];
2491
2492 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2493
Corentin Wallez168d5e82017-02-01 12:18:56 -08002494 b = yy_scan_buffer( buf, n , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002495 if ( ! b )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002496 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002497
2498 /* It's okay to grow etc. this buffer, and we should throw it
2499 * away when we're done.
2500 */
2501 b->yy_is_our_buffer = 1;
2502
2503 return b;
2504}
2505
Geoff Lang93561c32016-09-20 10:22:55 -04002506
2507
2508
2509
2510
2511
2512
2513
2514
2515
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002516#ifndef YY_EXIT_FAILURE
2517#define YY_EXIT_FAILURE 2
2518#endif
2519
Corentin Wallez168d5e82017-02-01 12:18:56 -08002520static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002521{
Geoff Lang93561c32016-09-20 10:22:55 -04002522 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2523 (void)yyg;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002524 fprintf( stderr, "%s\n", msg );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002525 exit( YY_EXIT_FAILURE );
2526}
2527
2528/* Redefine yyless() so it works in section 3 code. */
2529
2530#undef yyless
2531#define yyless(n) \
2532 do \
2533 { \
2534 /* Undo effects of setting up yytext. */ \
2535 int yyless_macro_arg = (n); \
2536 YY_LESS_LINENO(yyless_macro_arg);\
2537 yytext[yyleng] = yyg->yy_hold_char; \
2538 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2539 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2540 *yyg->yy_c_buf_p = '\0'; \
2541 yyleng = yyless_macro_arg; \
2542 } \
2543 while ( 0 )
2544
Geoff Lang93561c32016-09-20 10:22:55 -04002545
2546
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002547/* Accessor methods (get/set functions) to struct members. */
2548
Geoff Lang93561c32016-09-20 10:22:55 -04002549
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002550/** Get the user-defined data for this scanner.
2551 * @param yyscanner The scanner object.
2552 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002553YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002554{
2555 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2556 return yyextra;
2557}
2558
Geoff Lang93561c32016-09-20 10:22:55 -04002559
2560
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002561/** Get the current line number.
2562 * @param yyscanner The scanner object.
2563 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002564int yyget_lineno (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002565{
2566 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002567
Luc Ferrone49f1e92018-01-24 14:47:55 -05002568
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002569 if (! YY_CURRENT_BUFFER)
2570 return 0;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002571
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002572 return yylineno;
2573}
2574
Geoff Lang93561c32016-09-20 10:22:55 -04002575
2576
2577
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002578/** Get the current column number.
2579 * @param yyscanner The scanner object.
2580 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002581int yyget_column (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002582{
2583 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002584
Luc Ferrone49f1e92018-01-24 14:47:55 -05002585
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002586 if (! YY_CURRENT_BUFFER)
2587 return 0;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002588
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002589 return yycolumn;
2590}
2591
Geoff Lang93561c32016-09-20 10:22:55 -04002592
2593
2594
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002595/** Get the input stream.
2596 * @param yyscanner The scanner object.
2597 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002598FILE *yyget_in (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002599{
2600 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2601 return yyin;
2602}
2603
Geoff Lang93561c32016-09-20 10:22:55 -04002604
2605
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002606/** Get the output stream.
2607 * @param yyscanner The scanner object.
2608 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002609FILE *yyget_out (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002610{
2611 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2612 return yyout;
2613}
2614
Geoff Lang93561c32016-09-20 10:22:55 -04002615
2616
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002617/** Get the length of the current token.
2618 * @param yyscanner The scanner object.
2619 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002620int yyget_leng (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002621{
2622 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2623 return yyleng;
2624}
2625
Geoff Lang93561c32016-09-20 10:22:55 -04002626
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002627/** Get the current token.
2628 * @param yyscanner The scanner object.
2629 */
2630
Corentin Wallez168d5e82017-02-01 12:18:56 -08002631char *yyget_text (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002632{
2633 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2634 return yytext;
2635}
2636
Geoff Lang93561c32016-09-20 10:22:55 -04002637
2638
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002639/** Set the user-defined data. This data is never touched by the scanner.
2640 * @param user_defined The data to be associated with this scanner.
2641 * @param yyscanner The scanner object.
2642 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002643void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002644{
2645 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2646 yyextra = user_defined ;
2647}
2648
Geoff Lang93561c32016-09-20 10:22:55 -04002649
2650
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002651/** Set the current line number.
Geoff Lang93561c32016-09-20 10:22:55 -04002652 * @param _line_number line number
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002653 * @param yyscanner The scanner object.
2654 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002655void yyset_lineno (int _line_number , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002656{
2657 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2658
Luc Ferrone49f1e92018-01-24 14:47:55 -05002659
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002660 /* lineno is only valid if an input buffer exists. */
2661 if (! YY_CURRENT_BUFFER )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002662 YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
Luc Ferrone49f1e92018-01-24 14:47:55 -05002663
Geoff Lang93561c32016-09-20 10:22:55 -04002664 yylineno = _line_number;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002665}
2666
Geoff Lang93561c32016-09-20 10:22:55 -04002667
2668
2669
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002670/** Set the current column.
Geoff Lang93561c32016-09-20 10:22:55 -04002671 * @param _column_no column number
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002672 * @param yyscanner The scanner object.
2673 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002674void yyset_column (int _column_no , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002675{
2676 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2677
Luc Ferrone49f1e92018-01-24 14:47:55 -05002678
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002679 /* column is only valid if an input buffer exists. */
2680 if (! YY_CURRENT_BUFFER )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002681 YY_FATAL_ERROR( "yyset_column called with no buffer" );
Luc Ferrone49f1e92018-01-24 14:47:55 -05002682
Geoff Lang93561c32016-09-20 10:22:55 -04002683 yycolumn = _column_no;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002684}
2685
Geoff Lang93561c32016-09-20 10:22:55 -04002686
2687
2688
2689
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002690/** Set the input stream. This does not discard the current
2691 * input buffer.
Geoff Lang93561c32016-09-20 10:22:55 -04002692 * @param _in_str A readable stream.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002693 * @param yyscanner The scanner object.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002694 * @see yy_switch_to_buffer
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002695 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002696void yyset_in (FILE * _in_str , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002697{
2698 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04002699 yyin = _in_str ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002700}
2701
Geoff Lang93561c32016-09-20 10:22:55 -04002702
2703
Corentin Wallez168d5e82017-02-01 12:18:56 -08002704void yyset_out (FILE * _out_str , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002705{
2706 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04002707 yyout = _out_str ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002708}
2709
Geoff Lang93561c32016-09-20 10:22:55 -04002710
2711
2712
Corentin Wallez168d5e82017-02-01 12:18:56 -08002713int yyget_debug (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002714{
2715 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2716 return yy_flex_debug;
2717}
2718
Geoff Lang93561c32016-09-20 10:22:55 -04002719
2720
Corentin Wallez168d5e82017-02-01 12:18:56 -08002721void yyset_debug (int _bdebug , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002722{
2723 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04002724 yy_flex_debug = _bdebug ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002725}
2726
Geoff Lang93561c32016-09-20 10:22:55 -04002727
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002728/* Accessor methods for yylval and yylloc */
2729
Geoff Lang93561c32016-09-20 10:22:55 -04002730
Corentin Wallez168d5e82017-02-01 12:18:56 -08002731YYSTYPE * yyget_lval (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002732{
2733 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2734 return yylval;
2735}
2736
Geoff Lang93561c32016-09-20 10:22:55 -04002737
2738
Corentin Wallez168d5e82017-02-01 12:18:56 -08002739void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002740{
2741 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2742 yylval = yylval_param;
2743}
2744
Luc Ferrone49f1e92018-01-24 14:47:55 -05002745
2746
2747
Corentin Wallez168d5e82017-02-01 12:18:56 -08002748YYLTYPE *yyget_lloc (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002749{
2750 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2751 return yylloc;
2752}
Luc Ferrone49f1e92018-01-24 14:47:55 -05002753
Geoff Lang93561c32016-09-20 10:22:55 -04002754
Luc Ferrone49f1e92018-01-24 14:47:55 -05002755
Corentin Wallez168d5e82017-02-01 12:18:56 -08002756void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002757{
2758 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2759 yylloc = yylloc_param;
2760}
Luc Ferrone49f1e92018-01-24 14:47:55 -05002761
2762
2763
2764
Geoff Lang93561c32016-09-20 10:22:55 -04002765
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002766/* User-visible API */
2767
Corentin Wallez168d5e82017-02-01 12:18:56 -08002768/* yylex_init is special because it creates the scanner itself, so it is
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002769 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2770 * That's why we explicitly handle the declaration, instead of using our macros.
2771 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002772int yylex_init(yyscan_t* ptr_yy_globals)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002773{
Luc Ferrone49f1e92018-01-24 14:47:55 -05002774 if (ptr_yy_globals == NULL){
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002775 errno = EINVAL;
2776 return 1;
2777 }
2778
Luc Ferrone49f1e92018-01-24 14:47:55 -05002779 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002780
Luc Ferrone49f1e92018-01-24 14:47:55 -05002781 if (*ptr_yy_globals == NULL){
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002782 errno = ENOMEM;
2783 return 1;
2784 }
2785
2786 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2787 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2788
2789 return yy_init_globals ( *ptr_yy_globals );
2790}
2791
Geoff Lang93561c32016-09-20 10:22:55 -04002792
Corentin Wallez168d5e82017-02-01 12:18:56 -08002793/* yylex_init_extra has the same functionality as yylex_init, but follows the
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002794 * convention of taking the scanner as the last argument. Note however, that
2795 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2796 * is the reason, too, why this function also must handle its own declaration).
Corentin Wallez168d5e82017-02-01 12:18:56 -08002797 * The user defined value in the first argument will be available to yyalloc in
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002798 * the yyextra field.
2799 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002800int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002801{
2802 struct yyguts_t dummy_yyguts;
2803
Corentin Wallez168d5e82017-02-01 12:18:56 -08002804 yyset_extra (yy_user_defined, &dummy_yyguts);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002805
Luc Ferrone49f1e92018-01-24 14:47:55 -05002806 if (ptr_yy_globals == NULL){
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002807 errno = EINVAL;
2808 return 1;
2809 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08002810
2811 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2812
Luc Ferrone49f1e92018-01-24 14:47:55 -05002813 if (*ptr_yy_globals == NULL){
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002814 errno = ENOMEM;
2815 return 1;
2816 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08002817
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002818 /* By setting to 0xAA, we expose bugs in
2819 yy_init_globals. Leave at 0x00 for releases. */
2820 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
Corentin Wallez168d5e82017-02-01 12:18:56 -08002821
2822 yyset_extra (yy_user_defined, *ptr_yy_globals);
2823
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002824 return yy_init_globals ( *ptr_yy_globals );
2825}
2826
Geoff Lang93561c32016-09-20 10:22:55 -04002827
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002828static int yy_init_globals (yyscan_t yyscanner)
2829{
2830 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2831 /* Initialization is the same as for the non-reentrant scanner.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002832 * This function is called from yylex_destroy(), so don't allocate here.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002833 */
2834
Luc Ferrone49f1e92018-01-24 14:47:55 -05002835
2836 yyg->yy_buffer_stack = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002837 yyg->yy_buffer_stack_top = 0;
2838 yyg->yy_buffer_stack_max = 0;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002839 yyg->yy_c_buf_p = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002840 yyg->yy_init = 0;
2841 yyg->yy_start = 0;
2842
Geoff Lang93561c32016-09-20 10:22:55 -04002843
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002844 yyg->yy_start_stack_ptr = 0;
2845 yyg->yy_start_stack_depth = 0;
Luc Ferrone49f1e92018-01-24 14:47:55 -05002846 yyg->yy_start_stack = NULL;
2847
2848
2849
2850
2851
Geoff Lang93561c32016-09-20 10:22:55 -04002852
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002853/* Defined in main.c */
2854#ifdef YY_STDINIT
2855 yyin = stdin;
2856 yyout = stdout;
2857#else
Luc Ferrone49f1e92018-01-24 14:47:55 -05002858 yyin = NULL;
2859 yyout = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002860#endif
2861
2862 /* For future reference: Set errno on error, since we are called by
Corentin Wallez168d5e82017-02-01 12:18:56 -08002863 * yylex_init()
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002864 */
2865 return 0;
2866}
2867
Geoff Lang93561c32016-09-20 10:22:55 -04002868
Corentin Wallez168d5e82017-02-01 12:18:56 -08002869/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2870int yylex_destroy (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002871{
2872 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2873
2874 /* Pop the buffer stack, destroying each element. */
2875 while(YY_CURRENT_BUFFER){
Corentin Wallez168d5e82017-02-01 12:18:56 -08002876 yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
Luc Ferrone49f1e92018-01-24 14:47:55 -05002877 YY_CURRENT_BUFFER_LVALUE = NULL;
2878 yypop_buffer_state(yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002879 }
2880
2881 /* Destroy the stack itself. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002882 yyfree(yyg->yy_buffer_stack , yyscanner);
Luc Ferrone49f1e92018-01-24 14:47:55 -05002883 yyg->yy_buffer_stack = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002884
Luc Ferrone49f1e92018-01-24 14:47:55 -05002885
2886 /* Destroy the start condition stack. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002887 yyfree( yyg->yy_start_stack , yyscanner );
Luc Ferrone49f1e92018-01-24 14:47:55 -05002888 yyg->yy_start_stack = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002889
Geoff Lang93561c32016-09-20 10:22:55 -04002890
Luc Ferrone49f1e92018-01-24 14:47:55 -05002891
2892
2893 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2894 * yylex() is called, initialization will occur. */
2895 yy_init_globals( yyscanner);
2896
2897 /* Destroy the main struct (reentrant only). */
2898 yyfree ( yyscanner , yyscanner );
2899 yyscanner = NULL;
2900 return 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002901}
2902
Geoff Lang93561c32016-09-20 10:22:55 -04002903
2904
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002905/*
2906 * Internal utility routines.
2907 */
2908
Geoff Lang93561c32016-09-20 10:22:55 -04002909
2910
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002911#ifndef yytext_ptr
Corentin Wallez168d5e82017-02-01 12:18:56 -08002912static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002913{
Geoff Lang93561c32016-09-20 10:22:55 -04002914 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2915 (void)yyg;
2916
2917 int i;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002918 for ( i = 0; i < n; ++i )
2919 s1[i] = s2[i];
2920}
2921#endif
2922
Geoff Lang93561c32016-09-20 10:22:55 -04002923
2924
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002925#ifdef YY_NEED_STRLEN
Corentin Wallez168d5e82017-02-01 12:18:56 -08002926static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002927{
Geoff Lang93561c32016-09-20 10:22:55 -04002928 int n;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002929 for ( n = 0; s[n]; ++n )
2930 ;
2931
2932 return n;
2933}
2934#endif
2935
Geoff Lang93561c32016-09-20 10:22:55 -04002936
2937
Corentin Wallez168d5e82017-02-01 12:18:56 -08002938void *yyalloc (yy_size_t size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002939{
Geoff Lang93561c32016-09-20 10:22:55 -04002940 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2941 (void)yyg;
2942 return malloc(size);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002943}
2944
Geoff Lang93561c32016-09-20 10:22:55 -04002945
2946
Corentin Wallez168d5e82017-02-01 12:18:56 -08002947void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002948{
Geoff Lang93561c32016-09-20 10:22:55 -04002949 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2950 (void)yyg;
2951
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002952 /* The cast to (char *) in the following accommodates both
2953 * implementations that use char* generic pointers, and those
2954 * that use void* generic pointers. It works with the latter
2955 * because both ANSI C and C++ allow castless assignment from
2956 * any pointer type to void*, and deal with argument conversions
2957 * as though doing an assignment.
2958 */
Geoff Lang93561c32016-09-20 10:22:55 -04002959 return realloc(ptr, size);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002960}
2961
Geoff Lang93561c32016-09-20 10:22:55 -04002962
2963
Corentin Wallez168d5e82017-02-01 12:18:56 -08002964void yyfree (void * ptr , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002965{
Geoff Lang93561c32016-09-20 10:22:55 -04002966 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2967 (void)yyg;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002968 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002969}
2970
Geoff Lang93561c32016-09-20 10:22:55 -04002971
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002972#define YYTABLES_NAME "yytables"
2973
Geoff Lang93561c32016-09-20 10:22:55 -04002974
2975
2976
2977
2978
2979
2980
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002981namespace pp {
2982
Corentin Wallez054f7ed2016-09-20 17:15:59 -04002983Tokenizer::Tokenizer(Diagnostics *diagnostics) : mHandle(nullptr), mMaxTokenSize(256)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002984{
alokp@chromium.org2c958ee2012-05-17 20:35:42 +00002985 mContext.diagnostics = diagnostics;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002986}
2987
2988Tokenizer::~Tokenizer()
2989{
2990 destroyScanner();
2991}
2992
Zhenyao Mod526f982014-05-13 14:51:19 -07002993bool Tokenizer::init(size_t count, const char * const string[], const int length[])
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002994{
Zhenyao Mod526f982014-05-13 14:51:19 -07002995 if ((count > 0) && (string == 0))
2996 return false;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002997
2998 mContext.input = Input(count, string, length);
2999 return initScanner();
3000}
3001
alokp@chromium.org46aa13d2012-06-15 15:40:27 +00003002void Tokenizer::setFileNumber(int file)
3003{
3004 // We use column number as file number.
3005 // See macro yyfileno.
Corentin Wallez168d5e82017-02-01 12:18:56 -08003006 yyset_column(file, mHandle);
alokp@chromium.org46aa13d2012-06-15 15:40:27 +00003007}
3008
3009void Tokenizer::setLineNumber(int line)
3010{
Corentin Wallez168d5e82017-02-01 12:18:56 -08003011 yyset_lineno(line, mHandle);
alokp@chromium.org46aa13d2012-06-15 15:40:27 +00003012}
3013
Jamie Madill5508f392014-02-20 13:31:36 -05003014void Tokenizer::setMaxTokenSize(size_t maxTokenSize)
3015{
3016 mMaxTokenSize = maxTokenSize;
3017}
3018
Zhenyao Mod526f982014-05-13 14:51:19 -07003019void Tokenizer::lex(Token *token)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003020{
Corentin Wallezdc0fa462017-02-01 14:44:43 -05003021 int tokenType = yylex(&token->text, &token->location, mHandle);
3022
3023 if (tokenType == Token::GOT_ERROR)
3024 {
3025 mContext.diagnostics->report(Diagnostics::PP_TOKENIZER_ERROR, token->location, token->text);
3026 token->type = Token::LAST;
3027 }
3028 else
3029 {
3030 token->type = tokenType;
3031 }
3032
Jamie Madill5508f392014-02-20 13:31:36 -05003033 if (token->text.size() > mMaxTokenSize)
alokp@chromium.orgc022c3a2012-07-09 15:56:42 +00003034 {
Shannon Woods7f2d7942013-11-19 15:07:58 -05003035 mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
alokp@chromium.orgc022c3a2012-07-09 15:56:42 +00003036 token->location, token->text);
Jamie Madill5508f392014-02-20 13:31:36 -05003037 token->text.erase(mMaxTokenSize);
alokp@chromium.orgc022c3a2012-07-09 15:56:42 +00003038 }
3039
alokp@chromium.org7fc38dd2012-06-14 18:23:23 +00003040 token->flags = 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003041
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00003042 token->setAtStartOfLine(mContext.lineStart);
3043 mContext.lineStart = token->type == '\n';
3044
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003045 token->setHasLeadingSpace(mContext.leadingSpace);
3046 mContext.leadingSpace = false;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003047}
3048
3049bool Tokenizer::initScanner()
3050{
Corentin Wallez168d5e82017-02-01 12:18:56 -08003051 if ((mHandle == nullptr) && yylex_init_extra(&mContext, &mHandle))
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003052 return false;
3053
Corentin Wallez168d5e82017-02-01 12:18:56 -08003054 yyrestart(0, mHandle);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003055 return true;
3056}
3057
3058void Tokenizer::destroyScanner()
3059{
Corentin Wallez054f7ed2016-09-20 17:15:59 -04003060 if (mHandle == nullptr)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003061 return;
3062
Corentin Wallez168d5e82017-02-01 12:18:56 -08003063 yylex_destroy(mHandle);
Corentin Wallez054f7ed2016-09-20 17:15:59 -04003064 mHandle = nullptr;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00003065}
3066
3067} // namespace pp
3068
Geoff Lang93561c32016-09-20 10:22:55 -04003069