Home | History | Annotate | Download | only in preprocessor
      1 #line 16 "./Tokenizer.l"
      2 // Copyright 2016 The SwiftShader Authors. All Rights Reserved.
      3 //
      4 // Licensed under the Apache License, Version 2.0 (the "License");
      5 // you may not use this file except in compliance with the License.
      6 // You may obtain a copy of the License at
      7 //
      8 //    http://www.apache.org/licenses/LICENSE-2.0
      9 //
     10 // Unless required by applicable law or agreed to in writing, software
     11 // distributed under the License is distributed on an "AS IS" BASIS,
     12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 // See the License for the specific language governing permissions and
     14 // limitations under the License.
     15 
     16 // This file is auto-generated by generate_parser.sh. DO NOT EDIT!
     17 
     18 
     19 
     20 #line 13 "./Tokenizer.cpp"
     21 
     22 #define  YY_INT_ALIGNED short int
     23 
     24 /* A lexical scanner generated by flex */
     25 
     26 #define FLEX_SCANNER
     27 #define YY_FLEX_MAJOR_VERSION 2
     28 #define YY_FLEX_MINOR_VERSION 6
     29 #define YY_FLEX_SUBMINOR_VERSION 0
     30 #if YY_FLEX_SUBMINOR_VERSION > 0
     31 #define FLEX_BETA
     32 #endif
     33 
     34 /* First, we deal with  platform-specific or compiler-specific issues. */
     35 
     36 /* begin standard C headers. */
     37 #include <stdio.h>
     38 #include <string.h>
     39 #include <errno.h>
     40 #include <stdlib.h>
     41 
     42 /* end standard C headers. */
     43 
     44 /* flex integer type definitions */
     45 
     46 #ifndef FLEXINT_H
     47 #define FLEXINT_H
     48 
     49 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
     50 
     51 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
     52 
     53 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
     54  * if you want the limit (max/min) macros for int types.
     55  */
     56 #ifndef __STDC_LIMIT_MACROS
     57 #define __STDC_LIMIT_MACROS 1
     58 #endif
     59 
     60 #include <inttypes.h>
     61 typedef int8_t flex_int8_t;
     62 typedef uint8_t flex_uint8_t;
     63 typedef int16_t flex_int16_t;
     64 typedef uint16_t flex_uint16_t;
     65 typedef int32_t flex_int32_t;
     66 typedef uint32_t flex_uint32_t;
     67 #else
     68 typedef signed char flex_int8_t;
     69 typedef short int flex_int16_t;
     70 typedef int flex_int32_t;
     71 typedef unsigned char flex_uint8_t;
     72 typedef unsigned short int flex_uint16_t;
     73 typedef unsigned int flex_uint32_t;
     74 
     75 /* Limits of integral types. */
     76 #ifndef INT8_MIN
     77 #define INT8_MIN               (-128)
     78 #endif
     79 #ifndef INT16_MIN
     80 #define INT16_MIN              (-32767-1)
     81 #endif
     82 #ifndef INT32_MIN
     83 #define INT32_MIN              (-2147483647-1)
     84 #endif
     85 #ifndef INT8_MAX
     86 #define INT8_MAX               (127)
     87 #endif
     88 #ifndef INT16_MAX
     89 #define INT16_MAX              (32767)
     90 #endif
     91 #ifndef INT32_MAX
     92 #define INT32_MAX              (2147483647)
     93 #endif
     94 #ifndef UINT8_MAX
     95 #define UINT8_MAX              (255U)
     96 #endif
     97 #ifndef UINT16_MAX
     98 #define UINT16_MAX             (65535U)
     99 #endif
    100 #ifndef UINT32_MAX
    101 #define UINT32_MAX             (4294967295U)
    102 #endif
    103 
    104 #endif /* ! C99 */
    105 
    106 #endif /* ! FLEXINT_H */
    107 
    108 #ifdef __cplusplus
    109 
    110 /* The "const" storage-class-modifier is valid. */
    111 #define YY_USE_CONST
    112 
    113 #else	/* ! __cplusplus */
    114 
    115 /* C99 requires __STDC__ to be defined as 1. */
    116 #if defined (__STDC__)
    117 
    118 #define YY_USE_CONST
    119 
    120 #endif	/* defined (__STDC__) */
    121 #endif	/* ! __cplusplus */
    122 
    123 #ifdef YY_USE_CONST
    124 #define yyconst const
    125 #else
    126 #define yyconst
    127 #endif
    128 
    129 /* Returned upon end-of-file. */
    130 #define YY_NULL 0
    131 
    132 /* Promotes a possibly negative, possibly signed char to an unsigned
    133  * integer for use as an array index.  If the signed char is negative,
    134  * we want to instead treat it as an 8-bit unsigned char, hence the
    135  * double cast.
    136  */
    137 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
    138 
    139 /* An opaque pointer. */
    140 #ifndef YY_TYPEDEF_YY_SCANNER_T
    141 #define YY_TYPEDEF_YY_SCANNER_T
    142 typedef void* yyscan_t;
    143 #endif
    144 
    145 /* For convenience, these vars (plus the bison vars far below)
    146    are macros in the reentrant scanner. */
    147 #define yyin yyg->yyin_r
    148 #define yyout yyg->yyout_r
    149 #define yyextra yyg->yyextra_r
    150 #define yyleng yyg->yyleng_r
    151 #define yytext yyg->yytext_r
    152 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
    153 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
    154 #define yy_flex_debug yyg->yy_flex_debug_r
    155 
    156 /* Enter a start condition.  This macro really ought to take a parameter,
    157  * but we do it the disgusting crufty way forced on us by the ()-less
    158  * definition of BEGIN.
    159  */
    160 #define BEGIN yyg->yy_start = 1 + 2 *
    161 
    162 /* Translate the current start state into a value that can be later handed
    163  * to BEGIN to return to the state.  The YYSTATE alias is for lex
    164  * compatibility.
    165  */
    166 #define YY_START ((yyg->yy_start - 1) / 2)
    167 #define YYSTATE YY_START
    168 
    169 /* Action number for EOF rule of a given start state. */
    170 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
    171 
    172 /* Special action meaning "start processing a new file". */
    173 #define YY_NEW_FILE pprestart(yyin ,yyscanner )
    174 
    175 #define YY_END_OF_BUFFER_CHAR 0
    176 
    177 /* Size of default input buffer. */
    178 #ifndef YY_BUF_SIZE
    179 #ifdef __ia64__
    180 /* On IA-64, the buffer size is 16k, not 8k.
    181  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
    182  * Ditto for the __ia64__ case accordingly.
    183  */
    184 #define YY_BUF_SIZE 32768
    185 #else
    186 #define YY_BUF_SIZE 16384
    187 #endif /* __ia64__ */
    188 #endif
    189 
    190 /* The state buf must be large enough to hold one state per character in the main buffer.
    191  */
    192 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
    193 
    194 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
    195 #define YY_TYPEDEF_YY_BUFFER_STATE
    196 typedef struct yy_buffer_state *YY_BUFFER_STATE;
    197 #endif
    198 
    199 #ifndef YY_TYPEDEF_YY_SIZE_T
    200 #define YY_TYPEDEF_YY_SIZE_T
    201 typedef size_t yy_size_t;
    202 #endif
    203 
    204 #define EOB_ACT_CONTINUE_SCAN 0
    205 #define EOB_ACT_END_OF_FILE 1
    206 #define EOB_ACT_LAST_MATCH 2
    207 
    208     #define YY_LESS_LINENO(n)
    209     #define YY_LINENO_REWIND_TO(ptr)
    210 
    211 /* Return all but the first "n" matched characters back to the input stream. */
    212 #define yyless(n) \
    213 	do \
    214 		{ \
    215 		/* Undo effects of setting up yytext. */ \
    216         int yyless_macro_arg = (n); \
    217         YY_LESS_LINENO(yyless_macro_arg);\
    218 		*yy_cp = yyg->yy_hold_char; \
    219 		YY_RESTORE_YY_MORE_OFFSET \
    220 		yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
    221 		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
    222 		} \
    223 	while ( 0 )
    224 
    225 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
    226 
    227 #ifndef YY_STRUCT_YY_BUFFER_STATE
    228 #define YY_STRUCT_YY_BUFFER_STATE
    229 struct yy_buffer_state
    230 	{
    231 	FILE *yy_input_file;
    232 
    233 	char *yy_ch_buf;		/* input buffer */
    234 	char *yy_buf_pos;		/* current position in input buffer */
    235 
    236 	/* Size of input buffer in bytes, not including room for EOB
    237 	 * characters.
    238 	 */
    239 	yy_size_t yy_buf_size;
    240 
    241 	/* Number of characters read into yy_ch_buf, not including EOB
    242 	 * characters.
    243 	 */
    244 	yy_size_t yy_n_chars;
    245 
    246 	/* Whether we "own" the buffer - i.e., we know we created it,
    247 	 * and can realloc() it to grow it, and should free() it to
    248 	 * delete it.
    249 	 */
    250 	int yy_is_our_buffer;
    251 
    252 	/* Whether this is an "interactive" input source; if so, and
    253 	 * if we're using stdio for input, then we want to use getc()
    254 	 * instead of fread(), to make sure we stop fetching input after
    255 	 * each newline.
    256 	 */
    257 	int yy_is_interactive;
    258 
    259 	/* Whether we're considered to be at the beginning of a line.
    260 	 * If so, '^' rules will be active on the next match, otherwise
    261 	 * not.
    262 	 */
    263 	int yy_at_bol;
    264 
    265     int yy_bs_lineno; /**< The line count. */
    266     int yy_bs_column; /**< The column count. */
    267 
    268 	/* Whether to try to fill the input buffer when we reach the
    269 	 * end of it.
    270 	 */
    271 	int yy_fill_buffer;
    272 
    273 	int yy_buffer_status;
    274 
    275 #define YY_BUFFER_NEW 0
    276 #define YY_BUFFER_NORMAL 1
    277 	/* When an EOF's been seen but there's still some text to process
    278 	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
    279 	 * shouldn't try reading from the input source any more.  We might
    280 	 * still have a bunch of tokens to match, though, because of
    281 	 * possible backing-up.
    282 	 *
    283 	 * When we actually see the EOF, we change the status to "new"
    284 	 * (via pprestart()), so that the user can continue scanning by
    285 	 * just pointing yyin at a new input file.
    286 	 */
    287 #define YY_BUFFER_EOF_PENDING 2
    288 
    289 	};
    290 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
    291 
    292 /* We provide macros for accessing buffer states in case in the
    293  * future we want to put the buffer states in a more general
    294  * "scanner state".
    295  *
    296  * Returns the top of the stack, or NULL.
    297  */
    298 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
    299                           ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
    300                           : NULL)
    301 
    302 /* Same as previous macro, but useful when we know that the buffer stack is not
    303  * NULL or when we need an lvalue. For internal use only.
    304  */
    305 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
    306 
    307 void pprestart (FILE *input_file ,yyscan_t yyscanner );
    308 void pp_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
    309 YY_BUFFER_STATE pp_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
    310 void pp_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
    311 void pp_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
    312 void pppush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
    313 void pppop_buffer_state (yyscan_t yyscanner );
    314 
    315 static void ppensure_buffer_stack (yyscan_t yyscanner );
    316 static void pp_load_buffer_state (yyscan_t yyscanner );
    317 static void pp_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
    318 
    319 #define YY_FLUSH_BUFFER pp_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
    320 
    321 YY_BUFFER_STATE pp_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
    322 YY_BUFFER_STATE pp_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
    323 YY_BUFFER_STATE pp_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
    324 
    325 void *ppalloc (yy_size_t ,yyscan_t yyscanner );
    326 void *pprealloc (void *,yy_size_t ,yyscan_t yyscanner );
    327 void ppfree (void * ,yyscan_t yyscanner );
    328 
    329 #define yy_new_buffer pp_create_buffer
    330 
    331 #define yy_set_interactive(is_interactive) \
    332 	{ \
    333 	if ( ! YY_CURRENT_BUFFER ){ \
    334         ppensure_buffer_stack (yyscanner); \
    335 		YY_CURRENT_BUFFER_LVALUE =    \
    336             pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
    337 	} \
    338 	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
    339 	}
    340 
    341 #define yy_set_bol(at_bol) \
    342 	{ \
    343 	if ( ! YY_CURRENT_BUFFER ){\
    344         ppensure_buffer_stack (yyscanner); \
    345 		YY_CURRENT_BUFFER_LVALUE =    \
    346             pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
    347 	} \
    348 	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
    349 	}
    350 
    351 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
    352 
    353 /* Begin user sect3 */
    354 
    355 #define ppwrap(yyscanner) (/*CONSTCOND*/1)
    356 #define YY_SKIP_YYWRAP
    357 
    358 typedef unsigned char YY_CHAR;
    359 
    360 typedef int yy_state_type;
    361 
    362 #define yytext_ptr yytext_r
    363 
    364 static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
    365 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
    366 static int yy_get_next_buffer (yyscan_t yyscanner );
    367 #if defined(__GNUC__) && __GNUC__ >= 3
    368 __attribute__((__noreturn__))
    369 #endif
    370 static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
    371 
    372 /* Done after the current pattern has been matched and before the
    373  * corresponding action - sets up yytext.
    374  */
    375 #define YY_DO_BEFORE_ACTION \
    376 	yyg->yytext_ptr = yy_bp; \
    377 	yyleng = (size_t) (yy_cp - yy_bp); \
    378 	yyg->yy_hold_char = *yy_cp; \
    379 	*yy_cp = '\0'; \
    380 	yyg->yy_c_buf_p = yy_cp;
    381 
    382 #define YY_NUM_RULES 38
    383 #define YY_END_OF_BUFFER 39
    384 /* This struct is not used in this scanner,
    385    but its presence is necessary. */
    386 struct yy_trans_info
    387 	{
    388 	flex_int32_t yy_verify;
    389 	flex_int32_t yy_nxt;
    390 	};
    391 static yyconst flex_int16_t yy_accept[98] =
    392     {   0,
    393         0,    0,    0,    0,   39,   37,   34,   35,   35,   33,
    394         7,   33,   33,   33,   33,   33,   33,   33,   33,    9,
    395         9,   33,   33,   33,    8,   37,   33,   33,    3,    5,
    396         5,    4,   34,   35,   19,   27,   20,   30,   25,   12,
    397        23,   13,   24,   10,    2,    1,   26,   10,    9,   11,
    398        11,   11,    9,   11,    9,    9,   14,   16,   18,   17,
    399        15,    8,   36,   36,   31,   21,   32,   22,    3,    5,
    400         6,   11,   10,   11,   10,    1,   10,   11,   10,    0,
    401        10,    9,    9,    9,   28,   29,    0,   10,   10,   10,
    402        10,    9,   10,   10,    9,   10,    0
    403 
    404     } ;
    405 
    406 static yyconst YY_CHAR yy_ec[256] =
    407     {   0,
    408         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
    409         2,    2,    4,    1,    1,    1,    1,    1,    1,    1,
    410         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    411         1,    2,    5,    1,    6,    1,    7,    8,    1,    9,
    412         9,   10,   11,    9,   12,   13,   14,   15,   16,   16,
    413        16,   16,   16,   16,   16,   17,   17,    9,    9,   18,
    414        19,   20,    9,    1,   21,   21,   21,   21,   22,   23,
    415        24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
    416        24,   24,   24,   24,   25,   24,   24,   26,   24,   24,
    417         9,   27,    9,   28,   24,    1,   21,   21,   21,   21,
    418 
    419        22,   23,   24,   24,   24,   24,   24,   24,   24,   24,
    420        24,   24,   24,   24,   24,   24,   25,   24,   24,   26,
    421        24,   24,    9,   29,    9,    9,    1,    1,    1,    1,
    422         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    423         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    424         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    425         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    426         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    427         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    428         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    429 
    430         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    431         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    432         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    433         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    434         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    435         1,    1,    1,    1,    1
    436     } ;
    437 
    438 static yyconst YY_CHAR yy_meta[30] =
    439     {   0,
    440         1,    1,    2,    2,    1,    1,    1,    1,    1,    3,
    441         1,    1,    4,    1,    5,    5,    5,    1,    1,    1,
    442         5,    5,    5,    5,    5,    5,    1,    1,    1
    443     } ;
    444 
    445 static yyconst flex_uint16_t yy_base[103] =
    446     {   0,
    447         0,    0,   27,   29,  137,  194,  133,  194,  117,  100,
    448       194,   98,   26,  194,   94,   24,   28,   33,   32,   39,
    449        51,   39,   80,   50,    0,   68,   25,   54,    0,  194,
    450        88,   71,   80,  194,  194,  194,  194,  194,  194,  194,
    451       194,  194,  194,   71,  194,    0,  194,   85,   55,   64,
    452        99,  111,   53,  105,    0,   50,   55,  194,  194,  194,
    453        40,    0,  194,   38,  194,  194,  194,  194,    0,  194,
    454       194,  117,    0,  130,    0,    0,    0,  137,    0,   88,
    455       113,    0,  131,    0,  194,  194,  143,  139,  152,  150,
    456         0,   13,  153,  194,    0,  194,  194,  176,   31,  181,
    457 
    458       186,  188
    459     } ;
    460 
    461 static yyconst flex_int16_t yy_def[103] =
    462     {   0,
    463        97,    1,   98,   98,   97,   97,   97,   97,   97,   97,
    464        97,   97,   97,   97,   97,   97,   97,   97,   97,   97,
    465        20,   97,   97,   97,   99,   97,   97,   97,  100,   97,
    466        97,   97,   97,   97,   97,   97,   97,   97,   97,   97,
    467        97,   97,   97,   97,   97,  101,   97,   97,   20,   20,
    468        50,   51,   51,  102,   21,   51,   97,   97,   97,   97,
    469        97,   99,   97,   97,   97,   97,   97,   97,  100,   97,
    470        97,   44,   44,   72,   72,  101,   48,   51,   51,   97,
    471        52,   51,  102,   51,   97,   97,   97,   74,   78,   97,
    472        51,   51,   97,   97,   51,   97,    0,   97,   97,   97,
    473 
    474        97,   97
    475     } ;
    476 
    477 static yyconst flex_uint16_t yy_nxt[224] =
    478     {   0,
    479         6,    7,    8,    9,   10,   11,   12,   13,   14,   15,
    480        16,   17,   18,   19,   20,   21,   21,   22,   23,   24,
    481        25,   25,   25,   25,   25,   25,   26,   27,   28,   30,
    482        31,   30,   31,   37,   40,   62,   32,   95,   32,   42,
    483        63,   45,   41,   65,   38,   46,   43,   44,   44,   44,
    484        47,   48,   66,   49,   49,   50,   57,   58,   86,   51,
    485        52,   51,   51,   53,   54,   55,   55,   55,   60,   61,
    486        63,   64,   67,   85,   84,   56,   51,   82,   50,   50,
    487        51,   33,   68,   72,   71,   73,   73,   73,   51,   51,
    488        70,   72,   74,   75,   72,   72,   72,   51,   59,   77,
    489 
    490        77,   77,   90,   90,   90,   51,   78,   79,   51,   51,
    491        51,   51,   39,   51,   51,   51,   36,   51,   35,   34,
    492        51,   80,   80,   97,   97,   81,   81,   81,   51,   51,
    493        51,   72,   72,   72,   33,   91,   97,   97,   72,   72,
    494        87,   87,   97,   51,   88,   88,   88,   87,   87,   97,
    495        97,   89,   89,   89,   51,   92,   51,   93,   93,   93,
    496        97,   75,   97,   97,   90,   90,   90,   93,   93,   93,
    497        97,   97,   94,   97,   79,   96,   29,   29,   29,   29,
    498        29,   69,   97,   97,   69,   69,   76,   97,   76,   76,
    499        76,   83,   83,    5,   97,   97,   97,   97,   97,   97,
    500 
    501        97,   97,   97,   97,   97,   97,   97,   97,   97,   97,
    502        97,   97,   97,   97,   97,   97,   97,   97,   97,   97,
    503        97,   97,   97
    504     } ;
    505 
    506 static yyconst flex_int16_t yy_chk[224] =
    507     {   0,
    508         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    509         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    510         1,    1,    1,    1,    1,    1,    1,    1,    1,    3,
    511         3,    4,    4,   13,   16,   99,    3,   92,    4,   17,
    512        64,   19,   16,   27,   13,   19,   17,   18,   18,   18,
    513        19,   20,   27,   20,   20,   20,   22,   22,   61,   20,
    514        20,   20,   20,   20,   20,   21,   21,   21,   24,   24,
    515        26,   26,   28,   57,   56,   21,   21,   53,   50,   50,
    516        49,   33,   28,   44,   32,   44,   44,   44,   50,   50,
    517        31,   44,   44,   44,   44,   44,   44,   48,   23,   48,
    518 
    519        48,   48,   80,   80,   80,   48,   48,   48,   48,   48,
    520        48,   51,   15,   51,   51,   51,   12,   54,   10,    9,
    521        51,   52,   52,   81,   81,   52,   52,   52,   54,   54,
    522        54,   72,   72,   72,    7,   81,    5,    0,   72,   72,
    523        74,   74,    0,   83,   74,   74,   74,   78,   78,   88,
    524        88,   78,   78,   78,   83,   83,   83,   87,   87,   87,
    525         0,   88,   89,   89,   90,   90,   90,   93,   93,   93,
    526         0,    0,   90,    0,   89,   93,   98,   98,   98,   98,
    527        98,  100,    0,    0,  100,  100,  101,    0,  101,  101,
    528       101,  102,  102,   97,   97,   97,   97,   97,   97,   97,
    529 
    530        97,   97,   97,   97,   97,   97,   97,   97,   97,   97,
    531        97,   97,   97,   97,   97,   97,   97,   97,   97,   97,
    532        97,   97,   97
    533     } ;
    534 
    535 /* The intent behind this definition is that it'll catch
    536  * any uses of REJECT which flex missed.
    537  */
    538 #define REJECT reject_used_but_not_detected
    539 #define yymore() yymore_used_but_not_detected
    540 #define YY_MORE_ADJ 0
    541 #define YY_RESTORE_YY_MORE_OFFSET
    542 /*
    543 // Copyright 2016 The SwiftShader Authors. All Rights Reserved.
    544 //
    545 // Licensed under the Apache License, Version 2.0 (the "License");
    546 // you may not use this file except in compliance with the License.
    547 // You may obtain a copy of the License at
    548 //
    549 //    http://www.apache.org/licenses/LICENSE-2.0
    550 //
    551 // Unless required by applicable law or agreed to in writing, software
    552 // distributed under the License is distributed on an "AS IS" BASIS,
    553 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    554 // See the License for the specific language governing permissions and
    555 // limitations under the License.
    556 
    557 This file contains the Lex specification for GLSL ES preprocessor.
    558 Based on Microsoft Visual Studio 2010 Preprocessor Grammar:
    559 http://msdn.microsoft.com/en-us/library/2scxys89.aspx
    560 
    561 IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
    562 */
    563 
    564 #include "Tokenizer.h"
    565 
    566 #include "Diagnostics.h"
    567 #include "Token.h"
    568 
    569 #if defined(__GNUC__)
    570 // Triggered by the auto-generated yy_fatal_error function.
    571 #pragma GCC diagnostic ignored "-Wmissing-noreturn"
    572 #endif
    573 
    574 typedef std::string YYSTYPE;
    575 typedef pp::SourceLocation YYLTYPE;
    576 
    577 // Use the unused yycolumn variable to track file (string) number.
    578 #define yyfileno yycolumn
    579 
    580 #define YY_USER_INIT                   \
    581     do {                               \
    582         yyfileno = 0;                  \
    583         yylineno = 1;                  \
    584         yyextra->leadingSpace = false; \
    585         yyextra->lineStart = true;     \
    586     } while(0);
    587 
    588 #define YY_USER_ACTION                                              \
    589     do                                                              \
    590     {                                                               \
    591         pp::Input* input = &yyextra->input;                         \
    592         pp::Input::Location* scanLoc = &yyextra->scanLoc;           \
    593         while ((scanLoc->sIndex < input->count()) &&                \
    594                (scanLoc->cIndex >= input->length(scanLoc->sIndex))) \
    595         {                                                           \
    596             scanLoc->cIndex -= input->length(scanLoc->sIndex++);    \
    597             ++yyfileno; yylineno = 1;                               \
    598         }                                                           \
    599         yylloc->file = yyfileno;                                    \
    600         yylloc->line = yylineno;                                    \
    601         scanLoc->cIndex += yyleng;                                  \
    602     } while(0);
    603 
    604 #define YY_INPUT(buf, result, maxSize) \
    605     result = yyextra->input.read(buf, maxSize);
    606 
    607 #define INITIAL 0
    608 #define COMMENT 1
    609 
    610 #define YY_EXTRA_TYPE pp::Tokenizer::Context*
    611 
    612 /* Holds the entire state of the reentrant scanner. */
    613 struct yyguts_t
    614     {
    615 
    616     /* User-defined. Not touched by flex. */
    617     YY_EXTRA_TYPE yyextra_r;
    618 
    619     /* The rest are the same as the globals declared in the non-reentrant scanner. */
    620     FILE *yyin_r, *yyout_r;
    621     size_t yy_buffer_stack_top; /**< index of top of stack. */
    622     size_t yy_buffer_stack_max; /**< capacity of stack. */
    623     YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
    624     char yy_hold_char;
    625     yy_size_t yy_n_chars;
    626     yy_size_t yyleng_r;
    627     char *yy_c_buf_p;
    628     int yy_init;
    629     int yy_start;
    630     int yy_did_buffer_switch_on_eof;
    631     int yy_start_stack_ptr;
    632     int yy_start_stack_depth;
    633     int *yy_start_stack;
    634     yy_state_type yy_last_accepting_state;
    635     char* yy_last_accepting_cpos;
    636 
    637     int yylineno_r;
    638     int yy_flex_debug_r;
    639 
    640     char *yytext_r;
    641     int yy_more_flag;
    642     int yy_more_len;
    643 
    644     YYSTYPE * yylval_r;
    645 
    646     YYLTYPE * yylloc_r;
    647 
    648     }; /* end struct yyguts_t */
    649 
    650 static int yy_init_globals (yyscan_t yyscanner );
    651 
    652     /* This must go here because YYSTYPE and YYLTYPE are included
    653      * from bison output in section 1.*/
    654     #    define yylval yyg->yylval_r
    655 
    656     #    define yylloc yyg->yylloc_r
    657 
    658 int pplex_init (yyscan_t* scanner);
    659 
    660 int pplex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
    661 
    662 /* Accessor methods to globals.
    663    These are made visible to non-reentrant scanners for convenience. */
    664 
    665 int pplex_destroy (yyscan_t yyscanner );
    666 
    667 int ppget_debug (yyscan_t yyscanner );
    668 
    669 void ppset_debug (int debug_flag ,yyscan_t yyscanner );
    670 
    671 YY_EXTRA_TYPE ppget_extra (yyscan_t yyscanner );
    672 
    673 void ppset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
    674 
    675 FILE *ppget_in (yyscan_t yyscanner );
    676 
    677 void ppset_in  (FILE * _in_str ,yyscan_t yyscanner );
    678 
    679 FILE *ppget_out (yyscan_t yyscanner );
    680 
    681 void ppset_out  (FILE * _out_str ,yyscan_t yyscanner );
    682 
    683 yy_size_t ppget_leng (yyscan_t yyscanner );
    684 
    685 char *ppget_text (yyscan_t yyscanner );
    686 
    687 int ppget_lineno (yyscan_t yyscanner );
    688 
    689 void ppset_lineno (int _line_number ,yyscan_t yyscanner );
    690 
    691 int ppget_column  (yyscan_t yyscanner );
    692 
    693 void ppset_column (int _column_no ,yyscan_t yyscanner );
    694 
    695 YYSTYPE * ppget_lval (yyscan_t yyscanner );
    696 
    697 void ppset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
    698 
    699        YYLTYPE *ppget_lloc (yyscan_t yyscanner );
    700 
    701         void ppset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
    702 
    703 /* Macros after this point can all be overridden by user definitions in
    704  * section 1.
    705  */
    706 
    707 #ifndef YY_SKIP_YYWRAP
    708 #ifdef __cplusplus
    709 extern "C" int ppwrap (yyscan_t yyscanner );
    710 #else
    711 extern int ppwrap (yyscan_t yyscanner );
    712 #endif
    713 #endif
    714 
    715 #ifndef YY_NO_UNPUT
    716 
    717 #endif
    718 
    719 #ifndef yytext_ptr
    720 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
    721 #endif
    722 
    723 #ifdef YY_NEED_STRLEN
    724 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
    725 #endif
    726 
    727 #ifndef YY_NO_INPUT
    728 
    729 #ifdef __cplusplus
    730 static int yyinput (yyscan_t yyscanner );
    731 #else
    732 static int input (yyscan_t yyscanner );
    733 #endif
    734 
    735 #endif
    736 
    737 /* Amount of stuff to slurp up with each read. */
    738 #ifndef YY_READ_BUF_SIZE
    739 #ifdef __ia64__
    740 /* On IA-64, the buffer size is 16k, not 8k */
    741 #define YY_READ_BUF_SIZE 16384
    742 #else
    743 #define YY_READ_BUF_SIZE 8192
    744 #endif /* __ia64__ */
    745 #endif
    746 
    747 /* Copy whatever the last rule matched to the standard output. */
    748 #ifndef ECHO
    749 /* This used to be an fputs(), but since the string might contain NUL's,
    750  * we now use fwrite().
    751  */
    752 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
    753 #endif
    754 
    755 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
    756  * is returned in "result".
    757  */
    758 #ifndef YY_INPUT
    759 #define YY_INPUT(buf,result,max_size) \
    760 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
    761 		{ \
    762 		int c = '*'; \
    763 		size_t n; \
    764 		for ( n = 0; n < max_size && \
    765 			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
    766 			buf[n] = (char) c; \
    767 		if ( c == '\n' ) \
    768 			buf[n++] = (char) c; \
    769 		if ( c == EOF && ferror( yyin ) ) \
    770 			YY_FATAL_ERROR( "input in flex scanner failed" ); \
    771 		result = n; \
    772 		} \
    773 	else \
    774 		{ \
    775 		errno=0; \
    776 		while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
    777 			{ \
    778 			if( errno != EINTR) \
    779 				{ \
    780 				YY_FATAL_ERROR( "input in flex scanner failed" ); \
    781 				break; \
    782 				} \
    783 			errno=0; \
    784 			clearerr(yyin); \
    785 			} \
    786 		}\
    787 \
    788 
    789 #endif
    790 
    791 /* No semi-colon after return; correct usage is to write "yyterminate();" -
    792  * we don't want an extra ';' after the "return" because that will cause
    793  * some compilers to complain about unreachable statements.
    794  */
    795 #ifndef yyterminate
    796 #define yyterminate() return YY_NULL
    797 #endif
    798 
    799 /* Number of entries by which start-condition stack grows. */
    800 #ifndef YY_START_STACK_INCR
    801 #define YY_START_STACK_INCR 25
    802 #endif
    803 
    804 /* Report a fatal error. */
    805 #ifndef YY_FATAL_ERROR
    806 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
    807 #endif
    808 
    809 /* end tables serialization structures and prototypes */
    810 
    811 /* Default declaration of generated scanner - a define so the user can
    812  * easily add parameters.
    813  */
    814 #ifndef YY_DECL
    815 #define YY_DECL_IS_OURS 1
    816 
    817 extern int pplex \
    818                (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
    819 
    820 #define YY_DECL int pplex \
    821                (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
    822 #endif /* !YY_DECL */
    823 
    824 /* Code executed at the beginning of each rule, after yytext and yyleng
    825  * have been set up.
    826  */
    827 #ifndef YY_USER_ACTION
    828 #define YY_USER_ACTION
    829 #endif
    830 
    831 /* Code executed at the end of each rule. */
    832 #ifndef YY_BREAK
    833 #define YY_BREAK /*LINTED*/break;
    834 #endif
    835 
    836 #define YY_RULE_SETUP \
    837 	YY_USER_ACTION
    838 
    839 /** The main scanner function which does all the work.
    840  */
    841 YY_DECL
    842 {
    843 	yy_state_type yy_current_state;
    844 	char *yy_cp, *yy_bp;
    845 	int yy_act;
    846     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
    847 
    848     yylval = yylval_param;
    849 
    850     yylloc = yylloc_param;
    851 
    852 	if ( !yyg->yy_init )
    853 		{
    854 		yyg->yy_init = 1;
    855 
    856 #ifdef YY_USER_INIT
    857 		YY_USER_INIT;
    858 #endif
    859 
    860 		if ( ! yyg->yy_start )
    861 			yyg->yy_start = 1;	/* first start state */
    862 
    863 		if ( ! yyin )
    864 			yyin = stdin;
    865 
    866 		if ( ! yyout )
    867 			yyout = stdout;
    868 
    869 		if ( ! YY_CURRENT_BUFFER ) {
    870 			ppensure_buffer_stack (yyscanner);
    871 			YY_CURRENT_BUFFER_LVALUE =
    872 				pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
    873 		}
    874 
    875 		pp_load_buffer_state(yyscanner );
    876 		}
    877 
    878 	{
    879 
    880     /* Line comment */
    881 
    882 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
    883 		{
    884 		yy_cp = yyg->yy_c_buf_p;
    885 
    886 		/* Support of yytext. */
    887 		*yy_cp = yyg->yy_hold_char;
    888 
    889 		/* yy_bp points to the position in yy_ch_buf of the start of
    890 		 * the current run.
    891 		 */
    892 		yy_bp = yy_cp;
    893 
    894 		yy_current_state = yyg->yy_start;
    895 yy_match:
    896 		do
    897 			{
    898 			YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
    899 			if ( yy_accept[yy_current_state] )
    900 				{
    901 				yyg->yy_last_accepting_state = yy_current_state;
    902 				yyg->yy_last_accepting_cpos = yy_cp;
    903 				}
    904 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
    905 				{
    906 				yy_current_state = (int) yy_def[yy_current_state];
    907 				if ( yy_current_state >= 98 )
    908 					yy_c = yy_meta[(unsigned int) yy_c];
    909 				}
    910 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
    911 			++yy_cp;
    912 			}
    913 		while ( yy_current_state != 97 );
    914 		yy_cp = yyg->yy_last_accepting_cpos;
    915 		yy_current_state = yyg->yy_last_accepting_state;
    916 
    917 yy_find_action:
    918 		yy_act = yy_accept[yy_current_state];
    919 
    920 		YY_DO_BEFORE_ACTION;
    921 
    922 do_action:	/* This label is used only to access EOF actions. */
    923 
    924 		switch ( yy_act )
    925 	{ /* beginning of action switch */
    926 			case 0: /* must back up */
    927 			/* undo the effects of YY_DO_BEFORE_ACTION */
    928 			*yy_cp = yyg->yy_hold_char;
    929 			yy_cp = yyg->yy_last_accepting_cpos;
    930 			yy_current_state = yyg->yy_last_accepting_state;
    931 			goto yy_find_action;
    932 
    933 case 1:
    934 YY_RULE_SETUP
    935 
    936 	YY_BREAK
    937 /* Block comment */
    938 /* Line breaks are just counted - not returned. */
    939 /* The comment is replaced by a single space. */
    940 case 2:
    941 YY_RULE_SETUP
    942 { BEGIN(COMMENT); }
    943 	YY_BREAK
    944 case 3:
    945 YY_RULE_SETUP
    946 
    947 	YY_BREAK
    948 case 4:
    949 YY_RULE_SETUP
    950 
    951 	YY_BREAK
    952 case 5:
    953 /* rule 5 can match eol */
    954 YY_RULE_SETUP
    955 { ++yylineno; }
    956 	YY_BREAK
    957 case 6:
    958 YY_RULE_SETUP
    959 {
    960     yyextra->leadingSpace = true;
    961     BEGIN(INITIAL);
    962 }
    963 	YY_BREAK
    964 case 7:
    965 YY_RULE_SETUP
    966 {
    967     // # is only valid at start of line for preprocessor directives.
    968     yylval->assign(1, yytext[0]);
    969     return yyextra->lineStart ? pp::Token::PP_HASH : pp::Token::PP_OTHER;
    970 }
    971 	YY_BREAK
    972 case 8:
    973 YY_RULE_SETUP
    974 {
    975     yylval->assign(yytext, yyleng);
    976     return pp::Token::IDENTIFIER;
    977 }
    978 	YY_BREAK
    979 case 9:
    980 YY_RULE_SETUP
    981 {
    982     yylval->assign(yytext, yyleng);
    983     return pp::Token::CONST_INT;
    984 }
    985 	YY_BREAK
    986 case 10:
    987 YY_RULE_SETUP
    988 {
    989     yylval->assign(yytext, yyleng);
    990     return pp::Token::CONST_FLOAT;
    991 }
    992 	YY_BREAK
    993 /* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */
    994 /* Rule to catch all invalid integers and floats. */
    995 case 11:
    996 YY_RULE_SETUP
    997 {
    998     yylval->assign(yytext, yyleng);
    999     return pp::Token::PP_NUMBER;
   1000 }
   1001 	YY_BREAK
   1002 case 12:
   1003 YY_RULE_SETUP
   1004 {
   1005     yylval->assign(yytext, yyleng);
   1006     return pp::Token::OP_INC;
   1007 }
   1008 	YY_BREAK
   1009 case 13:
   1010 YY_RULE_SETUP
   1011 {
   1012     yylval->assign(yytext, yyleng);
   1013     return pp::Token::OP_DEC;
   1014 }
   1015 	YY_BREAK
   1016 case 14:
   1017 YY_RULE_SETUP
   1018 {
   1019     yylval->assign(yytext, yyleng);
   1020     return pp::Token::OP_LEFT;
   1021 }
   1022 	YY_BREAK
   1023 case 15:
   1024 YY_RULE_SETUP
   1025 {
   1026     yylval->assign(yytext, yyleng);
   1027     return pp::Token::OP_RIGHT;
   1028 }
   1029 	YY_BREAK
   1030 case 16:
   1031 YY_RULE_SETUP
   1032 {
   1033     yylval->assign(yytext, yyleng);
   1034     return pp::Token::OP_LE;
   1035 }
   1036 	YY_BREAK
   1037 case 17:
   1038 YY_RULE_SETUP
   1039 {
   1040     yylval->assign(yytext, yyleng);
   1041     return pp::Token::OP_GE;
   1042 }
   1043 	YY_BREAK
   1044 case 18:
   1045 YY_RULE_SETUP
   1046 {
   1047     yylval->assign(yytext, yyleng);
   1048     return pp::Token::OP_EQ;
   1049 }
   1050 	YY_BREAK
   1051 case 19:
   1052 YY_RULE_SETUP
   1053 {
   1054     yylval->assign(yytext, yyleng);
   1055     return pp::Token::OP_NE;
   1056 }
   1057 	YY_BREAK
   1058 case 20:
   1059 YY_RULE_SETUP
   1060 {
   1061     yylval->assign(yytext, yyleng);
   1062     return pp::Token::OP_AND;
   1063 }
   1064 	YY_BREAK
   1065 case 21:
   1066 YY_RULE_SETUP
   1067 {
   1068     yylval->assign(yytext, yyleng);
   1069     return pp::Token::OP_XOR;
   1070 }
   1071 	YY_BREAK
   1072 case 22:
   1073 YY_RULE_SETUP
   1074 {
   1075     yylval->assign(yytext, yyleng);
   1076     return pp::Token::OP_OR;
   1077 }
   1078 	YY_BREAK
   1079 case 23:
   1080 YY_RULE_SETUP
   1081 {
   1082     yylval->assign(yytext, yyleng);
   1083     return pp::Token::OP_ADD_ASSIGN;
   1084 }
   1085 	YY_BREAK
   1086 case 24:
   1087 YY_RULE_SETUP
   1088 {
   1089     yylval->assign(yytext, yyleng);
   1090     return pp::Token::OP_SUB_ASSIGN;
   1091 }
   1092 	YY_BREAK
   1093 case 25:
   1094 YY_RULE_SETUP
   1095 {
   1096     yylval->assign(yytext, yyleng);
   1097     return pp::Token::OP_MUL_ASSIGN;
   1098 }
   1099 	YY_BREAK
   1100 case 26:
   1101 YY_RULE_SETUP
   1102 {
   1103     yylval->assign(yytext, yyleng);
   1104     return pp::Token::OP_DIV_ASSIGN;
   1105 }
   1106 	YY_BREAK
   1107 case 27:
   1108 YY_RULE_SETUP
   1109 {
   1110     yylval->assign(yytext, yyleng);
   1111     return pp::Token::OP_MOD_ASSIGN;
   1112 }
   1113 	YY_BREAK
   1114 case 28:
   1115 YY_RULE_SETUP
   1116 {
   1117     yylval->assign(yytext, yyleng);
   1118     return pp::Token::OP_LEFT_ASSIGN;
   1119 }
   1120 	YY_BREAK
   1121 case 29:
   1122 YY_RULE_SETUP
   1123 {
   1124     yylval->assign(yytext, yyleng);
   1125     return pp::Token::OP_RIGHT_ASSIGN;
   1126 }
   1127 	YY_BREAK
   1128 case 30:
   1129 YY_RULE_SETUP
   1130 {
   1131     yylval->assign(yytext, yyleng);
   1132     return pp::Token::OP_AND_ASSIGN;
   1133 }
   1134 	YY_BREAK
   1135 case 31:
   1136 YY_RULE_SETUP
   1137 {
   1138     yylval->assign(yytext, yyleng);
   1139     return pp::Token::OP_XOR_ASSIGN;
   1140 }
   1141 	YY_BREAK
   1142 case 32:
   1143 YY_RULE_SETUP
   1144 {
   1145     yylval->assign(yytext, yyleng);
   1146     return pp::Token::OP_OR_ASSIGN;
   1147 }
   1148 	YY_BREAK
   1149 case 33:
   1150 YY_RULE_SETUP
   1151 {
   1152     yylval->assign(1, yytext[0]);
   1153     return yytext[0];
   1154 }
   1155 	YY_BREAK
   1156 case 34:
   1157 YY_RULE_SETUP
   1158 { yyextra->leadingSpace = true; }
   1159 	YY_BREAK
   1160 case 35:
   1161 /* rule 35 can match eol */
   1162 YY_RULE_SETUP
   1163 {
   1164     ++yylineno;
   1165     yylval->assign(1, '\n');
   1166     return '\n';
   1167 }
   1168 	YY_BREAK
   1169 case 36:
   1170 /* rule 36 can match eol */
   1171 YY_RULE_SETUP
   1172 { ++yylineno; }
   1173 	YY_BREAK
   1174 case 37:
   1175 YY_RULE_SETUP
   1176 {
   1177     yylval->assign(1, yytext[0]);
   1178     return pp::Token::PP_OTHER;
   1179 }
   1180 	YY_BREAK
   1181 case YY_STATE_EOF(INITIAL):
   1182 case YY_STATE_EOF(COMMENT):
   1183 {
   1184     // YY_USER_ACTION is not invoked for handling EOF.
   1185     // Set the location for EOF token manually.
   1186     pp::Input* input = &yyextra->input;
   1187     pp::Input::Location* scanLoc = &yyextra->scanLoc;
   1188     int sIndexMax = std::max(0, input->count() - 1);
   1189     if (scanLoc->sIndex != sIndexMax)
   1190     {
   1191         // We can only reach here if there are empty strings at the
   1192         // end of the input.
   1193         scanLoc->sIndex = sIndexMax; scanLoc->cIndex = 0;
   1194         yyfileno = sIndexMax; yylineno = 1;
   1195     }
   1196     yylloc->file = yyfileno;
   1197     yylloc->line = yylineno;
   1198     yylval->clear();
   1199 
   1200     if (YY_START == COMMENT)
   1201     {
   1202         yyextra->diagnostics->report(pp::Diagnostics::EOF_IN_COMMENT,
   1203                                      pp::SourceLocation(yyfileno, yylineno),
   1204                                      "");
   1205     }
   1206     yyterminate();
   1207 }
   1208 	YY_BREAK
   1209 case 38:
   1210 YY_RULE_SETUP
   1211 ECHO;
   1212 	YY_BREAK
   1213 
   1214 	case YY_END_OF_BUFFER:
   1215 		{
   1216 		/* Amount of text matched not including the EOB char. */
   1217 		int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
   1218 
   1219 		/* Undo the effects of YY_DO_BEFORE_ACTION. */
   1220 		*yy_cp = yyg->yy_hold_char;
   1221 		YY_RESTORE_YY_MORE_OFFSET
   1222 
   1223 		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
   1224 			{
   1225 			/* We're scanning a new file or input source.  It's
   1226 			 * possible that this happened because the user
   1227 			 * just pointed yyin at a new source and called
   1228 			 * pplex().  If so, then we have to assure
   1229 			 * consistency between YY_CURRENT_BUFFER and our
   1230 			 * globals.  Here is the right place to do so, because
   1231 			 * this is the first action (other than possibly a
   1232 			 * back-up) that will match for the new input source.
   1233 			 */
   1234 			yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
   1235 			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
   1236 			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
   1237 			}
   1238 
   1239 		/* Note that here we test for yy_c_buf_p "<=" to the position
   1240 		 * of the first EOB in the buffer, since yy_c_buf_p will
   1241 		 * already have been incremented past the NUL character
   1242 		 * (since all states make transitions on EOB to the
   1243 		 * end-of-buffer state).  Contrast this with the test
   1244 		 * in input().
   1245 		 */
   1246 		if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
   1247 			{ /* This was really a NUL. */
   1248 			yy_state_type yy_next_state;
   1249 
   1250 			yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
   1251 
   1252 			yy_current_state = yy_get_previous_state( yyscanner );
   1253 
   1254 			/* Okay, we're now positioned to make the NUL
   1255 			 * transition.  We couldn't have
   1256 			 * yy_get_previous_state() go ahead and do it
   1257 			 * for us because it doesn't know how to deal
   1258 			 * with the possibility of jamming (and we don't
   1259 			 * want to build jamming into it because then it
   1260 			 * will run more slowly).
   1261 			 */
   1262 
   1263 			yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
   1264 
   1265 			yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
   1266 
   1267 			if ( yy_next_state )
   1268 				{
   1269 				/* Consume the NUL. */
   1270 				yy_cp = ++yyg->yy_c_buf_p;
   1271 				yy_current_state = yy_next_state;
   1272 				goto yy_match;
   1273 				}
   1274 
   1275 			else
   1276 				{
   1277 				yy_cp = yyg->yy_last_accepting_cpos;
   1278 				yy_current_state = yyg->yy_last_accepting_state;
   1279 				goto yy_find_action;
   1280 				}
   1281 			}
   1282 
   1283 		else switch ( yy_get_next_buffer( yyscanner ) )
   1284 			{
   1285 			case EOB_ACT_END_OF_FILE:
   1286 				{
   1287 				yyg->yy_did_buffer_switch_on_eof = 0;
   1288 
   1289 				if ( ppwrap(yyscanner ) )
   1290 					{
   1291 					/* Note: because we've taken care in
   1292 					 * yy_get_next_buffer() to have set up
   1293 					 * yytext, we can now set up
   1294 					 * yy_c_buf_p so that if some total
   1295 					 * hoser (like flex itself) wants to
   1296 					 * call the scanner after we return the
   1297 					 * YY_NULL, it'll still work - another
   1298 					 * YY_NULL will get returned.
   1299 					 */
   1300 					yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
   1301 
   1302 					yy_act = YY_STATE_EOF(YY_START);
   1303 					goto do_action;
   1304 					}
   1305 
   1306 				else
   1307 					{
   1308 					if ( ! yyg->yy_did_buffer_switch_on_eof )
   1309 						YY_NEW_FILE;
   1310 					}
   1311 				break;
   1312 				}
   1313 
   1314 			case EOB_ACT_CONTINUE_SCAN:
   1315 				yyg->yy_c_buf_p =
   1316 					yyg->yytext_ptr + yy_amount_of_matched_text;
   1317 
   1318 				yy_current_state = yy_get_previous_state( yyscanner );
   1319 
   1320 				yy_cp = yyg->yy_c_buf_p;
   1321 				yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
   1322 				goto yy_match;
   1323 
   1324 			case EOB_ACT_LAST_MATCH:
   1325 				yyg->yy_c_buf_p =
   1326 				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
   1327 
   1328 				yy_current_state = yy_get_previous_state( yyscanner );
   1329 
   1330 				yy_cp = yyg->yy_c_buf_p;
   1331 				yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
   1332 				goto yy_find_action;
   1333 			}
   1334 		break;
   1335 		}
   1336 
   1337 	default:
   1338 		YY_FATAL_ERROR(
   1339 			"fatal flex scanner internal error--no action found" );
   1340 	} /* end of action switch */
   1341 		} /* end of scanning one token */
   1342 	} /* end of user's declarations */
   1343 } /* end of pplex */
   1344 
   1345 /* yy_get_next_buffer - try to read in a new buffer
   1346  *
   1347  * Returns a code representing an action:
   1348  *	EOB_ACT_LAST_MATCH -
   1349  *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
   1350  *	EOB_ACT_END_OF_FILE - end of file
   1351  */
   1352 static int yy_get_next_buffer (yyscan_t yyscanner)
   1353 {
   1354     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   1355 	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
   1356 	char *source = yyg->yytext_ptr;
   1357 	yy_size_t number_to_move, i;
   1358 	int ret_val;
   1359 
   1360 	if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
   1361 		YY_FATAL_ERROR(
   1362 		"fatal flex scanner internal error--end of buffer missed" );
   1363 
   1364 	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
   1365 		{ /* Don't try to fill the buffer, so this is an EOF. */
   1366 		if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
   1367 			{
   1368 			/* We matched a single character, the EOB, so
   1369 			 * treat this as a final EOF.
   1370 			 */
   1371 			return EOB_ACT_END_OF_FILE;
   1372 			}
   1373 
   1374 		else
   1375 			{
   1376 			/* We matched some text prior to the EOB, first
   1377 			 * process it.
   1378 			 */
   1379 			return EOB_ACT_LAST_MATCH;
   1380 			}
   1381 		}
   1382 
   1383 	/* Try to read more data. */
   1384 
   1385 	/* First move last chars to start of buffer. */
   1386 	number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
   1387 
   1388 	for ( i = 0; i < number_to_move; ++i )
   1389 		*(dest++) = *(source++);
   1390 
   1391 	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
   1392 		/* don't do the read, it's not guaranteed to return an EOF,
   1393 		 * just force an EOF
   1394 		 */
   1395 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
   1396 
   1397 	else
   1398 		{
   1399 			yy_size_t num_to_read =
   1400 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
   1401 
   1402 		while ( num_to_read <= 0 )
   1403 			{ /* Not enough room in the buffer - grow it. */
   1404 
   1405 			/* just a shorter name for the current buffer */
   1406 			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
   1407 
   1408 			int yy_c_buf_p_offset =
   1409 				(int) (yyg->yy_c_buf_p - b->yy_ch_buf);
   1410 
   1411 			if ( b->yy_is_our_buffer )
   1412 				{
   1413 				yy_size_t new_size = b->yy_buf_size * 2;
   1414 
   1415 				if ( new_size <= 0 )
   1416 					b->yy_buf_size += b->yy_buf_size / 8;
   1417 				else
   1418 					b->yy_buf_size *= 2;
   1419 
   1420 				b->yy_ch_buf = (char *)
   1421 					/* Include room in for 2 EOB chars. */
   1422 					pprealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
   1423 				}
   1424 			else
   1425 				/* Can't grow it, we don't own it. */
   1426 				b->yy_ch_buf = 0;
   1427 
   1428 			if ( ! b->yy_ch_buf )
   1429 				YY_FATAL_ERROR(
   1430 				"fatal error - scanner input buffer overflow" );
   1431 
   1432 			yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
   1433 
   1434 			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
   1435 						number_to_move - 1;
   1436 
   1437 			}
   1438 
   1439 		if ( num_to_read > YY_READ_BUF_SIZE )
   1440 			num_to_read = YY_READ_BUF_SIZE;
   1441 
   1442 		/* Read in more data. */
   1443 		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
   1444 			yyg->yy_n_chars, num_to_read );
   1445 
   1446 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
   1447 		}
   1448 
   1449 	if ( yyg->yy_n_chars == 0 )
   1450 		{
   1451 		if ( number_to_move == YY_MORE_ADJ )
   1452 			{
   1453 			ret_val = EOB_ACT_END_OF_FILE;
   1454 			pprestart(yyin  ,yyscanner);
   1455 			}
   1456 
   1457 		else
   1458 			{
   1459 			ret_val = EOB_ACT_LAST_MATCH;
   1460 			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
   1461 				YY_BUFFER_EOF_PENDING;
   1462 			}
   1463 		}
   1464 
   1465 	else
   1466 		ret_val = EOB_ACT_CONTINUE_SCAN;
   1467 
   1468 	if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
   1469 		/* Extend the array by 50%, plus the number we really need. */
   1470 		yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
   1471 		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) pprealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
   1472 		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
   1473 			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
   1474 	}
   1475 
   1476 	yyg->yy_n_chars += number_to_move;
   1477 	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
   1478 	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
   1479 
   1480 	yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
   1481 
   1482 	return ret_val;
   1483 }
   1484 
   1485 /* yy_get_previous_state - get the state just before the EOB char was reached */
   1486 
   1487     static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
   1488 {
   1489 	yy_state_type yy_current_state;
   1490 	char *yy_cp;
   1491     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   1492 
   1493 	yy_current_state = yyg->yy_start;
   1494 
   1495 	for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
   1496 		{
   1497 		YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
   1498 		if ( yy_accept[yy_current_state] )
   1499 			{
   1500 			yyg->yy_last_accepting_state = yy_current_state;
   1501 			yyg->yy_last_accepting_cpos = yy_cp;
   1502 			}
   1503 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
   1504 			{
   1505 			yy_current_state = (int) yy_def[yy_current_state];
   1506 			if ( yy_current_state >= 98 )
   1507 				yy_c = yy_meta[(unsigned int) yy_c];
   1508 			}
   1509 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
   1510 		}
   1511 
   1512 	return yy_current_state;
   1513 }
   1514 
   1515 /* yy_try_NUL_trans - try to make a transition on the NUL character
   1516  *
   1517  * synopsis
   1518  *	next_state = yy_try_NUL_trans( current_state );
   1519  */
   1520     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
   1521 {
   1522 	int yy_is_jam;
   1523     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
   1524 	char *yy_cp = yyg->yy_c_buf_p;
   1525 
   1526 	YY_CHAR yy_c = 1;
   1527 	if ( yy_accept[yy_current_state] )
   1528 		{
   1529 		yyg->yy_last_accepting_state = yy_current_state;
   1530 		yyg->yy_last_accepting_cpos = yy_cp;
   1531 		}
   1532 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
   1533 		{
   1534 		yy_current_state = (int) yy_def[yy_current_state];
   1535 		if ( yy_current_state >= 98 )
   1536 			yy_c = yy_meta[(unsigned int) yy_c];
   1537 		}
   1538 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
   1539 	yy_is_jam = (yy_current_state == 97);
   1540 
   1541 	(void)yyg;
   1542 	return yy_is_jam ? 0 : yy_current_state;
   1543 }
   1544 
   1545 #ifndef YY_NO_UNPUT
   1546 
   1547 #endif
   1548 
   1549 #ifndef YY_NO_INPUT
   1550 #ifdef __cplusplus
   1551     static int yyinput (yyscan_t yyscanner)
   1552 #else
   1553     static int input  (yyscan_t yyscanner)
   1554 #endif
   1555 
   1556 {
   1557 	int c;
   1558     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   1559 
   1560 	*yyg->yy_c_buf_p = yyg->yy_hold_char;
   1561 
   1562 	if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
   1563 		{
   1564 		/* yy_c_buf_p now points to the character we want to return.
   1565 		 * If this occurs *before* the EOB characters, then it's a
   1566 		 * valid NUL; if not, then we've hit the end of the buffer.
   1567 		 */
   1568 		if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
   1569 			/* This was really a NUL. */
   1570 			*yyg->yy_c_buf_p = '\0';
   1571 
   1572 		else
   1573 			{ /* need more input */
   1574 			yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
   1575 			++yyg->yy_c_buf_p;
   1576 
   1577 			switch ( yy_get_next_buffer( yyscanner ) )
   1578 				{
   1579 				case EOB_ACT_LAST_MATCH:
   1580 					/* This happens because yy_g_n_b()
   1581 					 * sees that we've accumulated a
   1582 					 * token and flags that we need to
   1583 					 * try matching the token before
   1584 					 * proceeding.  But for input(),
   1585 					 * there's no matching to consider.
   1586 					 * So convert the EOB_ACT_LAST_MATCH
   1587 					 * to EOB_ACT_END_OF_FILE.
   1588 					 */
   1589 
   1590 					/* Reset buffer status. */
   1591 					pprestart(yyin ,yyscanner);
   1592 
   1593 					/*FALLTHROUGH*/
   1594 
   1595 				case EOB_ACT_END_OF_FILE:
   1596 					{
   1597 					if ( ppwrap(yyscanner ) )
   1598 						return EOF;
   1599 
   1600 					if ( ! yyg->yy_did_buffer_switch_on_eof )
   1601 						YY_NEW_FILE;
   1602 #ifdef __cplusplus
   1603 					return yyinput(yyscanner);
   1604 #else
   1605 					return input(yyscanner);
   1606 #endif
   1607 					}
   1608 
   1609 				case EOB_ACT_CONTINUE_SCAN:
   1610 					yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
   1611 					break;
   1612 				}
   1613 			}
   1614 		}
   1615 
   1616 	c = *(unsigned char *) yyg->yy_c_buf_p;	/* cast for 8-bit char's */
   1617 	*yyg->yy_c_buf_p = '\0';	/* preserve yytext */
   1618 	yyg->yy_hold_char = *++yyg->yy_c_buf_p;
   1619 
   1620 	return c;
   1621 }
   1622 #endif	/* ifndef YY_NO_INPUT */
   1623 
   1624 /** Immediately switch to a different input stream.
   1625  * @param input_file A readable stream.
   1626  * @param yyscanner The scanner object.
   1627  * @note This function does not reset the start condition to @c INITIAL .
   1628  */
   1629     void pprestart  (FILE * input_file , yyscan_t yyscanner)
   1630 {
   1631     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   1632 
   1633 	if ( ! YY_CURRENT_BUFFER ){
   1634         ppensure_buffer_stack (yyscanner);
   1635 		YY_CURRENT_BUFFER_LVALUE =
   1636             pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
   1637 	}
   1638 
   1639 	pp_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
   1640 	pp_load_buffer_state(yyscanner );
   1641 }
   1642 
   1643 /** Switch to a different input buffer.
   1644  * @param new_buffer The new input buffer.
   1645  * @param yyscanner The scanner object.
   1646  */
   1647     void pp_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
   1648 {
   1649     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   1650 
   1651 	/* TODO. We should be able to replace this entire function body
   1652 	 * with
   1653 	 *		pppop_buffer_state();
   1654 	 *		pppush_buffer_state(new_buffer);
   1655      */
   1656 	ppensure_buffer_stack (yyscanner);
   1657 	if ( YY_CURRENT_BUFFER == new_buffer )
   1658 		return;
   1659 
   1660 	if ( YY_CURRENT_BUFFER )
   1661 		{
   1662 		/* Flush out information for old buffer. */
   1663 		*yyg->yy_c_buf_p = yyg->yy_hold_char;
   1664 		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
   1665 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
   1666 		}
   1667 
   1668 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
   1669 	pp_load_buffer_state(yyscanner );
   1670 
   1671 	/* We don't actually know whether we did this switch during
   1672 	 * EOF (ppwrap()) processing, but the only time this flag
   1673 	 * is looked at is after ppwrap() is called, so it's safe
   1674 	 * to go ahead and always set it.
   1675 	 */
   1676 	yyg->yy_did_buffer_switch_on_eof = 1;
   1677 }
   1678 
   1679 static void pp_load_buffer_state  (yyscan_t yyscanner)
   1680 {
   1681     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   1682 	yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
   1683 	yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
   1684 	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
   1685 	yyg->yy_hold_char = *yyg->yy_c_buf_p;
   1686 }
   1687 
   1688 /** Allocate and initialize an input buffer state.
   1689  * @param file A readable stream.
   1690  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
   1691  * @param yyscanner The scanner object.
   1692  * @return the allocated buffer state.
   1693  */
   1694     YY_BUFFER_STATE pp_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
   1695 {
   1696 	YY_BUFFER_STATE b;
   1697 
   1698 	b = (YY_BUFFER_STATE) ppalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
   1699 	if ( ! b )
   1700 		YY_FATAL_ERROR( "out of dynamic memory in pp_create_buffer()" );
   1701 
   1702 	b->yy_buf_size = (yy_size_t)size;
   1703 
   1704 	/* yy_ch_buf has to be 2 characters longer than the size given because
   1705 	 * we need to put in 2 end-of-buffer characters.
   1706 	 */
   1707 	b->yy_ch_buf = (char *) ppalloc(b->yy_buf_size + 2 ,yyscanner );
   1708 	if ( ! b->yy_ch_buf )
   1709 		YY_FATAL_ERROR( "out of dynamic memory in pp_create_buffer()" );
   1710 
   1711 	b->yy_is_our_buffer = 1;
   1712 
   1713 	pp_init_buffer(b,file ,yyscanner);
   1714 
   1715 	return b;
   1716 }
   1717 
   1718 /** Destroy the buffer.
   1719  * @param b a buffer created with pp_create_buffer()
   1720  * @param yyscanner The scanner object.
   1721  */
   1722     void pp_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
   1723 {
   1724     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   1725 
   1726 	if ( ! b )
   1727 		return;
   1728 
   1729 	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
   1730 		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
   1731 
   1732 	if ( b->yy_is_our_buffer )
   1733 		ppfree((void *) b->yy_ch_buf ,yyscanner );
   1734 
   1735 	ppfree((void *) b ,yyscanner );
   1736 }
   1737 
   1738 /* Initializes or reinitializes a buffer.
   1739  * This function is sometimes called more than once on the same buffer,
   1740  * such as during a pprestart() or at EOF.
   1741  */
   1742     static void pp_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
   1743 
   1744 {
   1745 	int oerrno = errno;
   1746     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   1747 
   1748 	pp_flush_buffer(b ,yyscanner);
   1749 
   1750 	b->yy_input_file = file;
   1751 	b->yy_fill_buffer = 1;
   1752 
   1753     /* If b is the current buffer, then pp_init_buffer was _probably_
   1754      * called from pprestart() or through yy_get_next_buffer.
   1755      * In that case, we don't want to reset the lineno or column.
   1756      */
   1757     if (b != YY_CURRENT_BUFFER){
   1758         b->yy_bs_lineno = 1;
   1759         b->yy_bs_column = 0;
   1760     }
   1761 
   1762         b->yy_is_interactive = 0;
   1763 
   1764 	errno = oerrno;
   1765 }
   1766 
   1767 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
   1768  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
   1769  * @param yyscanner The scanner object.
   1770  */
   1771     void pp_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
   1772 {
   1773     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   1774 	if ( ! b )
   1775 		return;
   1776 
   1777 	b->yy_n_chars = 0;
   1778 
   1779 	/* We always need two end-of-buffer characters.  The first causes
   1780 	 * a transition to the end-of-buffer state.  The second causes
   1781 	 * a jam in that state.
   1782 	 */
   1783 	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
   1784 	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
   1785 
   1786 	b->yy_buf_pos = &b->yy_ch_buf[0];
   1787 
   1788 	b->yy_at_bol = 1;
   1789 	b->yy_buffer_status = YY_BUFFER_NEW;
   1790 
   1791 	if ( b == YY_CURRENT_BUFFER )
   1792 		pp_load_buffer_state(yyscanner );
   1793 }
   1794 
   1795 /** Pushes the new state onto the stack. The new state becomes
   1796  *  the current state. This function will allocate the stack
   1797  *  if necessary.
   1798  *  @param new_buffer The new state.
   1799  *  @param yyscanner The scanner object.
   1800  */
   1801 void pppush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
   1802 {
   1803     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   1804 	if (new_buffer == NULL)
   1805 		return;
   1806 
   1807 	ppensure_buffer_stack(yyscanner);
   1808 
   1809 	/* This block is copied from pp_switch_to_buffer. */
   1810 	if ( YY_CURRENT_BUFFER )
   1811 		{
   1812 		/* Flush out information for old buffer. */
   1813 		*yyg->yy_c_buf_p = yyg->yy_hold_char;
   1814 		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
   1815 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
   1816 		}
   1817 
   1818 	/* Only push if top exists. Otherwise, replace top. */
   1819 	if (YY_CURRENT_BUFFER)
   1820 		yyg->yy_buffer_stack_top++;
   1821 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
   1822 
   1823 	/* copied from pp_switch_to_buffer. */
   1824 	pp_load_buffer_state(yyscanner );
   1825 	yyg->yy_did_buffer_switch_on_eof = 1;
   1826 }
   1827 
   1828 /** Removes and deletes the top of the stack, if present.
   1829  *  The next element becomes the new top.
   1830  *  @param yyscanner The scanner object.
   1831  */
   1832 void pppop_buffer_state (yyscan_t yyscanner)
   1833 {
   1834     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   1835 	if (!YY_CURRENT_BUFFER)
   1836 		return;
   1837 
   1838 	pp_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
   1839 	YY_CURRENT_BUFFER_LVALUE = NULL;
   1840 	if (yyg->yy_buffer_stack_top > 0)
   1841 		--yyg->yy_buffer_stack_top;
   1842 
   1843 	if (YY_CURRENT_BUFFER) {
   1844 		pp_load_buffer_state(yyscanner );
   1845 		yyg->yy_did_buffer_switch_on_eof = 1;
   1846 	}
   1847 }
   1848 
   1849 /* Allocates the stack if it does not exist.
   1850  *  Guarantees space for at least one push.
   1851  */
   1852 static void ppensure_buffer_stack (yyscan_t yyscanner)
   1853 {
   1854 	yy_size_t num_to_alloc;
   1855     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   1856 
   1857 	if (!yyg->yy_buffer_stack) {
   1858 
   1859 		/* First allocation is just for 2 elements, since we don't know if this
   1860 		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
   1861 		 * immediate realloc on the next call.
   1862          */
   1863 		num_to_alloc = 1; // After all that talk, this was set to 1 anyways...
   1864 		yyg->yy_buffer_stack = (struct yy_buffer_state**)ppalloc
   1865 								(num_to_alloc * sizeof(struct yy_buffer_state*)
   1866 								, yyscanner);
   1867 		if ( ! yyg->yy_buffer_stack )
   1868 			YY_FATAL_ERROR( "out of dynamic memory in ppensure_buffer_stack()" );
   1869 
   1870 		memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
   1871 
   1872 		yyg->yy_buffer_stack_max = num_to_alloc;
   1873 		yyg->yy_buffer_stack_top = 0;
   1874 		return;
   1875 	}
   1876 
   1877 	if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
   1878 
   1879 		/* Increase the buffer to prepare for a possible push. */
   1880 		yy_size_t grow_size = 8 /* arbitrary grow size */;
   1881 
   1882 		num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
   1883 		yyg->yy_buffer_stack = (struct yy_buffer_state**)pprealloc
   1884 								(yyg->yy_buffer_stack,
   1885 								num_to_alloc * sizeof(struct yy_buffer_state*)
   1886 								, yyscanner);
   1887 		if ( ! yyg->yy_buffer_stack )
   1888 			YY_FATAL_ERROR( "out of dynamic memory in ppensure_buffer_stack()" );
   1889 
   1890 		/* zero only the new slots.*/
   1891 		memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
   1892 		yyg->yy_buffer_stack_max = num_to_alloc;
   1893 	}
   1894 }
   1895 
   1896 /** Setup the input buffer state to scan directly from a user-specified character buffer.
   1897  * @param base the character buffer
   1898  * @param size the size in bytes of the character buffer
   1899  * @param yyscanner The scanner object.
   1900  * @return the newly allocated buffer state object.
   1901  */
   1902 YY_BUFFER_STATE pp_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
   1903 {
   1904 	YY_BUFFER_STATE b;
   1905 
   1906 	if ( size < 2 ||
   1907 	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
   1908 	     base[size-1] != YY_END_OF_BUFFER_CHAR )
   1909 		/* They forgot to leave room for the EOB's. */
   1910 		return 0;
   1911 
   1912 	b = (YY_BUFFER_STATE) ppalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
   1913 	if ( ! b )
   1914 		YY_FATAL_ERROR( "out of dynamic memory in pp_scan_buffer()" );
   1915 
   1916 	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
   1917 	b->yy_buf_pos = b->yy_ch_buf = base;
   1918 	b->yy_is_our_buffer = 0;
   1919 	b->yy_input_file = 0;
   1920 	b->yy_n_chars = b->yy_buf_size;
   1921 	b->yy_is_interactive = 0;
   1922 	b->yy_at_bol = 1;
   1923 	b->yy_fill_buffer = 0;
   1924 	b->yy_buffer_status = YY_BUFFER_NEW;
   1925 
   1926 	pp_switch_to_buffer(b ,yyscanner );
   1927 
   1928 	return b;
   1929 }
   1930 
   1931 /** Setup the input buffer state to scan a string. The next call to pplex() will
   1932  * scan from a @e copy of @a str.
   1933  * @param yystr a NUL-terminated string to scan
   1934  * @param yyscanner The scanner object.
   1935  * @return the newly allocated buffer state object.
   1936  * @note If you want to scan bytes that may contain NUL values, then use
   1937  *       pp_scan_bytes() instead.
   1938  */
   1939 YY_BUFFER_STATE pp_scan_string (yyconst char * yystr , yyscan_t yyscanner)
   1940 {
   1941 
   1942 	return pp_scan_bytes(yystr,strlen(yystr) ,yyscanner);
   1943 }
   1944 
   1945 /** Setup the input buffer state to scan the given bytes. The next call to pplex() will
   1946  * scan from a @e copy of @a bytes.
   1947  * @param yybytes the byte buffer to scan
   1948  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
   1949  * @param yyscanner The scanner object.
   1950  * @return the newly allocated buffer state object.
   1951  */
   1952 YY_BUFFER_STATE pp_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len , yyscan_t yyscanner)
   1953 {
   1954 	YY_BUFFER_STATE b;
   1955 	char *buf;
   1956 	yy_size_t n;
   1957 	yy_size_t i;
   1958 
   1959 	/* Get memory for full buffer, including space for trailing EOB's. */
   1960 	n = _yybytes_len + 2;
   1961 	buf = (char *) ppalloc(n ,yyscanner );
   1962 	if ( ! buf )
   1963 		YY_FATAL_ERROR( "out of dynamic memory in pp_scan_bytes()" );
   1964 
   1965 	for ( i = 0; i < _yybytes_len; ++i )
   1966 		buf[i] = yybytes[i];
   1967 
   1968 	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
   1969 
   1970 	b = pp_scan_buffer(buf,n ,yyscanner);
   1971 	if ( ! b )
   1972 		YY_FATAL_ERROR( "bad buffer in pp_scan_bytes()" );
   1973 
   1974 	/* It's okay to grow etc. this buffer, and we should throw it
   1975 	 * away when we're done.
   1976 	 */
   1977 	b->yy_is_our_buffer = 1;
   1978 
   1979 	return b;
   1980 }
   1981 
   1982 #ifndef YY_EXIT_FAILURE
   1983 #define YY_EXIT_FAILURE 2
   1984 #endif
   1985 
   1986 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
   1987 {
   1988 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   1989 	(void)yyg;
   1990 	(void) fprintf( stderr, "%s\n", msg );
   1991 	exit( YY_EXIT_FAILURE );
   1992 }
   1993 
   1994 /* Redefine yyless() so it works in section 3 code. */
   1995 
   1996 #undef yyless
   1997 #define yyless(n) \
   1998 	do \
   1999 		{ \
   2000 		/* Undo effects of setting up yytext. */ \
   2001         int yyless_macro_arg = (n); \
   2002         YY_LESS_LINENO(yyless_macro_arg);\
   2003 		yytext[yyleng] = yyg->yy_hold_char; \
   2004 		yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
   2005 		yyg->yy_hold_char = *yyg->yy_c_buf_p; \
   2006 		*yyg->yy_c_buf_p = '\0'; \
   2007 		yyleng = yyless_macro_arg; \
   2008 		} \
   2009 	while ( 0 )
   2010 
   2011 /* Accessor  methods (get/set functions) to struct members. */
   2012 
   2013 /** Get the user-defined data for this scanner.
   2014  * @param yyscanner The scanner object.
   2015  */
   2016 YY_EXTRA_TYPE ppget_extra  (yyscan_t yyscanner)
   2017 {
   2018     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2019     return yyextra;
   2020 }
   2021 
   2022 /** Get the current line number.
   2023  * @param yyscanner The scanner object.
   2024  */
   2025 int ppget_lineno  (yyscan_t yyscanner)
   2026 {
   2027     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2028 
   2029         if (! YY_CURRENT_BUFFER)
   2030             return 0;
   2031 
   2032     return yylineno;
   2033 }
   2034 
   2035 /** Get the current column number.
   2036  * @param yyscanner The scanner object.
   2037  */
   2038 int ppget_column  (yyscan_t yyscanner)
   2039 {
   2040     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2041 
   2042         if (! YY_CURRENT_BUFFER)
   2043             return 0;
   2044 
   2045     return yycolumn;
   2046 }
   2047 
   2048 /** Get the input stream.
   2049  * @param yyscanner The scanner object.
   2050  */
   2051 FILE *ppget_in  (yyscan_t yyscanner)
   2052 {
   2053     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2054     return yyin;
   2055 }
   2056 
   2057 /** Get the output stream.
   2058  * @param yyscanner The scanner object.
   2059  */
   2060 FILE *ppget_out  (yyscan_t yyscanner)
   2061 {
   2062     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2063     return yyout;
   2064 }
   2065 
   2066 /** Get the length of the current token.
   2067  * @param yyscanner The scanner object.
   2068  */
   2069 yy_size_t ppget_leng  (yyscan_t yyscanner)
   2070 {
   2071     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2072     return yyleng;
   2073 }
   2074 
   2075 /** Get the current token.
   2076  * @param yyscanner The scanner object.
   2077  */
   2078 
   2079 char *ppget_text  (yyscan_t yyscanner)
   2080 {
   2081     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2082     return yytext;
   2083 }
   2084 
   2085 /** Set the user-defined data. This data is never touched by the scanner.
   2086  * @param user_defined The data to be associated with this scanner.
   2087  * @param yyscanner The scanner object.
   2088  */
   2089 void ppset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
   2090 {
   2091     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2092     yyextra = user_defined ;
   2093 }
   2094 
   2095 /** Set the current line number.
   2096  * @param _line_number line number
   2097  * @param yyscanner The scanner object.
   2098  */
   2099 void ppset_lineno (int  _line_number , yyscan_t yyscanner)
   2100 {
   2101     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2102 
   2103         /* lineno is only valid if an input buffer exists. */
   2104         if (! YY_CURRENT_BUFFER )
   2105            YY_FATAL_ERROR( "ppset_lineno called with no buffer" );
   2106 
   2107     yylineno = _line_number;
   2108 }
   2109 
   2110 /** Set the current column.
   2111  * @param _column_no column number
   2112  * @param yyscanner The scanner object.
   2113  */
   2114 void ppset_column (int  _column_no , yyscan_t yyscanner)
   2115 {
   2116     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2117 
   2118         /* column is only valid if an input buffer exists. */
   2119         if (! YY_CURRENT_BUFFER )
   2120            YY_FATAL_ERROR( "ppset_column called with no buffer" );
   2121 
   2122     yycolumn = _column_no;
   2123 }
   2124 
   2125 /** Set the input stream. This does not discard the current
   2126  * input buffer.
   2127  * @param _in_str A readable stream.
   2128  * @param yyscanner The scanner object.
   2129  * @see pp_switch_to_buffer
   2130  */
   2131 void ppset_in (FILE *  _in_str , yyscan_t yyscanner)
   2132 {
   2133     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2134     yyin = _in_str ;
   2135 }
   2136 
   2137 void ppset_out (FILE *  _out_str , yyscan_t yyscanner)
   2138 {
   2139     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2140     yyout = _out_str ;
   2141 }
   2142 
   2143 int ppget_debug  (yyscan_t yyscanner)
   2144 {
   2145     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2146     return yy_flex_debug;
   2147 }
   2148 
   2149 void ppset_debug (int  _bdebug , yyscan_t yyscanner)
   2150 {
   2151     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2152     yy_flex_debug = _bdebug ;
   2153 }
   2154 
   2155 /* Accessor methods for yylval and yylloc */
   2156 
   2157 YYSTYPE * ppget_lval  (yyscan_t yyscanner)
   2158 {
   2159     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2160     return yylval;
   2161 }
   2162 
   2163 void ppset_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
   2164 {
   2165     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2166     yylval = yylval_param;
   2167 }
   2168 
   2169 YYLTYPE *ppget_lloc  (yyscan_t yyscanner)
   2170 {
   2171     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2172     return yylloc;
   2173 }
   2174 
   2175 void ppset_lloc (YYLTYPE *  yylloc_param , yyscan_t yyscanner)
   2176 {
   2177     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2178     yylloc = yylloc_param;
   2179 }
   2180 
   2181 /* User-visible API */
   2182 
   2183 /* pplex_init is special because it creates the scanner itself, so it is
   2184  * the ONLY reentrant function that doesn't take the scanner as the last argument.
   2185  * That's why we explicitly handle the declaration, instead of using our macros.
   2186  */
   2187 
   2188 int pplex_init(yyscan_t* ptr_yy_globals)
   2189 
   2190 {
   2191     if (ptr_yy_globals == NULL){
   2192         errno = EINVAL;
   2193         return 1;
   2194     }
   2195 
   2196     *ptr_yy_globals = (yyscan_t) ppalloc ( sizeof( struct yyguts_t ), NULL );
   2197 
   2198     if (*ptr_yy_globals == NULL){
   2199         errno = ENOMEM;
   2200         return 1;
   2201     }
   2202 
   2203     /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
   2204     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
   2205 
   2206     return yy_init_globals ( *ptr_yy_globals );
   2207 }
   2208 
   2209 /* pplex_init_extra has the same functionality as pplex_init, but follows the
   2210  * convention of taking the scanner as the last argument. Note however, that
   2211  * this is a *pointer* to a scanner, as it will be allocated by this call (and
   2212  * is the reason, too, why this function also must handle its own declaration).
   2213  * The user defined value in the first argument will be available to ppalloc in
   2214  * the yyextra field.
   2215  */
   2216 
   2217 int pplex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
   2218 
   2219 {
   2220     struct yyguts_t dummy_yyguts;
   2221 
   2222     ppset_extra (yy_user_defined, &dummy_yyguts);
   2223 
   2224     if (ptr_yy_globals == NULL){
   2225         errno = EINVAL;
   2226         return 1;
   2227     }
   2228 
   2229     *ptr_yy_globals = (yyscan_t) ppalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
   2230 
   2231     if (*ptr_yy_globals == NULL){
   2232         errno = ENOMEM;
   2233         return 1;
   2234     }
   2235 
   2236     /* By setting to 0xAA, we expose bugs in
   2237     yy_init_globals. Leave at 0x00 for releases. */
   2238     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
   2239 
   2240     ppset_extra (yy_user_defined, *ptr_yy_globals);
   2241 
   2242     return yy_init_globals ( *ptr_yy_globals );
   2243 }
   2244 
   2245 static int yy_init_globals (yyscan_t yyscanner)
   2246 {
   2247     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2248     /* Initialization is the same as for the non-reentrant scanner.
   2249      * This function is called from pplex_destroy(), so don't allocate here.
   2250      */
   2251 
   2252     yyg->yy_buffer_stack = 0;
   2253     yyg->yy_buffer_stack_top = 0;
   2254     yyg->yy_buffer_stack_max = 0;
   2255     yyg->yy_c_buf_p = (char *) 0;
   2256     yyg->yy_init = 0;
   2257     yyg->yy_start = 0;
   2258 
   2259     yyg->yy_start_stack_ptr = 0;
   2260     yyg->yy_start_stack_depth = 0;
   2261     yyg->yy_start_stack =  NULL;
   2262 
   2263 /* Defined in main.c */
   2264 #ifdef YY_STDINIT
   2265     yyin = stdin;
   2266     yyout = stdout;
   2267 #else
   2268     yyin = (FILE *) 0;
   2269     yyout = (FILE *) 0;
   2270 #endif
   2271 
   2272     /* For future reference: Set errno on error, since we are called by
   2273      * pplex_init()
   2274      */
   2275     return 0;
   2276 }
   2277 
   2278 /* pplex_destroy is for both reentrant and non-reentrant scanners. */
   2279 int pplex_destroy  (yyscan_t yyscanner)
   2280 {
   2281     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2282 
   2283     /* Pop the buffer stack, destroying each element. */
   2284 	while(YY_CURRENT_BUFFER){
   2285 		pp_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
   2286 		YY_CURRENT_BUFFER_LVALUE = NULL;
   2287 		pppop_buffer_state(yyscanner);
   2288 	}
   2289 
   2290 	/* Destroy the stack itself. */
   2291 	ppfree(yyg->yy_buffer_stack ,yyscanner);
   2292 	yyg->yy_buffer_stack = NULL;
   2293 
   2294     /* Destroy the start condition stack. */
   2295         ppfree(yyg->yy_start_stack ,yyscanner );
   2296         yyg->yy_start_stack = NULL;
   2297 
   2298     /* Reset the globals. This is important in a non-reentrant scanner so the next time
   2299      * pplex() is called, initialization will occur. */
   2300     yy_init_globals( yyscanner);
   2301 
   2302     /* Destroy the main struct (reentrant only). */
   2303     ppfree ( yyscanner , yyscanner );
   2304     yyscanner = NULL;
   2305     return 0;
   2306 }
   2307 
   2308 /*
   2309  * Internal utility routines.
   2310  */
   2311 
   2312 #ifndef yytext_ptr
   2313 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
   2314 {
   2315 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2316 	(void)yyg;
   2317 
   2318 	int i;
   2319 	for ( i = 0; i < n; ++i )
   2320 		s1[i] = s2[i];
   2321 }
   2322 #endif
   2323 
   2324 #ifdef YY_NEED_STRLEN
   2325 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
   2326 {
   2327 	int n;
   2328 	for ( n = 0; s[n]; ++n )
   2329 		;
   2330 
   2331 	return n;
   2332 }
   2333 #endif
   2334 
   2335 void *ppalloc (yy_size_t  size , yyscan_t yyscanner)
   2336 {
   2337 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2338 	(void)yyg;
   2339 	return (void *) malloc( size );
   2340 }
   2341 
   2342 void *pprealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
   2343 {
   2344 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2345 	(void)yyg;
   2346 
   2347 	/* The cast to (char *) in the following accommodates both
   2348 	 * implementations that use char* generic pointers, and those
   2349 	 * that use void* generic pointers.  It works with the latter
   2350 	 * because both ANSI C and C++ allow castless assignment from
   2351 	 * any pointer type to void*, and deal with argument conversions
   2352 	 * as though doing an assignment.
   2353 	 */
   2354 	return (void *) realloc( (char *) ptr, size );
   2355 }
   2356 
   2357 void ppfree (void * ptr , yyscan_t yyscanner)
   2358 {
   2359 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   2360 	(void)yyg;
   2361 	free( (char *) ptr );	/* see pprealloc() for (char *) cast */
   2362 }
   2363 
   2364 #define YYTABLES_NAME "yytables"
   2365 
   2366 namespace pp {
   2367 
   2368 // TODO(alokp): Maximum token length should ideally be specified by
   2369 // the preprocessor client, i.e., the compiler.
   2370 const size_t Tokenizer::kMaxTokenLength = 256;
   2371 
   2372 Tokenizer::Tokenizer(Diagnostics* diagnostics) : mHandle(0)
   2373 {
   2374     mContext.diagnostics = diagnostics;
   2375 }
   2376 
   2377 Tokenizer::~Tokenizer()
   2378 {
   2379     destroyScanner();
   2380 }
   2381 
   2382 bool Tokenizer::init(int count, const char* const string[], const int length[])
   2383 {
   2384     if (count < 0) return false;
   2385     if ((count > 0) && (string == 0)) return false;
   2386 
   2387     mContext.input = Input(count, string, length);
   2388     return initScanner();
   2389 }
   2390 
   2391 void Tokenizer::setFileNumber(int file)
   2392 {
   2393     // We use column number as file number.
   2394     // See macro yyfileno.
   2395     ppset_column(file,mHandle);
   2396 }
   2397 
   2398 void Tokenizer::setLineNumber(int line)
   2399 {
   2400     ppset_lineno(line,mHandle);
   2401 }
   2402 
   2403 void Tokenizer::lex(Token* token)
   2404 {
   2405     token->type = pplex(&token->text,&token->location,mHandle);
   2406     if (token->text.size() > kMaxTokenLength)
   2407     {
   2408         mContext.diagnostics->report(Diagnostics::TOKEN_TOO_LONG,
   2409                                      token->location, token->text);
   2410         token->text.erase(kMaxTokenLength);
   2411     }
   2412 
   2413     token->flags = 0;
   2414 
   2415     token->setAtStartOfLine(mContext.lineStart);
   2416     mContext.lineStart = token->type == '\n';
   2417 
   2418     token->setHasLeadingSpace(mContext.leadingSpace);
   2419     mContext.leadingSpace = false;
   2420 }
   2421 
   2422 bool Tokenizer::initScanner()
   2423 {
   2424     if ((mHandle == NULL) && pplex_init_extra(&mContext,&mHandle))
   2425         return false;
   2426 
   2427     pprestart(0,mHandle);
   2428     return true;
   2429 }
   2430 
   2431 void Tokenizer::destroyScanner()
   2432 {
   2433     if (mHandle == NULL)
   2434         return;
   2435 
   2436     pplex_destroy(mHandle);
   2437     mHandle = NULL;
   2438 }
   2439 
   2440 }  // namespace pp
   2441 
   2442