1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/compiler/preprocessor/Tokenizer.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,2365 @@ 1.4 +#line 16 "./Tokenizer.l" 1.5 +// 1.6 +// Copyright (c) 2011-2013 The ANGLE Project Authors. All rights reserved. 1.7 +// Use of this source code is governed by a BSD-style license that can be 1.8 +// found in the LICENSE file. 1.9 +// 1.10 + 1.11 +// This file is auto-generated by generate_parser.sh. DO NOT EDIT! 1.12 + 1.13 + 1.14 + 1.15 +#line 13 "./Tokenizer.cpp" 1.16 + 1.17 +#define YY_INT_ALIGNED short int 1.18 + 1.19 +/* A lexical scanner generated by flex */ 1.20 + 1.21 +#define FLEX_SCANNER 1.22 +#define YY_FLEX_MAJOR_VERSION 2 1.23 +#define YY_FLEX_MINOR_VERSION 5 1.24 +#define YY_FLEX_SUBMINOR_VERSION 35 1.25 +#if YY_FLEX_SUBMINOR_VERSION > 0 1.26 +#define FLEX_BETA 1.27 +#endif 1.28 + 1.29 +/* First, we deal with platform-specific or compiler-specific issues. */ 1.30 + 1.31 +/* begin standard C headers. */ 1.32 +#include <stdio.h> 1.33 +#include <string.h> 1.34 +#include <errno.h> 1.35 +#include <stdlib.h> 1.36 + 1.37 +/* end standard C headers. */ 1.38 + 1.39 +/* flex integer type definitions */ 1.40 + 1.41 +#ifndef FLEXINT_H 1.42 +#define FLEXINT_H 1.43 + 1.44 +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 1.45 + 1.46 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 1.47 + 1.48 +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 1.49 + * if you want the limit (max/min) macros for int types. 1.50 + */ 1.51 +#ifndef __STDC_LIMIT_MACROS 1.52 +#define __STDC_LIMIT_MACROS 1 1.53 +#endif 1.54 + 1.55 +#include <inttypes.h> 1.56 +typedef int8_t flex_int8_t; 1.57 +typedef uint8_t flex_uint8_t; 1.58 +typedef int16_t flex_int16_t; 1.59 +typedef uint16_t flex_uint16_t; 1.60 +typedef int32_t flex_int32_t; 1.61 +typedef uint32_t flex_uint32_t; 1.62 +typedef uint64_t flex_uint64_t; 1.63 +#else 1.64 +typedef signed char flex_int8_t; 1.65 +typedef short int flex_int16_t; 1.66 +typedef int flex_int32_t; 1.67 +typedef unsigned char flex_uint8_t; 1.68 +typedef unsigned short int flex_uint16_t; 1.69 +typedef unsigned int flex_uint32_t; 1.70 +#endif /* ! C99 */ 1.71 + 1.72 +/* Limits of integral types. */ 1.73 +#ifndef INT8_MIN 1.74 +#define INT8_MIN (-128) 1.75 +#endif 1.76 +#ifndef INT16_MIN 1.77 +#define INT16_MIN (-32767-1) 1.78 +#endif 1.79 +#ifndef INT32_MIN 1.80 +#define INT32_MIN (-2147483647-1) 1.81 +#endif 1.82 +#ifndef INT8_MAX 1.83 +#define INT8_MAX (127) 1.84 +#endif 1.85 +#ifndef INT16_MAX 1.86 +#define INT16_MAX (32767) 1.87 +#endif 1.88 +#ifndef INT32_MAX 1.89 +#define INT32_MAX (2147483647) 1.90 +#endif 1.91 +#ifndef UINT8_MAX 1.92 +#define UINT8_MAX (255U) 1.93 +#endif 1.94 +#ifndef UINT16_MAX 1.95 +#define UINT16_MAX (65535U) 1.96 +#endif 1.97 +#ifndef UINT32_MAX 1.98 +#define UINT32_MAX (4294967295U) 1.99 +#endif 1.100 + 1.101 +#endif /* ! FLEXINT_H */ 1.102 + 1.103 +#ifdef __cplusplus 1.104 + 1.105 +/* The "const" storage-class-modifier is valid. */ 1.106 +#define YY_USE_CONST 1.107 + 1.108 +#else /* ! __cplusplus */ 1.109 + 1.110 +/* C99 requires __STDC__ to be defined as 1. */ 1.111 +#if defined (__STDC__) 1.112 + 1.113 +#define YY_USE_CONST 1.114 + 1.115 +#endif /* defined (__STDC__) */ 1.116 +#endif /* ! __cplusplus */ 1.117 + 1.118 +#ifdef YY_USE_CONST 1.119 +#define yyconst const 1.120 +#else 1.121 +#define yyconst 1.122 +#endif 1.123 + 1.124 +/* Returned upon end-of-file. */ 1.125 +#define YY_NULL 0 1.126 + 1.127 +/* Promotes a possibly negative, possibly signed char to an unsigned 1.128 + * integer for use as an array index. If the signed char is negative, 1.129 + * we want to instead treat it as an 8-bit unsigned char, hence the 1.130 + * double cast. 1.131 + */ 1.132 +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 1.133 + 1.134 +/* An opaque pointer. */ 1.135 +#ifndef YY_TYPEDEF_YY_SCANNER_T 1.136 +#define YY_TYPEDEF_YY_SCANNER_T 1.137 +typedef void* yyscan_t; 1.138 +#endif 1.139 + 1.140 +/* For convenience, these vars (plus the bison vars far below) 1.141 + are macros in the reentrant scanner. */ 1.142 +#define yyin yyg->yyin_r 1.143 +#define yyout yyg->yyout_r 1.144 +#define yyextra yyg->yyextra_r 1.145 +#define yyleng yyg->yyleng_r 1.146 +#define yytext yyg->yytext_r 1.147 +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) 1.148 +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) 1.149 +#define yy_flex_debug yyg->yy_flex_debug_r 1.150 + 1.151 +/* Enter a start condition. This macro really ought to take a parameter, 1.152 + * but we do it the disgusting crufty way forced on us by the ()-less 1.153 + * definition of BEGIN. 1.154 + */ 1.155 +#define BEGIN yyg->yy_start = 1 + 2 * 1.156 + 1.157 +/* Translate the current start state into a value that can be later handed 1.158 + * to BEGIN to return to the state. The YYSTATE alias is for lex 1.159 + * compatibility. 1.160 + */ 1.161 +#define YY_START ((yyg->yy_start - 1) / 2) 1.162 +#define YYSTATE YY_START 1.163 + 1.164 +/* Action number for EOF rule of a given start state. */ 1.165 +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 1.166 + 1.167 +/* Special action meaning "start processing a new file". */ 1.168 +#define YY_NEW_FILE pprestart(yyin ,yyscanner ) 1.169 + 1.170 +#define YY_END_OF_BUFFER_CHAR 0 1.171 + 1.172 +/* Size of default input buffer. */ 1.173 +#ifndef YY_BUF_SIZE 1.174 +#define YY_BUF_SIZE 16384 1.175 +#endif 1.176 + 1.177 +/* The state buf must be large enough to hold one state per character in the main buffer. 1.178 + */ 1.179 +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 1.180 + 1.181 +#ifndef YY_TYPEDEF_YY_BUFFER_STATE 1.182 +#define YY_TYPEDEF_YY_BUFFER_STATE 1.183 +typedef struct yy_buffer_state *YY_BUFFER_STATE; 1.184 +#endif 1.185 + 1.186 +#ifndef YY_TYPEDEF_YY_SIZE_T 1.187 +#define YY_TYPEDEF_YY_SIZE_T 1.188 +typedef size_t yy_size_t; 1.189 +#endif 1.190 + 1.191 +#define EOB_ACT_CONTINUE_SCAN 0 1.192 +#define EOB_ACT_END_OF_FILE 1 1.193 +#define EOB_ACT_LAST_MATCH 2 1.194 + 1.195 + #define YY_LESS_LINENO(n) 1.196 + 1.197 +/* Return all but the first "n" matched characters back to the input stream. */ 1.198 +#define yyless(n) \ 1.199 + do \ 1.200 + { \ 1.201 + /* Undo effects of setting up yytext. */ \ 1.202 + int yyless_macro_arg = (n); \ 1.203 + YY_LESS_LINENO(yyless_macro_arg);\ 1.204 + *yy_cp = yyg->yy_hold_char; \ 1.205 + YY_RESTORE_YY_MORE_OFFSET \ 1.206 + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 1.207 + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 1.208 + } \ 1.209 + while ( 0 ) 1.210 + 1.211 +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) 1.212 + 1.213 +#ifndef YY_STRUCT_YY_BUFFER_STATE 1.214 +#define YY_STRUCT_YY_BUFFER_STATE 1.215 +struct yy_buffer_state 1.216 + { 1.217 + FILE *yy_input_file; 1.218 + 1.219 + char *yy_ch_buf; /* input buffer */ 1.220 + char *yy_buf_pos; /* current position in input buffer */ 1.221 + 1.222 + /* Size of input buffer in bytes, not including room for EOB 1.223 + * characters. 1.224 + */ 1.225 + yy_size_t yy_buf_size; 1.226 + 1.227 + /* Number of characters read into yy_ch_buf, not including EOB 1.228 + * characters. 1.229 + */ 1.230 + yy_size_t yy_n_chars; 1.231 + 1.232 + /* Whether we "own" the buffer - i.e., we know we created it, 1.233 + * and can realloc() it to grow it, and should free() it to 1.234 + * delete it. 1.235 + */ 1.236 + int yy_is_our_buffer; 1.237 + 1.238 + /* Whether this is an "interactive" input source; if so, and 1.239 + * if we're using stdio for input, then we want to use getc() 1.240 + * instead of fread(), to make sure we stop fetching input after 1.241 + * each newline. 1.242 + */ 1.243 + int yy_is_interactive; 1.244 + 1.245 + /* Whether we're considered to be at the beginning of a line. 1.246 + * If so, '^' rules will be active on the next match, otherwise 1.247 + * not. 1.248 + */ 1.249 + int yy_at_bol; 1.250 + 1.251 + int yy_bs_lineno; /**< The line count. */ 1.252 + int yy_bs_column; /**< The column count. */ 1.253 + 1.254 + /* Whether to try to fill the input buffer when we reach the 1.255 + * end of it. 1.256 + */ 1.257 + int yy_fill_buffer; 1.258 + 1.259 + int yy_buffer_status; 1.260 + 1.261 +#define YY_BUFFER_NEW 0 1.262 +#define YY_BUFFER_NORMAL 1 1.263 + /* When an EOF's been seen but there's still some text to process 1.264 + * then we mark the buffer as YY_EOF_PENDING, to indicate that we 1.265 + * shouldn't try reading from the input source any more. We might 1.266 + * still have a bunch of tokens to match, though, because of 1.267 + * possible backing-up. 1.268 + * 1.269 + * When we actually see the EOF, we change the status to "new" 1.270 + * (via pprestart()), so that the user can continue scanning by 1.271 + * just pointing yyin at a new input file. 1.272 + */ 1.273 +#define YY_BUFFER_EOF_PENDING 2 1.274 + 1.275 + }; 1.276 +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ 1.277 + 1.278 +/* We provide macros for accessing buffer states in case in the 1.279 + * future we want to put the buffer states in a more general 1.280 + * "scanner state". 1.281 + * 1.282 + * Returns the top of the stack, or NULL. 1.283 + */ 1.284 +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ 1.285 + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ 1.286 + : NULL) 1.287 + 1.288 +/* Same as previous macro, but useful when we know that the buffer stack is not 1.289 + * NULL or when we need an lvalue. For internal use only. 1.290 + */ 1.291 +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] 1.292 + 1.293 +void pprestart (FILE *input_file ,yyscan_t yyscanner ); 1.294 +void pp_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); 1.295 +YY_BUFFER_STATE pp_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); 1.296 +void pp_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); 1.297 +void pp_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); 1.298 +void pppush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); 1.299 +void pppop_buffer_state (yyscan_t yyscanner ); 1.300 + 1.301 +static void ppensure_buffer_stack (yyscan_t yyscanner ); 1.302 +static void pp_load_buffer_state (yyscan_t yyscanner ); 1.303 +static void pp_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); 1.304 + 1.305 +#define YY_FLUSH_BUFFER pp_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) 1.306 + 1.307 +YY_BUFFER_STATE pp_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); 1.308 +YY_BUFFER_STATE pp_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); 1.309 +YY_BUFFER_STATE pp_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); 1.310 + 1.311 +void *ppalloc (yy_size_t ,yyscan_t yyscanner ); 1.312 +void *pprealloc (void *,yy_size_t ,yyscan_t yyscanner ); 1.313 +void ppfree (void * ,yyscan_t yyscanner ); 1.314 + 1.315 +#define yy_new_buffer pp_create_buffer 1.316 + 1.317 +#define yy_set_interactive(is_interactive) \ 1.318 + { \ 1.319 + if ( ! YY_CURRENT_BUFFER ){ \ 1.320 + ppensure_buffer_stack (yyscanner); \ 1.321 + YY_CURRENT_BUFFER_LVALUE = \ 1.322 + pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ 1.323 + } \ 1.324 + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 1.325 + } 1.326 + 1.327 +#define yy_set_bol(at_bol) \ 1.328 + { \ 1.329 + if ( ! YY_CURRENT_BUFFER ){\ 1.330 + ppensure_buffer_stack (yyscanner); \ 1.331 + YY_CURRENT_BUFFER_LVALUE = \ 1.332 + pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ 1.333 + } \ 1.334 + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 1.335 + } 1.336 + 1.337 +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 1.338 + 1.339 +/* Begin user sect3 */ 1.340 + 1.341 +#define ppwrap(n) 1 1.342 +#define YY_SKIP_YYWRAP 1.343 + 1.344 +typedef unsigned char YY_CHAR; 1.345 + 1.346 +typedef int yy_state_type; 1.347 + 1.348 +#define yytext_ptr yytext_r 1.349 + 1.350 +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); 1.351 +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); 1.352 +static int yy_get_next_buffer (yyscan_t yyscanner ); 1.353 +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); 1.354 + 1.355 +/* Done after the current pattern has been matched and before the 1.356 + * corresponding action - sets up yytext. 1.357 + */ 1.358 +#define YY_DO_BEFORE_ACTION \ 1.359 + yyg->yytext_ptr = yy_bp; \ 1.360 + yyleng = (yy_size_t) (yy_cp - yy_bp); \ 1.361 + yyg->yy_hold_char = *yy_cp; \ 1.362 + *yy_cp = '\0'; \ 1.363 + yyg->yy_c_buf_p = yy_cp; 1.364 + 1.365 +#define YY_NUM_RULES 38 1.366 +#define YY_END_OF_BUFFER 39 1.367 +/* This struct is not used in this scanner, 1.368 + but its presence is necessary. */ 1.369 +struct yy_trans_info 1.370 + { 1.371 + flex_int32_t yy_verify; 1.372 + flex_int32_t yy_nxt; 1.373 + }; 1.374 +static yyconst flex_int16_t yy_accept[87] = 1.375 + { 0, 1.376 + 0, 0, 0, 0, 39, 37, 34, 35, 35, 33, 1.377 + 7, 33, 33, 33, 33, 33, 33, 33, 33, 9, 1.378 + 9, 33, 33, 33, 8, 37, 33, 33, 3, 5, 1.379 + 5, 4, 34, 35, 19, 27, 20, 30, 25, 12, 1.380 + 23, 13, 24, 10, 2, 1, 26, 10, 9, 11, 1.381 + 11, 11, 11, 9, 14, 16, 18, 17, 15, 8, 1.382 + 36, 36, 31, 21, 32, 22, 3, 5, 6, 11, 1.383 + 10, 11, 1, 10, 11, 0, 10, 9, 28, 29, 1.384 + 0, 10, 10, 10, 10, 0 1.385 + } ; 1.386 + 1.387 +static yyconst flex_int32_t yy_ec[256] = 1.388 + { 0, 1.389 + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1.390 + 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, 1.391 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.392 + 1, 2, 5, 1, 6, 1, 7, 8, 1, 9, 1.393 + 9, 10, 11, 9, 12, 13, 14, 15, 16, 16, 1.394 + 16, 16, 16, 16, 16, 17, 17, 9, 9, 18, 1.395 + 19, 20, 9, 1, 21, 21, 21, 21, 22, 21, 1.396 + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 1.397 + 23, 23, 23, 23, 23, 23, 23, 24, 23, 23, 1.398 + 9, 25, 9, 26, 23, 1, 21, 21, 21, 21, 1.399 + 1.400 + 22, 21, 23, 23, 23, 23, 23, 23, 23, 23, 1.401 + 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 1.402 + 23, 23, 9, 27, 9, 9, 1, 1, 1, 1, 1.403 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.404 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.405 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.406 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.407 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.408 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.409 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.410 + 1.411 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.412 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.413 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.414 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.415 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.416 + 1, 1, 1, 1, 1 1.417 + } ; 1.418 + 1.419 +static yyconst flex_int32_t yy_meta[28] = 1.420 + { 0, 1.421 + 1, 1, 2, 2, 1, 1, 1, 1, 1, 3, 1.422 + 1, 1, 4, 1, 5, 5, 5, 1, 1, 1, 1.423 + 5, 5, 5, 5, 1, 1, 1 1.424 + } ; 1.425 + 1.426 +static yyconst flex_int16_t yy_base[92] = 1.427 + { 0, 1.428 + 0, 0, 25, 27, 162, 163, 159, 163, 152, 132, 1.429 + 163, 131, 24, 163, 116, 22, 26, 31, 30, 37, 1.430 + 40, 44, 115, 46, 0, 64, 50, 15, 0, 163, 1.431 + 124, 91, 88, 163, 163, 163, 163, 163, 163, 163, 1.432 + 163, 163, 163, 64, 163, 0, 163, 76, 54, 58, 1.433 + 79, 91, 91, 0, 56, 163, 163, 163, 32, 0, 1.434 + 163, 36, 163, 163, 163, 163, 0, 163, 163, 94, 1.435 + 0, 106, 0, 0, 113, 55, 72, 113, 163, 163, 1.436 + 116, 101, 108, 123, 126, 163, 143, 31, 148, 153, 1.437 + 155 1.438 + 1.439 + } ; 1.440 + 1.441 +static yyconst flex_int16_t yy_def[92] = 1.442 + { 0, 1.443 + 86, 1, 87, 87, 86, 86, 86, 86, 86, 86, 1.444 + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 1.445 + 20, 86, 86, 86, 88, 86, 86, 86, 89, 86, 1.446 + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 1.447 + 86, 86, 86, 86, 86, 90, 86, 86, 20, 20, 1.448 + 48, 51, 91, 21, 86, 86, 86, 86, 86, 88, 1.449 + 86, 86, 86, 86, 86, 86, 89, 86, 86, 44, 1.450 + 44, 70, 90, 48, 51, 86, 52, 91, 86, 86, 1.451 + 86, 72, 75, 86, 86, 0, 86, 86, 86, 86, 1.452 + 86 1.453 + 1.454 + } ; 1.455 + 1.456 +static yyconst flex_int16_t yy_nxt[191] = 1.457 + { 0, 1.458 + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1.459 + 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 1.460 + 25, 25, 25, 25, 26, 27, 28, 30, 31, 30, 1.461 + 31, 37, 40, 65, 32, 60, 32, 42, 61, 45, 1.462 + 41, 66, 38, 46, 43, 44, 44, 44, 47, 48, 1.463 + 80, 49, 49, 50, 54, 54, 54, 51, 52, 51, 1.464 + 53, 55, 56, 51, 58, 59, 61, 62, 63, 84, 1.465 + 84, 84, 50, 50, 79, 64, 70, 51, 71, 71, 1.466 + 71, 51, 86, 86, 70, 72, 70, 70, 51, 33, 1.467 + 74, 74, 74, 51, 51, 51, 51, 75, 51, 51, 1.468 + 1.469 + 51, 76, 76, 51, 69, 77, 77, 77, 70, 70, 1.470 + 70, 86, 86, 51, 51, 70, 81, 81, 86, 86, 1.471 + 82, 82, 82, 81, 81, 51, 68, 83, 83, 83, 1.472 + 85, 85, 85, 57, 39, 51, 51, 84, 84, 84, 1.473 + 85, 85, 85, 29, 29, 29, 29, 29, 67, 36, 1.474 + 35, 67, 67, 73, 34, 73, 73, 73, 78, 78, 1.475 + 33, 86, 5, 86, 86, 86, 86, 86, 86, 86, 1.476 + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 1.477 + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86 1.478 + } ; 1.479 + 1.480 +static yyconst flex_int16_t yy_chk[191] = 1.481 + { 0, 1.482 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.483 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.484 + 1, 1, 1, 1, 1, 1, 1, 3, 3, 4, 1.485 + 4, 13, 16, 28, 3, 88, 4, 17, 62, 19, 1.486 + 16, 28, 13, 19, 17, 18, 18, 18, 19, 20, 1.487 + 59, 20, 20, 20, 21, 21, 21, 20, 20, 20, 1.488 + 20, 22, 22, 21, 24, 24, 26, 26, 27, 76, 1.489 + 76, 76, 50, 50, 55, 27, 44, 49, 44, 44, 1.490 + 44, 50, 77, 77, 44, 44, 44, 44, 48, 33, 1.491 + 48, 48, 48, 51, 51, 51, 48, 48, 48, 48, 1.492 + 1.493 + 51, 52, 52, 53, 32, 52, 52, 52, 70, 70, 1.494 + 70, 82, 82, 53, 53, 70, 72, 72, 83, 83, 1.495 + 72, 72, 72, 75, 75, 78, 31, 75, 75, 75, 1.496 + 81, 81, 81, 23, 15, 78, 78, 84, 84, 84, 1.497 + 85, 85, 85, 87, 87, 87, 87, 87, 89, 12, 1.498 + 10, 89, 89, 90, 9, 90, 90, 90, 91, 91, 1.499 + 7, 5, 86, 86, 86, 86, 86, 86, 86, 86, 1.500 + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 1.501 + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86 1.502 + } ; 1.503 + 1.504 +/* The intent behind this definition is that it'll catch 1.505 + * any uses of REJECT which flex missed. 1.506 + */ 1.507 +#define REJECT reject_used_but_not_detected 1.508 +#define yymore() yymore_used_but_not_detected 1.509 +#define YY_MORE_ADJ 0 1.510 +#define YY_RESTORE_YY_MORE_OFFSET 1.511 +/* 1.512 +// 1.513 +// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. 1.514 +// Use of this source code is governed by a BSD-style license that can be 1.515 +// found in the LICENSE file. 1.516 +// 1.517 + 1.518 +This file contains the Lex specification for GLSL ES preprocessor. 1.519 +Based on Microsoft Visual Studio 2010 Preprocessor Grammar: 1.520 +http://msdn.microsoft.com/en-us/library/2scxys89.aspx 1.521 + 1.522 +IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh. 1.523 +*/ 1.524 + 1.525 +#include "Tokenizer.h" 1.526 + 1.527 +#include "DiagnosticsBase.h" 1.528 +#include "Token.h" 1.529 + 1.530 +#if defined(__GNUC__) 1.531 +// Triggered by the auto-generated yy_fatal_error function. 1.532 +#pragma GCC diagnostic ignored "-Wmissing-noreturn" 1.533 +#endif 1.534 + 1.535 +typedef std::string YYSTYPE; 1.536 +typedef pp::SourceLocation YYLTYPE; 1.537 + 1.538 +// Use the unused yycolumn variable to track file (string) number. 1.539 +#define yyfileno yycolumn 1.540 + 1.541 +#define YY_USER_INIT \ 1.542 + do { \ 1.543 + yyfileno = 0; \ 1.544 + yylineno = 1; \ 1.545 + yyextra->leadingSpace = false; \ 1.546 + yyextra->lineStart = true; \ 1.547 + } while(0); 1.548 + 1.549 +#define YY_USER_ACTION \ 1.550 + do \ 1.551 + { \ 1.552 + pp::Input* input = &yyextra->input; \ 1.553 + pp::Input::Location* scanLoc = &yyextra->scanLoc; \ 1.554 + while ((scanLoc->sIndex < input->count()) && \ 1.555 + (scanLoc->cIndex >= input->length(scanLoc->sIndex))) \ 1.556 + { \ 1.557 + scanLoc->cIndex -= input->length(scanLoc->sIndex++); \ 1.558 + ++yyfileno; yylineno = 1; \ 1.559 + } \ 1.560 + yylloc->file = yyfileno; \ 1.561 + yylloc->line = yylineno; \ 1.562 + scanLoc->cIndex += yyleng; \ 1.563 + } while(0); 1.564 + 1.565 +#define YY_INPUT(buf, result, maxSize) \ 1.566 + result = yyextra->input.read(buf, maxSize); 1.567 + 1.568 +#define INITIAL 0 1.569 +#define COMMENT 1 1.570 + 1.571 +#define YY_EXTRA_TYPE pp::Tokenizer::Context* 1.572 + 1.573 +/* Holds the entire state of the reentrant scanner. */ 1.574 +struct yyguts_t 1.575 + { 1.576 + 1.577 + /* User-defined. Not touched by flex. */ 1.578 + YY_EXTRA_TYPE yyextra_r; 1.579 + 1.580 + /* The rest are the same as the globals declared in the non-reentrant scanner. */ 1.581 + FILE *yyin_r, *yyout_r; 1.582 + size_t yy_buffer_stack_top; /**< index of top of stack. */ 1.583 + size_t yy_buffer_stack_max; /**< capacity of stack. */ 1.584 + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ 1.585 + char yy_hold_char; 1.586 + yy_size_t yy_n_chars; 1.587 + yy_size_t yyleng_r; 1.588 + char *yy_c_buf_p; 1.589 + int yy_init; 1.590 + int yy_start; 1.591 + int yy_did_buffer_switch_on_eof; 1.592 + int yy_start_stack_ptr; 1.593 + int yy_start_stack_depth; 1.594 + int *yy_start_stack; 1.595 + yy_state_type yy_last_accepting_state; 1.596 + char* yy_last_accepting_cpos; 1.597 + 1.598 + int yylineno_r; 1.599 + int yy_flex_debug_r; 1.600 + 1.601 + char *yytext_r; 1.602 + int yy_more_flag; 1.603 + int yy_more_len; 1.604 + 1.605 + YYSTYPE * yylval_r; 1.606 + 1.607 + YYLTYPE * yylloc_r; 1.608 + 1.609 + }; /* end struct yyguts_t */ 1.610 + 1.611 +static int yy_init_globals (yyscan_t yyscanner ); 1.612 + 1.613 + /* This must go here because YYSTYPE and YYLTYPE are included 1.614 + * from bison output in section 1.*/ 1.615 + # define yylval yyg->yylval_r 1.616 + 1.617 + # define yylloc yyg->yylloc_r 1.618 + 1.619 +int pplex_init (yyscan_t* scanner); 1.620 + 1.621 +int pplex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); 1.622 + 1.623 +/* Accessor methods to globals. 1.624 + These are made visible to non-reentrant scanners for convenience. */ 1.625 + 1.626 +int pplex_destroy (yyscan_t yyscanner ); 1.627 + 1.628 +int ppget_debug (yyscan_t yyscanner ); 1.629 + 1.630 +void ppset_debug (int debug_flag ,yyscan_t yyscanner ); 1.631 + 1.632 +YY_EXTRA_TYPE ppget_extra (yyscan_t yyscanner ); 1.633 + 1.634 +void ppset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); 1.635 + 1.636 +FILE *ppget_in (yyscan_t yyscanner ); 1.637 + 1.638 +void ppset_in (FILE * in_str ,yyscan_t yyscanner ); 1.639 + 1.640 +FILE *ppget_out (yyscan_t yyscanner ); 1.641 + 1.642 +void ppset_out (FILE * out_str ,yyscan_t yyscanner ); 1.643 + 1.644 +yy_size_t ppget_leng (yyscan_t yyscanner ); 1.645 + 1.646 +char *ppget_text (yyscan_t yyscanner ); 1.647 + 1.648 +int ppget_lineno (yyscan_t yyscanner ); 1.649 + 1.650 +void ppset_lineno (int line_number ,yyscan_t yyscanner ); 1.651 + 1.652 +YYSTYPE * ppget_lval (yyscan_t yyscanner ); 1.653 + 1.654 +void ppset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); 1.655 + 1.656 + YYLTYPE *ppget_lloc (yyscan_t yyscanner ); 1.657 + 1.658 + void ppset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); 1.659 + 1.660 +/* Macros after this point can all be overridden by user definitions in 1.661 + * section 1. 1.662 + */ 1.663 + 1.664 +#ifndef YY_SKIP_YYWRAP 1.665 +#ifdef __cplusplus 1.666 +extern "C" int ppwrap (yyscan_t yyscanner ); 1.667 +#else 1.668 +extern int ppwrap (yyscan_t yyscanner ); 1.669 +#endif 1.670 +#endif 1.671 + 1.672 +#ifndef yytext_ptr 1.673 +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); 1.674 +#endif 1.675 + 1.676 +#ifdef YY_NEED_STRLEN 1.677 +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); 1.678 +#endif 1.679 + 1.680 +#ifndef YY_NO_INPUT 1.681 + 1.682 +#ifdef __cplusplus 1.683 +static int yyinput (yyscan_t yyscanner ); 1.684 +#else 1.685 +static int input (yyscan_t yyscanner ); 1.686 +#endif 1.687 + 1.688 +#endif 1.689 + 1.690 +/* Amount of stuff to slurp up with each read. */ 1.691 +#ifndef YY_READ_BUF_SIZE 1.692 +#define YY_READ_BUF_SIZE 8192 1.693 +#endif 1.694 + 1.695 +/* Copy whatever the last rule matched to the standard output. */ 1.696 +#ifndef ECHO 1.697 +/* This used to be an fputs(), but since the string might contain NUL's, 1.698 + * we now use fwrite(). 1.699 + */ 1.700 +#define ECHO fwrite( yytext, yyleng, 1, yyout ) 1.701 +#endif 1.702 + 1.703 +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 1.704 + * is returned in "result". 1.705 + */ 1.706 +#ifndef YY_INPUT 1.707 +#define YY_INPUT(buf,result,max_size) \ 1.708 + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 1.709 + { \ 1.710 + int c = '*'; \ 1.711 + yy_size_t n; \ 1.712 + for ( n = 0; n < max_size && \ 1.713 + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 1.714 + buf[n] = (char) c; \ 1.715 + if ( c == '\n' ) \ 1.716 + buf[n++] = (char) c; \ 1.717 + if ( c == EOF && ferror( yyin ) ) \ 1.718 + YY_FATAL_ERROR( "input in flex scanner failed" ); \ 1.719 + result = n; \ 1.720 + } \ 1.721 + else \ 1.722 + { \ 1.723 + errno=0; \ 1.724 + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ 1.725 + { \ 1.726 + if( errno != EINTR) \ 1.727 + { \ 1.728 + YY_FATAL_ERROR( "input in flex scanner failed" ); \ 1.729 + break; \ 1.730 + } \ 1.731 + errno=0; \ 1.732 + clearerr(yyin); \ 1.733 + } \ 1.734 + }\ 1.735 +\ 1.736 + 1.737 +#endif 1.738 + 1.739 +/* No semi-colon after return; correct usage is to write "yyterminate();" - 1.740 + * we don't want an extra ';' after the "return" because that will cause 1.741 + * some compilers to complain about unreachable statements. 1.742 + */ 1.743 +#ifndef yyterminate 1.744 +#define yyterminate() return YY_NULL 1.745 +#endif 1.746 + 1.747 +/* Number of entries by which start-condition stack grows. */ 1.748 +#ifndef YY_START_STACK_INCR 1.749 +#define YY_START_STACK_INCR 25 1.750 +#endif 1.751 + 1.752 +/* Report a fatal error. */ 1.753 +#ifndef YY_FATAL_ERROR 1.754 +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) 1.755 +#endif 1.756 + 1.757 +/* end tables serialization structures and prototypes */ 1.758 + 1.759 +/* Default declaration of generated scanner - a define so the user can 1.760 + * easily add parameters. 1.761 + */ 1.762 +#ifndef YY_DECL 1.763 +#define YY_DECL_IS_OURS 1 1.764 + 1.765 +extern int pplex \ 1.766 + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); 1.767 + 1.768 +#define YY_DECL int pplex \ 1.769 + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) 1.770 +#endif /* !YY_DECL */ 1.771 + 1.772 +/* Code executed at the beginning of each rule, after yytext and yyleng 1.773 + * have been set up. 1.774 + */ 1.775 +#ifndef YY_USER_ACTION 1.776 +#define YY_USER_ACTION 1.777 +#endif 1.778 + 1.779 +/* Code executed at the end of each rule. */ 1.780 +#ifndef YY_BREAK 1.781 +#define YY_BREAK break; 1.782 +#endif 1.783 + 1.784 +#define YY_RULE_SETUP \ 1.785 + YY_USER_ACTION 1.786 + 1.787 +/** The main scanner function which does all the work. 1.788 + */ 1.789 +YY_DECL 1.790 +{ 1.791 + register yy_state_type yy_current_state; 1.792 + register char *yy_cp, *yy_bp; 1.793 + register int yy_act; 1.794 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.795 + 1.796 + /* Line comment */ 1.797 + 1.798 + yylval = yylval_param; 1.799 + 1.800 + yylloc = yylloc_param; 1.801 + 1.802 + if ( !yyg->yy_init ) 1.803 + { 1.804 + yyg->yy_init = 1; 1.805 + 1.806 +#ifdef YY_USER_INIT 1.807 + YY_USER_INIT; 1.808 +#endif 1.809 + 1.810 + if ( ! yyg->yy_start ) 1.811 + yyg->yy_start = 1; /* first start state */ 1.812 + 1.813 + if ( ! yyin ) 1.814 + yyin = stdin; 1.815 + 1.816 + if ( ! yyout ) 1.817 + yyout = stdout; 1.818 + 1.819 + if ( ! YY_CURRENT_BUFFER ) { 1.820 + ppensure_buffer_stack (yyscanner); 1.821 + YY_CURRENT_BUFFER_LVALUE = 1.822 + pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 1.823 + } 1.824 + 1.825 + pp_load_buffer_state(yyscanner ); 1.826 + } 1.827 + 1.828 + while ( 1 ) /* loops until end-of-file is reached */ 1.829 + { 1.830 + yy_cp = yyg->yy_c_buf_p; 1.831 + 1.832 + /* Support of yytext. */ 1.833 + *yy_cp = yyg->yy_hold_char; 1.834 + 1.835 + /* yy_bp points to the position in yy_ch_buf of the start of 1.836 + * the current run. 1.837 + */ 1.838 + yy_bp = yy_cp; 1.839 + 1.840 + yy_current_state = yyg->yy_start; 1.841 +yy_match: 1.842 + do 1.843 + { 1.844 + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 1.845 + if ( yy_accept[yy_current_state] ) 1.846 + { 1.847 + yyg->yy_last_accepting_state = yy_current_state; 1.848 + yyg->yy_last_accepting_cpos = yy_cp; 1.849 + } 1.850 + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1.851 + { 1.852 + yy_current_state = (int) yy_def[yy_current_state]; 1.853 + if ( yy_current_state >= 87 ) 1.854 + yy_c = yy_meta[(unsigned int) yy_c]; 1.855 + } 1.856 + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1.857 + ++yy_cp; 1.858 + } 1.859 + while ( yy_current_state != 86 ); 1.860 + yy_cp = yyg->yy_last_accepting_cpos; 1.861 + yy_current_state = yyg->yy_last_accepting_state; 1.862 + 1.863 +yy_find_action: 1.864 + yy_act = yy_accept[yy_current_state]; 1.865 + 1.866 + YY_DO_BEFORE_ACTION; 1.867 + 1.868 +do_action: /* This label is used only to access EOF actions. */ 1.869 + 1.870 + switch ( yy_act ) 1.871 + { /* beginning of action switch */ 1.872 + case 0: /* must back up */ 1.873 + /* undo the effects of YY_DO_BEFORE_ACTION */ 1.874 + *yy_cp = yyg->yy_hold_char; 1.875 + yy_cp = yyg->yy_last_accepting_cpos; 1.876 + yy_current_state = yyg->yy_last_accepting_state; 1.877 + goto yy_find_action; 1.878 + 1.879 +case 1: 1.880 +YY_RULE_SETUP 1.881 + 1.882 + YY_BREAK 1.883 +/* Block comment */ 1.884 +/* Line breaks are just counted - not returned. */ 1.885 +/* The comment is replaced by a single space. */ 1.886 +case 2: 1.887 +YY_RULE_SETUP 1.888 +{ BEGIN(COMMENT); } 1.889 + YY_BREAK 1.890 +case 3: 1.891 +YY_RULE_SETUP 1.892 + 1.893 + YY_BREAK 1.894 +case 4: 1.895 +YY_RULE_SETUP 1.896 + 1.897 + YY_BREAK 1.898 +case 5: 1.899 +/* rule 5 can match eol */ 1.900 +YY_RULE_SETUP 1.901 +{ ++yylineno; } 1.902 + YY_BREAK 1.903 +case 6: 1.904 +YY_RULE_SETUP 1.905 +{ 1.906 + yyextra->leadingSpace = true; 1.907 + BEGIN(INITIAL); 1.908 +} 1.909 + YY_BREAK 1.910 +case 7: 1.911 +YY_RULE_SETUP 1.912 +{ 1.913 + // # is only valid at start of line for preprocessor directives. 1.914 + yylval->assign(1, yytext[0]); 1.915 + return yyextra->lineStart ? pp::Token::PP_HASH : pp::Token::PP_OTHER; 1.916 +} 1.917 + YY_BREAK 1.918 +case 8: 1.919 +YY_RULE_SETUP 1.920 +{ 1.921 + yylval->assign(yytext, yyleng); 1.922 + return pp::Token::IDENTIFIER; 1.923 +} 1.924 + YY_BREAK 1.925 +case 9: 1.926 +YY_RULE_SETUP 1.927 +{ 1.928 + yylval->assign(yytext, yyleng); 1.929 + return pp::Token::CONST_INT; 1.930 +} 1.931 + YY_BREAK 1.932 +case 10: 1.933 +YY_RULE_SETUP 1.934 +{ 1.935 + yylval->assign(yytext, yyleng); 1.936 + return pp::Token::CONST_FLOAT; 1.937 +} 1.938 + YY_BREAK 1.939 +/* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */ 1.940 +/* Rule to catch all invalid integers and floats. */ 1.941 +case 11: 1.942 +YY_RULE_SETUP 1.943 +{ 1.944 + yylval->assign(yytext, yyleng); 1.945 + return pp::Token::PP_NUMBER; 1.946 +} 1.947 + YY_BREAK 1.948 +case 12: 1.949 +YY_RULE_SETUP 1.950 +{ 1.951 + yylval->assign(yytext, yyleng); 1.952 + return pp::Token::OP_INC; 1.953 +} 1.954 + YY_BREAK 1.955 +case 13: 1.956 +YY_RULE_SETUP 1.957 +{ 1.958 + yylval->assign(yytext, yyleng); 1.959 + return pp::Token::OP_DEC; 1.960 +} 1.961 + YY_BREAK 1.962 +case 14: 1.963 +YY_RULE_SETUP 1.964 +{ 1.965 + yylval->assign(yytext, yyleng); 1.966 + return pp::Token::OP_LEFT; 1.967 +} 1.968 + YY_BREAK 1.969 +case 15: 1.970 +YY_RULE_SETUP 1.971 +{ 1.972 + yylval->assign(yytext, yyleng); 1.973 + return pp::Token::OP_RIGHT; 1.974 +} 1.975 + YY_BREAK 1.976 +case 16: 1.977 +YY_RULE_SETUP 1.978 +{ 1.979 + yylval->assign(yytext, yyleng); 1.980 + return pp::Token::OP_LE; 1.981 +} 1.982 + YY_BREAK 1.983 +case 17: 1.984 +YY_RULE_SETUP 1.985 +{ 1.986 + yylval->assign(yytext, yyleng); 1.987 + return pp::Token::OP_GE; 1.988 +} 1.989 + YY_BREAK 1.990 +case 18: 1.991 +YY_RULE_SETUP 1.992 +{ 1.993 + yylval->assign(yytext, yyleng); 1.994 + return pp::Token::OP_EQ; 1.995 +} 1.996 + YY_BREAK 1.997 +case 19: 1.998 +YY_RULE_SETUP 1.999 +{ 1.1000 + yylval->assign(yytext, yyleng); 1.1001 + return pp::Token::OP_NE; 1.1002 +} 1.1003 + YY_BREAK 1.1004 +case 20: 1.1005 +YY_RULE_SETUP 1.1006 +{ 1.1007 + yylval->assign(yytext, yyleng); 1.1008 + return pp::Token::OP_AND; 1.1009 +} 1.1010 + YY_BREAK 1.1011 +case 21: 1.1012 +YY_RULE_SETUP 1.1013 +{ 1.1014 + yylval->assign(yytext, yyleng); 1.1015 + return pp::Token::OP_XOR; 1.1016 +} 1.1017 + YY_BREAK 1.1018 +case 22: 1.1019 +YY_RULE_SETUP 1.1020 +{ 1.1021 + yylval->assign(yytext, yyleng); 1.1022 + return pp::Token::OP_OR; 1.1023 +} 1.1024 + YY_BREAK 1.1025 +case 23: 1.1026 +YY_RULE_SETUP 1.1027 +{ 1.1028 + yylval->assign(yytext, yyleng); 1.1029 + return pp::Token::OP_ADD_ASSIGN; 1.1030 +} 1.1031 + YY_BREAK 1.1032 +case 24: 1.1033 +YY_RULE_SETUP 1.1034 +{ 1.1035 + yylval->assign(yytext, yyleng); 1.1036 + return pp::Token::OP_SUB_ASSIGN; 1.1037 +} 1.1038 + YY_BREAK 1.1039 +case 25: 1.1040 +YY_RULE_SETUP 1.1041 +{ 1.1042 + yylval->assign(yytext, yyleng); 1.1043 + return pp::Token::OP_MUL_ASSIGN; 1.1044 +} 1.1045 + YY_BREAK 1.1046 +case 26: 1.1047 +YY_RULE_SETUP 1.1048 +{ 1.1049 + yylval->assign(yytext, yyleng); 1.1050 + return pp::Token::OP_DIV_ASSIGN; 1.1051 +} 1.1052 + YY_BREAK 1.1053 +case 27: 1.1054 +YY_RULE_SETUP 1.1055 +{ 1.1056 + yylval->assign(yytext, yyleng); 1.1057 + return pp::Token::OP_MOD_ASSIGN; 1.1058 +} 1.1059 + YY_BREAK 1.1060 +case 28: 1.1061 +YY_RULE_SETUP 1.1062 +{ 1.1063 + yylval->assign(yytext, yyleng); 1.1064 + return pp::Token::OP_LEFT_ASSIGN; 1.1065 +} 1.1066 + YY_BREAK 1.1067 +case 29: 1.1068 +YY_RULE_SETUP 1.1069 +{ 1.1070 + yylval->assign(yytext, yyleng); 1.1071 + return pp::Token::OP_RIGHT_ASSIGN; 1.1072 +} 1.1073 + YY_BREAK 1.1074 +case 30: 1.1075 +YY_RULE_SETUP 1.1076 +{ 1.1077 + yylval->assign(yytext, yyleng); 1.1078 + return pp::Token::OP_AND_ASSIGN; 1.1079 +} 1.1080 + YY_BREAK 1.1081 +case 31: 1.1082 +YY_RULE_SETUP 1.1083 +{ 1.1084 + yylval->assign(yytext, yyleng); 1.1085 + return pp::Token::OP_XOR_ASSIGN; 1.1086 +} 1.1087 + YY_BREAK 1.1088 +case 32: 1.1089 +YY_RULE_SETUP 1.1090 +{ 1.1091 + yylval->assign(yytext, yyleng); 1.1092 + return pp::Token::OP_OR_ASSIGN; 1.1093 +} 1.1094 + YY_BREAK 1.1095 +case 33: 1.1096 +YY_RULE_SETUP 1.1097 +{ 1.1098 + yylval->assign(1, yytext[0]); 1.1099 + return yytext[0]; 1.1100 +} 1.1101 + YY_BREAK 1.1102 +case 34: 1.1103 +YY_RULE_SETUP 1.1104 +{ yyextra->leadingSpace = true; } 1.1105 + YY_BREAK 1.1106 +case 35: 1.1107 +/* rule 35 can match eol */ 1.1108 +YY_RULE_SETUP 1.1109 +{ 1.1110 + ++yylineno; 1.1111 + yylval->assign(1, '\n'); 1.1112 + return '\n'; 1.1113 +} 1.1114 + YY_BREAK 1.1115 +case 36: 1.1116 +/* rule 36 can match eol */ 1.1117 +YY_RULE_SETUP 1.1118 +{ ++yylineno; } 1.1119 + YY_BREAK 1.1120 +case 37: 1.1121 +YY_RULE_SETUP 1.1122 +{ 1.1123 + yylval->assign(1, yytext[0]); 1.1124 + return pp::Token::PP_OTHER; 1.1125 +} 1.1126 + YY_BREAK 1.1127 +case YY_STATE_EOF(INITIAL): 1.1128 +case YY_STATE_EOF(COMMENT): 1.1129 +{ 1.1130 + // YY_USER_ACTION is not invoked for handling EOF. 1.1131 + // Set the location for EOF token manually. 1.1132 + pp::Input* input = &yyextra->input; 1.1133 + pp::Input::Location* scanLoc = &yyextra->scanLoc; 1.1134 + yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0; 1.1135 + if (scanLoc->sIndex != sIndexMax) 1.1136 + { 1.1137 + // We can only reach here if there are empty strings at the 1.1138 + // end of the input. 1.1139 + scanLoc->sIndex = sIndexMax; scanLoc->cIndex = 0; 1.1140 + // FIXME: this is not 64-bit clean. 1.1141 + yyfileno = static_cast<int>(sIndexMax); yylineno = 1; 1.1142 + } 1.1143 + yylloc->file = yyfileno; 1.1144 + yylloc->line = yylineno; 1.1145 + yylval->clear(); 1.1146 + 1.1147 + if (YY_START == COMMENT) 1.1148 + { 1.1149 + yyextra->diagnostics->report(pp::Diagnostics::EOF_IN_COMMENT, 1.1150 + pp::SourceLocation(yyfileno, yylineno), 1.1151 + ""); 1.1152 + } 1.1153 + yyterminate(); 1.1154 +} 1.1155 + YY_BREAK 1.1156 +case 38: 1.1157 +YY_RULE_SETUP 1.1158 +ECHO; 1.1159 + YY_BREAK 1.1160 + 1.1161 + case YY_END_OF_BUFFER: 1.1162 + { 1.1163 + /* Amount of text matched not including the EOB char. */ 1.1164 + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; 1.1165 + 1.1166 + /* Undo the effects of YY_DO_BEFORE_ACTION. */ 1.1167 + *yy_cp = yyg->yy_hold_char; 1.1168 + YY_RESTORE_YY_MORE_OFFSET 1.1169 + 1.1170 + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 1.1171 + { 1.1172 + /* We're scanning a new file or input source. It's 1.1173 + * possible that this happened because the user 1.1174 + * just pointed yyin at a new source and called 1.1175 + * pplex(). If so, then we have to assure 1.1176 + * consistency between YY_CURRENT_BUFFER and our 1.1177 + * globals. Here is the right place to do so, because 1.1178 + * this is the first action (other than possibly a 1.1179 + * back-up) that will match for the new input source. 1.1180 + */ 1.1181 + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1.1182 + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 1.1183 + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 1.1184 + } 1.1185 + 1.1186 + /* Note that here we test for yy_c_buf_p "<=" to the position 1.1187 + * of the first EOB in the buffer, since yy_c_buf_p will 1.1188 + * already have been incremented past the NUL character 1.1189 + * (since all states make transitions on EOB to the 1.1190 + * end-of-buffer state). Contrast this with the test 1.1191 + * in input(). 1.1192 + */ 1.1193 + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 1.1194 + { /* This was really a NUL. */ 1.1195 + yy_state_type yy_next_state; 1.1196 + 1.1197 + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; 1.1198 + 1.1199 + yy_current_state = yy_get_previous_state( yyscanner ); 1.1200 + 1.1201 + /* Okay, we're now positioned to make the NUL 1.1202 + * transition. We couldn't have 1.1203 + * yy_get_previous_state() go ahead and do it 1.1204 + * for us because it doesn't know how to deal 1.1205 + * with the possibility of jamming (and we don't 1.1206 + * want to build jamming into it because then it 1.1207 + * will run more slowly). 1.1208 + */ 1.1209 + 1.1210 + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); 1.1211 + 1.1212 + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1.1213 + 1.1214 + if ( yy_next_state ) 1.1215 + { 1.1216 + /* Consume the NUL. */ 1.1217 + yy_cp = ++yyg->yy_c_buf_p; 1.1218 + yy_current_state = yy_next_state; 1.1219 + goto yy_match; 1.1220 + } 1.1221 + 1.1222 + else 1.1223 + { 1.1224 + yy_cp = yyg->yy_last_accepting_cpos; 1.1225 + yy_current_state = yyg->yy_last_accepting_state; 1.1226 + goto yy_find_action; 1.1227 + } 1.1228 + } 1.1229 + 1.1230 + else switch ( yy_get_next_buffer( yyscanner ) ) 1.1231 + { 1.1232 + case EOB_ACT_END_OF_FILE: 1.1233 + { 1.1234 + yyg->yy_did_buffer_switch_on_eof = 0; 1.1235 + 1.1236 + if ( ppwrap(yyscanner ) ) 1.1237 + { 1.1238 + /* Note: because we've taken care in 1.1239 + * yy_get_next_buffer() to have set up 1.1240 + * yytext, we can now set up 1.1241 + * yy_c_buf_p so that if some total 1.1242 + * hoser (like flex itself) wants to 1.1243 + * call the scanner after we return the 1.1244 + * YY_NULL, it'll still work - another 1.1245 + * YY_NULL will get returned. 1.1246 + */ 1.1247 + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; 1.1248 + 1.1249 + yy_act = YY_STATE_EOF(YY_START); 1.1250 + goto do_action; 1.1251 + } 1.1252 + 1.1253 + else 1.1254 + { 1.1255 + if ( ! yyg->yy_did_buffer_switch_on_eof ) 1.1256 + YY_NEW_FILE; 1.1257 + } 1.1258 + break; 1.1259 + } 1.1260 + 1.1261 + case EOB_ACT_CONTINUE_SCAN: 1.1262 + yyg->yy_c_buf_p = 1.1263 + yyg->yytext_ptr + yy_amount_of_matched_text; 1.1264 + 1.1265 + yy_current_state = yy_get_previous_state( yyscanner ); 1.1266 + 1.1267 + yy_cp = yyg->yy_c_buf_p; 1.1268 + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1.1269 + goto yy_match; 1.1270 + 1.1271 + case EOB_ACT_LAST_MATCH: 1.1272 + yyg->yy_c_buf_p = 1.1273 + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; 1.1274 + 1.1275 + yy_current_state = yy_get_previous_state( yyscanner ); 1.1276 + 1.1277 + yy_cp = yyg->yy_c_buf_p; 1.1278 + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; 1.1279 + goto yy_find_action; 1.1280 + } 1.1281 + break; 1.1282 + } 1.1283 + 1.1284 + default: 1.1285 + YY_FATAL_ERROR( 1.1286 + "fatal flex scanner internal error--no action found" ); 1.1287 + } /* end of action switch */ 1.1288 + } /* end of scanning one token */ 1.1289 +} /* end of pplex */ 1.1290 + 1.1291 +/* yy_get_next_buffer - try to read in a new buffer 1.1292 + * 1.1293 + * Returns a code representing an action: 1.1294 + * EOB_ACT_LAST_MATCH - 1.1295 + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 1.1296 + * EOB_ACT_END_OF_FILE - end of file 1.1297 + */ 1.1298 +static int yy_get_next_buffer (yyscan_t yyscanner) 1.1299 +{ 1.1300 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1301 + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 1.1302 + register char *source = yyg->yytext_ptr; 1.1303 + register int number_to_move, i; 1.1304 + int ret_val; 1.1305 + 1.1306 + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) 1.1307 + YY_FATAL_ERROR( 1.1308 + "fatal flex scanner internal error--end of buffer missed" ); 1.1309 + 1.1310 + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 1.1311 + { /* Don't try to fill the buffer, so this is an EOF. */ 1.1312 + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) 1.1313 + { 1.1314 + /* We matched a single character, the EOB, so 1.1315 + * treat this as a final EOF. 1.1316 + */ 1.1317 + return EOB_ACT_END_OF_FILE; 1.1318 + } 1.1319 + 1.1320 + else 1.1321 + { 1.1322 + /* We matched some text prior to the EOB, first 1.1323 + * process it. 1.1324 + */ 1.1325 + return EOB_ACT_LAST_MATCH; 1.1326 + } 1.1327 + } 1.1328 + 1.1329 + /* Try to read more data. */ 1.1330 + 1.1331 + /* First move last chars to start of buffer. */ 1.1332 + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; 1.1333 + 1.1334 + for ( i = 0; i < number_to_move; ++i ) 1.1335 + *(dest++) = *(source++); 1.1336 + 1.1337 + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 1.1338 + /* don't do the read, it's not guaranteed to return an EOF, 1.1339 + * just force an EOF 1.1340 + */ 1.1341 + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; 1.1342 + 1.1343 + else 1.1344 + { 1.1345 + yy_size_t num_to_read = 1.1346 + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1.1347 + 1.1348 + while ( num_to_read <= 0 ) 1.1349 + { /* Not enough room in the buffer - grow it. */ 1.1350 + 1.1351 + /* just a shorter name for the current buffer */ 1.1352 + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 1.1353 + 1.1354 + int yy_c_buf_p_offset = 1.1355 + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); 1.1356 + 1.1357 + if ( b->yy_is_our_buffer ) 1.1358 + { 1.1359 + yy_size_t new_size = b->yy_buf_size * 2; 1.1360 + 1.1361 + if ( new_size <= 0 ) 1.1362 + b->yy_buf_size += b->yy_buf_size / 8; 1.1363 + else 1.1364 + b->yy_buf_size *= 2; 1.1365 + 1.1366 + b->yy_ch_buf = (char *) 1.1367 + /* Include room in for 2 EOB chars. */ 1.1368 + pprealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); 1.1369 + } 1.1370 + else 1.1371 + /* Can't grow it, we don't own it. */ 1.1372 + b->yy_ch_buf = 0; 1.1373 + 1.1374 + if ( ! b->yy_ch_buf ) 1.1375 + YY_FATAL_ERROR( 1.1376 + "fatal error - scanner input buffer overflow" ); 1.1377 + 1.1378 + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; 1.1379 + 1.1380 + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1.1381 + number_to_move - 1; 1.1382 + 1.1383 + } 1.1384 + 1.1385 + if ( num_to_read > YY_READ_BUF_SIZE ) 1.1386 + num_to_read = YY_READ_BUF_SIZE; 1.1387 + 1.1388 + /* Read in more data. */ 1.1389 + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1.1390 + yyg->yy_n_chars, num_to_read ); 1.1391 + 1.1392 + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1.1393 + } 1.1394 + 1.1395 + if ( yyg->yy_n_chars == 0 ) 1.1396 + { 1.1397 + if ( number_to_move == YY_MORE_ADJ ) 1.1398 + { 1.1399 + ret_val = EOB_ACT_END_OF_FILE; 1.1400 + pprestart(yyin ,yyscanner); 1.1401 + } 1.1402 + 1.1403 + else 1.1404 + { 1.1405 + ret_val = EOB_ACT_LAST_MATCH; 1.1406 + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1.1407 + YY_BUFFER_EOF_PENDING; 1.1408 + } 1.1409 + } 1.1410 + 1.1411 + else 1.1412 + ret_val = EOB_ACT_CONTINUE_SCAN; 1.1413 + 1.1414 + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 1.1415 + /* Extend the array by 50%, plus the number we really need. */ 1.1416 + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); 1.1417 + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) pprealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); 1.1418 + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1.1419 + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 1.1420 + } 1.1421 + 1.1422 + yyg->yy_n_chars += number_to_move; 1.1423 + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; 1.1424 + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; 1.1425 + 1.1426 + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1.1427 + 1.1428 + return ret_val; 1.1429 +} 1.1430 + 1.1431 +/* yy_get_previous_state - get the state just before the EOB char was reached */ 1.1432 + 1.1433 + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) 1.1434 +{ 1.1435 + register yy_state_type yy_current_state; 1.1436 + register char *yy_cp; 1.1437 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1438 + 1.1439 + yy_current_state = yyg->yy_start; 1.1440 + 1.1441 + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) 1.1442 + { 1.1443 + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 1.1444 + if ( yy_accept[yy_current_state] ) 1.1445 + { 1.1446 + yyg->yy_last_accepting_state = yy_current_state; 1.1447 + yyg->yy_last_accepting_cpos = yy_cp; 1.1448 + } 1.1449 + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1.1450 + { 1.1451 + yy_current_state = (int) yy_def[yy_current_state]; 1.1452 + if ( yy_current_state >= 87 ) 1.1453 + yy_c = yy_meta[(unsigned int) yy_c]; 1.1454 + } 1.1455 + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1.1456 + } 1.1457 + 1.1458 + return yy_current_state; 1.1459 +} 1.1460 + 1.1461 +/* yy_try_NUL_trans - try to make a transition on the NUL character 1.1462 + * 1.1463 + * synopsis 1.1464 + * next_state = yy_try_NUL_trans( current_state ); 1.1465 + */ 1.1466 + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) 1.1467 +{ 1.1468 + register int yy_is_jam; 1.1469 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ 1.1470 + register char *yy_cp = yyg->yy_c_buf_p; 1.1471 + 1.1472 + register YY_CHAR yy_c = 1; 1.1473 + if ( yy_accept[yy_current_state] ) 1.1474 + { 1.1475 + yyg->yy_last_accepting_state = yy_current_state; 1.1476 + yyg->yy_last_accepting_cpos = yy_cp; 1.1477 + } 1.1478 + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1.1479 + { 1.1480 + yy_current_state = (int) yy_def[yy_current_state]; 1.1481 + if ( yy_current_state >= 87 ) 1.1482 + yy_c = yy_meta[(unsigned int) yy_c]; 1.1483 + } 1.1484 + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1.1485 + yy_is_jam = (yy_current_state == 86); 1.1486 + 1.1487 + return yy_is_jam ? 0 : yy_current_state; 1.1488 +} 1.1489 + 1.1490 +#ifndef YY_NO_INPUT 1.1491 +#ifdef __cplusplus 1.1492 + static int yyinput (yyscan_t yyscanner) 1.1493 +#else 1.1494 + static int input (yyscan_t yyscanner) 1.1495 +#endif 1.1496 + 1.1497 +{ 1.1498 + int c; 1.1499 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1500 + 1.1501 + *yyg->yy_c_buf_p = yyg->yy_hold_char; 1.1502 + 1.1503 + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) 1.1504 + { 1.1505 + /* yy_c_buf_p now points to the character we want to return. 1.1506 + * If this occurs *before* the EOB characters, then it's a 1.1507 + * valid NUL; if not, then we've hit the end of the buffer. 1.1508 + */ 1.1509 + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) 1.1510 + /* This was really a NUL. */ 1.1511 + *yyg->yy_c_buf_p = '\0'; 1.1512 + 1.1513 + else 1.1514 + { /* need more input */ 1.1515 + yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; 1.1516 + ++yyg->yy_c_buf_p; 1.1517 + 1.1518 + switch ( yy_get_next_buffer( yyscanner ) ) 1.1519 + { 1.1520 + case EOB_ACT_LAST_MATCH: 1.1521 + /* This happens because yy_g_n_b() 1.1522 + * sees that we've accumulated a 1.1523 + * token and flags that we need to 1.1524 + * try matching the token before 1.1525 + * proceeding. But for input(), 1.1526 + * there's no matching to consider. 1.1527 + * So convert the EOB_ACT_LAST_MATCH 1.1528 + * to EOB_ACT_END_OF_FILE. 1.1529 + */ 1.1530 + 1.1531 + /* Reset buffer status. */ 1.1532 + pprestart(yyin ,yyscanner); 1.1533 + 1.1534 + /*FALLTHROUGH*/ 1.1535 + 1.1536 + case EOB_ACT_END_OF_FILE: 1.1537 + { 1.1538 + if ( ppwrap(yyscanner ) ) 1.1539 + return EOF; 1.1540 + 1.1541 + if ( ! yyg->yy_did_buffer_switch_on_eof ) 1.1542 + YY_NEW_FILE; 1.1543 +#ifdef __cplusplus 1.1544 + return yyinput(yyscanner); 1.1545 +#else 1.1546 + return input(yyscanner); 1.1547 +#endif 1.1548 + } 1.1549 + 1.1550 + case EOB_ACT_CONTINUE_SCAN: 1.1551 + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; 1.1552 + break; 1.1553 + } 1.1554 + } 1.1555 + } 1.1556 + 1.1557 + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ 1.1558 + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ 1.1559 + yyg->yy_hold_char = *++yyg->yy_c_buf_p; 1.1560 + 1.1561 + return c; 1.1562 +} 1.1563 +#endif /* ifndef YY_NO_INPUT */ 1.1564 + 1.1565 +/** Immediately switch to a different input stream. 1.1566 + * @param input_file A readable stream. 1.1567 + * @param yyscanner The scanner object. 1.1568 + * @note This function does not reset the start condition to @c INITIAL . 1.1569 + */ 1.1570 + void pprestart (FILE * input_file , yyscan_t yyscanner) 1.1571 +{ 1.1572 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1573 + 1.1574 + if ( ! YY_CURRENT_BUFFER ){ 1.1575 + ppensure_buffer_stack (yyscanner); 1.1576 + YY_CURRENT_BUFFER_LVALUE = 1.1577 + pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); 1.1578 + } 1.1579 + 1.1580 + pp_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); 1.1581 + pp_load_buffer_state(yyscanner ); 1.1582 +} 1.1583 + 1.1584 +/** Switch to a different input buffer. 1.1585 + * @param new_buffer The new input buffer. 1.1586 + * @param yyscanner The scanner object. 1.1587 + */ 1.1588 + void pp_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 1.1589 +{ 1.1590 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1591 + 1.1592 + /* TODO. We should be able to replace this entire function body 1.1593 + * with 1.1594 + * pppop_buffer_state(); 1.1595 + * pppush_buffer_state(new_buffer); 1.1596 + */ 1.1597 + ppensure_buffer_stack (yyscanner); 1.1598 + if ( YY_CURRENT_BUFFER == new_buffer ) 1.1599 + return; 1.1600 + 1.1601 + if ( YY_CURRENT_BUFFER ) 1.1602 + { 1.1603 + /* Flush out information for old buffer. */ 1.1604 + *yyg->yy_c_buf_p = yyg->yy_hold_char; 1.1605 + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 1.1606 + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1.1607 + } 1.1608 + 1.1609 + YY_CURRENT_BUFFER_LVALUE = new_buffer; 1.1610 + pp_load_buffer_state(yyscanner ); 1.1611 + 1.1612 + /* We don't actually know whether we did this switch during 1.1613 + * EOF (ppwrap()) processing, but the only time this flag 1.1614 + * is looked at is after ppwrap() is called, so it's safe 1.1615 + * to go ahead and always set it. 1.1616 + */ 1.1617 + yyg->yy_did_buffer_switch_on_eof = 1; 1.1618 +} 1.1619 + 1.1620 +static void pp_load_buffer_state (yyscan_t yyscanner) 1.1621 +{ 1.1622 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1623 + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1.1624 + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 1.1625 + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 1.1626 + yyg->yy_hold_char = *yyg->yy_c_buf_p; 1.1627 +} 1.1628 + 1.1629 +/** Allocate and initialize an input buffer state. 1.1630 + * @param file A readable stream. 1.1631 + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 1.1632 + * @param yyscanner The scanner object. 1.1633 + * @return the allocated buffer state. 1.1634 + */ 1.1635 + YY_BUFFER_STATE pp_create_buffer (FILE * file, int size , yyscan_t yyscanner) 1.1636 +{ 1.1637 + YY_BUFFER_STATE b; 1.1638 + 1.1639 + b = (YY_BUFFER_STATE) ppalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 1.1640 + if ( ! b ) 1.1641 + YY_FATAL_ERROR( "out of dynamic memory in pp_create_buffer()" ); 1.1642 + 1.1643 + b->yy_buf_size = size; 1.1644 + 1.1645 + /* yy_ch_buf has to be 2 characters longer than the size given because 1.1646 + * we need to put in 2 end-of-buffer characters. 1.1647 + */ 1.1648 + b->yy_ch_buf = (char *) ppalloc(b->yy_buf_size + 2 ,yyscanner ); 1.1649 + if ( ! b->yy_ch_buf ) 1.1650 + YY_FATAL_ERROR( "out of dynamic memory in pp_create_buffer()" ); 1.1651 + 1.1652 + b->yy_is_our_buffer = 1; 1.1653 + 1.1654 + pp_init_buffer(b,file ,yyscanner); 1.1655 + 1.1656 + return b; 1.1657 +} 1.1658 + 1.1659 +/** Destroy the buffer. 1.1660 + * @param b a buffer created with pp_create_buffer() 1.1661 + * @param yyscanner The scanner object. 1.1662 + */ 1.1663 + void pp_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 1.1664 +{ 1.1665 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1666 + 1.1667 + if ( ! b ) 1.1668 + return; 1.1669 + 1.1670 + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 1.1671 + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 1.1672 + 1.1673 + if ( b->yy_is_our_buffer ) 1.1674 + ppfree((void *) b->yy_ch_buf ,yyscanner ); 1.1675 + 1.1676 + ppfree((void *) b ,yyscanner ); 1.1677 +} 1.1678 + 1.1679 +/* Initializes or reinitializes a buffer. 1.1680 + * This function is sometimes called more than once on the same buffer, 1.1681 + * such as during a pprestart() or at EOF. 1.1682 + */ 1.1683 + static void pp_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) 1.1684 + 1.1685 +{ 1.1686 + int oerrno = errno; 1.1687 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1688 + 1.1689 + pp_flush_buffer(b ,yyscanner); 1.1690 + 1.1691 + b->yy_input_file = file; 1.1692 + b->yy_fill_buffer = 1; 1.1693 + 1.1694 + /* If b is the current buffer, then pp_init_buffer was _probably_ 1.1695 + * called from pprestart() or through yy_get_next_buffer. 1.1696 + * In that case, we don't want to reset the lineno or column. 1.1697 + */ 1.1698 + if (b != YY_CURRENT_BUFFER){ 1.1699 + b->yy_bs_lineno = 1; 1.1700 + b->yy_bs_column = 0; 1.1701 + } 1.1702 + 1.1703 + b->yy_is_interactive = 0; 1.1704 + 1.1705 + errno = oerrno; 1.1706 +} 1.1707 + 1.1708 +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. 1.1709 + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 1.1710 + * @param yyscanner The scanner object. 1.1711 + */ 1.1712 + void pp_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) 1.1713 +{ 1.1714 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1715 + if ( ! b ) 1.1716 + return; 1.1717 + 1.1718 + b->yy_n_chars = 0; 1.1719 + 1.1720 + /* We always need two end-of-buffer characters. The first causes 1.1721 + * a transition to the end-of-buffer state. The second causes 1.1722 + * a jam in that state. 1.1723 + */ 1.1724 + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 1.1725 + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 1.1726 + 1.1727 + b->yy_buf_pos = &b->yy_ch_buf[0]; 1.1728 + 1.1729 + b->yy_at_bol = 1; 1.1730 + b->yy_buffer_status = YY_BUFFER_NEW; 1.1731 + 1.1732 + if ( b == YY_CURRENT_BUFFER ) 1.1733 + pp_load_buffer_state(yyscanner ); 1.1734 +} 1.1735 + 1.1736 +/** Pushes the new state onto the stack. The new state becomes 1.1737 + * the current state. This function will allocate the stack 1.1738 + * if necessary. 1.1739 + * @param new_buffer The new state. 1.1740 + * @param yyscanner The scanner object. 1.1741 + */ 1.1742 +void pppush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) 1.1743 +{ 1.1744 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1745 + if (new_buffer == NULL) 1.1746 + return; 1.1747 + 1.1748 + ppensure_buffer_stack(yyscanner); 1.1749 + 1.1750 + /* This block is copied from pp_switch_to_buffer. */ 1.1751 + if ( YY_CURRENT_BUFFER ) 1.1752 + { 1.1753 + /* Flush out information for old buffer. */ 1.1754 + *yyg->yy_c_buf_p = yyg->yy_hold_char; 1.1755 + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; 1.1756 + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1.1757 + } 1.1758 + 1.1759 + /* Only push if top exists. Otherwise, replace top. */ 1.1760 + if (YY_CURRENT_BUFFER) 1.1761 + yyg->yy_buffer_stack_top++; 1.1762 + YY_CURRENT_BUFFER_LVALUE = new_buffer; 1.1763 + 1.1764 + /* copied from pp_switch_to_buffer. */ 1.1765 + pp_load_buffer_state(yyscanner ); 1.1766 + yyg->yy_did_buffer_switch_on_eof = 1; 1.1767 +} 1.1768 + 1.1769 +/** Removes and deletes the top of the stack, if present. 1.1770 + * The next element becomes the new top. 1.1771 + * @param yyscanner The scanner object. 1.1772 + */ 1.1773 +void pppop_buffer_state (yyscan_t yyscanner) 1.1774 +{ 1.1775 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1776 + if (!YY_CURRENT_BUFFER) 1.1777 + return; 1.1778 + 1.1779 + pp_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); 1.1780 + YY_CURRENT_BUFFER_LVALUE = NULL; 1.1781 + if (yyg->yy_buffer_stack_top > 0) 1.1782 + --yyg->yy_buffer_stack_top; 1.1783 + 1.1784 + if (YY_CURRENT_BUFFER) { 1.1785 + pp_load_buffer_state(yyscanner ); 1.1786 + yyg->yy_did_buffer_switch_on_eof = 1; 1.1787 + } 1.1788 +} 1.1789 + 1.1790 +/* Allocates the stack if it does not exist. 1.1791 + * Guarantees space for at least one push. 1.1792 + */ 1.1793 +static void ppensure_buffer_stack (yyscan_t yyscanner) 1.1794 +{ 1.1795 + yy_size_t num_to_alloc; 1.1796 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1797 + 1.1798 + if (!yyg->yy_buffer_stack) { 1.1799 + 1.1800 + /* First allocation is just for 2 elements, since we don't know if this 1.1801 + * scanner will even need a stack. We use 2 instead of 1 to avoid an 1.1802 + * immediate realloc on the next call. 1.1803 + */ 1.1804 + num_to_alloc = 1; 1.1805 + yyg->yy_buffer_stack = (struct yy_buffer_state**)ppalloc 1.1806 + (num_to_alloc * sizeof(struct yy_buffer_state*) 1.1807 + , yyscanner); 1.1808 + if ( ! yyg->yy_buffer_stack ) 1.1809 + YY_FATAL_ERROR( "out of dynamic memory in ppensure_buffer_stack()" ); 1.1810 + 1.1811 + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 1.1812 + 1.1813 + yyg->yy_buffer_stack_max = num_to_alloc; 1.1814 + yyg->yy_buffer_stack_top = 0; 1.1815 + return; 1.1816 + } 1.1817 + 1.1818 + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ 1.1819 + 1.1820 + /* Increase the buffer to prepare for a possible push. */ 1.1821 + int grow_size = 8 /* arbitrary grow size */; 1.1822 + 1.1823 + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; 1.1824 + yyg->yy_buffer_stack = (struct yy_buffer_state**)pprealloc 1.1825 + (yyg->yy_buffer_stack, 1.1826 + num_to_alloc * sizeof(struct yy_buffer_state*) 1.1827 + , yyscanner); 1.1828 + if ( ! yyg->yy_buffer_stack ) 1.1829 + YY_FATAL_ERROR( "out of dynamic memory in ppensure_buffer_stack()" ); 1.1830 + 1.1831 + /* zero only the new slots.*/ 1.1832 + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); 1.1833 + yyg->yy_buffer_stack_max = num_to_alloc; 1.1834 + } 1.1835 +} 1.1836 + 1.1837 +/** Setup the input buffer state to scan directly from a user-specified character buffer. 1.1838 + * @param base the character buffer 1.1839 + * @param size the size in bytes of the character buffer 1.1840 + * @param yyscanner The scanner object. 1.1841 + * @return the newly allocated buffer state object. 1.1842 + */ 1.1843 +YY_BUFFER_STATE pp_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) 1.1844 +{ 1.1845 + YY_BUFFER_STATE b; 1.1846 + 1.1847 + if ( size < 2 || 1.1848 + base[size-2] != YY_END_OF_BUFFER_CHAR || 1.1849 + base[size-1] != YY_END_OF_BUFFER_CHAR ) 1.1850 + /* They forgot to leave room for the EOB's. */ 1.1851 + return 0; 1.1852 + 1.1853 + b = (YY_BUFFER_STATE) ppalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); 1.1854 + if ( ! b ) 1.1855 + YY_FATAL_ERROR( "out of dynamic memory in pp_scan_buffer()" ); 1.1856 + 1.1857 + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 1.1858 + b->yy_buf_pos = b->yy_ch_buf = base; 1.1859 + b->yy_is_our_buffer = 0; 1.1860 + b->yy_input_file = 0; 1.1861 + b->yy_n_chars = b->yy_buf_size; 1.1862 + b->yy_is_interactive = 0; 1.1863 + b->yy_at_bol = 1; 1.1864 + b->yy_fill_buffer = 0; 1.1865 + b->yy_buffer_status = YY_BUFFER_NEW; 1.1866 + 1.1867 + pp_switch_to_buffer(b ,yyscanner ); 1.1868 + 1.1869 + return b; 1.1870 +} 1.1871 + 1.1872 +/** Setup the input buffer state to scan a string. The next call to pplex() will 1.1873 + * scan from a @e copy of @a str. 1.1874 + * @param yystr a NUL-terminated string to scan 1.1875 + * @param yyscanner The scanner object. 1.1876 + * @return the newly allocated buffer state object. 1.1877 + * @note If you want to scan bytes that may contain NUL values, then use 1.1878 + * pp_scan_bytes() instead. 1.1879 + */ 1.1880 +YY_BUFFER_STATE pp_scan_string (yyconst char * yystr , yyscan_t yyscanner) 1.1881 +{ 1.1882 + 1.1883 + return pp_scan_bytes(yystr,strlen(yystr) ,yyscanner); 1.1884 +} 1.1885 + 1.1886 +/** Setup the input buffer state to scan the given bytes. The next call to pplex() will 1.1887 + * scan from a @e copy of @a bytes. 1.1888 + * @param bytes the byte buffer to scan 1.1889 + * @param len the number of bytes in the buffer pointed to by @a bytes. 1.1890 + * @param yyscanner The scanner object. 1.1891 + * @return the newly allocated buffer state object. 1.1892 + */ 1.1893 +YY_BUFFER_STATE pp_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) 1.1894 +{ 1.1895 + YY_BUFFER_STATE b; 1.1896 + char *buf; 1.1897 + yy_size_t n, i; 1.1898 + 1.1899 + /* Get memory for full buffer, including space for trailing EOB's. */ 1.1900 + n = _yybytes_len + 2; 1.1901 + buf = (char *) ppalloc(n ,yyscanner ); 1.1902 + if ( ! buf ) 1.1903 + YY_FATAL_ERROR( "out of dynamic memory in pp_scan_bytes()" ); 1.1904 + 1.1905 + for ( i = 0; i < _yybytes_len; ++i ) 1.1906 + buf[i] = yybytes[i]; 1.1907 + 1.1908 + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 1.1909 + 1.1910 + b = pp_scan_buffer(buf,n ,yyscanner); 1.1911 + if ( ! b ) 1.1912 + YY_FATAL_ERROR( "bad buffer in pp_scan_bytes()" ); 1.1913 + 1.1914 + /* It's okay to grow etc. this buffer, and we should throw it 1.1915 + * away when we're done. 1.1916 + */ 1.1917 + b->yy_is_our_buffer = 1; 1.1918 + 1.1919 + return b; 1.1920 +} 1.1921 + 1.1922 +#ifndef YY_EXIT_FAILURE 1.1923 +#define YY_EXIT_FAILURE 2 1.1924 +#endif 1.1925 + 1.1926 +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) 1.1927 +{ 1.1928 + (void) fprintf( stderr, "%s\n", msg ); 1.1929 + exit( YY_EXIT_FAILURE ); 1.1930 +} 1.1931 + 1.1932 +/* Redefine yyless() so it works in section 3 code. */ 1.1933 + 1.1934 +#undef yyless 1.1935 +#define yyless(n) \ 1.1936 + do \ 1.1937 + { \ 1.1938 + /* Undo effects of setting up yytext. */ \ 1.1939 + int yyless_macro_arg = (n); \ 1.1940 + YY_LESS_LINENO(yyless_macro_arg);\ 1.1941 + yytext[yyleng] = yyg->yy_hold_char; \ 1.1942 + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ 1.1943 + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ 1.1944 + *yyg->yy_c_buf_p = '\0'; \ 1.1945 + yyleng = yyless_macro_arg; \ 1.1946 + } \ 1.1947 + while ( 0 ) 1.1948 + 1.1949 +/* Accessor methods (get/set functions) to struct members. */ 1.1950 + 1.1951 +/** Get the user-defined data for this scanner. 1.1952 + * @param yyscanner The scanner object. 1.1953 + */ 1.1954 +YY_EXTRA_TYPE ppget_extra (yyscan_t yyscanner) 1.1955 +{ 1.1956 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1957 + return yyextra; 1.1958 +} 1.1959 + 1.1960 +/** Get the current line number. 1.1961 + * @param yyscanner The scanner object. 1.1962 + */ 1.1963 +int ppget_lineno (yyscan_t yyscanner) 1.1964 +{ 1.1965 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1966 + 1.1967 + if (! YY_CURRENT_BUFFER) 1.1968 + return 0; 1.1969 + 1.1970 + return yylineno; 1.1971 +} 1.1972 + 1.1973 +/** Get the current column number. 1.1974 + * @param yyscanner The scanner object. 1.1975 + */ 1.1976 +int ppget_column (yyscan_t yyscanner) 1.1977 +{ 1.1978 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1979 + 1.1980 + if (! YY_CURRENT_BUFFER) 1.1981 + return 0; 1.1982 + 1.1983 + return yycolumn; 1.1984 +} 1.1985 + 1.1986 +/** Get the input stream. 1.1987 + * @param yyscanner The scanner object. 1.1988 + */ 1.1989 +FILE *ppget_in (yyscan_t yyscanner) 1.1990 +{ 1.1991 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.1992 + return yyin; 1.1993 +} 1.1994 + 1.1995 +/** Get the output stream. 1.1996 + * @param yyscanner The scanner object. 1.1997 + */ 1.1998 +FILE *ppget_out (yyscan_t yyscanner) 1.1999 +{ 1.2000 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2001 + return yyout; 1.2002 +} 1.2003 + 1.2004 +/** Get the length of the current token. 1.2005 + * @param yyscanner The scanner object. 1.2006 + */ 1.2007 +yy_size_t ppget_leng (yyscan_t yyscanner) 1.2008 +{ 1.2009 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2010 + return yyleng; 1.2011 +} 1.2012 + 1.2013 +/** Get the current token. 1.2014 + * @param yyscanner The scanner object. 1.2015 + */ 1.2016 + 1.2017 +char *ppget_text (yyscan_t yyscanner) 1.2018 +{ 1.2019 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2020 + return yytext; 1.2021 +} 1.2022 + 1.2023 +/** Set the user-defined data. This data is never touched by the scanner. 1.2024 + * @param user_defined The data to be associated with this scanner. 1.2025 + * @param yyscanner The scanner object. 1.2026 + */ 1.2027 +void ppset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) 1.2028 +{ 1.2029 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2030 + yyextra = user_defined ; 1.2031 +} 1.2032 + 1.2033 +/** Set the current line number. 1.2034 + * @param line_number 1.2035 + * @param yyscanner The scanner object. 1.2036 + */ 1.2037 +void ppset_lineno (int line_number , yyscan_t yyscanner) 1.2038 +{ 1.2039 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2040 + 1.2041 + /* lineno is only valid if an input buffer exists. */ 1.2042 + if (! YY_CURRENT_BUFFER ) 1.2043 + yy_fatal_error( "ppset_lineno called with no buffer" , yyscanner); 1.2044 + 1.2045 + yylineno = line_number; 1.2046 +} 1.2047 + 1.2048 +/** Set the current column. 1.2049 + * @param line_number 1.2050 + * @param yyscanner The scanner object. 1.2051 + */ 1.2052 +void ppset_column (int column_no , yyscan_t yyscanner) 1.2053 +{ 1.2054 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2055 + 1.2056 + /* column is only valid if an input buffer exists. */ 1.2057 + if (! YY_CURRENT_BUFFER ) 1.2058 + yy_fatal_error( "ppset_column called with no buffer" , yyscanner); 1.2059 + 1.2060 + yycolumn = column_no; 1.2061 +} 1.2062 + 1.2063 +/** Set the input stream. This does not discard the current 1.2064 + * input buffer. 1.2065 + * @param in_str A readable stream. 1.2066 + * @param yyscanner The scanner object. 1.2067 + * @see pp_switch_to_buffer 1.2068 + */ 1.2069 +void ppset_in (FILE * in_str , yyscan_t yyscanner) 1.2070 +{ 1.2071 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2072 + yyin = in_str ; 1.2073 +} 1.2074 + 1.2075 +void ppset_out (FILE * out_str , yyscan_t yyscanner) 1.2076 +{ 1.2077 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2078 + yyout = out_str ; 1.2079 +} 1.2080 + 1.2081 +int ppget_debug (yyscan_t yyscanner) 1.2082 +{ 1.2083 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2084 + return yy_flex_debug; 1.2085 +} 1.2086 + 1.2087 +void ppset_debug (int bdebug , yyscan_t yyscanner) 1.2088 +{ 1.2089 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2090 + yy_flex_debug = bdebug ; 1.2091 +} 1.2092 + 1.2093 +/* Accessor methods for yylval and yylloc */ 1.2094 + 1.2095 +YYSTYPE * ppget_lval (yyscan_t yyscanner) 1.2096 +{ 1.2097 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2098 + return yylval; 1.2099 +} 1.2100 + 1.2101 +void ppset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) 1.2102 +{ 1.2103 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2104 + yylval = yylval_param; 1.2105 +} 1.2106 + 1.2107 +YYLTYPE *ppget_lloc (yyscan_t yyscanner) 1.2108 +{ 1.2109 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2110 + return yylloc; 1.2111 +} 1.2112 + 1.2113 +void ppset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) 1.2114 +{ 1.2115 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2116 + yylloc = yylloc_param; 1.2117 +} 1.2118 + 1.2119 +/* User-visible API */ 1.2120 + 1.2121 +/* pplex_init is special because it creates the scanner itself, so it is 1.2122 + * the ONLY reentrant function that doesn't take the scanner as the last argument. 1.2123 + * That's why we explicitly handle the declaration, instead of using our macros. 1.2124 + */ 1.2125 + 1.2126 +int pplex_init(yyscan_t* ptr_yy_globals) 1.2127 + 1.2128 +{ 1.2129 + if (ptr_yy_globals == NULL){ 1.2130 + errno = EINVAL; 1.2131 + return 1; 1.2132 + } 1.2133 + 1.2134 + *ptr_yy_globals = (yyscan_t) ppalloc ( sizeof( struct yyguts_t ), NULL ); 1.2135 + 1.2136 + if (*ptr_yy_globals == NULL){ 1.2137 + errno = ENOMEM; 1.2138 + return 1; 1.2139 + } 1.2140 + 1.2141 + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ 1.2142 + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 1.2143 + 1.2144 + return yy_init_globals ( *ptr_yy_globals ); 1.2145 +} 1.2146 + 1.2147 +/* pplex_init_extra has the same functionality as pplex_init, but follows the 1.2148 + * convention of taking the scanner as the last argument. Note however, that 1.2149 + * this is a *pointer* to a scanner, as it will be allocated by this call (and 1.2150 + * is the reason, too, why this function also must handle its own declaration). 1.2151 + * The user defined value in the first argument will be available to ppalloc in 1.2152 + * the yyextra field. 1.2153 + */ 1.2154 + 1.2155 +int pplex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) 1.2156 + 1.2157 +{ 1.2158 + struct yyguts_t dummy_yyguts; 1.2159 + 1.2160 + ppset_extra (yy_user_defined, &dummy_yyguts); 1.2161 + 1.2162 + if (ptr_yy_globals == NULL){ 1.2163 + errno = EINVAL; 1.2164 + return 1; 1.2165 + } 1.2166 + 1.2167 + *ptr_yy_globals = (yyscan_t) ppalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); 1.2168 + 1.2169 + if (*ptr_yy_globals == NULL){ 1.2170 + errno = ENOMEM; 1.2171 + return 1; 1.2172 + } 1.2173 + 1.2174 + /* By setting to 0xAA, we expose bugs in 1.2175 + yy_init_globals. Leave at 0x00 for releases. */ 1.2176 + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); 1.2177 + 1.2178 + ppset_extra (yy_user_defined, *ptr_yy_globals); 1.2179 + 1.2180 + return yy_init_globals ( *ptr_yy_globals ); 1.2181 +} 1.2182 + 1.2183 +static int yy_init_globals (yyscan_t yyscanner) 1.2184 +{ 1.2185 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2186 + /* Initialization is the same as for the non-reentrant scanner. 1.2187 + * This function is called from pplex_destroy(), so don't allocate here. 1.2188 + */ 1.2189 + 1.2190 + yyg->yy_buffer_stack = 0; 1.2191 + yyg->yy_buffer_stack_top = 0; 1.2192 + yyg->yy_buffer_stack_max = 0; 1.2193 + yyg->yy_c_buf_p = (char *) 0; 1.2194 + yyg->yy_init = 0; 1.2195 + yyg->yy_start = 0; 1.2196 + 1.2197 + yyg->yy_start_stack_ptr = 0; 1.2198 + yyg->yy_start_stack_depth = 0; 1.2199 + yyg->yy_start_stack = NULL; 1.2200 + 1.2201 +/* Defined in main.c */ 1.2202 +#ifdef YY_STDINIT 1.2203 + yyin = stdin; 1.2204 + yyout = stdout; 1.2205 +#else 1.2206 + yyin = (FILE *) 0; 1.2207 + yyout = (FILE *) 0; 1.2208 +#endif 1.2209 + 1.2210 + /* For future reference: Set errno on error, since we are called by 1.2211 + * pplex_init() 1.2212 + */ 1.2213 + return 0; 1.2214 +} 1.2215 + 1.2216 +/* pplex_destroy is for both reentrant and non-reentrant scanners. */ 1.2217 +int pplex_destroy (yyscan_t yyscanner) 1.2218 +{ 1.2219 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.2220 + 1.2221 + /* Pop the buffer stack, destroying each element. */ 1.2222 + while(YY_CURRENT_BUFFER){ 1.2223 + pp_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); 1.2224 + YY_CURRENT_BUFFER_LVALUE = NULL; 1.2225 + pppop_buffer_state(yyscanner); 1.2226 + } 1.2227 + 1.2228 + /* Destroy the stack itself. */ 1.2229 + ppfree(yyg->yy_buffer_stack ,yyscanner); 1.2230 + yyg->yy_buffer_stack = NULL; 1.2231 + 1.2232 + /* Destroy the start condition stack. */ 1.2233 + ppfree(yyg->yy_start_stack ,yyscanner ); 1.2234 + yyg->yy_start_stack = NULL; 1.2235 + 1.2236 + /* Reset the globals. This is important in a non-reentrant scanner so the next time 1.2237 + * pplex() is called, initialization will occur. */ 1.2238 + yy_init_globals( yyscanner); 1.2239 + 1.2240 + /* Destroy the main struct (reentrant only). */ 1.2241 + ppfree ( yyscanner , yyscanner ); 1.2242 + yyscanner = NULL; 1.2243 + return 0; 1.2244 +} 1.2245 + 1.2246 +/* 1.2247 + * Internal utility routines. 1.2248 + */ 1.2249 + 1.2250 +#ifndef yytext_ptr 1.2251 +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) 1.2252 +{ 1.2253 + register int i; 1.2254 + for ( i = 0; i < n; ++i ) 1.2255 + s1[i] = s2[i]; 1.2256 +} 1.2257 +#endif 1.2258 + 1.2259 +#ifdef YY_NEED_STRLEN 1.2260 +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) 1.2261 +{ 1.2262 + register int n; 1.2263 + for ( n = 0; s[n]; ++n ) 1.2264 + ; 1.2265 + 1.2266 + return n; 1.2267 +} 1.2268 +#endif 1.2269 + 1.2270 +void *ppalloc (yy_size_t size , yyscan_t yyscanner) 1.2271 +{ 1.2272 + return (void *) malloc( size ); 1.2273 +} 1.2274 + 1.2275 +void *pprealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) 1.2276 +{ 1.2277 + /* The cast to (char *) in the following accommodates both 1.2278 + * implementations that use char* generic pointers, and those 1.2279 + * that use void* generic pointers. It works with the latter 1.2280 + * because both ANSI C and C++ allow castless assignment from 1.2281 + * any pointer type to void*, and deal with argument conversions 1.2282 + * as though doing an assignment. 1.2283 + */ 1.2284 + return (void *) realloc( (char *) ptr, size ); 1.2285 +} 1.2286 + 1.2287 +void ppfree (void * ptr , yyscan_t yyscanner) 1.2288 +{ 1.2289 + free( (char *) ptr ); /* see pprealloc() for (char *) cast */ 1.2290 +} 1.2291 + 1.2292 +#define YYTABLES_NAME "yytables" 1.2293 + 1.2294 +namespace pp { 1.2295 + 1.2296 +// TODO(alokp): Maximum token length should ideally be specified by 1.2297 +// the preprocessor client, i.e., the compiler. 1.2298 +const size_t Tokenizer::kMaxTokenLength = 256; 1.2299 + 1.2300 +Tokenizer::Tokenizer(Diagnostics* diagnostics) : mHandle(0) 1.2301 +{ 1.2302 + mContext.diagnostics = diagnostics; 1.2303 +} 1.2304 + 1.2305 +Tokenizer::~Tokenizer() 1.2306 +{ 1.2307 + destroyScanner(); 1.2308 +} 1.2309 + 1.2310 +bool Tokenizer::init(size_t count, const char* const string[], const int length[]) 1.2311 +{ 1.2312 + if ((count > 0) && (string == 0)) return false; 1.2313 + 1.2314 + mContext.input = Input(count, string, length); 1.2315 + return initScanner(); 1.2316 +} 1.2317 + 1.2318 +void Tokenizer::setFileNumber(int file) 1.2319 +{ 1.2320 + // We use column number as file number. 1.2321 + // See macro yyfileno. 1.2322 + ppset_column(file,mHandle); 1.2323 +} 1.2324 + 1.2325 +void Tokenizer::setLineNumber(int line) 1.2326 +{ 1.2327 + ppset_lineno(line,mHandle); 1.2328 +} 1.2329 + 1.2330 +void Tokenizer::lex(Token* token) 1.2331 +{ 1.2332 + token->type = pplex(&token->text,&token->location,mHandle); 1.2333 + if (token->text.size() > kMaxTokenLength) 1.2334 + { 1.2335 + mContext.diagnostics->report(Diagnostics::TOKEN_TOO_LONG, 1.2336 + token->location, token->text); 1.2337 + token->text.erase(kMaxTokenLength); 1.2338 + } 1.2339 + 1.2340 + token->flags = 0; 1.2341 + 1.2342 + token->setAtStartOfLine(mContext.lineStart); 1.2343 + mContext.lineStart = token->type == '\n'; 1.2344 + 1.2345 + token->setHasLeadingSpace(mContext.leadingSpace); 1.2346 + mContext.leadingSpace = false; 1.2347 +} 1.2348 + 1.2349 +bool Tokenizer::initScanner() 1.2350 +{ 1.2351 + if ((mHandle == NULL) && pplex_init_extra(&mContext,&mHandle)) 1.2352 + return false; 1.2353 + 1.2354 + pprestart(0,mHandle); 1.2355 + return true; 1.2356 +} 1.2357 + 1.2358 +void Tokenizer::destroyScanner() 1.2359 +{ 1.2360 + if (mHandle == NULL) 1.2361 + return; 1.2362 + 1.2363 + pplex_destroy(mHandle); 1.2364 + mHandle = NULL; 1.2365 +} 1.2366 + 1.2367 +} // namespace pp 1.2368 +