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