blob: f2ac6c40b2ef7852ed432da04d2eec6a9531a18b [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
Corentin Wallez168d5e82017-02-01 12:18:56 -080052#ifdef yy_delete_buffer
53#define pp_delete_buffer_ALREADY_DEFINED
54#else
55#define yy_delete_buffer pp_delete_buffer
56#endif
57
Corentin Wallez168d5e82017-02-01 12:18:56 -080058#ifdef yy_scan_buffer
59#define pp_scan_buffer_ALREADY_DEFINED
60#else
61#define yy_scan_buffer pp_scan_buffer
62#endif
63
Corentin Wallez168d5e82017-02-01 12:18:56 -080064#ifdef yy_scan_string
65#define pp_scan_string_ALREADY_DEFINED
66#else
67#define yy_scan_string pp_scan_string
68#endif
69
Corentin Wallez168d5e82017-02-01 12:18:56 -080070#ifdef yy_scan_bytes
71#define pp_scan_bytes_ALREADY_DEFINED
72#else
73#define yy_scan_bytes pp_scan_bytes
74#endif
75
Corentin Wallez168d5e82017-02-01 12:18:56 -080076#ifdef yy_init_buffer
77#define pp_init_buffer_ALREADY_DEFINED
78#else
79#define yy_init_buffer pp_init_buffer
80#endif
81
Corentin Wallez168d5e82017-02-01 12:18:56 -080082#ifdef yy_flush_buffer
83#define pp_flush_buffer_ALREADY_DEFINED
84#else
85#define yy_flush_buffer pp_flush_buffer
86#endif
87
Corentin Wallez168d5e82017-02-01 12:18:56 -080088#ifdef yy_load_buffer_state
89#define pp_load_buffer_state_ALREADY_DEFINED
90#else
91#define yy_load_buffer_state pp_load_buffer_state
92#endif
93
Corentin Wallez168d5e82017-02-01 12:18:56 -080094#ifdef yy_switch_to_buffer
95#define pp_switch_to_buffer_ALREADY_DEFINED
96#else
97#define yy_switch_to_buffer pp_switch_to_buffer
98#endif
99
Corentin Wallez168d5e82017-02-01 12:18:56 -0800100#ifdef yypush_buffer_state
101#define pppush_buffer_state_ALREADY_DEFINED
102#else
103#define yypush_buffer_state pppush_buffer_state
104#endif
105
Corentin Wallez168d5e82017-02-01 12:18:56 -0800106#ifdef yypop_buffer_state
107#define pppop_buffer_state_ALREADY_DEFINED
108#else
109#define yypop_buffer_state pppop_buffer_state
110#endif
111
Corentin Wallez168d5e82017-02-01 12:18:56 -0800112#ifdef yyensure_buffer_stack
113#define ppensure_buffer_stack_ALREADY_DEFINED
114#else
115#define yyensure_buffer_stack ppensure_buffer_stack
116#endif
117
Corentin Wallez168d5e82017-02-01 12:18:56 -0800118#ifdef yylex
119#define pplex_ALREADY_DEFINED
120#else
121#define yylex pplex
122#endif
123
Corentin Wallez168d5e82017-02-01 12:18:56 -0800124#ifdef yyrestart
125#define pprestart_ALREADY_DEFINED
126#else
127#define yyrestart pprestart
128#endif
129
Corentin Wallez168d5e82017-02-01 12:18:56 -0800130#ifdef yylex_init
131#define pplex_init_ALREADY_DEFINED
132#else
133#define yylex_init pplex_init
134#endif
135
Corentin Wallez168d5e82017-02-01 12:18:56 -0800136#ifdef yylex_init_extra
137#define pplex_init_extra_ALREADY_DEFINED
138#else
139#define yylex_init_extra pplex_init_extra
140#endif
141
Corentin Wallez168d5e82017-02-01 12:18:56 -0800142#ifdef yylex_destroy
143#define pplex_destroy_ALREADY_DEFINED
144#else
145#define yylex_destroy pplex_destroy
146#endif
147
Corentin Wallez168d5e82017-02-01 12:18:56 -0800148#ifdef yyget_debug
149#define ppget_debug_ALREADY_DEFINED
150#else
151#define yyget_debug ppget_debug
152#endif
153
Corentin Wallez168d5e82017-02-01 12:18:56 -0800154#ifdef yyset_debug
155#define ppset_debug_ALREADY_DEFINED
156#else
157#define yyset_debug ppset_debug
158#endif
159
Corentin Wallez168d5e82017-02-01 12:18:56 -0800160#ifdef yyget_extra
161#define ppget_extra_ALREADY_DEFINED
162#else
163#define yyget_extra ppget_extra
164#endif
165
Corentin Wallez168d5e82017-02-01 12:18:56 -0800166#ifdef yyset_extra
167#define ppset_extra_ALREADY_DEFINED
168#else
169#define yyset_extra ppset_extra
170#endif
171
Corentin Wallez168d5e82017-02-01 12:18:56 -0800172#ifdef yyget_in
173#define ppget_in_ALREADY_DEFINED
174#else
175#define yyget_in ppget_in
176#endif
177
Corentin Wallez168d5e82017-02-01 12:18:56 -0800178#ifdef yyset_in
179#define ppset_in_ALREADY_DEFINED
180#else
181#define yyset_in ppset_in
182#endif
183
Corentin Wallez168d5e82017-02-01 12:18:56 -0800184#ifdef yyget_out
185#define ppget_out_ALREADY_DEFINED
186#else
187#define yyget_out ppget_out
188#endif
189
Corentin Wallez168d5e82017-02-01 12:18:56 -0800190#ifdef yyset_out
191#define ppset_out_ALREADY_DEFINED
192#else
193#define yyset_out ppset_out
194#endif
195
Corentin Wallez168d5e82017-02-01 12:18:56 -0800196#ifdef yyget_leng
197#define ppget_leng_ALREADY_DEFINED
198#else
199#define yyget_leng ppget_leng
200#endif
201
Corentin Wallez168d5e82017-02-01 12:18:56 -0800202#ifdef yyget_text
203#define ppget_text_ALREADY_DEFINED
204#else
205#define yyget_text ppget_text
206#endif
207
Corentin Wallez168d5e82017-02-01 12:18:56 -0800208#ifdef yyget_lineno
209#define ppget_lineno_ALREADY_DEFINED
210#else
211#define yyget_lineno ppget_lineno
212#endif
213
Corentin Wallez168d5e82017-02-01 12:18:56 -0800214#ifdef yyset_lineno
215#define ppset_lineno_ALREADY_DEFINED
216#else
217#define yyset_lineno ppset_lineno
218#endif
219
Corentin Wallez168d5e82017-02-01 12:18:56 -0800220#ifdef yyget_column
221#define ppget_column_ALREADY_DEFINED
222#else
223#define yyget_column ppget_column
224#endif
225
Corentin Wallez168d5e82017-02-01 12:18:56 -0800226#ifdef yyset_column
227#define ppset_column_ALREADY_DEFINED
228#else
229#define yyset_column ppset_column
230#endif
Geoff Lang93561c32016-09-20 10:22:55 -0400231
Corentin Wallez168d5e82017-02-01 12:18:56 -0800232#ifdef yywrap
233#define ppwrap_ALREADY_DEFINED
234#else
235#define yywrap ppwrap
236#endif
237
Corentin Wallez168d5e82017-02-01 12:18:56 -0800238#ifdef yyget_lval
239#define ppget_lval_ALREADY_DEFINED
240#else
241#define yyget_lval ppget_lval
242#endif
243
Corentin Wallez168d5e82017-02-01 12:18:56 -0800244#ifdef yyset_lval
245#define ppset_lval_ALREADY_DEFINED
246#else
247#define yyset_lval ppset_lval
248#endif
249
Corentin Wallez168d5e82017-02-01 12:18:56 -0800250#ifdef yyget_lloc
251#define ppget_lloc_ALREADY_DEFINED
252#else
253#define yyget_lloc ppget_lloc
254#endif
255
Corentin Wallez168d5e82017-02-01 12:18:56 -0800256#ifdef yyset_lloc
257#define ppset_lloc_ALREADY_DEFINED
258#else
259#define yyset_lloc ppset_lloc
260#endif
261
262
263
264
265#ifdef yyalloc
266#define ppalloc_ALREADY_DEFINED
267#else
268#define yyalloc ppalloc
269#endif
270
Corentin Wallez168d5e82017-02-01 12:18:56 -0800271#ifdef yyrealloc
272#define pprealloc_ALREADY_DEFINED
273#else
274#define yyrealloc pprealloc
275#endif
276
Corentin Wallez168d5e82017-02-01 12:18:56 -0800277#ifdef yyfree
278#define ppfree_ALREADY_DEFINED
279#else
280#define yyfree ppfree
281#endif
282
283
284
Geoff Lang93561c32016-09-20 10:22:55 -0400285
286
287
288
289
290
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000291/* First, we deal with platform-specific or compiler-specific issues. */
292
293/* begin standard C headers. */
294#include <stdio.h>
295#include <string.h>
296#include <errno.h>
297#include <stdlib.h>
298
299/* end standard C headers. */
300
301/* flex integer type definitions */
302
303#ifndef FLEXINT_H
304#define FLEXINT_H
305
306/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
307
308#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
309
310/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
Luc Ferronadcf0ae2018-01-24 08:27:37 -0500311 * if you want the limit (max/min) macros for int types.
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000312 */
313#ifndef __STDC_LIMIT_MACROS
314#define __STDC_LIMIT_MACROS 1
315#endif
316
317#include <inttypes.h>
318typedef int8_t flex_int8_t;
319typedef uint8_t flex_uint8_t;
320typedef int16_t flex_int16_t;
321typedef uint16_t flex_uint16_t;
322typedef int32_t flex_int32_t;
323typedef uint32_t flex_uint32_t;
324#else
325typedef signed char flex_int8_t;
326typedef short int flex_int16_t;
327typedef int flex_int32_t;
Luc Ferronadcf0ae2018-01-24 08:27:37 -0500328typedef unsigned char flex_uint8_t;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000329typedef unsigned short int flex_uint16_t;
330typedef unsigned int flex_uint32_t;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000331
332/* Limits of integral types. */
333#ifndef INT8_MIN
334#define INT8_MIN (-128)
335#endif
336#ifndef INT16_MIN
337#define INT16_MIN (-32767-1)
338#endif
339#ifndef INT32_MIN
340#define INT32_MIN (-2147483647-1)
341#endif
342#ifndef INT8_MAX
343#define INT8_MAX (127)
344#endif
345#ifndef INT16_MAX
346#define INT16_MAX (32767)
347#endif
348#ifndef INT32_MAX
349#define INT32_MAX (2147483647)
350#endif
351#ifndef UINT8_MAX
352#define UINT8_MAX (255U)
353#endif
354#ifndef UINT16_MAX
355#define UINT16_MAX (65535U)
356#endif
357#ifndef UINT32_MAX
358#define UINT32_MAX (4294967295U)
359#endif
360
Corentin Wallez168d5e82017-02-01 12:18:56 -0800361#ifndef SIZE_MAX
362#define SIZE_MAX (~(size_t)0)
363#endif
364
Zhenyao Mof1d723c2013-09-23 14:57:07 -0400365#endif /* ! C99 */
366
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000367#endif /* ! FLEXINT_H */
368
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000369
Corentin Wallez168d5e82017-02-01 12:18:56 -0800370/* begin standard C++ headers. */
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000371
Geoff Lang93561c32016-09-20 10:22:55 -0400372/* TODO: this is always defined, so inline it */
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000373#define yyconst const
Geoff Lang93561c32016-09-20 10:22:55 -0400374
375#if defined(__GNUC__) && __GNUC__ >= 3
376#define yynoreturn __attribute__((__noreturn__))
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000377#else
Geoff Lang93561c32016-09-20 10:22:55 -0400378#define yynoreturn
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000379#endif
380
381/* Returned upon end-of-file. */
382#define YY_NULL 0
383
Geoff Lang93561c32016-09-20 10:22:55 -0400384
Corentin Wallez168d5e82017-02-01 12:18:56 -0800385/* Promotes a possibly negative, possibly signed char to an
386 * integer in range [0..255] for use as an array index.
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000387 */
Corentin Wallez168d5e82017-02-01 12:18:56 -0800388#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000389
Geoff Lang93561c32016-09-20 10:22:55 -0400390
391
392
393
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000394/* An opaque pointer. */
395#ifndef YY_TYPEDEF_YY_SCANNER_T
396#define YY_TYPEDEF_YY_SCANNER_T
397typedef void* yyscan_t;
398#endif
399
Geoff Lang93561c32016-09-20 10:22:55 -0400400
401
402
403
404
405
406
407
Geoff Lang93561c32016-09-20 10:22:55 -0400408
409
410
411
412
413
414
415
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000416/* For convenience, these vars (plus the bison vars far below)
417 are macros in the reentrant scanner. */
418#define yyin yyg->yyin_r
419#define yyout yyg->yyout_r
420#define yyextra yyg->yyextra_r
421#define yyleng yyg->yyleng_r
422#define yytext yyg->yytext_r
423#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
424#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
425#define yy_flex_debug yyg->yy_flex_debug_r
426
Geoff Lang93561c32016-09-20 10:22:55 -0400427
428
429
430
431
432
433
434
Corentin Wallez168d5e82017-02-01 12:18:56 -0800435
Geoff Lang93561c32016-09-20 10:22:55 -0400436
437
438
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000439/* Enter a start condition. This macro really ought to take a parameter,
440 * but we do it the disgusting crufty way forced on us by the ()-less
441 * definition of BEGIN.
442 */
443#define BEGIN yyg->yy_start = 1 + 2 *
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000444/* Translate the current start state into a value that can be later handed
445 * to BEGIN to return to the state. The YYSTATE alias is for lex
446 * compatibility.
447 */
448#define YY_START ((yyg->yy_start - 1) / 2)
449#define YYSTATE YY_START
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000450/* Action number for EOF rule of a given start state. */
451#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000452/* Special action meaning "start processing a new file". */
Corentin Wallez168d5e82017-02-01 12:18:56 -0800453#define YY_NEW_FILE yyrestart( yyin , yyscanner )
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000454#define YY_END_OF_BUFFER_CHAR 0
455
Geoff Lang93561c32016-09-20 10:22:55 -0400456
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000457/* Size of default input buffer. */
458#ifndef YY_BUF_SIZE
Geoff Lang93561c32016-09-20 10:22:55 -0400459#ifdef __ia64__
460/* On IA-64, the buffer size is 16k, not 8k.
461 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
462 * Ditto for the __ia64__ case accordingly.
463 */
464#define YY_BUF_SIZE 32768
465#else
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000466#define YY_BUF_SIZE 16384
Geoff Lang93561c32016-09-20 10:22:55 -0400467#endif /* __ia64__ */
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000468#endif
469
Geoff Lang93561c32016-09-20 10:22:55 -0400470
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000471/* The state buf must be large enough to hold one state per character in the main buffer.
472 */
473#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
474
Geoff Lang93561c32016-09-20 10:22:55 -0400475
476
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000477#ifndef YY_TYPEDEF_YY_BUFFER_STATE
478#define YY_TYPEDEF_YY_BUFFER_STATE
479typedef struct yy_buffer_state *YY_BUFFER_STATE;
480#endif
481
shannonwoods@chromium.orgb0757162013-05-30 00:21:27 +0000482#ifndef YY_TYPEDEF_YY_SIZE_T
483#define YY_TYPEDEF_YY_SIZE_T
484typedef size_t yy_size_t;
485#endif
486
Geoff Lang93561c32016-09-20 10:22:55 -0400487
488
Zhenyao Mof1d723c2013-09-23 14:57:07 -0400489
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000490#define EOB_ACT_CONTINUE_SCAN 0
491#define EOB_ACT_END_OF_FILE 1
492#define EOB_ACT_LAST_MATCH 2
Luc Ferronadcf0ae2018-01-24 08:27:37 -0500493
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000494 #define YY_LESS_LINENO(n)
Jamie Madill185de882014-12-22 15:17:52 -0500495 #define YY_LINENO_REWIND_TO(ptr)
Luc Ferronadcf0ae2018-01-24 08:27:37 -0500496
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000497/* Return all but the first "n" matched characters back to the input stream. */
498#define yyless(n) \
499 do \
500 { \
501 /* Undo effects of setting up yytext. */ \
502 int yyless_macro_arg = (n); \
503 YY_LESS_LINENO(yyless_macro_arg);\
504 *yy_cp = yyg->yy_hold_char; \
505 YY_RESTORE_YY_MORE_OFFSET \
506 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
507 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
508 } \
509 while ( 0 )
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000510#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
511
Geoff Lang93561c32016-09-20 10:22:55 -0400512
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000513#ifndef YY_STRUCT_YY_BUFFER_STATE
514#define YY_STRUCT_YY_BUFFER_STATE
515struct yy_buffer_state
516 {
517 FILE *yy_input_file;
518
Geoff Lang93561c32016-09-20 10:22:55 -0400519
520
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000521 char *yy_ch_buf; /* input buffer */
522 char *yy_buf_pos; /* current position in input buffer */
523
524 /* Size of input buffer in bytes, not including room for EOB
525 * characters.
526 */
Geoff Lang93561c32016-09-20 10:22:55 -0400527 int yy_buf_size;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000528
529 /* Number of characters read into yy_ch_buf, not including EOB
530 * characters.
531 */
Geoff Lang93561c32016-09-20 10:22:55 -0400532 int yy_n_chars;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000533
534 /* Whether we "own" the buffer - i.e., we know we created it,
535 * and can realloc() it to grow it, and should free() it to
536 * delete it.
537 */
538 int yy_is_our_buffer;
539
540 /* Whether this is an "interactive" input source; if so, and
541 * if we're using stdio for input, then we want to use getc()
542 * instead of fread(), to make sure we stop fetching input after
543 * each newline.
544 */
545 int yy_is_interactive;
546
547 /* Whether we're considered to be at the beginning of a line.
548 * If so, '^' rules will be active on the next match, otherwise
549 * not.
550 */
551 int yy_at_bol;
552
553 int yy_bs_lineno; /**< The line count. */
554 int yy_bs_column; /**< The column count. */
Corentin Wallez168d5e82017-02-01 12:18:56 -0800555
Geoff Lang93561c32016-09-20 10:22:55 -0400556
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000557 /* Whether to try to fill the input buffer when we reach the
558 * end of it.
559 */
560 int yy_fill_buffer;
561
562 int yy_buffer_status;
563
564#define YY_BUFFER_NEW 0
565#define YY_BUFFER_NORMAL 1
566 /* When an EOF's been seen but there's still some text to process
567 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
568 * shouldn't try reading from the input source any more. We might
569 * still have a bunch of tokens to match, though, because of
570 * possible backing-up.
571 *
572 * When we actually see the EOF, we change the status to "new"
Corentin Wallez168d5e82017-02-01 12:18:56 -0800573 * (via yyrestart()), so that the user can continue scanning by
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000574 * just pointing yyin at a new input file.
575 */
576#define YY_BUFFER_EOF_PENDING 2
577
578 };
579#endif /* !YY_STRUCT_YY_BUFFER_STATE */
580
Geoff Lang93561c32016-09-20 10:22:55 -0400581
582
583
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000584/* We provide macros for accessing buffer states in case in the
585 * future we want to put the buffer states in a more general
586 * "scanner state".
587 *
588 * Returns the top of the stack, or NULL.
589 */
590#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
591 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
592 : NULL)
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000593/* Same as previous macro, but useful when we know that the buffer stack is not
594 * NULL or when we need an lvalue. For internal use only.
595 */
596#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
597
Geoff Lang93561c32016-09-20 10:22:55 -0400598
599
600
601
Corentin Wallez168d5e82017-02-01 12:18:56 -0800602void yyrestart ( FILE *input_file , yyscan_t yyscanner );
603void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
604YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
605void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
606void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
607void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
608void yypop_buffer_state ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000609
Geoff Lang93561c32016-09-20 10:22:55 -0400610
Corentin Wallez168d5e82017-02-01 12:18:56 -0800611static void yyensure_buffer_stack ( yyscan_t yyscanner );
612static void yy_load_buffer_state ( yyscan_t yyscanner );
613static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );
614#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000615
Geoff Lang93561c32016-09-20 10:22:55 -0400616
Corentin Wallez168d5e82017-02-01 12:18:56 -0800617YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
618YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
619YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000620
Geoff Lang93561c32016-09-20 10:22:55 -0400621
Corentin Wallez168d5e82017-02-01 12:18:56 -0800622void *yyalloc ( yy_size_t , yyscan_t yyscanner );
623void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
624void yyfree ( void * , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -0400625
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000626
Corentin Wallez168d5e82017-02-01 12:18:56 -0800627#define yy_new_buffer yy_create_buffer
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000628#define yy_set_interactive(is_interactive) \
629 { \
630 if ( ! YY_CURRENT_BUFFER ){ \
Corentin Wallez168d5e82017-02-01 12:18:56 -0800631 yyensure_buffer_stack (yyscanner); \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000632 YY_CURRENT_BUFFER_LVALUE = \
Corentin Wallez168d5e82017-02-01 12:18:56 -0800633 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000634 } \
635 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
636 }
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000637#define yy_set_bol(at_bol) \
638 { \
639 if ( ! YY_CURRENT_BUFFER ){\
Corentin Wallez168d5e82017-02-01 12:18:56 -0800640 yyensure_buffer_stack (yyscanner); \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000641 YY_CURRENT_BUFFER_LVALUE = \
Corentin Wallez168d5e82017-02-01 12:18:56 -0800642 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000643 } \
644 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
645 }
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000646#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
647
Geoff Lang93561c32016-09-20 10:22:55 -0400648
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000649/* Begin user sect3 */
650
Geoff Lang93561c32016-09-20 10:22:55 -0400651#define ppwrap(yyscanner) (/*CONSTCOND*/1)
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000652#define YY_SKIP_YYWRAP
Corentin Wallez168d5e82017-02-01 12:18:56 -0800653typedef flex_uint8_t YY_CHAR;
Geoff Lang93561c32016-09-20 10:22:55 -0400654
655
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000656typedef int yy_state_type;
657
658#define yytext_ptr yytext_r
659
Geoff Lang93561c32016-09-20 10:22:55 -0400660
661
662
663
664
Corentin Wallez168d5e82017-02-01 12:18:56 -0800665static yy_state_type yy_get_previous_state ( yyscan_t yyscanner );
666static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner);
667static int yy_get_next_buffer ( yyscan_t yyscanner );
668static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -0400669
670
671
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000672
673/* Done after the current pattern has been matched and before the
674 * corresponding action - sets up yytext.
675 */
676#define YY_DO_BEFORE_ACTION \
677 yyg->yytext_ptr = yy_bp; \
Geoff Lang93561c32016-09-20 10:22:55 -0400678 yyleng = (int) (yy_cp - yy_bp); \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000679 yyg->yy_hold_char = *yy_cp; \
680 *yy_cp = '\0'; \
681 yyg->yy_c_buf_p = yy_cp;
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500682#define YY_NUM_RULES 37
683#define YY_END_OF_BUFFER 38
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000684/* This struct is not used in this scanner,
685 but its presence is necessary. */
686struct yy_trans_info
687 {
688 flex_int32_t yy_verify;
689 flex_int32_t yy_nxt;
690 };
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500691static const flex_int16_t yy_accept[95] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000692 { 0,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500693 0, 0, 0, 0, 38, 36, 34, 35, 35, 33,
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000694 7, 33, 33, 33, 33, 33, 33, 33, 33, 9,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500695 9, 33, 33, 33, 8, 33, 33, 3, 5, 5,
696 4, 34, 35, 19, 27, 20, 30, 25, 12, 23,
697 13, 24, 10, 2, 1, 26, 10, 9, 11, 11,
698 11, 9, 11, 9, 9, 14, 16, 18, 17, 15,
699 8, 31, 21, 32, 22, 3, 5, 6, 11, 10,
700 11, 10, 1, 10, 11, 10, 0, 10, 9, 9,
701 9, 28, 29, 0, 10, 10, 10, 10, 9, 10,
702 10, 9, 10, 0
shannonwoods@chromium.org3f83e292013-05-30 00:21:34 +0000703
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000704 } ;
705
Corentin Wallez168d5e82017-02-01 12:18:56 -0800706static const YY_CHAR yy_ec[256] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000707 { 0,
708 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
709 2, 2, 4, 1, 1, 1, 1, 1, 1, 1,
710 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
711 1, 2, 5, 1, 6, 1, 7, 8, 1, 9,
712 9, 10, 11, 9, 12, 13, 14, 15, 16, 16,
713 16, 16, 16, 16, 16, 17, 17, 9, 9, 18,
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000714 19, 20, 9, 1, 21, 21, 21, 21, 22, 23,
715 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
716 24, 24, 24, 24, 25, 24, 24, 26, 24, 24,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500717 9, 1, 9, 27, 24, 1, 21, 21, 21, 21,
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000718
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000719 22, 23, 24, 24, 24, 24, 24, 24, 24, 24,
720 24, 24, 24, 24, 24, 24, 25, 24, 24, 26,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500721 24, 24, 9, 28, 9, 9, 1, 1, 1, 1,
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000722 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
723 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
724 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
725 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
726 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
727 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
728 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
729
730 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
731 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
732 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
733 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
734 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
735 1, 1, 1, 1, 1
736 } ;
737
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500738static const YY_CHAR yy_meta[29] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000739 { 0,
740 1, 1, 2, 2, 1, 1, 1, 1, 1, 3,
shannonwoods@chromium.org2a5436f2013-05-30 00:21:41 +0000741 1, 1, 4, 1, 5, 5, 5, 1, 1, 1,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500742 5, 5, 5, 5, 5, 5, 1, 1
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000743 } ;
744
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500745static const flex_int16_t yy_base[100] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000746 { 0,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500747 0, 0, 26, 28, 133, 195, 130, 195, 128, 105,
748 195, 104, 25, 195, 100, 23, 27, 32, 31, 38,
749 50, 38, 93, 49, 0, 16, 51, 0, 195, 105,
750 87, 93, 195, 195, 195, 195, 195, 195, 195, 195,
751 195, 195, 67, 195, 0, 195, 81, 55, 84, 98,
752 110, 53, 61, 0, 52, 39, 195, 195, 195, 33,
753 0, 195, 195, 195, 195, 0, 195, 195, 113, 0,
754 126, 0, 0, 0, 133, 0, 56, 128, 0, 133,
755 0, 195, 195, 101, 141, 143, 145, 0, 15, 154,
756 195, 0, 195, 195, 177, 32, 182, 187, 189
shannon.woods%transgaming.com@gtempaccount.combcde56f2013-04-13 03:32:12 +0000757
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000758 } ;
759
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500760static const flex_int16_t yy_def[100] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000761 { 0,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500762 94, 1, 95, 95, 94, 94, 94, 94, 94, 94,
763 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
764 20, 94, 94, 94, 96, 94, 94, 97, 94, 94,
765 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
766 94, 94, 94, 94, 98, 94, 94, 20, 20, 49,
767 50, 50, 99, 21, 50, 94, 94, 94, 94, 94,
768 96, 94, 94, 94, 94, 97, 94, 94, 43, 43,
769 69, 69, 98, 47, 50, 50, 94, 51, 50, 99,
770 50, 94, 94, 94, 71, 75, 94, 50, 50, 94,
771 94, 50, 94, 0, 94, 94, 94, 94, 94
shannon.woods%transgaming.com@gtempaccount.combcde56f2013-04-13 03:32:12 +0000772
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000773 } ;
774
Corentin Wallez168d5e82017-02-01 12:18:56 -0800775static const flex_int16_t yy_nxt[224] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000776 { 0,
777 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
778 16, 17, 18, 19, 20, 21, 21, 22, 23, 24,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500779 25, 25, 25, 25, 25, 25, 26, 27, 29, 30,
780 29, 30, 36, 39, 62, 31, 61, 31, 41, 92,
781 44, 40, 63, 37, 45, 42, 43, 43, 43, 46,
782 47, 83, 48, 48, 49, 56, 57, 82, 50, 51,
783 50, 50, 52, 53, 54, 54, 54, 59, 60, 64,
784 87, 87, 87, 50, 55, 50, 81, 79, 65, 69,
785 50, 70, 70, 70, 50, 50, 50, 69, 71, 72,
786 69, 69, 69, 50, 32, 74, 74, 74, 49, 49,
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000787
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500788 68, 50, 75, 76, 50, 50, 50, 67, 50, 50,
789 50, 58, 50, 50, 50, 90, 90, 90, 38, 50,
790 77, 77, 35, 34, 78, 78, 78, 69, 69, 69,
791 33, 32, 94, 94, 69, 69, 84, 84, 94, 94,
792 85, 85, 85, 84, 84, 50, 94, 86, 86, 86,
793 88, 94, 94, 94, 94, 94, 50, 89, 50, 87,
794 87, 87, 94, 72, 94, 76, 94, 91, 90, 90,
795 90, 94, 94, 94, 94, 94, 93, 28, 28, 28,
796 28, 28, 66, 94, 94, 66, 66, 73, 94, 73,
797 73, 73, 80, 80, 5, 94, 94, 94, 94, 94,
shannonwoods@chromium.orgc8100b82013-05-30 00:20:34 +0000798
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500799 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
800 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
801 94, 94, 94
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000802 } ;
803
Corentin Wallez168d5e82017-02-01 12:18:56 -0800804static const flex_int16_t yy_chk[224] =
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000805 { 0,
806 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
807 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500808 1, 1, 1, 1, 1, 1, 1, 1, 3, 3,
809 4, 4, 13, 16, 26, 3, 96, 4, 17, 89,
810 19, 16, 26, 13, 19, 17, 18, 18, 18, 19,
811 20, 60, 20, 20, 20, 22, 22, 56, 20, 20,
812 20, 20, 20, 20, 21, 21, 21, 24, 24, 27,
813 77, 77, 77, 53, 21, 21, 55, 52, 27, 43,
814 48, 43, 43, 43, 53, 53, 53, 43, 43, 43,
815 43, 43, 43, 47, 32, 47, 47, 47, 49, 49,
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000816
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500817 31, 47, 47, 47, 47, 47, 47, 30, 49, 49,
818 50, 23, 50, 50, 50, 84, 84, 84, 15, 50,
819 51, 51, 12, 10, 51, 51, 51, 69, 69, 69,
820 9, 7, 5, 0, 69, 69, 71, 71, 78, 78,
821 71, 71, 71, 75, 75, 80, 0, 75, 75, 75,
822 78, 85, 85, 86, 86, 0, 80, 80, 80, 87,
823 87, 87, 0, 85, 0, 86, 0, 87, 90, 90,
824 90, 0, 0, 0, 0, 0, 90, 95, 95, 95,
825 95, 95, 97, 0, 0, 97, 97, 98, 0, 98,
826 98, 98, 99, 99, 94, 94, 94, 94, 94, 94,
shannonwoods@chromium.orgc8100b82013-05-30 00:20:34 +0000827
Corentin Wallezdc0fa462017-02-01 14:44:43 -0500828 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
829 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
830 94, 94, 94
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000831 } ;
832
833/* The intent behind this definition is that it'll catch
834 * any uses of REJECT which flex missed.
835 */
836#define REJECT reject_used_but_not_detected
837#define yymore() yymore_used_but_not_detected
838#define YY_MORE_ADJ 0
839#define YY_RESTORE_YY_MORE_OFFSET
840/*
841//
Jamie Madill88f6e942014-02-19 10:27:53 -0500842// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000843// Use of this source code is governed by a BSD-style license that can be
844// found in the LICENSE file.
845//
846
847This file contains the Lex specification for GLSL ES preprocessor.
848Based on Microsoft Visual Studio 2010 Preprocessor Grammar:
849http://msdn.microsoft.com/en-us/library/2scxys89.aspx
850
851IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
852*/
853
Scott Grahama8975422015-05-01 11:09:12 -0700854#if defined(_MSC_VER)
855#pragma warning(disable: 4005)
856#endif
857
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400858#include "compiler/preprocessor/Tokenizer.h"
alokp@chromium.org2c958ee2012-05-17 20:35:42 +0000859
Corentin Wallez054f7ed2016-09-20 17:15:59 -0400860#include "compiler/preprocessor/DiagnosticsBase.h"
861#include "compiler/preprocessor/Token.h"
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000862
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +0000863#if defined(__GNUC__)
864// Triggered by the auto-generated yy_fatal_error function.
865#pragma GCC diagnostic ignored "-Wmissing-noreturn"
Minmin Gong794e0002015-04-07 18:31:54 -0700866#elif defined(_MSC_VER)
867#pragma warning(disable: 4244)
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +0000868#endif
869
Jamie Madill2dc8bf82015-04-30 15:56:52 -0400870// Workaround for flex using the register keyword, deprecated in C++11.
871#ifdef __cplusplus
872#if __cplusplus > 199711L
873#define register
874#endif
875#endif
876
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000877typedef std::string YYSTYPE;
alokp@chromium.org2c958ee2012-05-17 20:35:42 +0000878typedef pp::SourceLocation YYLTYPE;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000879
880// Use the unused yycolumn variable to track file (string) number.
881#define yyfileno yycolumn
882
883#define YY_USER_INIT \
884 do { \
885 yyfileno = 0; \
886 yylineno = 1; \
887 yyextra->leadingSpace = false; \
888 yyextra->lineStart = true; \
889 } while(0);
890
alokp@chromium.org19d7aa62012-05-31 17:34:05 +0000891#define YY_USER_ACTION \
892 do \
893 { \
894 pp::Input* input = &yyextra->input; \
895 pp::Input::Location* scanLoc = &yyextra->scanLoc; \
896 while ((scanLoc->sIndex < input->count()) && \
897 (scanLoc->cIndex >= input->length(scanLoc->sIndex))) \
898 { \
899 scanLoc->cIndex -= input->length(scanLoc->sIndex++); \
900 ++yyfileno; yylineno = 1; \
901 } \
902 yylloc->file = yyfileno; \
903 yylloc->line = yylineno; \
904 scanLoc->cIndex += yyleng; \
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000905 } while(0);
906
907#define YY_INPUT(buf, result, maxSize) \
Olli Etuaho26e355b2015-08-14 14:16:19 +0300908 result = yyextra->input.read(buf, maxSize, &yylineno);
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000909
Geoff Lang93561c32016-09-20 10:22:55 -0400910
911
912
913
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000914#define INITIAL 0
915#define COMMENT 1
916
Geoff Lang93561c32016-09-20 10:22:55 -0400917
918
919
920
921
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000922#define YY_EXTRA_TYPE pp::Tokenizer::Context*
923
Geoff Lang93561c32016-09-20 10:22:55 -0400924
925
926
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000927/* Holds the entire state of the reentrant scanner. */
928struct yyguts_t
929 {
930
931 /* User-defined. Not touched by flex. */
932 YY_EXTRA_TYPE yyextra_r;
933
934 /* The rest are the same as the globals declared in the non-reentrant scanner. */
935 FILE *yyin_r, *yyout_r;
936 size_t yy_buffer_stack_top; /**< index of top of stack. */
937 size_t yy_buffer_stack_max; /**< capacity of stack. */
938 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
939 char yy_hold_char;
Geoff Lang93561c32016-09-20 10:22:55 -0400940 int yy_n_chars;
941 int yyleng_r;
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000942 char *yy_c_buf_p;
943 int yy_init;
944 int yy_start;
945 int yy_did_buffer_switch_on_eof;
946 int yy_start_stack_ptr;
947 int yy_start_stack_depth;
948 int *yy_start_stack;
949 yy_state_type yy_last_accepting_state;
950 char* yy_last_accepting_cpos;
951
952 int yylineno_r;
953 int yy_flex_debug_r;
954
Geoff Lang93561c32016-09-20 10:22:55 -0400955
956
957
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000958 char *yytext_r;
959 int yy_more_flag;
960 int yy_more_len;
961
Geoff Lang93561c32016-09-20 10:22:55 -0400962
963
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000964 YYSTYPE * yylval_r;
965
Geoff Lang93561c32016-09-20 10:22:55 -0400966
967
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000968 YYLTYPE * yylloc_r;
969
Geoff Lang93561c32016-09-20 10:22:55 -0400970
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000971 }; /* end struct yyguts_t */
972
Geoff Lang93561c32016-09-20 10:22:55 -0400973
974
975
Corentin Wallez168d5e82017-02-01 12:18:56 -0800976static int yy_init_globals ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000977
978 /* This must go here because YYSTYPE and YYLTYPE are included
979 * from bison output in section 1.*/
980 # define yylval yyg->yylval_r
Geoff Lang93561c32016-09-20 10:22:55 -0400981
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000982 # define yylloc yyg->yylloc_r
Geoff Lang93561c32016-09-20 10:22:55 -0400983
Corentin Wallez168d5e82017-02-01 12:18:56 -0800984int yylex_init (yyscan_t* scanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000985
Corentin Wallez168d5e82017-02-01 12:18:56 -0800986int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000987
Geoff Lang93561c32016-09-20 10:22:55 -0400988
989
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000990/* Accessor methods to globals.
991 These are made visible to non-reentrant scanners for convenience. */
992
Geoff Lang93561c32016-09-20 10:22:55 -0400993
Corentin Wallez168d5e82017-02-01 12:18:56 -0800994int yylex_destroy ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000995
Geoff Lang93561c32016-09-20 10:22:55 -0400996
997
Corentin Wallez168d5e82017-02-01 12:18:56 -0800998int yyget_debug ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +0000999
Geoff Lang93561c32016-09-20 10:22:55 -04001000
1001
Corentin Wallez168d5e82017-02-01 12:18:56 -08001002void yyset_debug ( int debug_flag , yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001003
Geoff Lang93561c32016-09-20 10:22:55 -04001004
1005
Corentin Wallez168d5e82017-02-01 12:18:56 -08001006YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001007
Geoff Lang93561c32016-09-20 10:22:55 -04001008
1009
Corentin Wallez168d5e82017-02-01 12:18:56 -08001010void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001011
Geoff Lang93561c32016-09-20 10:22:55 -04001012
1013
Corentin Wallez168d5e82017-02-01 12:18:56 -08001014FILE *yyget_in ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001015
Geoff Lang93561c32016-09-20 10:22:55 -04001016
1017
Corentin Wallez168d5e82017-02-01 12:18:56 -08001018void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001019
1020
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001021
Corentin Wallez168d5e82017-02-01 12:18:56 -08001022FILE *yyget_out ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001023
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001024
Geoff Lang93561c32016-09-20 10:22:55 -04001025
Corentin Wallez168d5e82017-02-01 12:18:56 -08001026void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001027
1028
1029
Corentin Wallez168d5e82017-02-01 12:18:56 -08001030 int yyget_leng ( yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001031
1032
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001033
Corentin Wallez168d5e82017-02-01 12:18:56 -08001034char *yyget_text ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001035
Geoff Lang93561c32016-09-20 10:22:55 -04001036
1037
Corentin Wallez168d5e82017-02-01 12:18:56 -08001038int yyget_lineno ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001039
Geoff Lang93561c32016-09-20 10:22:55 -04001040
1041
Corentin Wallez168d5e82017-02-01 12:18:56 -08001042void yyset_lineno ( int _line_number , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001043
1044
1045
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001046
Corentin Wallez168d5e82017-02-01 12:18:56 -08001047int yyget_column ( yyscan_t yyscanner );
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001048
Geoff Lang93561c32016-09-20 10:22:55 -04001049
1050
1051
1052
Corentin Wallez168d5e82017-02-01 12:18:56 -08001053void yyset_column ( int _column_no , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001054
1055
1056
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001057
Corentin Wallez168d5e82017-02-01 12:18:56 -08001058YYSTYPE * yyget_lval ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001059
Geoff Lang93561c32016-09-20 10:22:55 -04001060
Corentin Wallez168d5e82017-02-01 12:18:56 -08001061void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001062
Corentin Wallez168d5e82017-02-01 12:18:56 -08001063 YYLTYPE *yyget_lloc ( yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001064
Corentin Wallez168d5e82017-02-01 12:18:56 -08001065 void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner );
Geoff Lang93561c32016-09-20 10:22:55 -04001066
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001067/* Macros after this point can all be overridden by user definitions in
1068 * section 1.
1069 */
1070
1071#ifndef YY_SKIP_YYWRAP
1072#ifdef __cplusplus
Corentin Wallez168d5e82017-02-01 12:18:56 -08001073extern "C" int yywrap ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001074#else
Corentin Wallez168d5e82017-02-01 12:18:56 -08001075extern int yywrap ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001076#endif
1077#endif
1078
Geoff Lang93561c32016-09-20 10:22:55 -04001079#ifndef YY_NO_UNPUT
Luc Ferronadcf0ae2018-01-24 08:27:37 -05001080
Geoff Lang93561c32016-09-20 10:22:55 -04001081#endif
1082
1083
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001084#ifndef yytext_ptr
Corentin Wallez168d5e82017-02-01 12:18:56 -08001085static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001086#endif
1087
1088#ifdef YY_NEED_STRLEN
Corentin Wallez168d5e82017-02-01 12:18:56 -08001089static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001090#endif
1091
1092#ifndef YY_NO_INPUT
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001093#ifdef __cplusplus
Corentin Wallez168d5e82017-02-01 12:18:56 -08001094static int yyinput ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001095#else
Corentin Wallez168d5e82017-02-01 12:18:56 -08001096static int input ( yyscan_t yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001097#endif
1098
1099#endif
1100
Geoff Lang93561c32016-09-20 10:22:55 -04001101
1102
1103
1104
1105
1106
1107
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001108/* Amount of stuff to slurp up with each read. */
1109#ifndef YY_READ_BUF_SIZE
Geoff Lang93561c32016-09-20 10:22:55 -04001110#ifdef __ia64__
1111/* On IA-64, the buffer size is 16k, not 8k */
1112#define YY_READ_BUF_SIZE 16384
1113#else
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001114#define YY_READ_BUF_SIZE 8192
Geoff Lang93561c32016-09-20 10:22:55 -04001115#endif /* __ia64__ */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001116#endif
1117
Geoff Lang93561c32016-09-20 10:22:55 -04001118
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001119/* Copy whatever the last rule matched to the standard output. */
1120#ifndef ECHO
1121/* This used to be an fputs(), but since the string might contain NUL's,
1122 * we now use fwrite().
1123 */
Geoff Lang93561c32016-09-20 10:22:55 -04001124#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001125#endif
1126
Geoff Lang93561c32016-09-20 10:22:55 -04001127
1128
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001129/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1130 * is returned in "result".
1131 */
1132#ifndef YY_INPUT
1133#define YY_INPUT(buf,result,max_size) \
1134 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1135 { \
1136 int c = '*'; \
Corentin Wallez168d5e82017-02-01 12:18:56 -08001137 int n; \
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001138 for ( n = 0; n < max_size && \
1139 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1140 buf[n] = (char) c; \
1141 if ( c == '\n' ) \
1142 buf[n++] = (char) c; \
1143 if ( c == EOF && ferror( yyin ) ) \
1144 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1145 result = n; \
1146 } \
1147 else \
1148 { \
1149 errno=0; \
Corentin Wallez168d5e82017-02-01 12:18:56 -08001150 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001151 { \
1152 if( errno != EINTR) \
1153 { \
1154 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1155 break; \
1156 } \
1157 errno=0; \
1158 clearerr(yyin); \
1159 } \
1160 }\
1161\
1162
1163#endif
1164
Geoff Lang93561c32016-09-20 10:22:55 -04001165
1166
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001167/* No semi-colon after return; correct usage is to write "yyterminate();" -
1168 * we don't want an extra ';' after the "return" because that will cause
1169 * some compilers to complain about unreachable statements.
1170 */
1171#ifndef yyterminate
1172#define yyterminate() return YY_NULL
1173#endif
1174
Geoff Lang93561c32016-09-20 10:22:55 -04001175
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001176/* Number of entries by which start-condition stack grows. */
1177#ifndef YY_START_STACK_INCR
1178#define YY_START_STACK_INCR 25
1179#endif
1180
Geoff Lang93561c32016-09-20 10:22:55 -04001181
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001182/* Report a fatal error. */
1183#ifndef YY_FATAL_ERROR
1184#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
1185#endif
1186
Geoff Lang93561c32016-09-20 10:22:55 -04001187
1188
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001189/* end tables serialization structures and prototypes */
1190
Geoff Lang93561c32016-09-20 10:22:55 -04001191
1192
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001193/* Default declaration of generated scanner - a define so the user can
1194 * easily add parameters.
1195 */
1196#ifndef YY_DECL
1197#define YY_DECL_IS_OURS 1
1198
Corentin Wallez168d5e82017-02-01 12:18:56 -08001199extern int yylex \
1200 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001201
Corentin Wallez168d5e82017-02-01 12:18:56 -08001202#define YY_DECL int yylex \
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001203 (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
1204#endif /* !YY_DECL */
1205
Geoff Lang93561c32016-09-20 10:22:55 -04001206
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001207/* Code executed at the beginning of each rule, after yytext and yyleng
1208 * have been set up.
1209 */
1210#ifndef YY_USER_ACTION
1211#define YY_USER_ACTION
1212#endif
1213
Geoff Lang93561c32016-09-20 10:22:55 -04001214
1215
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001216/* Code executed at the end of each rule. */
1217#ifndef YY_BREAK
Geoff Lang93561c32016-09-20 10:22:55 -04001218#define YY_BREAK /*LINTED*/break;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001219#endif
1220
Geoff Lang93561c32016-09-20 10:22:55 -04001221
1222
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001223#define YY_RULE_SETUP \
1224 YY_USER_ACTION
1225
Geoff Lang93561c32016-09-20 10:22:55 -04001226
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001227/** The main scanner function which does all the work.
1228 */
1229YY_DECL
1230{
Geoff Lang93561c32016-09-20 10:22:55 -04001231 yy_state_type yy_current_state;
1232 char *yy_cp, *yy_bp;
1233 int yy_act;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001234 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1235
Geoff Lang93561c32016-09-20 10:22:55 -04001236
1237
1238
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001239 yylval = yylval_param;
1240
Geoff Lang93561c32016-09-20 10:22:55 -04001241
1242
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001243 yylloc = yylloc_param;
1244
Geoff Lang93561c32016-09-20 10:22:55 -04001245
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001246 if ( !yyg->yy_init )
1247 {
1248 yyg->yy_init = 1;
1249
1250#ifdef YY_USER_INIT
1251 YY_USER_INIT;
1252#endif
1253
Geoff Lang93561c32016-09-20 10:22:55 -04001254
1255
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001256 if ( ! yyg->yy_start )
1257 yyg->yy_start = 1; /* first start state */
1258
1259 if ( ! yyin )
1260 yyin = stdin;
1261
1262 if ( ! yyout )
1263 yyout = stdout;
1264
1265 if ( ! YY_CURRENT_BUFFER ) {
Corentin Wallez168d5e82017-02-01 12:18:56 -08001266 yyensure_buffer_stack (yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001267 YY_CURRENT_BUFFER_LVALUE =
Corentin Wallez168d5e82017-02-01 12:18:56 -08001268 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001269 }
1270
Corentin Wallez168d5e82017-02-01 12:18:56 -08001271 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001272 }
1273
Jamie Madill185de882014-12-22 15:17:52 -05001274 {
1275
Geoff Lang93561c32016-09-20 10:22:55 -04001276
Jamie Madill185de882014-12-22 15:17:52 -05001277 /* Line comment */
1278
Geoff Lang93561c32016-09-20 10:22:55 -04001279 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001280 {
1281 yy_cp = yyg->yy_c_buf_p;
1282
1283 /* Support of yytext. */
1284 *yy_cp = yyg->yy_hold_char;
1285
1286 /* yy_bp points to the position in yy_ch_buf of the start of
1287 * the current run.
1288 */
1289 yy_bp = yy_cp;
1290
1291 yy_current_state = yyg->yy_start;
1292yy_match:
1293 do
1294 {
Geoff Lang93561c32016-09-20 10:22:55 -04001295 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001296 if ( yy_accept[yy_current_state] )
1297 {
1298 yyg->yy_last_accepting_state = yy_current_state;
1299 yyg->yy_last_accepting_cpos = yy_cp;
1300 }
1301 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1302 {
1303 yy_current_state = (int) yy_def[yy_current_state];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001304 if ( yy_current_state >= 95 )
Corentin Wallez168d5e82017-02-01 12:18:56 -08001305 yy_c = yy_meta[yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001306 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08001307 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001308 ++yy_cp;
1309 }
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001310 while ( yy_current_state != 94 );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001311 yy_cp = yyg->yy_last_accepting_cpos;
1312 yy_current_state = yyg->yy_last_accepting_state;
1313
1314yy_find_action:
1315 yy_act = yy_accept[yy_current_state];
1316
1317 YY_DO_BEFORE_ACTION;
1318
Geoff Lang93561c32016-09-20 10:22:55 -04001319
1320
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001321do_action: /* This label is used only to access EOF actions. */
1322
Geoff Lang93561c32016-09-20 10:22:55 -04001323
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001324 switch ( yy_act )
1325 { /* beginning of action switch */
1326 case 0: /* must back up */
1327 /* undo the effects of YY_DO_BEFORE_ACTION */
1328 *yy_cp = yyg->yy_hold_char;
1329 yy_cp = yyg->yy_last_accepting_cpos;
1330 yy_current_state = yyg->yy_last_accepting_state;
1331 goto yy_find_action;
1332
1333case 1:
1334YY_RULE_SETUP
1335
1336 YY_BREAK
1337/* Block comment */
1338/* Line breaks are just counted - not returned. */
Jamie Madillb96687d2015-04-30 15:56:51 -04001339/* The comment is replaced by a single space. */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001340case 2:
1341YY_RULE_SETUP
1342{ BEGIN(COMMENT); }
1343 YY_BREAK
1344case 3:
1345YY_RULE_SETUP
1346
1347 YY_BREAK
1348case 4:
1349YY_RULE_SETUP
1350
1351 YY_BREAK
1352case 5:
1353/* rule 5 can match eol */
1354YY_RULE_SETUP
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001355{
1356 if (yylineno == INT_MAX)
1357 {
1358 *yylval = "Integer overflow on line number";
1359 return pp::Token::GOT_ERROR;
1360 }
1361 ++yylineno;
1362}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001363 YY_BREAK
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001364case 6:
1365YY_RULE_SETUP
alokp@chromium.org2c958ee2012-05-17 20:35:42 +00001366{
1367 yyextra->leadingSpace = true;
1368 BEGIN(INITIAL);
1369}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001370 YY_BREAK
1371case 7:
1372YY_RULE_SETUP
1373{
1374 // # is only valid at start of line for preprocessor directives.
alokp@chromium.org432d6fc2012-06-27 22:13:21 +00001375 yylval->assign(1, yytext[0]);
1376 return yyextra->lineStart ? pp::Token::PP_HASH : pp::Token::PP_OTHER;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001377}
1378 YY_BREAK
1379case 8:
1380YY_RULE_SETUP
1381{
1382 yylval->assign(yytext, yyleng);
1383 return pp::Token::IDENTIFIER;
1384}
1385 YY_BREAK
1386case 9:
1387YY_RULE_SETUP
1388{
1389 yylval->assign(yytext, yyleng);
1390 return pp::Token::CONST_INT;
1391}
1392 YY_BREAK
1393case 10:
1394YY_RULE_SETUP
1395{
1396 yylval->assign(yytext, yyleng);
1397 return pp::Token::CONST_FLOAT;
1398}
1399 YY_BREAK
1400/* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */
1401/* Rule to catch all invalid integers and floats. */
1402case 11:
1403YY_RULE_SETUP
1404{
alokp@chromium.org432d6fc2012-06-27 22:13:21 +00001405 yylval->assign(yytext, yyleng);
1406 return pp::Token::PP_NUMBER;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001407}
1408 YY_BREAK
1409case 12:
1410YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001411{
1412 yylval->assign(yytext, yyleng);
1413 return pp::Token::OP_INC;
1414}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001415 YY_BREAK
1416case 13:
1417YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001418{
1419 yylval->assign(yytext, yyleng);
1420 return pp::Token::OP_DEC;
1421}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001422 YY_BREAK
1423case 14:
1424YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001425{
1426 yylval->assign(yytext, yyleng);
1427 return pp::Token::OP_LEFT;
1428}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001429 YY_BREAK
1430case 15:
1431YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001432{
1433 yylval->assign(yytext, yyleng);
1434 return pp::Token::OP_RIGHT;
1435}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001436 YY_BREAK
1437case 16:
1438YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001439{
1440 yylval->assign(yytext, yyleng);
1441 return pp::Token::OP_LE;
1442}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001443 YY_BREAK
1444case 17:
1445YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001446{
1447 yylval->assign(yytext, yyleng);
1448 return pp::Token::OP_GE;
1449}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001450 YY_BREAK
1451case 18:
1452YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001453{
1454 yylval->assign(yytext, yyleng);
1455 return pp::Token::OP_EQ;
1456}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001457 YY_BREAK
1458case 19:
1459YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001460{
1461 yylval->assign(yytext, yyleng);
1462 return pp::Token::OP_NE;
1463}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001464 YY_BREAK
1465case 20:
1466YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001467{
1468 yylval->assign(yytext, yyleng);
1469 return pp::Token::OP_AND;
1470}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001471 YY_BREAK
1472case 21:
1473YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001474{
1475 yylval->assign(yytext, yyleng);
1476 return pp::Token::OP_XOR;
1477}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001478 YY_BREAK
1479case 22:
1480YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001481{
1482 yylval->assign(yytext, yyleng);
1483 return pp::Token::OP_OR;
1484}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001485 YY_BREAK
1486case 23:
1487YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001488{
1489 yylval->assign(yytext, yyleng);
1490 return pp::Token::OP_ADD_ASSIGN;
1491}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001492 YY_BREAK
1493case 24:
1494YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001495{
1496 yylval->assign(yytext, yyleng);
1497 return pp::Token::OP_SUB_ASSIGN;
1498}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001499 YY_BREAK
1500case 25:
1501YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001502{
1503 yylval->assign(yytext, yyleng);
1504 return pp::Token::OP_MUL_ASSIGN;
1505}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001506 YY_BREAK
1507case 26:
1508YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001509{
1510 yylval->assign(yytext, yyleng);
1511 return pp::Token::OP_DIV_ASSIGN;
1512}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001513 YY_BREAK
1514case 27:
1515YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001516{
1517 yylval->assign(yytext, yyleng);
1518 return pp::Token::OP_MOD_ASSIGN;
1519}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001520 YY_BREAK
1521case 28:
1522YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001523{
1524 yylval->assign(yytext, yyleng);
1525 return pp::Token::OP_LEFT_ASSIGN;
1526}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001527 YY_BREAK
1528case 29:
1529YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001530{
1531 yylval->assign(yytext, yyleng);
1532 return pp::Token::OP_RIGHT_ASSIGN;
1533}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001534 YY_BREAK
1535case 30:
1536YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001537{
1538 yylval->assign(yytext, yyleng);
1539 return pp::Token::OP_AND_ASSIGN;
1540}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001541 YY_BREAK
1542case 31:
1543YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001544{
1545 yylval->assign(yytext, yyleng);
1546 return pp::Token::OP_XOR_ASSIGN;
1547}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001548 YY_BREAK
1549case 32:
1550YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001551{
1552 yylval->assign(yytext, yyleng);
1553 return pp::Token::OP_OR_ASSIGN;
1554}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001555 YY_BREAK
1556case 33:
1557YY_RULE_SETUP
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001558{
1559 yylval->assign(1, yytext[0]);
1560 return yytext[0];
1561}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001562 YY_BREAK
1563case 34:
1564YY_RULE_SETUP
1565{ yyextra->leadingSpace = true; }
1566 YY_BREAK
1567case 35:
1568/* rule 35 can match eol */
1569YY_RULE_SETUP
1570{
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001571 if (yylineno == INT_MAX)
1572 {
1573 *yylval = "Integer overflow on line number";
1574 return pp::Token::GOT_ERROR;
1575 }
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001576 ++yylineno;
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001577 yylval->assign(1, '\n');
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001578 return '\n';
1579}
1580 YY_BREAK
1581case 36:
1582YY_RULE_SETUP
1583{
alokp@chromium.org432d6fc2012-06-27 22:13:21 +00001584 yylval->assign(1, yytext[0]);
1585 return pp::Token::PP_OTHER;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001586}
1587 YY_BREAK
1588case YY_STATE_EOF(INITIAL):
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001589case YY_STATE_EOF(COMMENT):
1590{
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00001591 // YY_USER_ACTION is not invoked for handling EOF.
1592 // Set the location for EOF token manually.
1593 pp::Input* input = &yyextra->input;
1594 pp::Input::Location* scanLoc = &yyextra->scanLoc;
shannon.woods@transgaming.comd64b3da2013-02-28 23:19:26 +00001595 yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00001596 if (scanLoc->sIndex != sIndexMax)
1597 {
1598 // We can only reach here if there are empty strings at the
1599 // end of the input.
1600 scanLoc->sIndex = sIndexMax; scanLoc->cIndex = 0;
shannon.woods@transgaming.comd64b3da2013-02-28 23:19:26 +00001601 // FIXME: this is not 64-bit clean.
1602 yyfileno = static_cast<int>(sIndexMax); yylineno = 1;
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00001603 }
1604 yylloc->file = yyfileno;
1605 yylloc->line = yylineno;
1606 yylval->clear();
1607
Corentin Wallezd78e33a2017-10-30 12:33:52 -04001608 // Line number overflows fake EOFs to exit early, check for this case.
1609 if (yylineno == INT_MAX)
1610 {
1611 yyextra->diagnostics->report(pp::Diagnostics::PP_TOKENIZER_ERROR,
1612 pp::SourceLocation(yyfileno, yylineno),
1613 "Integer overflow on line number");
1614 }
1615 else if (YY_START == COMMENT)
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001616 {
Shannon Woods7f2d7942013-11-19 15:07:58 -05001617 yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001618 pp::SourceLocation(yyfileno, yylineno),
Corentin Wallezd78e33a2017-10-30 12:33:52 -04001619 "EOF while in a comment");
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001620 }
alokp@chromium.org07d921d2012-05-22 20:22:08 +00001621 yyterminate();
1622}
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001623 YY_BREAK
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001624case 37:
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001625YY_RULE_SETUP
1626ECHO;
1627 YY_BREAK
1628
1629 case YY_END_OF_BUFFER:
1630 {
1631 /* Amount of text matched not including the EOB char. */
1632 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1633
1634 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1635 *yy_cp = yyg->yy_hold_char;
1636 YY_RESTORE_YY_MORE_OFFSET
1637
1638 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1639 {
1640 /* We're scanning a new file or input source. It's
1641 * possible that this happened because the user
1642 * just pointed yyin at a new source and called
Corentin Wallez168d5e82017-02-01 12:18:56 -08001643 * yylex(). If so, then we have to assure
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001644 * consistency between YY_CURRENT_BUFFER and our
1645 * globals. Here is the right place to do so, because
1646 * this is the first action (other than possibly a
1647 * back-up) that will match for the new input source.
1648 */
1649 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1650 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1651 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1652 }
1653
1654 /* Note that here we test for yy_c_buf_p "<=" to the position
1655 * of the first EOB in the buffer, since yy_c_buf_p will
1656 * already have been incremented past the NUL character
1657 * (since all states make transitions on EOB to the
1658 * end-of-buffer state). Contrast this with the test
1659 * in input().
1660 */
1661 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1662 { /* This was really a NUL. */
1663 yy_state_type yy_next_state;
1664
1665 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1666
1667 yy_current_state = yy_get_previous_state( yyscanner );
1668
1669 /* Okay, we're now positioned to make the NUL
1670 * transition. We couldn't have
1671 * yy_get_previous_state() go ahead and do it
1672 * for us because it doesn't know how to deal
1673 * with the possibility of jamming (and we don't
1674 * want to build jamming into it because then it
1675 * will run more slowly).
1676 */
1677
1678 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1679
1680 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1681
1682 if ( yy_next_state )
1683 {
1684 /* Consume the NUL. */
1685 yy_cp = ++yyg->yy_c_buf_p;
1686 yy_current_state = yy_next_state;
1687 goto yy_match;
1688 }
1689
1690 else
1691 {
1692 yy_cp = yyg->yy_last_accepting_cpos;
1693 yy_current_state = yyg->yy_last_accepting_state;
1694 goto yy_find_action;
1695 }
1696 }
1697
1698 else switch ( yy_get_next_buffer( yyscanner ) )
1699 {
1700 case EOB_ACT_END_OF_FILE:
1701 {
1702 yyg->yy_did_buffer_switch_on_eof = 0;
1703
Corentin Wallez168d5e82017-02-01 12:18:56 -08001704 if ( yywrap( yyscanner ) )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001705 {
1706 /* Note: because we've taken care in
1707 * yy_get_next_buffer() to have set up
1708 * yytext, we can now set up
1709 * yy_c_buf_p so that if some total
1710 * hoser (like flex itself) wants to
1711 * call the scanner after we return the
1712 * YY_NULL, it'll still work - another
1713 * YY_NULL will get returned.
1714 */
1715 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1716
1717 yy_act = YY_STATE_EOF(YY_START);
1718 goto do_action;
1719 }
1720
1721 else
1722 {
1723 if ( ! yyg->yy_did_buffer_switch_on_eof )
1724 YY_NEW_FILE;
1725 }
1726 break;
1727 }
1728
1729 case EOB_ACT_CONTINUE_SCAN:
1730 yyg->yy_c_buf_p =
1731 yyg->yytext_ptr + yy_amount_of_matched_text;
1732
1733 yy_current_state = yy_get_previous_state( yyscanner );
1734
1735 yy_cp = yyg->yy_c_buf_p;
1736 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1737 goto yy_match;
1738
1739 case EOB_ACT_LAST_MATCH:
1740 yyg->yy_c_buf_p =
1741 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1742
1743 yy_current_state = yy_get_previous_state( yyscanner );
1744
1745 yy_cp = yyg->yy_c_buf_p;
1746 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1747 goto yy_find_action;
1748 }
1749 break;
1750 }
1751
1752 default:
1753 YY_FATAL_ERROR(
1754 "fatal flex scanner internal error--no action found" );
1755 } /* end of action switch */
1756 } /* end of scanning one token */
Jamie Madill185de882014-12-22 15:17:52 -05001757 } /* end of user's declarations */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001758} /* end of yylex */
Geoff Lang93561c32016-09-20 10:22:55 -04001759
1760
1761
1762
1763
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001764/* yy_get_next_buffer - try to read in a new buffer
1765 *
1766 * Returns a code representing an action:
1767 * EOB_ACT_LAST_MATCH -
1768 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1769 * EOB_ACT_END_OF_FILE - end of file
1770 */
1771static int yy_get_next_buffer (yyscan_t yyscanner)
1772{
1773 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04001774 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1775 char *source = yyg->yytext_ptr;
Corentin Wallez168d5e82017-02-01 12:18:56 -08001776 int number_to_move, i;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001777 int ret_val;
1778
1779 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1780 YY_FATAL_ERROR(
1781 "fatal flex scanner internal error--end of buffer missed" );
1782
1783 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1784 { /* Don't try to fill the buffer, so this is an EOF. */
1785 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1786 {
1787 /* We matched a single character, the EOB, so
1788 * treat this as a final EOF.
1789 */
1790 return EOB_ACT_END_OF_FILE;
1791 }
1792
1793 else
1794 {
1795 /* We matched some text prior to the EOB, first
1796 * process it.
1797 */
1798 return EOB_ACT_LAST_MATCH;
1799 }
1800 }
1801
1802 /* Try to read more data. */
1803
1804 /* First move last chars to start of buffer. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001805 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001806
1807 for ( i = 0; i < number_to_move; ++i )
1808 *(dest++) = *(source++);
1809
1810 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1811 /* don't do the read, it's not guaranteed to return an EOF,
1812 * just force an EOF
1813 */
1814 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1815
1816 else
1817 {
Geoff Lang93561c32016-09-20 10:22:55 -04001818 int num_to_read =
Corentin Wallez168d5e82017-02-01 12:18:56 -08001819 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001820
1821 while ( num_to_read <= 0 )
1822 { /* Not enough room in the buffer - grow it. */
1823
1824 /* just a shorter name for the current buffer */
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001825 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001826
1827 int yy_c_buf_p_offset =
1828 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1829
1830 if ( b->yy_is_our_buffer )
1831 {
Geoff Lang93561c32016-09-20 10:22:55 -04001832 int new_size = b->yy_buf_size * 2;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001833
1834 if ( new_size <= 0 )
1835 b->yy_buf_size += b->yy_buf_size / 8;
1836 else
1837 b->yy_buf_size *= 2;
1838
1839 b->yy_ch_buf = (char *)
1840 /* Include room in for 2 EOB chars. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001841 yyrealloc( (void *) b->yy_ch_buf,
1842 (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001843 }
1844 else
1845 /* Can't grow it, we don't own it. */
Geoff Lang93561c32016-09-20 10:22:55 -04001846 b->yy_ch_buf = NULL;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001847
1848 if ( ! b->yy_ch_buf )
1849 YY_FATAL_ERROR(
1850 "fatal error - scanner input buffer overflow" );
1851
1852 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1853
Corentin Wallez168d5e82017-02-01 12:18:56 -08001854 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1855 number_to_move - 1;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001856
1857 }
1858
1859 if ( num_to_read > YY_READ_BUF_SIZE )
1860 num_to_read = YY_READ_BUF_SIZE;
1861
1862 /* Read in more data. */
Geoff Lang93561c32016-09-20 10:22:55 -04001863 yy_size_t ret = 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001864 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
Geoff Lang93561c32016-09-20 10:22:55 -04001865 ret, num_to_read );
1866 yyg->yy_n_chars = static_cast<int>(ret);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001867
1868 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1869 }
1870
1871 if ( yyg->yy_n_chars == 0 )
1872 {
1873 if ( number_to_move == YY_MORE_ADJ )
1874 {
1875 ret_val = EOB_ACT_END_OF_FILE;
Corentin Wallez168d5e82017-02-01 12:18:56 -08001876 yyrestart( yyin , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001877 }
1878
1879 else
1880 {
1881 ret_val = EOB_ACT_LAST_MATCH;
1882 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1883 YY_BUFFER_EOF_PENDING;
1884 }
1885 }
1886
1887 else
1888 ret_val = EOB_ACT_CONTINUE_SCAN;
1889
Corentin Wallez168d5e82017-02-01 12:18:56 -08001890 if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001891 /* Extend the array by 50%, plus the number we really need. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08001892 int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1893 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1894 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001895 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1896 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
Corentin Wallez168d5e82017-02-01 12:18:56 -08001897 /* "- 2" to take care of EOB's */
1898 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001899 }
1900
Corentin Wallez168d5e82017-02-01 12:18:56 -08001901 yyg->yy_n_chars += number_to_move;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001902 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1903 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1904
1905 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1906
1907 return ret_val;
1908}
1909
Geoff Lang93561c32016-09-20 10:22:55 -04001910
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001911/* yy_get_previous_state - get the state just before the EOB char was reached */
1912
1913 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1914{
Geoff Lang93561c32016-09-20 10:22:55 -04001915 yy_state_type yy_current_state;
1916 char *yy_cp;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001917 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1918
1919 yy_current_state = yyg->yy_start;
1920
1921 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1922 {
Geoff Lang93561c32016-09-20 10:22:55 -04001923 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001924 if ( yy_accept[yy_current_state] )
1925 {
1926 yyg->yy_last_accepting_state = yy_current_state;
1927 yyg->yy_last_accepting_cpos = yy_cp;
1928 }
1929 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1930 {
1931 yy_current_state = (int) yy_def[yy_current_state];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001932 if ( yy_current_state >= 95 )
Corentin Wallez168d5e82017-02-01 12:18:56 -08001933 yy_c = yy_meta[yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001934 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08001935 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001936 }
1937
1938 return yy_current_state;
1939}
1940
Geoff Lang93561c32016-09-20 10:22:55 -04001941
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001942/* yy_try_NUL_trans - try to make a transition on the NUL character
1943 *
1944 * synopsis
1945 * next_state = yy_try_NUL_trans( current_state );
1946 */
1947 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
1948{
Geoff Lang93561c32016-09-20 10:22:55 -04001949 int yy_is_jam;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001950 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
Geoff Lang93561c32016-09-20 10:22:55 -04001951 char *yy_cp = yyg->yy_c_buf_p;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001952
Geoff Lang93561c32016-09-20 10:22:55 -04001953 YY_CHAR yy_c = 1;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001954 if ( yy_accept[yy_current_state] )
1955 {
1956 yyg->yy_last_accepting_state = yy_current_state;
1957 yyg->yy_last_accepting_cpos = yy_cp;
1958 }
1959 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1960 {
1961 yy_current_state = (int) yy_def[yy_current_state];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001962 if ( yy_current_state >= 95 )
Corentin Wallez168d5e82017-02-01 12:18:56 -08001963 yy_c = yy_meta[yy_c];
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001964 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08001965 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
Corentin Wallezdc0fa462017-02-01 14:44:43 -05001966 yy_is_jam = (yy_current_state == 94);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001967
Zhenyao Mof1d723c2013-09-23 14:57:07 -04001968 (void)yyg;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001969 return yy_is_jam ? 0 : yy_current_state;
1970}
1971
Geoff Lang93561c32016-09-20 10:22:55 -04001972
1973#ifndef YY_NO_UNPUT
1974
1975#endif
1976
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001977#ifndef YY_NO_INPUT
1978#ifdef __cplusplus
1979 static int yyinput (yyscan_t yyscanner)
1980#else
1981 static int input (yyscan_t yyscanner)
1982#endif
1983
1984{
1985 int c;
1986 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1987
1988 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1989
1990 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1991 {
1992 /* yy_c_buf_p now points to the character we want to return.
1993 * If this occurs *before* the EOB characters, then it's a
1994 * valid NUL; if not, then we've hit the end of the buffer.
1995 */
1996 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1997 /* This was really a NUL. */
1998 *yyg->yy_c_buf_p = '\0';
1999
2000 else
2001 { /* need more input */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002002 int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002003 ++yyg->yy_c_buf_p;
2004
2005 switch ( yy_get_next_buffer( yyscanner ) )
2006 {
2007 case EOB_ACT_LAST_MATCH:
2008 /* This happens because yy_g_n_b()
2009 * sees that we've accumulated a
2010 * token and flags that we need to
2011 * try matching the token before
2012 * proceeding. But for input(),
2013 * there's no matching to consider.
2014 * So convert the EOB_ACT_LAST_MATCH
2015 * to EOB_ACT_END_OF_FILE.
2016 */
2017
2018 /* Reset buffer status. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002019 yyrestart( yyin , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002020
2021 /*FALLTHROUGH*/
2022
2023 case EOB_ACT_END_OF_FILE:
2024 {
Corentin Wallez168d5e82017-02-01 12:18:56 -08002025 if ( yywrap( yyscanner ) )
Geoff Lang93561c32016-09-20 10:22:55 -04002026 return 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002027
2028 if ( ! yyg->yy_did_buffer_switch_on_eof )
2029 YY_NEW_FILE;
2030#ifdef __cplusplus
2031 return yyinput(yyscanner);
2032#else
2033 return input(yyscanner);
2034#endif
2035 }
2036
2037 case EOB_ACT_CONTINUE_SCAN:
2038 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
2039 break;
2040 }
2041 }
2042 }
2043
2044 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
2045 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
2046 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
2047
Geoff Lang93561c32016-09-20 10:22:55 -04002048
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002049 return c;
2050}
2051#endif /* ifndef YY_NO_INPUT */
2052
2053/** Immediately switch to a different input stream.
2054 * @param input_file A readable stream.
2055 * @param yyscanner The scanner object.
2056 * @note This function does not reset the start condition to @c INITIAL .
2057 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002058 void yyrestart (FILE * input_file , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002059{
2060 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2061
2062 if ( ! YY_CURRENT_BUFFER ){
Corentin Wallez168d5e82017-02-01 12:18:56 -08002063 yyensure_buffer_stack (yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002064 YY_CURRENT_BUFFER_LVALUE =
Corentin Wallez168d5e82017-02-01 12:18:56 -08002065 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002066 }
2067
Corentin Wallez168d5e82017-02-01 12:18:56 -08002068 yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
2069 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002070}
2071
Geoff Lang93561c32016-09-20 10:22:55 -04002072
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002073/** Switch to a different input buffer.
2074 * @param new_buffer The new input buffer.
2075 * @param yyscanner The scanner object.
2076 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002077 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002078{
2079 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2080
2081 /* TODO. We should be able to replace this entire function body
2082 * with
Corentin Wallez168d5e82017-02-01 12:18:56 -08002083 * yypop_buffer_state();
2084 * yypush_buffer_state(new_buffer);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002085 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002086 yyensure_buffer_stack (yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002087 if ( YY_CURRENT_BUFFER == new_buffer )
2088 return;
2089
2090 if ( YY_CURRENT_BUFFER )
2091 {
2092 /* Flush out information for old buffer. */
2093 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2094 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2095 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2096 }
2097
2098 YY_CURRENT_BUFFER_LVALUE = new_buffer;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002099 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002100
2101 /* We don't actually know whether we did this switch during
Corentin Wallez168d5e82017-02-01 12:18:56 -08002102 * EOF (yywrap()) processing, but the only time this flag
2103 * is looked at is after yywrap() is called, so it's safe
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002104 * to go ahead and always set it.
2105 */
2106 yyg->yy_did_buffer_switch_on_eof = 1;
2107}
2108
Geoff Lang93561c32016-09-20 10:22:55 -04002109
Corentin Wallez168d5e82017-02-01 12:18:56 -08002110static void yy_load_buffer_state (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002111{
2112 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2113 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2114 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2115 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2116 yyg->yy_hold_char = *yyg->yy_c_buf_p;
2117}
2118
2119/** Allocate and initialize an input buffer state.
2120 * @param file A readable stream.
2121 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2122 * @param yyscanner The scanner object.
2123 * @return the allocated buffer state.
2124 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002125 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002126{
2127 YY_BUFFER_STATE b;
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002128
2129 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002130 if ( ! b )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002131 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002132
Corentin Wallez168d5e82017-02-01 12:18:56 -08002133 b->yy_buf_size = size;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002134
2135 /* yy_ch_buf has to be 2 characters longer than the size given because
2136 * we need to put in 2 end-of-buffer characters.
2137 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002138 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002139 if ( ! b->yy_ch_buf )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002140 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002141
2142 b->yy_is_our_buffer = 1;
2143
Corentin Wallez168d5e82017-02-01 12:18:56 -08002144 yy_init_buffer( b, file , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002145
2146 return b;
2147}
2148
Geoff Lang93561c32016-09-20 10:22:55 -04002149
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002150/** Destroy the buffer.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002151 * @param b a buffer created with yy_create_buffer()
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002152 * @param yyscanner The scanner object.
2153 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002154 void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002155{
2156 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2157
2158 if ( ! b )
2159 return;
2160
2161 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2162 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2163
2164 if ( b->yy_is_our_buffer )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002165 yyfree( (void *) b->yy_ch_buf , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002166
Corentin Wallez168d5e82017-02-01 12:18:56 -08002167 yyfree( (void *) b , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002168}
2169
Geoff Lang93561c32016-09-20 10:22:55 -04002170
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002171/* Initializes or reinitializes a buffer.
2172 * This function is sometimes called more than once on the same buffer,
Corentin Wallez168d5e82017-02-01 12:18:56 -08002173 * such as during a yyrestart() or at EOF.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002174 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002175 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002176
2177{
2178 int oerrno = errno;
2179 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2180
Corentin Wallez168d5e82017-02-01 12:18:56 -08002181 yy_flush_buffer( b , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002182
2183 b->yy_input_file = file;
2184 b->yy_fill_buffer = 1;
2185
Corentin Wallez168d5e82017-02-01 12:18:56 -08002186 /* If b is the current buffer, then yy_init_buffer was _probably_
2187 * called from yyrestart() or through yy_get_next_buffer.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002188 * In that case, we don't want to reset the lineno or column.
2189 */
2190 if (b != YY_CURRENT_BUFFER){
2191 b->yy_bs_lineno = 1;
2192 b->yy_bs_column = 0;
2193 }
2194
2195 b->yy_is_interactive = 0;
Geoff Lang93561c32016-09-20 10:22:55 -04002196
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002197 errno = oerrno;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002198}
2199
2200/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2201 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2202 * @param yyscanner The scanner object.
2203 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002204 void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002205{
2206 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2207 if ( ! b )
2208 return;
2209
2210 b->yy_n_chars = 0;
2211
2212 /* We always need two end-of-buffer characters. The first causes
2213 * a transition to the end-of-buffer state. The second causes
2214 * a jam in that state.
2215 */
2216 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2217 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2218
2219 b->yy_buf_pos = &b->yy_ch_buf[0];
2220
2221 b->yy_at_bol = 1;
2222 b->yy_buffer_status = YY_BUFFER_NEW;
2223
2224 if ( b == YY_CURRENT_BUFFER )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002225 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002226}
2227
2228/** Pushes the new state onto the stack. The new state becomes
2229 * the current state. This function will allocate the stack
2230 * if necessary.
2231 * @param new_buffer The new state.
2232 * @param yyscanner The scanner object.
2233 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002234void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002235{
2236 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002237 if (new_buffer == nullptr)
2238 return;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002239
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002240 yyensure_buffer_stack(yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002241
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002242 /* This block is copied from yy_switch_to_buffer. */
2243 if (YY_CURRENT_BUFFER)
2244 {
2245 /* Flush out information for old buffer. */
2246 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2247 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2248 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002249 }
2250
2251 /* Only push if top exists. Otherwise, replace top. */
2252 if (YY_CURRENT_BUFFER)
2253 yyg->yy_buffer_stack_top++;
2254 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2255
Corentin Wallez168d5e82017-02-01 12:18:56 -08002256 /* copied from yy_switch_to_buffer. */
2257 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002258 yyg->yy_did_buffer_switch_on_eof = 1;
2259}
2260
Geoff Lang93561c32016-09-20 10:22:55 -04002261
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002262/** Removes and deletes the top of the stack, if present.
2263 * The next element becomes the new top.
2264 * @param yyscanner The scanner object.
2265 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002266void yypop_buffer_state (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002267{
2268 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2269 if (!YY_CURRENT_BUFFER)
2270 return;
2271
Corentin Wallez168d5e82017-02-01 12:18:56 -08002272 yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002273 YY_CURRENT_BUFFER_LVALUE = nullptr;
2274 if (yyg->yy_buffer_stack_top > 0)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002275 --yyg->yy_buffer_stack_top;
2276
2277 if (YY_CURRENT_BUFFER) {
Corentin Wallez168d5e82017-02-01 12:18:56 -08002278 yy_load_buffer_state( yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002279 yyg->yy_did_buffer_switch_on_eof = 1;
2280 }
2281}
2282
Geoff Lang93561c32016-09-20 10:22:55 -04002283
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002284/* Allocates the stack if it does not exist.
2285 * Guarantees space for at least one push.
2286 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002287static void yyensure_buffer_stack (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002288{
shannonwoods@chromium.orgb0757162013-05-30 00:21:27 +00002289 yy_size_t num_to_alloc;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002290 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2291
2292 if (!yyg->yy_buffer_stack) {
2293
2294 /* First allocation is just for 2 elements, since we don't know if this
2295 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2296 * immediate realloc on the next call.
2297 */
Geoff Lang93561c32016-09-20 10:22:55 -04002298 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002299 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002300 (num_to_alloc * sizeof(struct yy_buffer_state*)
2301 , yyscanner);
2302 if ( ! yyg->yy_buffer_stack )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002303 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2304
2305
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002306 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
Corentin Wallez168d5e82017-02-01 12:18:56 -08002307
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002308 yyg->yy_buffer_stack_max = num_to_alloc;
2309 yyg->yy_buffer_stack_top = 0;
2310 return;
2311 }
2312
2313 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2314
2315 /* Increase the buffer to prepare for a possible push. */
Geoff Lang93561c32016-09-20 10:22:55 -04002316 yy_size_t grow_size = 8 /* arbitrary grow size */;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002317
2318 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002319 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002320 (yyg->yy_buffer_stack,
2321 num_to_alloc * sizeof(struct yy_buffer_state*)
2322 , yyscanner);
2323 if ( ! yyg->yy_buffer_stack )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002324 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002325
2326 /* zero only the new slots.*/
2327 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
2328 yyg->yy_buffer_stack_max = num_to_alloc;
2329 }
2330}
2331
Geoff Lang93561c32016-09-20 10:22:55 -04002332
2333
2334
2335
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002336/** Setup the input buffer state to scan directly from a user-specified character buffer.
2337 * @param base the character buffer
2338 * @param size the size in bytes of the character buffer
2339 * @param yyscanner The scanner object.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002340 * @return the newly allocated buffer state object.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002341 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002342YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002343{
2344 YY_BUFFER_STATE b;
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002345
2346 if ( size < 2 ||
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002347 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2348 base[size-1] != YY_END_OF_BUFFER_CHAR )
2349 /* They forgot to leave room for the EOB's. */
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002350 return nullptr;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002351
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002352 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002353 if ( ! b )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002354 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002355
Corentin Wallez168d5e82017-02-01 12:18:56 -08002356 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002357 b->yy_buf_pos = b->yy_ch_buf = base;
2358 b->yy_is_our_buffer = 0;
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002359 b->yy_input_file = nullptr;
2360 b->yy_n_chars = b->yy_buf_size;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002361 b->yy_is_interactive = 0;
2362 b->yy_at_bol = 1;
2363 b->yy_fill_buffer = 0;
2364 b->yy_buffer_status = YY_BUFFER_NEW;
2365
Corentin Wallez168d5e82017-02-01 12:18:56 -08002366 yy_switch_to_buffer( b , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002367
2368 return b;
2369}
2370
Geoff Lang93561c32016-09-20 10:22:55 -04002371
2372
2373
Corentin Wallez168d5e82017-02-01 12:18:56 -08002374/** Setup the input buffer state to scan a string. The next call to yylex() will
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002375 * scan from a @e copy of @a str.
2376 * @param yystr a NUL-terminated string to scan
2377 * @param yyscanner The scanner object.
2378 * @return the newly allocated buffer state object.
2379 * @note If you want to scan bytes that may contain NUL values, then use
Corentin Wallez168d5e82017-02-01 12:18:56 -08002380 * yy_scan_bytes() instead.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002381 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002382YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002383{
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002384
2385 return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002386}
2387
Geoff Lang93561c32016-09-20 10:22:55 -04002388
2389
2390
Corentin Wallez168d5e82017-02-01 12:18:56 -08002391/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002392 * scan from a @e copy of @a bytes.
Zhenyao Mof1d723c2013-09-23 14:57:07 -04002393 * @param yybytes the byte buffer to scan
2394 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002395 * @param yyscanner The scanner object.
2396 * @return the newly allocated buffer state object.
2397 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002398YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002399{
2400 YY_BUFFER_STATE b;
2401 char *buf;
Zhenyao Mof1d723c2013-09-23 14:57:07 -04002402 yy_size_t n;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002403 int i;
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002404
2405 /* Get memory for full buffer, including space for trailing EOB's. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002406 n = (yy_size_t) (_yybytes_len + 2);
2407 buf = (char *) yyalloc( n , yyscanner );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002408 if ( ! buf )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002409 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002410
Corentin Wallez168d5e82017-02-01 12:18:56 -08002411 for ( i = 0; i < _yybytes_len; ++i )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002412 buf[i] = yybytes[i];
2413
2414 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2415
Corentin Wallez168d5e82017-02-01 12:18:56 -08002416 b = yy_scan_buffer( buf, n , yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002417 if ( ! b )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002418 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002419
2420 /* It's okay to grow etc. this buffer, and we should throw it
2421 * away when we're done.
2422 */
2423 b->yy_is_our_buffer = 1;
2424
2425 return b;
2426}
2427
Geoff Lang93561c32016-09-20 10:22:55 -04002428
2429
2430
2431
2432
2433
2434
2435
2436
2437
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002438#ifndef YY_EXIT_FAILURE
2439#define YY_EXIT_FAILURE 2
2440#endif
2441
Corentin Wallez168d5e82017-02-01 12:18:56 -08002442static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002443{
Geoff Lang93561c32016-09-20 10:22:55 -04002444 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2445 (void)yyg;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002446 fprintf( stderr, "%s\n", msg );
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002447 exit( YY_EXIT_FAILURE );
2448}
2449
2450/* Redefine yyless() so it works in section 3 code. */
2451
2452#undef yyless
2453#define yyless(n) \
2454 do \
2455 { \
2456 /* Undo effects of setting up yytext. */ \
2457 int yyless_macro_arg = (n); \
2458 YY_LESS_LINENO(yyless_macro_arg);\
2459 yytext[yyleng] = yyg->yy_hold_char; \
2460 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2461 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2462 *yyg->yy_c_buf_p = '\0'; \
2463 yyleng = yyless_macro_arg; \
2464 } \
2465 while ( 0 )
2466
Geoff Lang93561c32016-09-20 10:22:55 -04002467
2468
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002469/* Accessor methods (get/set functions) to struct members. */
2470
Geoff Lang93561c32016-09-20 10:22:55 -04002471
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002472/** Get the user-defined data for this scanner.
2473 * @param yyscanner The scanner object.
2474 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002475YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002476{
2477 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2478 return yyextra;
2479}
2480
Geoff Lang93561c32016-09-20 10:22:55 -04002481
2482
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002483/** Get the current line number.
2484 * @param yyscanner The scanner object.
2485 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002486int yyget_lineno (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002487{
2488 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002489
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002490 if (! YY_CURRENT_BUFFER)
2491 return 0;
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002492
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002493 return yylineno;
2494}
2495
Geoff Lang93561c32016-09-20 10:22:55 -04002496
2497
2498
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002499/** Get the current column number.
2500 * @param yyscanner The scanner object.
2501 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002502int yyget_column (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002503{
2504 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002505
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002506 if (! YY_CURRENT_BUFFER)
2507 return 0;
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002508
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002509 return yycolumn;
2510}
2511
Geoff Lang93561c32016-09-20 10:22:55 -04002512
2513
2514
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002515/** Get the input stream.
2516 * @param yyscanner The scanner object.
2517 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002518FILE *yyget_in (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002519{
2520 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2521 return yyin;
2522}
2523
Geoff Lang93561c32016-09-20 10:22:55 -04002524
2525
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002526/** Get the output stream.
2527 * @param yyscanner The scanner object.
2528 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002529FILE *yyget_out (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002530{
2531 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2532 return yyout;
2533}
2534
Geoff Lang93561c32016-09-20 10:22:55 -04002535
2536
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002537/** Get the length of the current token.
2538 * @param yyscanner The scanner object.
2539 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002540int yyget_leng (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002541{
2542 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2543 return yyleng;
2544}
2545
Geoff Lang93561c32016-09-20 10:22:55 -04002546
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002547/** Get the current token.
2548 * @param yyscanner The scanner object.
2549 */
2550
Corentin Wallez168d5e82017-02-01 12:18:56 -08002551char *yyget_text (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002552{
2553 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2554 return yytext;
2555}
2556
Geoff Lang93561c32016-09-20 10:22:55 -04002557
2558
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002559/** Set the user-defined data. This data is never touched by the scanner.
2560 * @param user_defined The data to be associated with this scanner.
2561 * @param yyscanner The scanner object.
2562 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002563void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002564{
2565 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2566 yyextra = user_defined ;
2567}
2568
Geoff Lang93561c32016-09-20 10:22:55 -04002569
2570
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002571/** Set the current line number.
Geoff Lang93561c32016-09-20 10:22:55 -04002572 * @param _line_number line number
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002573 * @param yyscanner The scanner object.
2574 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002575void yyset_lineno (int _line_number , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002576{
2577 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2578
2579 /* lineno is only valid if an input buffer exists. */
2580 if (! YY_CURRENT_BUFFER )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002581 YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002582
Geoff Lang93561c32016-09-20 10:22:55 -04002583 yylineno = _line_number;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002584}
2585
Geoff Lang93561c32016-09-20 10:22:55 -04002586
2587
2588
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002589/** Set the current column.
Geoff Lang93561c32016-09-20 10:22:55 -04002590 * @param _column_no column number
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002591 * @param yyscanner The scanner object.
2592 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002593void yyset_column (int _column_no , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002594{
2595 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2596
2597 /* column is only valid if an input buffer exists. */
2598 if (! YY_CURRENT_BUFFER )
Corentin Wallez168d5e82017-02-01 12:18:56 -08002599 YY_FATAL_ERROR( "yyset_column called with no buffer" );
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002600
Geoff Lang93561c32016-09-20 10:22:55 -04002601 yycolumn = _column_no;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002602}
2603
Geoff Lang93561c32016-09-20 10:22:55 -04002604
2605
2606
2607
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002608/** Set the input stream. This does not discard the current
2609 * input buffer.
Geoff Lang93561c32016-09-20 10:22:55 -04002610 * @param _in_str A readable stream.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002611 * @param yyscanner The scanner object.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002612 * @see yy_switch_to_buffer
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002613 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002614void yyset_in (FILE * _in_str , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002615{
2616 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04002617 yyin = _in_str ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002618}
2619
Geoff Lang93561c32016-09-20 10:22:55 -04002620
2621
Corentin Wallez168d5e82017-02-01 12:18:56 -08002622void yyset_out (FILE * _out_str , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002623{
2624 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04002625 yyout = _out_str ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002626}
2627
Geoff Lang93561c32016-09-20 10:22:55 -04002628
2629
2630
Corentin Wallez168d5e82017-02-01 12:18:56 -08002631int yyget_debug (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002632{
2633 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2634 return yy_flex_debug;
2635}
2636
Geoff Lang93561c32016-09-20 10:22:55 -04002637
2638
Corentin Wallez168d5e82017-02-01 12:18:56 -08002639void yyset_debug (int _bdebug , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002640{
2641 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
Geoff Lang93561c32016-09-20 10:22:55 -04002642 yy_flex_debug = _bdebug ;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002643}
2644
Geoff Lang93561c32016-09-20 10:22:55 -04002645
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002646/* Accessor methods for yylval and yylloc */
2647
Geoff Lang93561c32016-09-20 10:22:55 -04002648
Corentin Wallez168d5e82017-02-01 12:18:56 -08002649YYSTYPE * yyget_lval (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002650{
2651 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2652 return yylval;
2653}
2654
Geoff Lang93561c32016-09-20 10:22:55 -04002655
2656
Corentin Wallez168d5e82017-02-01 12:18:56 -08002657void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002658{
2659 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2660 yylval = yylval_param;
2661}
2662
Corentin Wallez168d5e82017-02-01 12:18:56 -08002663YYLTYPE *yyget_lloc (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002664{
2665 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2666 return yylloc;
2667}
Geoff Lang93561c32016-09-20 10:22:55 -04002668
Corentin Wallez168d5e82017-02-01 12:18:56 -08002669void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002670{
2671 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2672 yylloc = yylloc_param;
2673}
Geoff Lang93561c32016-09-20 10:22:55 -04002674
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002675/* User-visible API */
2676
Corentin Wallez168d5e82017-02-01 12:18:56 -08002677/* yylex_init is special because it creates the scanner itself, so it is
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002678 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2679 * That's why we explicitly handle the declaration, instead of using our macros.
2680 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002681int yylex_init(yyscan_t* ptr_yy_globals)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002682{
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002683 if (ptr_yy_globals == nullptr)
2684 {
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002685 errno = EINVAL;
2686 return 1;
2687 }
2688
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002689 *ptr_yy_globals = (yyscan_t)yyalloc(sizeof(struct yyguts_t), nullptr);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002690
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002691 if (*ptr_yy_globals == nullptr)
2692 {
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002693 errno = ENOMEM;
2694 return 1;
2695 }
2696
2697 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2698 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2699
2700 return yy_init_globals ( *ptr_yy_globals );
2701}
2702
Geoff Lang93561c32016-09-20 10:22:55 -04002703
Corentin Wallez168d5e82017-02-01 12:18:56 -08002704/* yylex_init_extra has the same functionality as yylex_init, but follows the
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002705 * convention of taking the scanner as the last argument. Note however, that
2706 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2707 * is the reason, too, why this function also must handle its own declaration).
Corentin Wallez168d5e82017-02-01 12:18:56 -08002708 * The user defined value in the first argument will be available to yyalloc in
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002709 * the yyextra field.
2710 */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002711int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002712{
2713 struct yyguts_t dummy_yyguts;
2714
Corentin Wallez168d5e82017-02-01 12:18:56 -08002715 yyset_extra (yy_user_defined, &dummy_yyguts);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002716
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002717 if (ptr_yy_globals == nullptr)
2718 {
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002719 errno = EINVAL;
2720 return 1;
2721 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08002722
2723 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2724
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002725 if (*ptr_yy_globals == nullptr)
2726 {
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002727 errno = ENOMEM;
2728 return 1;
2729 }
Corentin Wallez168d5e82017-02-01 12:18:56 -08002730
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002731 /* By setting to 0xAA, we expose bugs in
2732 yy_init_globals. Leave at 0x00 for releases. */
2733 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
Corentin Wallez168d5e82017-02-01 12:18:56 -08002734
2735 yyset_extra (yy_user_defined, *ptr_yy_globals);
2736
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002737 return yy_init_globals ( *ptr_yy_globals );
2738}
2739
Geoff Lang93561c32016-09-20 10:22:55 -04002740
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002741static int yy_init_globals (yyscan_t yyscanner)
2742{
2743 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2744 /* Initialization is the same as for the non-reentrant scanner.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002745 * This function is called from yylex_destroy(), so don't allocate here.
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002746 */
2747
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002748 yyg->yy_buffer_stack = nullptr;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002749 yyg->yy_buffer_stack_top = 0;
2750 yyg->yy_buffer_stack_max = 0;
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002751 yyg->yy_c_buf_p = nullptr;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002752 yyg->yy_init = 0;
2753 yyg->yy_start = 0;
2754
Geoff Lang93561c32016-09-20 10:22:55 -04002755
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002756 yyg->yy_start_stack_ptr = 0;
2757 yyg->yy_start_stack_depth = 0;
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002758 yyg->yy_start_stack = nullptr;
Geoff Lang93561c32016-09-20 10:22:55 -04002759
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002760/* Defined in main.c */
2761#ifdef YY_STDINIT
2762 yyin = stdin;
2763 yyout = stdout;
2764#else
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002765 yyin = nullptr;
2766 yyout = nullptr;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002767#endif
2768
2769 /* For future reference: Set errno on error, since we are called by
Corentin Wallez168d5e82017-02-01 12:18:56 -08002770 * yylex_init()
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002771 */
2772 return 0;
2773}
2774
Geoff Lang93561c32016-09-20 10:22:55 -04002775
Corentin Wallez168d5e82017-02-01 12:18:56 -08002776/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2777int yylex_destroy (yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002778{
2779 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2780
2781 /* Pop the buffer stack, destroying each element. */
2782 while(YY_CURRENT_BUFFER){
Corentin Wallez168d5e82017-02-01 12:18:56 -08002783 yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002784 YY_CURRENT_BUFFER_LVALUE = nullptr;
2785 yypop_buffer_state(yyscanner);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002786 }
2787
2788 /* Destroy the stack itself. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002789 yyfree(yyg->yy_buffer_stack , yyscanner);
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002790 yyg->yy_buffer_stack = nullptr;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002791
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002792 /* Destroy the start condition stack. */
Corentin Wallez168d5e82017-02-01 12:18:56 -08002793 yyfree( yyg->yy_start_stack , yyscanner );
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002794 yyg->yy_start_stack = nullptr;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002795
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002796 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2797 * yylex() is called, initialization will occur. */
2798 yy_init_globals(yyscanner);
Geoff Lang93561c32016-09-20 10:22:55 -04002799
Luc Ferronadcf0ae2018-01-24 08:27:37 -05002800 /* Destroy the main struct (reentrant only). */
2801 yyfree(yyscanner, yyscanner);
2802 yyscanner = nullptr;
2803 return 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002804}
2805
Geoff Lang93561c32016-09-20 10:22:55 -04002806
2807
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002808/*
2809 * Internal utility routines.
2810 */
2811
Geoff Lang93561c32016-09-20 10:22:55 -04002812
2813
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002814#ifndef yytext_ptr
Corentin Wallez168d5e82017-02-01 12:18:56 -08002815static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002816{
Geoff Lang93561c32016-09-20 10:22:55 -04002817 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2818 (void)yyg;
2819
2820 int i;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002821 for ( i = 0; i < n; ++i )
2822 s1[i] = s2[i];
2823}
2824#endif
2825
Geoff Lang93561c32016-09-20 10:22:55 -04002826
2827
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002828#ifdef YY_NEED_STRLEN
Corentin Wallez168d5e82017-02-01 12:18:56 -08002829static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002830{
Geoff Lang93561c32016-09-20 10:22:55 -04002831 int n;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002832 for ( n = 0; s[n]; ++n )
2833 ;
2834
2835 return n;
2836}
2837#endif
2838
Geoff Lang93561c32016-09-20 10:22:55 -04002839
2840
Corentin Wallez168d5e82017-02-01 12:18:56 -08002841void *yyalloc (yy_size_t size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002842{
Geoff Lang93561c32016-09-20 10:22:55 -04002843 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2844 (void)yyg;
2845 return malloc(size);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002846}
2847
Geoff Lang93561c32016-09-20 10:22:55 -04002848
2849
Corentin Wallez168d5e82017-02-01 12:18:56 -08002850void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002851{
Geoff Lang93561c32016-09-20 10:22:55 -04002852 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2853 (void)yyg;
2854
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002855 /* The cast to (char *) in the following accommodates both
2856 * implementations that use char* generic pointers, and those
2857 * that use void* generic pointers. It works with the latter
2858 * because both ANSI C and C++ allow castless assignment from
2859 * any pointer type to void*, and deal with argument conversions
2860 * as though doing an assignment.
2861 */
Geoff Lang93561c32016-09-20 10:22:55 -04002862 return realloc(ptr, size);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002863}
2864
Geoff Lang93561c32016-09-20 10:22:55 -04002865
2866
Corentin Wallez168d5e82017-02-01 12:18:56 -08002867void yyfree (void * ptr , yyscan_t yyscanner)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002868{
Geoff Lang93561c32016-09-20 10:22:55 -04002869 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2870 (void)yyg;
Corentin Wallez168d5e82017-02-01 12:18:56 -08002871 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002872}
2873
Geoff Lang93561c32016-09-20 10:22:55 -04002874
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002875#define YYTABLES_NAME "yytables"
2876
Geoff Lang93561c32016-09-20 10:22:55 -04002877
2878
2879
2880
2881
2882
2883
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002884namespace pp {
2885
Corentin Wallez054f7ed2016-09-20 17:15:59 -04002886Tokenizer::Tokenizer(Diagnostics *diagnostics) : mHandle(nullptr), mMaxTokenSize(256)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002887{
alokp@chromium.org2c958ee2012-05-17 20:35:42 +00002888 mContext.diagnostics = diagnostics;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002889}
2890
2891Tokenizer::~Tokenizer()
2892{
2893 destroyScanner();
2894}
2895
Zhenyao Mod526f982014-05-13 14:51:19 -07002896bool Tokenizer::init(size_t count, const char * const string[], const int length[])
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002897{
Zhenyao Mod526f982014-05-13 14:51:19 -07002898 if ((count > 0) && (string == 0))
2899 return false;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002900
2901 mContext.input = Input(count, string, length);
2902 return initScanner();
2903}
2904
alokp@chromium.org46aa13d2012-06-15 15:40:27 +00002905void Tokenizer::setFileNumber(int file)
2906{
2907 // We use column number as file number.
2908 // See macro yyfileno.
Corentin Wallez168d5e82017-02-01 12:18:56 -08002909 yyset_column(file, mHandle);
alokp@chromium.org46aa13d2012-06-15 15:40:27 +00002910}
2911
2912void Tokenizer::setLineNumber(int line)
2913{
Corentin Wallez168d5e82017-02-01 12:18:56 -08002914 yyset_lineno(line, mHandle);
alokp@chromium.org46aa13d2012-06-15 15:40:27 +00002915}
2916
Jamie Madill5508f392014-02-20 13:31:36 -05002917void Tokenizer::setMaxTokenSize(size_t maxTokenSize)
2918{
2919 mMaxTokenSize = maxTokenSize;
2920}
2921
Zhenyao Mod526f982014-05-13 14:51:19 -07002922void Tokenizer::lex(Token *token)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002923{
Corentin Wallezdc0fa462017-02-01 14:44:43 -05002924 int tokenType = yylex(&token->text, &token->location, mHandle);
2925
2926 if (tokenType == Token::GOT_ERROR)
2927 {
2928 mContext.diagnostics->report(Diagnostics::PP_TOKENIZER_ERROR, token->location, token->text);
2929 token->type = Token::LAST;
2930 }
2931 else
2932 {
2933 token->type = tokenType;
2934 }
2935
Jamie Madill5508f392014-02-20 13:31:36 -05002936 if (token->text.size() > mMaxTokenSize)
alokp@chromium.orgc022c3a2012-07-09 15:56:42 +00002937 {
Shannon Woods7f2d7942013-11-19 15:07:58 -05002938 mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
alokp@chromium.orgc022c3a2012-07-09 15:56:42 +00002939 token->location, token->text);
Jamie Madill5508f392014-02-20 13:31:36 -05002940 token->text.erase(mMaxTokenSize);
alokp@chromium.orgc022c3a2012-07-09 15:56:42 +00002941 }
2942
alokp@chromium.org7fc38dd2012-06-14 18:23:23 +00002943 token->flags = 0;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002944
alokp@chromium.org19d7aa62012-05-31 17:34:05 +00002945 token->setAtStartOfLine(mContext.lineStart);
2946 mContext.lineStart = token->type == '\n';
2947
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002948 token->setHasLeadingSpace(mContext.leadingSpace);
2949 mContext.leadingSpace = false;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002950}
2951
2952bool Tokenizer::initScanner()
2953{
Corentin Wallez168d5e82017-02-01 12:18:56 -08002954 if ((mHandle == nullptr) && yylex_init_extra(&mContext, &mHandle))
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002955 return false;
2956
Corentin Wallez168d5e82017-02-01 12:18:56 -08002957 yyrestart(0, mHandle);
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002958 return true;
2959}
2960
2961void Tokenizer::destroyScanner()
2962{
Corentin Wallez054f7ed2016-09-20 17:15:59 -04002963 if (mHandle == nullptr)
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002964 return;
2965
Corentin Wallez168d5e82017-02-01 12:18:56 -08002966 yylex_destroy(mHandle);
Corentin Wallez054f7ed2016-09-20 17:15:59 -04002967 mHandle = nullptr;
alokp@chromium.org04d7d222012-05-16 19:24:07 +00002968}
2969
2970} // namespace pp
2971
Geoff Lang93561c32016-09-20 10:22:55 -04002972