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