From dfe5928a3db9c9fe2056c79592301203ed135557 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Fri, 19 Feb 2010 21:52:06 +0100 Subject: [PATCH] Newly lexed parser in XBoard directory --- parser.c | 4143 +++++++++++++++++++++++++++++++++++++++++++++++++++++ winboard/parser.c | 3884 ------------------------------------------------- 2 files changed, 4143 insertions(+), 3884 deletions(-) create mode 100644 parser.c delete mode 100644 winboard/parser.c diff --git a/parser.c b/parser.c new file mode 100644 index 0000000..70111a4 --- /dev/null +++ b/parser.c @@ -0,0 +1,4143 @@ + +#line 3 "parser.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 34 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + * Given that the standard has decreed that size_t exists since 1989, + * I guess we can afford to depend on it. Manoj. + */ + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +typedef unsigned char YY_CHAR; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 42 +#define YY_END_OF_BUFFER 43 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_acclist[602] = + { 0, + 43, 41, 42, 41, 42, 41, 42, 40, 41, 42, + 41, 42, 25, 41, 42, 41, 42, 40, 41, 42, + 40, 41, 42,16410, 40, 41, 42,16410, 41, 42, + 40, 41, 42, 40, 41, 42, 40, 41, 42, 40, + 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, + 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, + 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, + 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, + 40, 41, 42, 40, 41, 42, 40, 41, 42, 40, + 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, + + 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, + 40, 41, 42, 41, 42, 41, 42, 40, 41, 42, + 40, 41, 42, 40, 41, 42,16410, 40, 41, 42, + 16410, 41, 42, 40, 41, 42, 40, 41, 42, 40, + 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, + 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, + 40, 41, 42, 40, 41, 42, 40, 41, 42, 40, + 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, + 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, + 40, 41, 42, 40, 41, 42, 40, 41, 42, 40, + + 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, + 42, 40, 41, 42, 41, 42, 33, 40, 17, 40, + 9, 40, 40, 40,16410, 8218, 40, 35, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 9, 40, + 40, 40, 40, 36, 40, 3, 40, 40, 4, 40, + 40, 40, 40, 40, 40, 9, 40, 40, 40, 34, + 40, 40, 9, 40, 40, 40,16410, 8218, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 9, + 40, 40, 40, 40, 40, 3, 40, 40, 4, 40, + 40, 40, 40, 40, 40, 9, 40, 40, 40, 15, + + 9, 40, 23, 40, 23, 8, 40, 8218, 22, 40, + 22, 24, 40, 40, 40, 6, 40, 40, 40, 40, + 40, 40, 9, 40, 40, 40, 40, 4, 40, 40, + 3, 3, 40, 3, 40, 40, 4, 5, 40, 4, + 4, 40, 40, 40, 40, 9, 40, 40, 34, 39, + 9, 40, 23, 40, 8, 40, 22, 40, 35, 40, + 40, 40, 6, 40, 40, 40, 40, 40, 40, 9, + 40, 40, 40, 40, 4, 40, 40, 3, 40, 3, + 40, 40, 5, 40, 4, 40, 40, 40, 40, 9, + 40, 40, 38, 38, 38, 37, 25, 25, 6, 40, + + 10, 6, 40, 7, 40, 6, 40, 6, 40, 40, + 40, 19, 40, 40, 16, 40, 40, 40, 40, 40, + 36, 3, 3, 2, 40, 5, 4, 5, 5, 40, + 40, 4, 4, 40, 40, 25, 39, 40, 6, 40, + 7, 40, 40, 40, 40, 40, 19, 40, 40, 16, + 40, 40, 40, 40, 40, 2, 40, 5, 40, 40, + 4, 40, 40, 38, 7, 7, 1, 40, 20, 40, + 40, 19, 40, 40, 40, 40, 40, 40, 30, 36, + 2, 2, 2, 40, 5, 5, 5, 40, 39, 1, + 40, 40, 40, 19, 40, 40, 40, 40, 40, 40, + + 2, 40, 5, 40, 27, 38, 1, 23, 23, 22, + 22, 24, 24, 1, 1, 40, 21, 20, 40, 40, + 40, 11, 40, 40, 28, 36, 30, 2, 2, 27, + 34, 39, 39, 1, 40, 40, 40, 40, 11, 40, + 40, 18, 1, 24, 1, 21, 19, 40, 40, 40, + 11, 40, 40, 40, 40, 40, 11, 40, 40, 12, + 40, 40, 40, 40, 12, 40, 40, 14, 40, 40, + 40, 14, 40, 40, 40, 39, 40, 40, 40, 40, + 39, 39, 40, 40, 31, 40, 39, 39, 31, 40, + 13, 31, 32, 32, 35, 39, 39, 31, 39, 34, + + 29 + } ; + +static yyconst flex_int16_t yy_accept[689] = + { 0, + 1, 1, 1, 2, 4, 6, 8, 11, 13, 16, + 18, 21, 25, 29, 31, 34, 37, 40, 43, 46, + 49, 52, 55, 58, 61, 63, 66, 69, 72, 75, + 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, + 108, 111, 114, 116, 118, 121, 124, 128, 132, 134, + 137, 140, 143, 146, 149, 152, 155, 158, 161, 164, + 167, 170, 173, 176, 179, 182, 185, 188, 191, 194, + 197, 200, 203, 206, 209, 212, 215, 217, 217, 218, + 219, 219, 219, 219, 219, 220, 220, 220, 220, 221, + 221, 223, 223, 223, 223, 224, 224, 224, 226, 226, + + 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, + 233, 234, 235, 236, 237, 238, 239, 241, 242, 243, + 244, 244, 244, 244, 244, 245, 246, 248, 248, 249, + 251, 252, 253, 254, 255, 256, 258, 259, 260, 260, + 260, 260, 261, 261, 262, 262, 263, 265, 265, 266, + 268, 268, 270, 270, 271, 272, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 282, 283, 284, 285, 286, + 288, 288, 289, 291, 292, 293, 294, 295, 296, 298, + 299, 300, 300, 300, 300, 300, 300, 300, 300, 300, + 300, 300, 300, 301, 301, 301, 301, 301, 301, 303, + + 305, 306, 308, 309, 309, 309, 309, 311, 312, 313, + 313, 314, 314, 315, 315, 316, 316, 318, 318, 318, + 318, 318, 318, 318, 319, 320, 321, 322, 323, 325, + 326, 327, 328, 328, 328, 328, 328, 330, 330, 331, + 331, 332, 334, 336, 337, 338, 338, 340, 341, 343, + 344, 345, 346, 348, 349, 350, 350, 350, 350, 350, + 351, 353, 355, 357, 359, 359, 360, 360, 361, 362, + 362, 363, 365, 366, 367, 368, 369, 370, 372, 373, + 374, 375, 377, 378, 378, 380, 382, 383, 385, 387, + 388, 389, 390, 392, 393, 393, 393, 394, 395, 395, + + 395, 396, 396, 396, 397, 397, 397, 398, 398, 399, + 399, 400, 400, 400, 400, 401, 401, 401, 401, 401, + 401, 401, 401, 402, 404, 404, 406, 407, 408, 408, + 409, 410, 410, 410, 410, 410, 410, 410, 411, 412, + 414, 414, 415, 417, 418, 419, 420, 421, 421, 421, + 421, 421, 422, 423, 423, 424, 426, 427, 428, 428, + 428, 429, 431, 432, 433, 433, 435, 436, 436, 437, + 437, 437, 437, 437, 438, 438, 439, 439, 439, 441, + 443, 444, 444, 445, 446, 447, 449, 450, 452, 453, + 454, 455, 456, 458, 460, 461, 463, 464, 464, 464, + + 464, 464, 465, 465, 465, 465, 465, 466, 466, 466, + 466, 466, 466, 466, 466, 466, 466, 467, 469, 469, + 469, 469, 469, 469, 470, 471, 472, 472, 474, 474, + 475, 476, 477, 478, 479, 479, 479, 481, 481, 481, + 482, 482, 483, 485, 486, 486, 487, 487, 489, 489, + 489, 489, 489, 489, 489, 489, 490, 490, 490, 492, + 493, 494, 496, 497, 498, 499, 500, 501, 503, 505, + 505, 505, 505, 505, 505, 505, 507, 507, 508, 508, + 509, 509, 510, 510, 511, 511, 512, 512, 513, 513, + 514, 514, 514, 514, 515, 517, 517, 517, 518, 518, + + 518, 519, 520, 520, 520, 520, 520, 520, 521, 522, + 524, 525, 527, 527, 528, 529, 530, 530, 530, 532, + 532, 532, 533, 534, 534, 534, 536, 537, 538, 539, + 541, 542, 542, 543, 543, 543, 543, 543, 544, 544, + 545, 546, 546, 546, 547, 547, 547, 548, 548, 548, + 548, 548, 549, 550, 551, 553, 554, 554, 554, 554, + 554, 554, 555, 556, 557, 559, 560, 560, 560, 560, + 560, 560, 560, 561, 561, 561, 561, 561, 562, 563, + 563, 563, 563, 563, 564, 565, 565, 565, 565, 565, + 566, 566, 566, 566, 567, 568, 570, 570, 570, 570, + + 570, 571, 571, 572, 574, 574, 574, 574, 574, 575, + 576, 576, 576, 576, 576, 577, 578, 579, 579, 579, + 579, 579, 579, 580, 581, 581, 581, 581, 581, 582, + 583, 584, 585, 585, 585, 585, 585, 585, 587, 587, + 587, 587, 587, 588, 589, 591, 591, 591, 592, 592, + 593, 593, 594, 594, 594, 596, 596, 597, 598, 598, + 598, 598, 598, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 601, 602, 602 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 1, 5, 6, 7, 8, 1, 9, 10, + 11, 12, 13, 1, 14, 15, 16, 17, 18, 19, + 20, 20, 20, 20, 20, 20, 20, 21, 22, 1, + 23, 1, 1, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 33, 34, 35, 36, 37, 38, 34, + 34, 39, 40, 33, 41, 33, 42, 43, 33, 33, + 44, 1, 45, 1, 46, 1, 47, 48, 49, 50, + + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 68, 72, 1, 73, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[74] = + { 0, + 1, 2, 3, 2, 1, 1, 1, 1, 4, 5, + 6, 1, 7, 8, 1, 1, 9, 9, 9, 9, + 10, 1, 11, 1, 12, 12, 12, 12, 12, 12, + 12, 12, 13, 12, 13, 13, 12, 12, 12, 13, + 13, 12, 14, 1, 1, 1, 15, 15, 15, 15, + 16, 15, 15, 15, 15, 15, 15, 15, 17, 18, + 18, 18, 18, 18, 17, 17, 17, 17, 17, 19, + 17, 1, 1 + } ; + +static yyconst flex_int16_t yy_base[767] = + { 0, + 0, 73, 3814, 3815, 122, 131, 0, 142, 3809, 140, + 151, 171, 162, 3809, 231, 159, 3757, 3746, 119, 3762, + 143, 3757, 3741, 190, 301, 361, 211, 207, 279, 215, + 224, 284, 243, 286, 301, 303, 305, 3759, 232, 3754, + 3738, 264, 351, 3799, 149, 379, 430, 351, 255, 493, + 212, 3748, 3737, 327, 3753, 157, 3748, 3732, 331, 555, + 372, 245, 378, 351, 468, 530, 475, 477, 505, 523, + 508, 576, 578, 385, 579, 610, 615, 3744, 372, 0, + 3786, 309, 630, 431, 3815, 3782, 675, 575, 405, 3776, + 3776, 3774, 450, 639, 3774, 472, 165, 640, 3773, 0, + + 3786, 3815, 0, 699, 0, 744, 0, 648, 787, 652, + 656, 3649, 3636, 3591, 693, 3601, 3594, 697, 3584, 664, + 3585, 856, 352, 929, 3815, 956, 1006, 0, 1031, 1080, + 660, 717, 721, 3563, 3567, 3551, 3514, 3523, 435, 3504, + 757, 3572, 3571, 497, 3496, 517, 607, 550, 681, 1130, + 160, 518, 554, 1193, 1238, 3477, 686, 762, 787, 764, + 617, 676, 750, 3424, 803, 816, 864, 835, 1262, 1312, + 3439, 1337, 1387, 874, 888, 895, 700, 823, 865, 762, + 866, 885, 3360, 583, 610, 626, 652, 676, 944, 949, + 3394, 3260, 3815, 882, 1190, 3328, 3286, 3281, 3270, 3279, + + 3278, 0, 3815, 3277, 3266, 3263, 3262, 3182, 799, 830, + 900, 958, 1412, 928, 962, 966, 1457, 3130, 3120, 3119, + 3130, 3108, 382, 970, 1075, 3071, 759, 2895, 2927, 2884, + 2880, 1108, 572, 1213, 739, 1527, 1591, 0, 1596, 0, + 2927, 2844, 2843, 974, 1202, 1246, 1645, 2840, 2838, 238, + 2799, 2797, 2814, 2743, 3815, 1210, 1084, 2630, 211, 2628, + 1121, 1132, 606, 1253, 697, 2626, 895, 1217, 1688, 2624, + 1258, 1733, 1467, 1472, 901, 1536, 1252, 1532, 1535, 1538, + 1549, 1795, 1800, 2623, 810, 2615, 1556, 1849, 1259, 1573, + 1473, 1474, 1541, 1543, 1583, 2574, 3815, 778, 832, 913, + + 985, 989, 1007, 3815, 1593, 2613, 2612, 2549, 2548, 1281, + 1646, 2568, 2554, 2550, 2550, 585, 2549, 367, 2487, 636, + 1680, 1125, 3815, 2480, 1679, 2479, 2463, 1854, 1678, 3815, + 1287, 2407, 2407, 2403, 2401, 2401, 2402, 2404, 2403, 968, + 510, 598, 0, 2421, 2405, 2406, 2405, 1007, 1161, 1046, + 1354, 2450, 2443, 1455, 3815, 1694, 1510, 2442, 1161, 1585, + 1700, 2441, 1209, 3815, 2389, 0, 2389, 1789, 2445, 1577, + 1711, 2401, 2386, 2443, 403, 1709, 1281, 374, 1131, 1710, + 1866, 2441, 1741, 819, 1744, 1921, 1746, 1315, 1686, 1789, + 1748, 1793, 1754, 1852, 1917, 1571, 1919, 1930, 2392, 1127, + + 2431, 1221, 1244, 1392, 1421, 1486, 2418, 1620, 2429, 2366, + 2427, 2361, 2422, 2359, 2413, 1923, 3815, 1994, 2381, 2377, + 1452, 2377, 2372, 2361, 2421, 1266, 1919, 2420, 688, 2394, + 2370, 2359, 2358, 2412, 1684, 1660, 3815, 2406, 1891, 933, + 1388, 1579, 2399, 2398, 1462, 3815, 2346, 0, 2379, 1928, + 2371, 1645, 2371, 2328, 2321, 1603, 1495, 1269, 2029, 1941, + 1925, 1943, 1928, 1939, 1932, 1947, 1950, 1954, 1957, 1971, + 1350, 1515, 2374, 1568, 1573, 3815, 1976, 1756, 2373, 2372, + 2309, 2308, 2369, 2368, 2305, 2304, 2365, 2357, 2287, 2285, + 2341, 2337, 1959, 1966, 2344, 2293, 2302, 1746, 760, 2299, + + 3815, 2304, 2334, 2293, 2267, 2308, 2285, 2292, 2262, 1655, + 2274, 3815, 1995, 3815, 2301, 3815, 2294, 2070, 2297, 2243, + 2232, 2279, 1791, 1814, 1812, 1991, 2032, 2065, 2071, 2072, + 2073, 1974, 3815, 2230, 2269, 1647, 2089, 2268, 2274, 2271, + 3815, 2214, 2215, 3815, 2181, 2228, 2221, 2169, 2225, 2188, + 2161, 2184, 2156, 2164, 0, 2141, 2093, 2197, 2133, 1836, + 1662, 2074, 2076, 2082, 2095, 2106, 2002, 2130, 2146, 1724, + 2016, 1985, 2033, 1997, 958, 2003, 1946, 2172, 1919, 1903, + 1880, 1767, 1842, 2245, 2108, 2004, 1805, 1815, 1814, 3815, + 1794, 1920, 1960, 2318, 2077, 0, 1788, 1630, 2046, 598, + + 2391, 2114, 2097, 2110, 2125, 1592, 1532, 2109, 1524, 1460, + 1444, 1439, 1810, 758, 2118, 1443, 1374, 2132, 1261, 1257, + 2094, 2095, 1253, 1188, 1154, 1199, 2130, 1866, 2139, 2166, + 1117, 1053, 2147, 2087, 995, 2122, 2155, 0, 1027, 895, + 924, 2152, 2206, 2212, 0, 2154, 839, 3815, 821, 2158, + 787, 3815, 567, 501, 3815, 2155, 2209, 2232, 2219, 380, + 362, 1838, 2233, 2220, 288, 2197, 1969, 2005, 2157, 2270, + 2274, 2292, 2293, 2294, 2296, 2297, 2299, 2300, 2301, 2302, + 2332, 2345, 2347, 2199, 190, 3815, 3815, 2461, 2480, 2493, + 2507, 2526, 2545, 2561, 2580, 2599, 2617, 1883, 1994, 1999, + + 2635, 2654, 2030, 2673, 2692, 2711, 2730, 2749, 2768, 2787, + 2806, 2825, 2837, 2856, 2875, 2894, 2913, 2921, 2148, 2931, + 2947, 2966, 2985, 3004, 3023, 3042, 3061, 3080, 3099, 3118, + 3137, 3156, 3168, 3187, 3206, 3225, 3244, 3260, 3275, 3291, + 3310, 3326, 3345, 3364, 3383, 3402, 3421, 3440, 3459, 3478, + 3497, 3516, 3535, 3554, 3569, 3588, 3607, 3622, 3636, 3655, + 3674, 3693, 3712, 3731, 3750, 3769 + } ; + +static yyconst flex_int16_t yy_def[767] = + { 0, + 687, 687, 687, 687, 687, 687, 688, 689, 687, 690, + 688, 687, 12, 691, 688, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 692, 688, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 688, 688, 688, + 688, 688, 693, 687, 694, 694, 687, 47, 691, 694, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 694, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 694, 694, 694, 694, 694, 693, 687, 687, 688, + 695, 696, 695, 687, 687, 687, 687, 687, 688, 687, + 688, 687, 697, 697, 688, 697, 687, 12, 687, 688, + + 691, 687, 698, 688, 699, 688, 700, 106, 687, 106, + 106, 688, 688, 688, 106, 104, 688, 106, 688, 106, + 701, 692, 701, 702, 687, 688, 687, 703, 688, 688, + 688, 688, 688, 688, 688, 688, 688, 688, 693, 704, + 693, 687, 705, 694, 687, 694, 694, 687, 694, 687, + 687, 694, 706, 694, 154, 700, 155, 155, 155, 694, + 694, 694, 155, 154, 694, 155, 694, 155, 154, 687, + 703, 154, 687, 694, 694, 694, 694, 694, 694, 694, + 694, 693, 687, 707, 708, 708, 709, 710, 707, 707, + 711, 712, 687, 713, 713, 687, 687, 687, 688, 688, + + 687, 688, 687, 687, 687, 687, 688, 687, 687, 687, + 688, 687, 688, 713, 688, 687, 688, 687, 687, 687, + 687, 687, 687, 688, 688, 688, 688, 688, 688, 688, + 688, 688, 714, 715, 716, 717, 688, 718, 688, 719, + 718, 688, 239, 688, 720, 720, 688, 246, 688, 688, + 688, 688, 688, 688, 687, 693, 687, 721, 687, 722, + 694, 694, 694, 694, 723, 721, 724, 694, 694, 214, + 694, 269, 694, 694, 694, 694, 694, 694, 694, 694, + 694, 694, 269, 719, 694, 283, 694, 282, 694, 694, + 694, 694, 694, 694, 693, 687, 687, 725, 726, 727, + + 728, 725, 729, 687, 730, 731, 731, 732, 732, 687, + 733, 687, 687, 687, 688, 687, 687, 687, 687, 687, + 687, 687, 687, 688, 733, 688, 687, 688, 325, 687, + 688, 687, 687, 687, 687, 687, 687, 688, 688, 688, + 687, 688, 688, 688, 688, 688, 688, 734, 734, 735, + 736, 737, 687, 687, 687, 738, 739, 687, 687, 739, + 739, 688, 688, 687, 687, 688, 688, 693, 687, 687, + 687, 687, 687, 740, 687, 694, 741, 741, 694, 694, + 283, 329, 694, 694, 694, 694, 694, 694, 694, 694, + 694, 694, 742, 694, 694, 694, 694, 693, 687, 727, + + 743, 744, 728, 745, 729, 730, 687, 687, 746, 747, + 748, 749, 750, 751, 687, 687, 687, 688, 687, 687, + 687, 687, 687, 687, 688, 688, 687, 688, 687, 688, + 688, 688, 688, 688, 752, 753, 687, 754, 687, 755, + 755, 755, 688, 687, 687, 687, 687, 688, 687, 693, + 687, 687, 687, 687, 687, 756, 741, 741, 694, 694, + 694, 694, 694, 694, 694, 694, 694, 694, 694, 693, + 687, 744, 757, 728, 745, 687, 730, 758, 746, 746, + 747, 747, 748, 748, 749, 749, 750, 750, 751, 751, + 687, 687, 758, 758, 688, 687, 687, 687, 687, 687, + + 687, 688, 759, 687, 687, 687, 687, 688, 688, 688, + 688, 687, 687, 687, 687, 687, 687, 693, 687, 687, + 687, 756, 756, 741, 741, 694, 694, 694, 694, 694, + 694, 693, 687, 687, 757, 744, 730, 687, 687, 687, + 687, 687, 687, 687, 687, 759, 759, 687, 687, 687, + 687, 688, 688, 688, 688, 688, 693, 687, 687, 741, + 741, 694, 694, 694, 694, 694, 693, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 760, 688, 687, + 687, 741, 741, 761, 694, 693, 687, 687, 687, 687, + 687, 762, 762, 760, 594, 688, 687, 687, 741, 741, + + 761, 762, 601, 694, 693, 687, 687, 762, 594, 594, + 687, 687, 741, 741, 763, 601, 601, 693, 687, 687, + 762, 762, 594, 594, 687, 687, 741, 741, 763, 763, + 601, 601, 693, 687, 687, 762, 762, 594, 764, 687, + 765, 741, 763, 763, 601, 693, 687, 687, 687, 762, + 764, 687, 687, 765, 687, 741, 763, 763, 693, 687, + 687, 741, 763, 693, 687, 741, 693, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 687, 687, 0, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687 + } ; + +static yyconst flex_int16_t yy_nxt[3889] = + { 0, + 4, 4, 4, 5, 4, 4, 6, 4, 7, 8, + 4, 9, 10, 7, 4, 4, 11, 12, 13, 13, + 4, 14, 4, 4, 15, 16, 17, 18, 15, 15, + 19, 15, 15, 15, 15, 20, 15, 21, 22, 23, + 15, 24, 15, 25, 4, 4, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 7, + 39, 7, 7, 40, 41, 7, 7, 7, 42, 7, + 7, 43, 4, 4, 4, 4, 5, 4, 44, 6, + 44, 7, 8, 4, 9, 10, 45, 4, 4, 46, + 47, 48, 48, 4, 49, 4, 4, 50, 51, 52, + + 53, 50, 50, 54, 50, 50, 50, 50, 55, 50, + 56, 57, 58, 50, 59, 50, 25, 4, 4, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 45, 73, 45, 45, 74, 75, 45, 45, + 45, 76, 45, 45, 77, 4, 78, 79, 79, 79, + 79, 82, 85, 86, 88, 113, 116, 80, 83, 83, + 83, 83, 109, 260, 89, 93, 90, 91, 78, 145, + 164, 92, 93, 93, 94, 80, 208, 687, 114, 80, + 117, 208, 687, 209, 95, 96, 97, 98, 98, 98, + 98, 99, 686, 109, 165, 100, 100, 100, 100, 100, + + 100, 100, 100, 80, 100, 80, 80, 100, 100, 100, + 80, 80, 100, 80, 109, 109, 110, 100, 100, 100, + 100, 100, 100, 100, 100, 100, 100, 100, 100, 80, + 100, 100, 100, 100, 100, 80, 80, 80, 80, 80, + 80, 80, 103, 120, 104, 135, 105, 106, 106, 106, + 106, 107, 365, 131, 103, 130, 130, 102, 153, 130, + 133, 131, 131, 372, 130, 130, 130, 109, 132, 158, + 131, 131, 373, 104, 130, 130, 130, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 108, 108, 131, + 131, 174, 136, 173, 173, 130, 130, 130, 176, 366, + + 104, 121, 122, 122, 122, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 123, 121, 121, 138, 187, 188, + 113, 121, 121, 121, 121, 131, 131, 130, 130, 130, + 131, 131, 131, 131, 109, 130, 130, 130, 639, 130, + 130, 130, 112, 114, 121, 125, 121, 131, 131, 131, + 131, 131, 131, 140, 93, 130, 130, 130, 130, 130, + 130, 130, 130, 161, 144, 233, 687, 141, 141, 141, + 141, 145, 121, 121, 126, 109, 102, 127, 127, 127, + 127, 128, 88, 208, 168, 209, 162, 80, 79, 79, + 79, 79, 146, 80, 90, 147, 125, 174, 174, 148, + + 173, 173, 173, 129, 456, 145, 456, 130, 130, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 665, + 173, 199, 200, 142, 174, 174, 173, 173, 173, 175, + 129, 93, 93, 94, 458, 180, 337, 140, 80, 533, + 191, 160, 337, 149, 96, 97, 150, 150, 150, 150, + 151, 93, 93, 93, 152, 152, 152, 152, 152, 152, + 152, 152, 144, 152, 144, 144, 152, 152, 152, 144, + 144, 152, 144, 93, 93, 93, 152, 152, 152, 152, + 152, 152, 152, 152, 152, 152, 152, 152, 144, 152, + 152, 152, 152, 152, 144, 144, 144, 144, 144, 144, + + 144, 80, 192, 655, 103, 80, 154, 142, 105, 155, + 155, 155, 155, 156, 174, 174, 103, 145, 173, 173, + 173, 174, 174, 174, 174, 80, 80, 173, 173, 173, + 173, 173, 173, 261, 262, 154, 429, 145, 145, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 174, 174, 260, 174, 174, 266, 267, 429, 173, + 173, 173, 154, 80, 173, 173, 161, 201, 169, 174, + 174, 170, 170, 170, 170, 171, 174, 174, 173, 173, + 173, 173, 173, 173, 80, 349, 80, 80, 196, 162, + 197, 178, 185, 297, 409, 198, 145, 172, 145, 145, + + 102, 173, 173, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 109, 80, 80, 125, 140, 80, 187, + 298, 661, 177, 263, 172, 80, 145, 145, 182, 430, + 145, 141, 141, 141, 141, 187, 298, 145, 179, 185, + 93, 93, 93, 93, 167, 411, 189, 189, 189, 189, + 190, 431, 204, 80, 205, 687, 410, 276, 614, 206, + 687, 300, 301, 181, 217, 217, 217, 217, 217, 217, + 217, 217, 217, 217, 217, 217, 247, 247, 247, 247, + 217, 217, 217, 217, 80, 303, 304, 142, 107, 80, + 105, 194, 194, 194, 194, 107, 145, 264, 224, 266, + + 267, 145, 272, 272, 272, 272, 225, 412, 80, 217, + 217, 217, 217, 217, 217, 217, 217, 107, 232, 506, + 145, 195, 195, 195, 195, 195, 195, 195, 195, 195, + 195, 195, 195, 247, 247, 247, 247, 247, 247, 247, + 247, 507, 276, 351, 107, 211, 211, 211, 211, 211, + 211, 211, 211, 211, 211, 211, 211, 213, 228, 140, + 102, 230, 341, 251, 214, 277, 272, 272, 272, 272, + 80, 252, 80, 141, 141, 141, 141, 256, 272, 272, + 272, 272, 145, 352, 145, 342, 213, 303, 304, 652, + 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, + + 215, 215, 321, 272, 272, 272, 272, 342, 273, 544, + 275, 80, 322, 213, 218, 277, 219, 628, 80, 322, + 355, 220, 221, 145, 501, 222, 279, 80, 223, 142, + 145, 80, 272, 272, 272, 272, 218, 274, 219, 145, + 263, 300, 301, 145, 220, 221, 323, 323, 323, 323, + 222, 272, 272, 272, 272, 223, 121, 122, 122, 122, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 121, 80, 80, 80, 460, 121, 121, 121, 121, + 279, 660, 80, 293, 145, 145, 145, 140, 648, 281, + 288, 288, 288, 288, 145, 214, 80, 102, 295, 121, + + 125, 121, 214, 80, 288, 288, 288, 288, 145, 80, + 280, 288, 288, 288, 288, 145, 324, 324, 324, 324, + 294, 145, 401, 402, 214, 263, 655, 121, 121, 121, + 234, 234, 234, 235, 291, 121, 121, 121, 121, 121, + 121, 687, 441, 121, 121, 292, 653, 377, 687, 121, + 121, 214, 121, 185, 297, 442, 378, 142, 185, 297, + 189, 189, 189, 189, 190, 305, 305, 305, 305, 386, + 687, 427, 121, 125, 325, 325, 325, 325, 326, 326, + 326, 326, 327, 327, 327, 327, 326, 326, 326, 326, + 356, 356, 356, 356, 404, 188, 504, 687, 303, 304, + + 121, 121, 237, 237, 237, 237, 237, 237, 237, 237, + 237, 237, 237, 237, 80, 238, 404, 188, 338, 239, + 349, 504, 80, 80, 80, 80, 240, 428, 241, 652, + 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, + 242, 242, 242, 242, 242, 242, 242, 242, 243, 649, + 351, 125, 244, 244, 244, 244, 244, 244, 244, 244, + 244, 244, 244, 244, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 239, 80, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 246, + 352, 326, 326, 326, 326, 369, 247, 247, 247, 247, + + 370, 371, 248, 645, 249, 249, 249, 249, 249, 249, + 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, + 249, 249, 249, 339, 326, 326, 326, 326, 415, 80, + 250, 93, 93, 93, 376, 316, 401, 402, 80, 80, + 80, 145, 416, 144, 96, 645, 150, 150, 150, 150, + 145, 145, 145, 330, 152, 152, 152, 152, 152, 152, + 152, 152, 144, 152, 144, 144, 152, 152, 152, 144, + 144, 152, 144, 347, 435, 365, 152, 152, 152, 152, + 152, 152, 152, 152, 152, 152, 152, 152, 144, 152, + 152, 152, 152, 152, 144, 144, 144, 144, 144, 144, + + 144, 80, 640, 214, 639, 125, 311, 311, 311, 311, + 214, 246, 140, 145, 234, 234, 234, 235, 357, 357, + 357, 357, 364, 447, 248, 80, 368, 368, 368, 368, + 473, 474, 214, 379, 379, 379, 379, 145, 638, 268, + 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, + 268, 269, 359, 404, 188, 687, 320, 125, 270, 214, + 80, 80, 687, 687, 687, 687, 80, 80, 687, 364, + 448, 102, 145, 145, 380, 380, 380, 380, 145, 145, + 269, 638, 142, 102, 271, 271, 271, 271, 271, 271, + 271, 271, 271, 271, 271, 271, 687, 407, 407, 407, + + 407, 502, 388, 418, 418, 418, 418, 269, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 80, 238, 635, 80, 502, 283, 634, 457, 144, 144, + 144, 144, 284, 525, 241, 145, 285, 285, 285, 285, + 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, + 285, 285, 285, 285, 286, 436, 436, 436, 287, 287, + 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, + 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, + 144, 283, 144, 173, 173, 173, 173, 173, 173, 173, + 173, 173, 173, 173, 173, 80, 246, 687, 437, 533, + + 144, 473, 474, 288, 288, 288, 288, 145, 534, 248, + 687, 289, 289, 289, 289, 289, 289, 289, 289, 289, + 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, + 404, 188, 632, 144, 144, 144, 144, 290, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, 215, 215, + 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, + 328, 440, 440, 440, 440, 80, 447, 329, 631, 330, + 80, 80, 80, 380, 380, 380, 380, 145, 380, 380, + 380, 380, 145, 145, 145, 185, 476, 102, 626, 328, + + 477, 625, 498, 331, 331, 331, 331, 331, 331, 331, + 331, 331, 331, 331, 331, 384, 498, 498, 624, 360, + 385, 384, 385, 446, 473, 474, 328, 121, 234, 234, + 234, 235, 361, 121, 121, 121, 121, 121, 121, 341, + 80, 121, 121, 80, 80, 389, 80, 121, 121, 80, + 121, 80, 145, 524, 397, 145, 145, 80, 145, 623, + 445, 145, 387, 145, 80, 380, 380, 380, 380, 145, + 121, 125, 393, 393, 393, 393, 145, 404, 188, 80, + 88, 80, 473, 474, 387, 140, 620, 365, 441, 390, + 451, 145, 90, 145, 687, 391, 398, 92, 121, 121, + + 246, 687, 185, 297, 523, 375, 523, 687, 392, 406, + 406, 406, 406, 248, 392, 249, 249, 249, 249, 249, + 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, + 249, 249, 249, 249, 396, 687, 478, 478, 478, 478, + 619, 250, 244, 244, 244, 244, 244, 244, 244, 244, + 244, 244, 244, 244, 360, 142, 473, 474, 204, 329, + 205, 436, 436, 436, 102, 206, 329, 361, 330, 362, + 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, + 362, 362, 362, 362, 362, 362, 362, 362, 329, 413, + 612, 687, 329, 322, 80, 363, 80, 435, 687, 329, + + 322, 687, 80, 441, 437, 554, 145, 80, 145, 360, + 80, 80, 80, 80, 452, 329, 442, 80, 80, 555, + 687, 329, 687, 263, 453, 263, 97, 583, 512, 145, + 145, 99, 417, 413, 271, 271, 271, 271, 271, 271, + 271, 271, 271, 271, 271, 271, 381, 687, 329, 80, + 687, 414, 80, 382, 80, 330, 80, 459, 459, 459, + 459, 145, 80, 441, 145, 493, 145, 144, 145, 102, + 144, 144, 144, 144, 145, 381, 442, 463, 494, 383, + 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, + 383, 140, 523, 375, 523, 414, 498, 80, 466, 464, + + 461, 80, 381, 80, 246, 450, 450, 450, 450, 145, + 498, 498, 102, 145, 102, 145, 102, 248, 599, 289, + 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, + 289, 289, 289, 289, 289, 289, 289, 289, 102, 582, + 102, 465, 611, 467, 102, 290, 287, 287, 287, 287, + 287, 287, 287, 287, 287, 287, 287, 287, 360, 607, + 80, 142, 446, 590, 560, 606, 561, 627, 102, 642, + 533, 361, 145, 394, 394, 394, 394, 394, 394, 394, + 394, 394, 394, 394, 394, 394, 394, 394, 394, 394, + 394, 394, 513, 513, 513, 666, 600, 210, 210, 395, + + 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, + 331, 331, 383, 383, 383, 383, 383, 383, 383, 383, + 383, 383, 383, 383, 427, 80, 491, 80, 503, 80, + 140, 447, 140, 80, 598, 514, 80, 145, 492, 145, + 80, 145, 518, 470, 109, 145, 427, 80, 145, 80, + 608, 80, 145, 109, 597, 80, 528, 504, 80, 145, + 527, 145, 80, 145, 516, 80, 505, 145, 687, 596, + 145, 668, 608, 140, 145, 493, 140, 145, 469, 263, + 462, 687, 504, 527, 532, 185, 297, 567, 687, 529, + 608, 530, 537, 537, 537, 537, 513, 513, 513, 80, + + 519, 541, 142, 493, 140, 531, 140, 670, 212, 212, + 592, 145, 608, 216, 216, 586, 494, 605, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 80, 493, 514, + 80, 142, 592, 142, 245, 245, 142, 591, 102, 145, + 573, 494, 145, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 140, 80, 142, 588, 142, 255, 177, 80, + 80, 80, 80, 589, 80, 145, 557, 557, 557, 557, + 80, 145, 145, 145, 145, 140, 145, 590, 185, 476, + + 613, 609, 145, 80, 562, 537, 537, 537, 537, 557, + 557, 557, 557, 584, 80, 145, 80, 615, 80, 566, + 375, 616, 564, 610, 608, 608, 145, 140, 145, 636, + 145, 565, 102, 621, 140, 563, 565, 647, 618, 608, + 584, 375, 142, 617, 608, 633, 608, 608, 630, 140, + 650, 648, 608, 637, 102, 622, 140, 102, 604, 670, + 646, 608, 354, 354, 540, 519, 608, 659, 375, 630, + 630, 585, 593, 593, 608, 593, 593, 593, 593, 593, + 641, 593, 593, 593, 593, 608, 593, 593, 608, 587, + 643, 630, 593, 593, 593, 593, 630, 142, 581, 102, + + 580, 670, 595, 656, 142, 650, 579, 608, 375, 662, + 608, 375, 644, 555, 375, 593, 593, 593, 630, 142, + 578, 140, 140, 578, 595, 577, 142, 576, 575, 255, + 574, 547, 664, 667, 375, 375, 630, 663, 547, 630, + 573, 657, 630, 593, 593, 593, 593, 641, 593, 593, + 593, 593, 593, 594, 593, 593, 593, 593, 630, 593, + 593, 630, 630, 630, 630, 602, 593, 593, 593, 572, + 658, 685, 670, 571, 570, 603, 670, 569, 541, 536, + 568, 375, 663, 671, 630, 630, 559, 672, 593, 593, + 593, 142, 142, 558, 670, 670, 670, 603, 670, 670, + + 257, 670, 670, 670, 670, 673, 674, 675, 446, 676, + 677, 516, 678, 679, 680, 681, 593, 593, 593, 593, + 556, 593, 593, 593, 593, 593, 553, 593, 593, 593, + 593, 552, 593, 593, 670, 551, 550, 549, 593, 593, + 593, 593, 255, 548, 547, 682, 255, 670, 595, 670, + 134, 545, 543, 542, 541, 540, 539, 490, 683, 490, + 684, 593, 593, 593, 255, 255, 255, 488, 255, 255, + 595, 255, 255, 255, 255, 488, 486, 486, 484, 484, + 482, 482, 480, 480, 536, 521, 520, 208, 201, 593, + 593, 593, 593, 364, 593, 593, 593, 593, 593, 594, + + 593, 593, 593, 593, 255, 593, 593, 517, 446, 516, + 439, 602, 593, 593, 593, 109, 511, 255, 510, 255, + 509, 603, 508, 427, 109, 501, 500, 499, 497, 496, + 416, 490, 488, 486, 593, 593, 593, 484, 482, 480, + 417, 297, 471, 603, 260, 375, 455, 454, 84, 202, + 449, 446, 364, 355, 439, 434, 433, 432, 202, 426, + 425, 424, 593, 593, 80, 423, 422, 421, 80, 80, + 420, 419, 80, 80, 80, 80, 80, 80, 80, 80, + 81, 81, 81, 81, 81, 330, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 87, + + 87, 417, 330, 208, 87, 87, 87, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 144, 208, 202, 201, 144, 144, + 144, 201, 144, 144, 144, 144, 144, 144, 144, 144, + 184, 184, 184, 184, 184, 201, 184, 184, 184, 184, + 184, 184, 184, 184, 184, 184, 184, 184, 184, 186, + + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 203, 203, + 309, 309, 307, 307, 399, 355, 260, 260, 203, 259, + 375, 203, 203, 259, 203, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 258, 258, 258, 258, 258, 258, 258, 258, + + 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, + 258, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, + 184, 184, 184, 184, 184, 184, 184, 184, 184, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 299, 299, + 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, + 299, 299, 299, 299, 299, 299, 299, 302, 302, 302, + 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, + + 302, 302, 302, 302, 302, 302, 306, 306, 347, 306, + 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, + 306, 306, 306, 306, 306, 308, 308, 367, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 310, 339, 310, 338, 364, 246, + 310, 310, 310, 355, 355, 310, 348, 348, 348, 348, + 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, + 348, 348, 348, 348, 348, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 350, 350, 350, 350, 350, 350, + + 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, + 350, 350, 350, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 353, 353, 353, 358, 238, 346, 345, 358, + 344, 358, 358, 358, 358, 343, 358, 258, 258, 258, + 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, + 258, 258, 258, 258, 258, 258, 374, 374, 374, 374, + 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, + 374, 374, 374, 374, 374, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + + 265, 265, 265, 265, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 302, 302, 302, 302, 302, 302, 302, + 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, + 302, 302, 299, 299, 299, 299, 299, 299, 299, 299, + 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, + 299, 400, 400, 400, 400, 400, 400, 400, 400, 400, + 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, + 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, + 403, 403, 403, 403, 403, 403, 403, 403, 403, 405, + + 405, 405, 405, 405, 405, 405, 405, 405, 405, 405, + 405, 405, 405, 405, 405, 405, 405, 405, 184, 184, + 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, + 184, 184, 184, 184, 184, 184, 184, 306, 306, 340, + 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, + 306, 306, 306, 306, 306, 306, 308, 308, 336, 308, + 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 408, 335, 408, 408, 334, + 333, 408, 408, 408, 332, 320, 408, 348, 348, 348, + 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, + + 348, 348, 348, 348, 348, 348, 350, 350, 350, 350, + 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, + 350, 350, 350, 350, 350, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 438, 438, 438, 438, 438, 438, + 438, 438, 438, 438, 438, 438, 438, 438, 438, 438, + 438, 438, 438, 443, 443, 320, 319, 443, 443, 318, + 443, 443, 443, 443, 443, 443, 443, 443, 443, 444, + 317, 316, 316, 315, 314, 444, 444, 444, 444, 313, + 444, 374, 374, 374, 374, 374, 374, 374, 374, 374, + + 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 468, + 468, 312, 309, 468, 468, 468, 468, 468, 468, 468, + 468, 468, 468, 468, 468, 401, 401, 401, 401, 401, + 401, 401, 401, 401, 401, 401, 401, 401, 401, 401, + 401, 401, 401, 401, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 475, 475, 475, 475, 475, 475, 475, + 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, + + 475, 475, 479, 479, 307, 479, 479, 479, 479, 479, + 479, 479, 479, 479, 479, 479, 479, 479, 479, 479, + 479, 481, 481, 296, 481, 481, 481, 481, 481, 481, + 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, + 483, 483, 260, 483, 483, 483, 483, 483, 483, 483, + 483, 483, 483, 483, 483, 483, 483, 483, 483, 485, + 485, 278, 485, 485, 485, 485, 485, 485, 485, 485, + 485, 485, 485, 485, 485, 485, 485, 485, 487, 487, + 260, 487, 487, 487, 487, 487, 487, 487, 487, 487, + 487, 487, 487, 487, 487, 487, 487, 489, 489, 260, + + 489, 489, 489, 489, 489, 489, 489, 489, 489, 489, + 489, 489, 489, 489, 489, 489, 348, 348, 348, 348, + 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, + 348, 348, 348, 348, 348, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 438, 438, 438, 438, 438, 438, + 438, 438, 438, 438, 438, 438, 438, 438, 438, 438, + 438, 438, 438, 515, 259, 257, 255, 254, 230, 515, + 515, 515, 515, 515, 515, 515, 515, 515, 522, 522, + 522, 522, 522, 522, 522, 522, 522, 522, 522, 522, + + 522, 522, 522, 522, 522, 522, 522, 535, 535, 535, + 535, 202, 535, 535, 535, 535, 535, 535, 535, 535, + 535, 535, 535, 535, 535, 535, 538, 253, 228, 125, + 231, 202, 538, 538, 538, 538, 546, 546, 229, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 594, 594, 227, 594, 594, + 594, 594, 594, 594, 594, 594, 594, 594, 594, 594, + 594, 594, 594, 594, 601, 601, 227, 601, 601, 601, + 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, + 601, 601, 601, 593, 593, 226, 593, 593, 593, 593, + + 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, + 593, 593, 629, 629, 629, 629, 629, 629, 629, 629, + 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, + 629, 651, 651, 651, 651, 651, 651, 651, 651, 651, + 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, + 654, 654, 654, 654, 654, 654, 654, 654, 654, 654, + 654, 654, 654, 654, 654, 654, 654, 654, 654, 669, + 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, + 669, 669, 669, 669, 669, 669, 669, 669, 102, 208, + 207, 201, 202, 201, 193, 185, 183, 167, 166, 163, + + 160, 159, 143, 119, 137, 134, 119, 118, 115, 112, + 111, 102, 84, 687, 3, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687 + } ; + +static yyconst flex_int16_t yy_chk[3889] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 5, 6, 6, 6, + 6, 8, 10, 10, 11, 19, 21, 45, 8, 8, + 8, 8, 16, 151, 11, 13, 11, 11, 5, 45, + 56, 11, 12, 12, 12, 13, 151, 13, 19, 12, + 21, 97, 13, 97, 12, 12, 12, 12, 12, 12, + 12, 12, 685, 24, 56, 12, 12, 12, 12, 12, + + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 27, 51, 16, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 15, 24, 15, 39, 15, 15, 15, 15, + 15, 15, 250, 28, 15, 28, 28, 49, 49, 27, + 28, 30, 30, 259, 30, 30, 30, 42, 27, 51, + 31, 31, 259, 15, 31, 31, 31, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 33, + 33, 62, 39, 62, 62, 33, 33, 33, 62, 250, + + 15, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 42, 82, 82, + 32, 25, 25, 25, 25, 29, 29, 29, 29, 29, + 32, 32, 34, 34, 59, 32, 32, 32, 665, 34, + 34, 34, 29, 32, 25, 25, 25, 35, 35, 36, + 36, 37, 37, 43, 48, 35, 35, 35, 36, 36, + 36, 37, 37, 54, 48, 123, 48, 43, 43, 43, + 43, 48, 25, 25, 26, 61, 378, 26, 26, 26, + 26, 26, 46, 318, 59, 318, 54, 46, 79, 79, + 79, 79, 46, 74, 46, 46, 123, 64, 64, 46, + + 64, 64, 64, 26, 375, 74, 375, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 661, + 61, 89, 89, 43, 63, 63, 63, 63, 63, 61, + 26, 47, 47, 47, 378, 74, 223, 139, 47, 660, + 84, 63, 223, 47, 47, 47, 47, 47, 47, 47, + 47, 93, 93, 93, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 96, 96, 96, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + + 47, 50, 84, 654, 50, 144, 50, 139, 50, 50, + 50, 50, 50, 50, 65, 65, 50, 144, 65, 65, + 65, 67, 67, 68, 68, 146, 152, 67, 67, 67, + 68, 68, 68, 146, 146, 50, 341, 146, 152, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 69, 69, 148, 71, 71, 153, 153, 341, 69, + 69, 69, 50, 60, 71, 71, 66, 148, 60, 70, + 70, 60, 60, 60, 60, 60, 66, 66, 70, 70, + 70, 66, 66, 66, 72, 233, 73, 75, 88, 66, + 88, 73, 184, 184, 316, 88, 72, 60, 73, 75, + + 600, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 76, 263, 147, 233, 77, 76, 185, + 185, 653, 72, 147, 60, 161, 263, 147, 77, 342, + 76, 77, 77, 77, 77, 186, 186, 161, 73, 83, + 94, 94, 94, 98, 75, 320, 83, 83, 83, 83, + 83, 342, 94, 98, 94, 98, 316, 161, 600, 94, + 98, 187, 187, 76, 108, 108, 108, 108, 110, 110, + 110, 110, 111, 111, 111, 111, 131, 131, 131, 131, + 120, 120, 120, 120, 162, 188, 188, 77, 87, 149, + 87, 87, 87, 87, 87, 87, 162, 149, 110, 265, + + 265, 149, 157, 157, 157, 157, 111, 320, 177, 115, + 115, 115, 115, 118, 118, 118, 118, 87, 120, 429, + 177, 87, 87, 87, 87, 87, 87, 87, 87, 87, + 87, 87, 87, 132, 132, 132, 132, 133, 133, 133, + 133, 429, 162, 235, 87, 104, 104, 104, 104, 104, + 104, 104, 104, 104, 104, 104, 104, 106, 115, 141, + 614, 118, 227, 132, 106, 177, 163, 163, 163, 163, + 180, 133, 160, 141, 141, 141, 141, 141, 158, 158, + 158, 158, 180, 235, 160, 227, 106, 298, 298, 651, + 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, + + 106, 106, 209, 159, 159, 159, 159, 227, 158, 499, + 160, 165, 209, 106, 109, 163, 109, 614, 285, 209, + 285, 109, 109, 165, 499, 109, 180, 384, 109, 141, + 285, 178, 166, 166, 166, 166, 109, 159, 109, 384, + 165, 299, 299, 178, 109, 109, 210, 210, 210, 210, + 109, 168, 168, 168, 168, 109, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 167, 179, 181, 384, 122, 122, 122, 122, + 166, 649, 174, 178, 167, 179, 181, 182, 647, 168, + 174, 174, 174, 174, 174, 194, 175, 267, 182, 122, + + 122, 122, 194, 176, 175, 175, 175, 175, 175, 275, + 167, 176, 176, 176, 176, 176, 211, 211, 211, 211, + 181, 275, 300, 300, 194, 179, 641, 122, 122, 124, + 124, 124, 124, 124, 175, 124, 124, 124, 124, 124, + 124, 214, 440, 124, 124, 176, 640, 267, 214, 124, + 124, 194, 124, 189, 189, 440, 267, 182, 190, 190, + 189, 189, 189, 189, 189, 190, 190, 190, 190, 275, + 214, 340, 124, 124, 212, 212, 212, 212, 215, 215, + 215, 215, 216, 216, 216, 216, 224, 224, 224, 224, + 244, 244, 244, 244, 301, 301, 575, 214, 302, 302, + + 124, 124, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 127, 127, 303, 303, 224, 127, + 348, 575, 127, 127, 127, 127, 127, 340, 127, 639, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 635, + 350, 348, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 130, + 350, 225, 225, 225, 225, 257, 130, 130, 130, 130, + + 257, 257, 130, 632, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 225, 232, 232, 232, 232, 322, 261, + 130, 150, 150, 150, 261, 262, 400, 400, 150, 379, + 262, 261, 322, 150, 150, 631, 150, 150, 150, 150, + 150, 379, 262, 379, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 232, 349, 359, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + + 150, 154, 626, 195, 625, 349, 195, 195, 195, 195, + 195, 245, 256, 154, 234, 234, 234, 234, 245, 245, + 245, 245, 359, 363, 245, 268, 256, 256, 256, 256, + 402, 402, 195, 268, 268, 268, 268, 268, 624, 154, + 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, + 154, 155, 245, 403, 403, 246, 264, 234, 155, 195, + 277, 264, 246, 246, 246, 246, 271, 289, 246, 289, + 363, 458, 277, 264, 271, 271, 271, 271, 271, 289, + 155, 623, 256, 377, 155, 155, 155, 155, 155, 155, + 155, 155, 155, 155, 155, 155, 246, 310, 310, 310, + + 310, 426, 277, 331, 331, 331, 331, 155, 169, 169, + 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, + 170, 170, 620, 388, 426, 170, 619, 377, 170, 170, + 170, 170, 170, 458, 170, 388, 170, 170, 170, 170, + 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, + 170, 170, 170, 170, 170, 351, 351, 351, 170, 170, + 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, + 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, + 170, 170, 170, 172, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 173, 173, 441, 351, 471, + + 173, 404, 404, 173, 173, 173, 173, 173, 471, 173, + 441, 173, 173, 173, 173, 173, 173, 173, 173, 173, + 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, + 405, 405, 617, 173, 173, 173, 173, 173, 173, 173, + 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, + 173, 173, 173, 173, 173, 173, 173, 173, 213, 213, + 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, + 217, 354, 354, 354, 354, 273, 445, 217, 616, 217, + 274, 291, 292, 273, 273, 273, 273, 273, 274, 274, + 274, 274, 274, 291, 292, 406, 406, 457, 612, 217, + + 406, 611, 421, 217, 217, 217, 217, 217, 217, 217, + 217, 217, 217, 217, 217, 273, 421, 421, 610, 357, + 274, 291, 292, 445, 472, 472, 217, 236, 236, 236, + 236, 236, 357, 236, 236, 236, 236, 236, 236, 276, + 278, 236, 236, 279, 276, 278, 280, 236, 236, 293, + 236, 294, 278, 457, 293, 279, 276, 281, 280, 609, + 357, 293, 276, 294, 287, 281, 281, 281, 281, 281, + 236, 236, 287, 287, 287, 287, 287, 474, 474, 396, + 370, 290, 475, 475, 276, 295, 607, 290, 442, 279, + 370, 396, 370, 290, 360, 280, 295, 370, 236, 236, + + 237, 442, 305, 305, 456, 456, 456, 360, 294, 305, + 305, 305, 305, 237, 281, 237, 237, 237, 237, 237, + 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, + 237, 237, 237, 237, 290, 360, 408, 408, 408, 408, + 606, 237, 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 247, 295, 536, 536, 452, 311, + 452, 436, 436, 436, 561, 452, 311, 247, 311, 247, + 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, + 247, 247, 247, 247, 247, 247, 247, 247, 311, 321, + 598, 329, 325, 321, 389, 247, 269, 435, 329, 325, + + 321, 325, 356, 356, 436, 510, 389, 356, 269, 361, + 356, 356, 356, 356, 371, 311, 356, 376, 380, 510, + 329, 325, 361, 389, 371, 376, 371, 561, 435, 376, + 380, 371, 380, 570, 269, 269, 269, 269, 269, 269, + 269, 269, 269, 269, 269, 269, 272, 329, 325, 383, + 361, 321, 385, 272, 387, 272, 391, 383, 383, 383, + 383, 383, 393, 393, 385, 478, 387, 393, 391, 582, + 393, 393, 393, 393, 393, 272, 393, 387, 478, 272, + 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, + 272, 368, 523, 523, 523, 570, 498, 390, 391, 387, + + 385, 392, 272, 282, 282, 368, 368, 368, 368, 390, + 498, 498, 613, 392, 525, 282, 524, 282, 582, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 560, 560, + 662, 390, 597, 392, 583, 282, 283, 283, 283, 283, + 283, 283, 283, 283, 283, 283, 283, 283, 288, 591, + 394, 368, 394, 589, 524, 588, 525, 613, 628, 628, + 587, 288, 394, 288, 288, 288, 288, 288, 288, 288, + 288, 288, 288, 288, 288, 288, 288, 288, 288, 288, + 288, 288, 439, 439, 439, 662, 583, 698, 698, 288, + + 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, + 328, 328, 381, 381, 381, 381, 381, 381, 381, 381, + 381, 381, 381, 381, 386, 395, 416, 397, 427, 386, + 450, 395, 398, 461, 581, 439, 463, 395, 416, 397, + 465, 386, 450, 398, 460, 461, 462, 464, 463, 460, + 592, 462, 465, 467, 580, 466, 463, 427, 467, 464, + 461, 460, 468, 462, 468, 469, 427, 466, 493, 579, + 467, 667, 592, 470, 468, 494, 532, 469, 395, 397, + 386, 493, 427, 461, 470, 477, 477, 532, 494, 464, + 593, 465, 477, 477, 477, 477, 513, 513, 513, 526, + + 450, 526, 398, 418, 567, 466, 586, 668, 699, 699, + 577, 526, 593, 700, 700, 567, 418, 586, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 459, 459, 513, + 527, 667, 576, 470, 703, 703, 532, 574, 599, 459, + 572, 459, 527, 459, 459, 459, 459, 459, 459, 459, + 459, 459, 459, 459, 459, 459, 459, 459, 459, 459, + 459, 459, 518, 528, 567, 571, 586, 668, 527, 529, + 530, 531, 562, 573, 563, 528, 518, 518, 518, 518, + 564, 529, 530, 531, 562, 557, 563, 573, 537, 537, + + 599, 595, 564, 565, 528, 537, 537, 537, 537, 557, + 557, 557, 557, 562, 566, 565, 585, 602, 604, 531, + 615, 603, 530, 595, 621, 622, 566, 605, 585, 621, + 604, 564, 627, 608, 618, 529, 530, 634, 605, 608, + 563, 629, 518, 603, 602, 618, 621, 622, 615, 633, + 636, 634, 636, 622, 642, 608, 646, 656, 585, 669, + 633, 608, 719, 719, 569, 557, 602, 646, 630, 629, + 615, 566, 578, 578, 636, 578, 578, 578, 578, 578, + 627, 578, 578, 578, 578, 637, 578, 578, 650, 568, + 630, 629, 578, 578, 578, 578, 630, 605, 559, 666, + + 558, 684, 578, 642, 618, 637, 556, 637, 643, 656, + 650, 657, 630, 554, 644, 578, 578, 578, 630, 633, + 553, 659, 664, 552, 578, 551, 646, 550, 549, 669, + 548, 547, 659, 664, 658, 663, 643, 657, 546, 657, + 545, 643, 644, 578, 578, 584, 584, 666, 584, 584, + 584, 584, 584, 584, 584, 584, 584, 584, 643, 584, + 584, 657, 658, 663, 644, 584, 584, 584, 584, 543, + 644, 684, 670, 542, 540, 584, 671, 539, 538, 535, + 534, 522, 658, 670, 658, 663, 521, 671, 584, 584, + 584, 659, 664, 520, 672, 673, 674, 584, 675, 676, + + 519, 677, 678, 679, 680, 672, 673, 674, 517, 675, + 676, 515, 677, 678, 679, 680, 584, 584, 594, 594, + 511, 594, 594, 594, 594, 594, 509, 594, 594, 594, + 594, 508, 594, 594, 681, 507, 506, 505, 594, 594, + 594, 594, 670, 504, 503, 681, 671, 682, 594, 683, + 502, 500, 497, 496, 495, 492, 491, 490, 682, 489, + 683, 594, 594, 594, 672, 673, 674, 488, 675, 676, + 594, 677, 678, 679, 680, 487, 486, 485, 484, 483, + 482, 481, 480, 479, 473, 455, 454, 453, 451, 594, + 594, 601, 601, 449, 601, 601, 601, 601, 601, 601, + + 601, 601, 601, 601, 681, 601, 601, 447, 444, 443, + 438, 601, 601, 601, 601, 434, 433, 682, 432, 683, + 431, 601, 430, 428, 425, 424, 423, 422, 420, 419, + 415, 414, 413, 412, 601, 601, 601, 411, 410, 409, + 407, 401, 399, 601, 382, 374, 373, 372, 369, 367, + 365, 362, 358, 353, 352, 347, 346, 345, 344, 339, + 338, 337, 601, 601, 688, 336, 335, 334, 688, 688, + 333, 332, 688, 688, 688, 688, 688, 688, 688, 688, + 689, 689, 689, 689, 689, 327, 689, 689, 689, 689, + 689, 689, 689, 689, 689, 689, 689, 689, 689, 690, + + 690, 326, 324, 319, 690, 690, 690, 691, 691, 691, + 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, + 691, 691, 691, 691, 691, 691, 692, 692, 692, 692, + 692, 692, 692, 692, 692, 692, 692, 692, 692, 692, + 692, 692, 692, 692, 692, 693, 693, 693, 693, 693, + 693, 693, 693, 693, 693, 693, 693, 693, 693, 693, + 693, 693, 693, 693, 694, 317, 315, 314, 694, 694, + 694, 313, 694, 694, 694, 694, 694, 694, 694, 694, + 695, 695, 695, 695, 695, 312, 695, 695, 695, 695, + 695, 695, 695, 695, 695, 695, 695, 695, 695, 696, + + 696, 696, 696, 696, 696, 696, 696, 696, 696, 696, + 696, 696, 696, 696, 696, 696, 696, 696, 697, 697, + 309, 308, 307, 306, 296, 286, 284, 270, 697, 266, + 260, 697, 697, 258, 697, 701, 701, 701, 701, 701, + 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, + 701, 701, 701, 701, 702, 702, 702, 702, 702, 702, + 702, 702, 702, 702, 702, 702, 702, 702, 702, 702, + 702, 702, 702, 704, 704, 704, 704, 704, 704, 704, + 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, + 704, 704, 705, 705, 705, 705, 705, 705, 705, 705, + + 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, + 705, 706, 706, 706, 706, 706, 706, 706, 706, 706, + 706, 706, 706, 706, 706, 706, 706, 706, 706, 706, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 708, + 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, + 708, 708, 708, 708, 708, 708, 708, 708, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 710, 710, 710, + 710, 710, 710, 710, 710, 710, 710, 710, 710, 710, + + 710, 710, 710, 710, 710, 710, 711, 711, 254, 711, + 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, + 711, 711, 711, 711, 711, 712, 712, 253, 712, 712, + 712, 712, 712, 712, 712, 712, 712, 712, 712, 712, + 712, 712, 712, 712, 713, 252, 713, 251, 249, 248, + 713, 713, 713, 243, 242, 713, 714, 714, 714, 714, + 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, + 714, 714, 714, 714, 714, 715, 715, 715, 715, 715, + 715, 715, 715, 715, 715, 715, 715, 715, 715, 715, + 715, 715, 715, 715, 716, 716, 716, 716, 716, 716, + + 716, 716, 716, 716, 716, 716, 716, 716, 716, 716, + 716, 716, 716, 717, 717, 717, 717, 717, 717, 717, + 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, + 717, 717, 718, 718, 718, 720, 241, 231, 230, 720, + 229, 720, 720, 720, 720, 228, 720, 721, 721, 721, + 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, + 721, 721, 721, 721, 721, 721, 722, 722, 722, 722, + 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, + 722, 722, 722, 722, 722, 723, 723, 723, 723, 723, + 723, 723, 723, 723, 723, 723, 723, 723, 723, 723, + + 723, 723, 723, 723, 724, 724, 724, 724, 724, 724, + 724, 724, 724, 724, 724, 724, 724, 724, 724, 724, + 724, 724, 724, 725, 725, 725, 725, 725, 725, 725, + 725, 725, 725, 725, 725, 725, 725, 725, 725, 725, + 725, 725, 726, 726, 726, 726, 726, 726, 726, 726, + 726, 726, 726, 726, 726, 726, 726, 726, 726, 726, + 726, 727, 727, 727, 727, 727, 727, 727, 727, 727, + 727, 727, 727, 727, 727, 727, 727, 727, 727, 727, + 728, 728, 728, 728, 728, 728, 728, 728, 728, 728, + 728, 728, 728, 728, 728, 728, 728, 728, 728, 729, + + 729, 729, 729, 729, 729, 729, 729, 729, 729, 729, + 729, 729, 729, 729, 729, 729, 729, 729, 730, 730, + 730, 730, 730, 730, 730, 730, 730, 730, 730, 730, + 730, 730, 730, 730, 730, 730, 730, 731, 731, 226, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 732, 732, 222, 732, + 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, + 732, 732, 732, 732, 732, 733, 221, 733, 733, 220, + 219, 733, 733, 733, 218, 208, 733, 734, 734, 734, + 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, + + 734, 734, 734, 734, 734, 734, 735, 735, 735, 735, + 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, + 735, 735, 735, 735, 735, 736, 736, 736, 736, 736, + 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, + 736, 736, 736, 736, 737, 737, 737, 737, 737, 737, + 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, + 737, 737, 737, 738, 738, 207, 206, 738, 738, 205, + 738, 738, 738, 738, 738, 738, 738, 738, 738, 739, + 204, 201, 200, 199, 198, 739, 739, 739, 739, 197, + 739, 740, 740, 740, 740, 740, 740, 740, 740, 740, + + 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, + 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, + 741, 741, 741, 741, 741, 741, 741, 741, 741, 742, + 742, 196, 192, 742, 742, 742, 742, 742, 742, 742, + 742, 742, 742, 742, 742, 743, 743, 743, 743, 743, + 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, + 743, 743, 743, 743, 744, 744, 744, 744, 744, 744, + 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, + 744, 744, 744, 745, 745, 745, 745, 745, 745, 745, + 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, + + 745, 745, 746, 746, 191, 746, 746, 746, 746, 746, + 746, 746, 746, 746, 746, 746, 746, 746, 746, 746, + 746, 747, 747, 183, 747, 747, 747, 747, 747, 747, + 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, + 748, 748, 171, 748, 748, 748, 748, 748, 748, 748, + 748, 748, 748, 748, 748, 748, 748, 748, 748, 749, + 749, 164, 749, 749, 749, 749, 749, 749, 749, 749, + 749, 749, 749, 749, 749, 749, 749, 749, 750, 750, + 156, 750, 750, 750, 750, 750, 750, 750, 750, 750, + 750, 750, 750, 750, 750, 750, 750, 751, 751, 145, + + 751, 751, 751, 751, 751, 751, 751, 751, 751, 751, + 751, 751, 751, 751, 751, 751, 752, 752, 752, 752, + 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, + 752, 752, 752, 752, 752, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 754, 754, 754, 754, 754, 754, + 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, + 754, 754, 754, 755, 143, 142, 140, 138, 137, 755, + 755, 755, 755, 755, 755, 755, 755, 755, 756, 756, + 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, + + 756, 756, 756, 756, 756, 756, 756, 757, 757, 757, + 757, 136, 757, 757, 757, 757, 757, 757, 757, 757, + 757, 757, 757, 757, 757, 757, 758, 135, 134, 121, + 119, 117, 758, 758, 758, 758, 759, 759, 116, 759, + 759, 759, 759, 759, 759, 759, 759, 759, 759, 759, + 759, 759, 759, 759, 759, 760, 760, 114, 760, 760, + 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, + 760, 760, 760, 760, 761, 761, 113, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 762, 762, 112, 762, 762, 762, 762, + + 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, + 762, 762, 763, 763, 763, 763, 763, 763, 763, 763, + 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, + 763, 764, 764, 764, 764, 764, 764, 764, 764, 764, + 764, 764, 764, 764, 764, 764, 764, 764, 764, 764, + 765, 765, 765, 765, 765, 765, 765, 765, 765, 765, + 765, 765, 765, 765, 765, 765, 765, 765, 765, 766, + 766, 766, 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, 101, 99, + 95, 92, 91, 90, 86, 81, 78, 58, 57, 55, + + 53, 52, 44, 41, 40, 38, 23, 22, 20, 18, + 17, 14, 9, 3, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 687, 687, 687 + } ; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +static yy_state_type *yy_state_buf=0, *yy_state_ptr=0; +static char *yy_full_match; +static int yy_lp; +static int yy_looking_for_trail_begin = 0; +static int yy_full_lp; +static int *yy_full_state; +#define YY_TRAILING_MASK 0x2000 +#define YY_TRAILING_HEAD_MASK 0x4000 +#define REJECT \ +{ \ +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \ +yy_cp = (yy_full_match); /* restore poss. backed-over text */ \ +(yy_lp) = (yy_full_lp); /* restore orig. accepting pos. */ \ +(yy_state_ptr) = (yy_full_state); /* restore orig. state */ \ +yy_current_state = *(yy_state_ptr); /* restore curr. state */ \ +++(yy_lp); \ +goto find_rule; \ +} + +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "parser.l" +#line 8 "parser.l" +/* + * parser.l -- lex parser of algebraic chess moves for XBoard + * + * Copyright 1991 by Digital Equipment Corporation, Maynard, + * Massachusetts. + * + * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, + * 2006, 2007, 2008, 2009 Free Software Foundation, Inc. + * + * The following terms apply to Digital Equipment Corporation's copyright + * interest in XBoard: + * ------------------------------------------------------------------------ + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * ------------------------------------------------------------------------ + * + * The following terms apply to the enhanced version of XBoard + * distributed by the Free Software Foundation: + * ------------------------------------------------------------------------ + * + * GNU XBoard is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * GNU XBoard is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + *------------------------------------------------------------------------ + ** See the file ChangeLog for a revision history. */ + +/* This parser handles all forms of promotion. + * The parser resolves ambiguous moves by searching and check-testing. + * It also parses comments of the form [anything] or (anything). + * + * [HGM] Parser extensively modified for bigger boards, Shogi-like syntax, + * and unknow pieces. All pieces are now mandatory upper case, but can be + * any letter A-Z. Files must be lower case (as before), but can run upto 'l'. + * Ranks can be 0-9. The parser returns 0 for off-board files and ranks. + * For an unknown piece (as mover or promotion piece) it returns + * IllegalMove, like it does when the piece doesn't match. + * Promotions can now also be appended Shogi-style, a bare '=' or '+', + * and this is then returned as promotion character. The piece indicator + * can be prefixed by a '+' to indicate it is a promoted piece. + */ + +#include "config.h" + +#define NO_CONSTRAINT -1 +#undef YYLMAX +#define YYLMAX 4096 +#define UNPUT_BUF_SIZE YYLMAX + +#ifdef FLEX_SCANNER +/* yytext is probably a char*, but could be a char[]. yy_text is set + in YY_DECL below, because if yytext is a char*, its value is not + constant. */ +char *yy_text; +#else /*!FLEX_SCANNER*/ +/* yytext is definitely a char[], so yy_text can be set here, statically. */ +char *yy_text = (char *) yytext; +#endif + +#ifdef FLEX_SCANNER +/* This is flex */ +/* [AP] use prototypes in function declarations */ +#define YY_USE_PROTOS + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif +/* end of [AP] fix */ + +#undef YY_INPUT +#define YY_INPUT(buf, result, max_size) my_yy_input(buf, &result, max_size) +#undef YY_DECL +#define YY_DECL \ + int _yylex YY_PROTO((void)); \ + int yylex YY_PROTO((void)) \ + { \ + int result = _yylex(); \ + yy_text = (char *) yytext; \ + return(result); \ + } \ + int _yylex YY_PROTO((void)) +#else +/* This is lex */ +#undef input +#undef output +#undef unput +#endif + +/* The includes must be here, below the #undef input */ + +#include + +#if STDC_HEADERS +# include +# include +#else /* not STDC_HEADERS */ +# if HAVE_STRING_H +# include +# else /* not HAVE_STRING_H */ +# include +# endif /* not HAVE_STRING_H */ +#endif /* not STDC_HEADERS */ + +#if HAVE_UNISTD_H +# include +#endif + +#if defined(_amigados) +# include +# if HAVE_FCNTL_H +# include /* isatty() prototype */ +# endif /* HAVE_FCNTL_H */ +#endif /* defined(_amigados) */ + +#include "common.h" +#include "backend.h" +#include "frontend.h" +#include "parser.h" +#include "moves.h" + +extern int PosFlags P((int)); + +extern Board boards[MAX_MOVES]; +int yyboardindex; +int yyskipmoves = FALSE; +char currentMoveString[YYLMAX]; +#ifndef FLEX_SCANNER +char unputBuffer[UNPUT_BUF_SIZE]; +int unputCount = 0; +#endif + +#ifdef FLEX_SCANNER +void my_yy_input P((char *buf, int *result, int max_size)); +#else /*!FLEX_SCANNER*/ +static int input P((void)); +static void output P((int ch)); +static void unput P((int ch)); +int yylook P((void)); +int yyback P((int *, int)); +#endif +#undef yywrap +int yywrap P((void)); +extern void CopyBoard P((Board to, Board from)); + +#line 1809 "parser.c" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (void ); +#else +extern int yywrap (void ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + if ( yyleng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (yytext[yyleng - 1] == '\n'); \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 179 "parser.l" + + +#line 1968 "parser.c" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + /* Create the reject buffer large enough to save one state per allowed character. */ + if ( ! (yy_state_buf) ) + (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE ); + if ( ! (yy_state_buf) ) + YY_FATAL_ERROR( "out of dynamic memory in yylex()" ); + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); + + (yy_state_ptr) = (yy_state_buf); + *(yy_state_ptr)++ = yy_current_state; + +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 688 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *(yy_state_ptr)++ = yy_current_state; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 3815 ); + +yy_find_action: + yy_current_state = *--(yy_state_ptr); + (yy_lp) = yy_accept[yy_current_state]; +find_rule: /* we branch to this label when backing up */ + for ( ; ; ) /* until we find what rule we matched */ + { + if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] ) + { + yy_act = yy_acclist[(yy_lp)]; + if ( yy_act & YY_TRAILING_HEAD_MASK || + (yy_looking_for_trail_begin) ) + { + if ( yy_act == (yy_looking_for_trail_begin) ) + { + (yy_looking_for_trail_begin) = 0; + yy_act &= ~YY_TRAILING_HEAD_MASK; + break; + } + } + else if ( yy_act & YY_TRAILING_MASK ) + { + (yy_looking_for_trail_begin) = yy_act & ~YY_TRAILING_MASK; + (yy_looking_for_trail_begin) |= YY_TRAILING_HEAD_MASK; + } + else + { + (yy_full_match) = yy_cp; + (yy_full_state) = (yy_state_ptr); + (yy_full_lp) = (yy_lp); + break; + } + ++(yy_lp); + goto find_rule; + } + --yy_cp; + yy_current_state = *--(yy_state_ptr); + (yy_lp) = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ +case 1: +YY_RULE_SETUP +#line 181 "parser.l" +{ + /* + * Fully-qualified algebraic move, possibly with promotion + */ + int skip1 = 0, skip2 = 0, skip3 = 0, promoted = 0; + ChessSquare piece; + ChessMove result; + char c; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + if (yytext[0] == '+') skip1 = skip3 = promoted = 1; /* [HGM] Shogi promoted */ + + /* remove the / */ + if (yytext[1+skip1] == '/') skip1++; + + /* remove the [xX:-] */ + if ((yytext[3+skip1] == 'x') || (yytext[3+skip1] == 'X') || + (yytext[3+skip1] == '-') || (yytext[3+skip1] == ':')) skip2 = 1; + + currentMoveString[0] = yytext[1+skip1]; + currentMoveString[1] = yytext[2+skip1]; + currentMoveString[2] = yytext[3+skip1+skip2]; + currentMoveString[3] = yytext[4+skip1+skip2]; + currentMoveString[4] = NULLCHAR; + + if (appData.debugMode) { + fprintf(debugFP, "Parser Qa1b2: yyleng=%d\n", + yyleng); + } + + if (yyleng-skip1-skip2 > 5) { char c; + if (yytext[yyleng-1] == ')') { + c = currentMoveString[4] = ToLower(yytext[yyleng-2]); + } else { + c = currentMoveString[4] = ToLower(yytext[yyleng-1]); + } + currentMoveString[5] = NULLCHAR; + if(c != '=' && c != '+' && CharToPiece(c) == EmptySquare) + return IllegalMove; /* [HGM] promotion to invalid piece */ + } + + if (appData.debugMode) { + fprintf(debugFP, "parser: %s\n", currentMoveString); + } + /* [HGM] do not allow values beyond board size */ + if(currentMoveString[1] - ONE >= BOARD_HEIGHT || + currentMoveString[1] - ONE < 0 || + currentMoveString[0] - AAA >= BOARD_RGHT || + currentMoveString[3] - ONE >= BOARD_HEIGHT || + currentMoveString[3] - ONE < 0 || + currentMoveString[2] - AAA >= BOARD_RGHT || + currentMoveString[0] - AAA < BOARD_LEFT || + currentMoveString[2] - AAA < BOARD_LEFT ) + return 0; + + piece = boards[yyboardindex] + [currentMoveString[1] - ONE][currentMoveString[0] - AAA]; + if(promoted) piece = (ChessSquare) (DEMOTED piece); + c = PieceToChar(piece); + if(c == '~') c = PieceToChar((ChessSquare) (DEMOTED piece)); + if (ToLower(yytext[skip3]) != ToLower(c)) + return (int) IllegalMove; + + result = LegalityTest(boards[yyboardindex], + PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.! + currentMoveString[1] - ONE, + currentMoveString[0] - AAA, + currentMoveString[3] - ONE, + currentMoveString[2] - AAA, + currentMoveString[4]); + + if (currentMoveString[4] == NULLCHAR && + (result == WhitePromotionKnight || result == BlackPromotionKnight || + result == WhitePromotionQueen || result == BlackPromotionQueen)) { + currentMoveString[4] = PieceToChar(BlackQueen); + currentMoveString[5] = NULLCHAR; + } + + return (int) result; +} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 263 "parser.l" +{ + /* + * Simple algebraic move, possibly with promotion + * [HGM] Engine moves are received in this format, with lower-case promoChar! + */ + int skip = 0; + ChessMove result; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + /* remove the [xX:-] */ + if ((yytext[2] == 'x') || (yytext[2] == 'X') || + (yytext[2] == '-') || (yytext[2] == ':')) skip = 1; + + currentMoveString[0] = yytext[0]; + currentMoveString[1] = yytext[1]; + currentMoveString[2] = yytext[2+skip]; + currentMoveString[3] = yytext[3+skip]; + currentMoveString[4] = NULLCHAR; + + if (yyleng-skip > 4) { char c; + if (yytext[yyleng-1] == ')') { + c = currentMoveString[4] = ToLower(yytext[yyleng-2]); + } else { + c = currentMoveString[4] = ToLower(yytext[yyleng-1]); + } + currentMoveString[5] = NULLCHAR; + if(c != '=' && c != '+' && CharToPiece(c) == EmptySquare) + return IllegalMove; + } + + /* [HGM] do not allow values beyond board size */ + if(currentMoveString[1] - ONE >= BOARD_HEIGHT || + currentMoveString[1] - ONE < 0 || + currentMoveString[0] - AAA >= BOARD_RGHT || + currentMoveString[3] - ONE >= BOARD_HEIGHT || + currentMoveString[3] - ONE < 0 || + currentMoveString[2] - AAA >= BOARD_RGHT || + currentMoveString[0] - AAA < BOARD_LEFT || + currentMoveString[2] - AAA < BOARD_LEFT ) + return 0; + + result = LegalityTest(boards[yyboardindex], + PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.! + currentMoveString[1] - ONE, + currentMoveString[0] - AAA, + currentMoveString[3] - ONE, + currentMoveString[2] - AAA, + currentMoveString[4]); + + if (currentMoveString[4] == NULLCHAR && + (result == WhitePromotionKnight || result == BlackPromotionKnight || + result == WhitePromotionQueen || result == BlackPromotionQueen)) { + if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || gameInfo.variant == VariantMakruk) + currentMoveString[4] = PieceToChar(BlackFerz); + else if(gameInfo.variant == VariantGreat) + currentMoveString[4] = PieceToChar(BlackMan); + else + currentMoveString[4] = PieceToChar(BlackQueen); + currentMoveString[5] = NULLCHAR; + } + + return (int) result; +} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 328 "parser.l" +{ + /* + * Pawn move, possibly with promotion + */ + DisambiguateClosure cl; + int skip = 0; char c; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + /* remove the =() */ + if (yytext[2] == '=' && yytext[3] != NULLCHAR) skip++; + if (yytext[2+skip] == '(') skip++; + + cl.pieceIn = WhiteOnMove(yyboardindex) ? WhitePawn : BlackPawn; + cl.rfIn = -1; + cl.ffIn = yytext[0] - AAA; + cl.rtIn = yytext[1] - ONE; + cl.ftIn = yytext[0] - AAA; + c = cl.promoCharIn = yytext[2+skip]; + + /* [HGM] do not allow values beyond board size */ + if(cl.rtIn >= BOARD_HEIGHT || + cl.rtIn < 0 || + cl.ffIn >= BOARD_RGHT || + cl.ftIn < BOARD_LEFT ) + return 0; + + if(c != '=' && c != '+' && c != NULLCHAR && CharToPiece(c) == EmptySquare) + return IllegalMove; + + + Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl); + + currentMoveString[0] = cl.ff + AAA; + currentMoveString[1] = cl.rf + ONE; + currentMoveString[2] = cl.ft + AAA; + currentMoveString[3] = cl.rt + ONE; + currentMoveString[4] = cl.promoChar; + currentMoveString[5] = NULLCHAR; + + return (int) cl.kind; +} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 372 "parser.l" +{ + /* + * Pawn capture, possibly with promotion, possibly ambiguous + */ + DisambiguateClosure cl; + int skip1 = 0, skip2 = 0; char c; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + /* remove trailing ep or e.p. (nonstandard PGN) */ + if (yytext[yyleng-1] == 'p') { + yyleng -= 2; + yytext[yyleng] = NULLCHAR; + } else if (yytext[yyleng-1] == '.') { + yyleng -= 4; + yytext[yyleng] = NULLCHAR; + } + + /* remove the [xX:-] and =() */ + if ((yytext[1] == 'x') || (yytext[1] == 'X') + || (yytext[1] == ':') || (yytext[1] == '-')) skip1 = 1; + if (yytext[2+skip1] == '=' && yytext[3+skip1] != NULLCHAR) skip2++; + if (yytext[2+skip1+skip2] == '(') skip2++; + + cl.pieceIn = WhiteOnMove(yyboardindex) ? WhitePawn : BlackPawn; + cl.rfIn = -1; + cl.ffIn = yytext[0] - AAA; + cl.rtIn = -1; + cl.ftIn = yytext[1+skip1] - AAA; + c = cl.promoCharIn = yytext[2+skip1+skip2]; + + /* [HGM] do not allow values beyond board size */ + if(cl.ffIn >= BOARD_RGHT || + cl.ffIn < BOARD_LEFT || + cl.ftIn >= BOARD_RGHT || + cl.ftIn < BOARD_LEFT ) + return 0; + + if(c != '=' && c != '+' && c != NULLCHAR && CharToPiece(c) == EmptySquare) + return IllegalMove; + + Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl); + + currentMoveString[0] = cl.ff + AAA; + currentMoveString[1] = cl.rf + ONE; + currentMoveString[2] = cl.ft + AAA; + currentMoveString[3] = cl.rt + ONE; + currentMoveString[4] = cl.promoChar; + currentMoveString[5] = NULLCHAR; + + return (int) cl.kind; +} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 425 "parser.l" +{ + /* + * unambiguously abbreviated Pawn capture, possibly with promotion + */ + int skip = 0; + ChessMove result; char c; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + /* remove trailing ep or e.p. (nonstandard PGN) */ + if (yytext[yyleng-1] == 'p') { + yyleng -= 2; + yytext[yyleng] = NULLCHAR; + } else if (yytext[yyleng-1] == '.') { + yyleng -= 4; + yytext[yyleng] = NULLCHAR; + } + + /* remove the [xX:-] */ + if ((yytext[1] == 'x') || (yytext[1] == 'X') + || (yytext[1] == ':') || (yytext[1] == '-')) skip = 1; + + currentMoveString[0] = yytext[0]; + currentMoveString[2] = yytext[1+skip]; + currentMoveString[3] = yytext[2+skip]; + + /* [HGM] do not allow values beyond board size */ + if(currentMoveString[0] - AAA >= BOARD_RGHT || + currentMoveString[3] - ONE >= BOARD_HEIGHT || + currentMoveString[3] - ONE < 0 || + currentMoveString[2] - AAA >= BOARD_RGHT || + currentMoveString[0] - AAA < BOARD_LEFT || + currentMoveString[2] - AAA < BOARD_LEFT ) + return 0; + + if (gameInfo.variant == VariantXiangqi && /* [HGM] In Xiangqi rank stays same */ + currentMoveString[0] != currentMoveString[2] ) { + currentMoveString[1] = yytext[2+skip]; + } else + if (WhiteOnMove(yyboardindex)) { + if (yytext[2+skip] == ONE) return (int) ImpossibleMove; + currentMoveString[1] = yytext[2+skip] - 1; + if(boards[yyboardindex][currentMoveString[1]-ONE][currentMoveString[0]-AAA] != WhitePawn) + return ImpossibleMove; + } else { + currentMoveString[1] = currentMoveString[3] + 1; + if (currentMoveString[3] == ONE+BOARD_HEIGHT-1) return (int) ImpossibleMove; + if(boards[yyboardindex][currentMoveString[1]-ONE][currentMoveString[0]-AAA] != BlackPawn) + return ImpossibleMove; + } + if (yyleng-skip > 3) { + if (yytext[yyleng-1] == ')') + c = currentMoveString[4] = ToLower(yytext[yyleng-2]); + else + c = currentMoveString[4] = ToLower(yytext[yyleng-1]); + currentMoveString[5] = NULLCHAR; + if(c != '=' && c != '+' && CharToPiece(c) == EmptySquare) + return IllegalMove; + } else { + currentMoveString[4] = NULLCHAR; + } + + result = LegalityTest(boards[yyboardindex], + PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.! + currentMoveString[1] - ONE, + currentMoveString[0] - AAA, + currentMoveString[3] - ONE, + currentMoveString[2] - AAA, + currentMoveString[4]); + + if (currentMoveString[4] == NULLCHAR && + (result == WhitePromotionQueen || result == BlackPromotionQueen || + result == WhitePromotionKnight || result == BlackPromotionKnight)) { + currentMoveString[4] = PieceToChar(BlackQueen); + // [HGM] shatranj: take care of variants without Queen + if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || gameInfo.variant == VariantMakruk) + currentMoveString[4] = PieceToChar(BlackFerz); + if(gameInfo.variant == VariantGreat) + currentMoveString[4] = PieceToChar(BlackMan); + currentMoveString[5] = NULLCHAR; + } + + if (result != IllegalMove) return (int) result; + + /* Special case: improperly written en passant capture */ + if (WhiteOnMove(yyboardindex)) { + if (currentMoveString[3] == '5') { + currentMoveString[1] = '5'; + currentMoveString[3] = '6'; + } else { + return (int) IllegalMove; + } + } else { + if (currentMoveString[3] == '4') { + currentMoveString[1] = '4'; + currentMoveString[3] = '3'; + } else { + return (int) IllegalMove; + } + } + + result = LegalityTest(boards[yyboardindex], + PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.! + currentMoveString[1] - ONE, + currentMoveString[0] - AAA, + currentMoveString[3] - ONE, + currentMoveString[2] - AAA, + currentMoveString[4]); + + if (result == WhiteCapturesEnPassant || result == BlackCapturesEnPassant) + return (int) result; + else + return (int) IllegalMove; +} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 540 "parser.l" +{ + /* + * piece move, possibly ambiguous + */ + DisambiguateClosure cl; + int skip = 0, skip2 = 0, promoted = 0; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + if(yytext[0] == '+') promoted = skip = skip2 = 1; + + /* remove the [xX:-] */ + if ((yytext[1+skip] == 'x') || (yytext[1+skip] == 'X') + || (yytext[1+skip] == ':') || (yytext[1+skip] == '-')) skip++; + + if (WhiteOnMove(yyboardindex)) { + cl.pieceIn = CharToPiece(ToUpper(yytext[skip2])); + } else { + cl.pieceIn = CharToPiece(ToLower(yytext[skip2])); + } + if(promoted) cl.pieceIn = (ChessSquare) (PROMOTED cl.pieceIn); + + cl.rfIn = -1; + cl.ffIn = -1; + cl.rtIn = yytext[2+skip] - ONE; + cl.ftIn = yytext[1+skip] - AAA; + cl.promoCharIn = NULLCHAR; + + if(yyleng-skip > 3) /* [HGM] can have Shogi-style promotion */ + cl.promoCharIn = yytext[yyleng-1]; + + if (appData.debugMode) { + fprintf(debugFP, "Parser Qa1: yyleng=%d, %d(%d,%d)-(%d,%d) = %d (%c)\n", + yyleng, + cl.pieceIn,cl.ffIn,cl.rfIn,cl.ftIn,cl.rtIn,cl.promoCharIn,cl.promoCharIn?cl.promoCharIn:' '); + } + + /* [HGM] but do not allow values beyond board size */ + if(cl.rtIn >= BOARD_HEIGHT || + cl.rtIn < 0 || + cl.ftIn >= BOARD_RGHT || + cl.ftIn < BOARD_LEFT ) + return 0; + + Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl); + + currentMoveString[0] = cl.ff + AAA; + currentMoveString[1] = cl.rf + ONE; + currentMoveString[2] = cl.ft + AAA; + currentMoveString[3] = cl.rt + ONE; + currentMoveString[4] = cl.promoChar; + currentMoveString[5] = NULLCHAR; + + return (int) cl.kind; +} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 596 "parser.l" +{ + /* + * piece move with rank or file disambiguator + */ + DisambiguateClosure cl; + int skip = 0, skip2 = 0; int promoted=0; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + if(yytext[0]=='+') promoted = skip = skip2 = 1; + + /* remove the [xX:-] */ + if ((yytext[2+skip] == 'x') || (yytext[2+skip] == 'X') + || (yytext[2+skip] == ':') || (yytext[2+skip] == '-')) skip++; + + if (WhiteOnMove(yyboardindex)) { + cl.pieceIn = CharToPiece(ToUpper(yytext[skip2])); + } else { + cl.pieceIn = CharToPiece(ToLower(yytext[skip2])); + } + if(promoted) cl.pieceIn = (ChessSquare) (PROMOTED cl.pieceIn); + + if (isalpha(yytext[1+skip2])) { + cl.rfIn = -1; + cl.ffIn = yytext[1+skip2] - AAA; + + if(cl.ffIn >= BOARD_RGHT || + cl.ffIn < BOARD_LEFT ) return 0; + } else { + cl.rfIn = yytext[1+skip2] - ONE; + cl.ffIn = -1; + if(cl.rfIn >= BOARD_HEIGHT || + cl.rfIn < 0) return 0; + } + cl.rtIn = yytext[3+skip] - ONE; + cl.ftIn = yytext[2+skip] - AAA; + cl.promoCharIn = NULLCHAR; + + if(yyleng-skip > 4) /* [HGM] can have Shogi-style promotion */ + cl.promoCharIn = yytext[yyleng-1]; + + /* [HGM] do not allow values beyond board size */ + if(cl.rtIn >= BOARD_HEIGHT || + cl.rtIn < 0 || + cl.ftIn >= BOARD_RGHT || + cl.ftIn < BOARD_LEFT ) + return 0; + + Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl); + + currentMoveString[0] = cl.ff + AAA; + currentMoveString[1] = cl.rf + ONE; + currentMoveString[2] = cl.ft + AAA; + currentMoveString[3] = cl.rt + ONE; + currentMoveString[4] = cl.promoChar; + currentMoveString[5] = NULLCHAR; + + return (int) cl.kind; +} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 656 "parser.l" +{ + int rf, ff, rt, ft; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + /* [HGM] all squares referenced to board edges in stead of absolute */ + if (WhiteOnMove(yyboardindex)) { + if (boards[yyboardindex][0][(BOARD_WIDTH-1)>>1] == WhiteKing) { + /* ICS wild castling */ + rf = 0; + ff = (BOARD_WIDTH-1)>>1; + rt = 0; + ft = BOARD_RGHT-3; + } else { + rf = 0; + ff = BOARD_WIDTH>>1; + rt = 0; + ft = BOARD_LEFT+2; + } + } else{ + if (boards[yyboardindex][BOARD_HEIGHT-1][(BOARD_WIDTH-1)>>1] == BlackKing) { + /* ICS wild castling */ + rf = BOARD_HEIGHT-1; + ff = (BOARD_WIDTH-1)>>1; + rt = BOARD_HEIGHT-1; + ft = BOARD_RGHT-3; + } else { + rf = BOARD_HEIGHT-1; + ff = BOARD_WIDTH>>1; + rt = BOARD_HEIGHT-1; + ft = BOARD_LEFT+2; + } + } + if(PosFlags(0) & F_FRC_TYPE_CASTLING) { + if (WhiteOnMove(yyboardindex)) { + ff = initialRights[2]; + ft = initialRights[1]; + } else { + ff = initialRights[5]; + ft = initialRights[4]; + } + if (appData.debugMode) + { + fprintf(debugFP, "Parser FRC long %d %d\n", ff, ft); + }; + if(ff < 0 || ft < 0) return 0; + } + sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); + if (appData.debugMode) { + fprintf(debugFP, "long castling %d %d\n", ff, ft); + } + return (int) LegalityTest(boards[yyboardindex], + PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: e.p.! + rf, ff, rt, ft, NULLCHAR); +} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 712 "parser.l" +{ + int rf, ff, rt, ft; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + if (WhiteOnMove(yyboardindex)) { + if (boards[yyboardindex][0][(BOARD_WIDTH-1)>>1] == WhiteKing) { + /* ICS wild castling */ + rf = 0; + ff = (BOARD_WIDTH-1)>>1; + rt = 0; + ft = BOARD_LEFT+1; + } else { + rf = 0; + ff = BOARD_WIDTH>>1; + rt = 0; + ft = BOARD_RGHT-2; + } + } else { + if (boards[yyboardindex][BOARD_HEIGHT-1][(BOARD_WIDTH-1)>>1] == BlackKing) { + /* ICS wild castling */ + rf = BOARD_HEIGHT-1; + ff = (BOARD_WIDTH-1)>>1; + rt = BOARD_HEIGHT-1; + ft = BOARD_LEFT+1; + } else { + rf = BOARD_HEIGHT-1; + ff = BOARD_WIDTH>>1; + rt = BOARD_HEIGHT-1; + ft = BOARD_RGHT-2; + } + } + if(PosFlags(0) & F_FRC_TYPE_CASTLING) { + if (WhiteOnMove(yyboardindex)) { + ff = initialRights[2]; + ft = initialRights[0]; + } else { + ff = initialRights[5]; + ft = initialRights[3]; + } + if (appData.debugMode) { + fprintf(debugFP, "Parser FRC short %d %d\n", ff, ft); + } + if(ff < 0 || ft < 0) return 0; + } + sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); + if (appData.debugMode) { + fprintf(debugFP, "short castling %d %d\n", ff, ft); + } + + return (int) LegalityTest(boards[yyboardindex], + PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: e.p.! + rf, ff, rt, ft, NULLCHAR); +} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 767 "parser.l" +{ + /* Bughouse piece drop. No legality checking for now. */ + currentMoveString[1] = '@'; + currentMoveString[2] = yytext[2]; + currentMoveString[3] = yytext[3]; + currentMoveString[4] = NULLCHAR; + + if (appData.debugMode) { + fprintf(debugFP, "Drop: %s\n", currentMoveString); + } + /* [HGM] do not allow values beyond board size */ + if(currentMoveString[3] - ONE >= BOARD_HEIGHT || + currentMoveString[2] - AAA >= BOARD_WIDTH ) + return 0; + + if (WhiteOnMove(yyboardindex)) { + currentMoveString[0] = ToUpper(yytext[0]); + return (int) WhiteDrop; + } else { + currentMoveString[0] = ToLower(yytext[0]); + return (int) BlackDrop; + } +} + YY_BREAK +case 11: +YY_RULE_SETUP +#line 791 "parser.l" +{ + if (WhiteOnMove(yyboardindex)) + return (int) BlackWins; + else + return (int) WhiteWins; +} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 798 "parser.l" +{ + return (int) (ToUpper(yytext[0]) == 'W' ? BlackWins : WhiteWins); +} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 802 "parser.l" +{ + return (int) GameUnfinished; +} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 806 "parser.l" +{ + return (int) GameIsDrawn; +} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 810 "parser.l" +{ + return (int) GameIsDrawn; +} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 814 "parser.l" +{ + if (WhiteOnMove(yyboardindex)) + return (int) BlackWins; + else + return (int) WhiteWins; +} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 821 "parser.l" +{ + if (WhiteOnMove(yyboardindex)) + return (int) BlackWins; + else + return (int) WhiteWins; +} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 828 "parser.l" +{ + return (int) GameIsDrawn; +} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 832 "parser.l" +{ + return (int) GameIsDrawn; +} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 836 "parser.l" +{ + return (int) (ToUpper(yytext[0]) == 'W' ? WhiteWins : BlackWins); +} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 840 "parser.l" +{ + return (int) (ToUpper(yytext[0]) == 'W' ? BlackWins : WhiteWins); +} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 844 "parser.l" +{ + return (int) WhiteWins; +} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 848 "parser.l" +{ + return (int) BlackWins; +} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 852 "parser.l" +{ + return (int) GameIsDrawn; +} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 856 "parser.l" +{ + return (int) GameUnfinished; +} + YY_BREAK +case 26: +/* rule 26 can match eol */ +YY_RULE_SETUP +#line 860 "parser.l" +{ + /* move numbers */ + if ((yyleng == 1) && (yytext[0] == '1')) + return (int) MoveNumberOne; +} + YY_BREAK +case 27: +YY_RULE_SETUP +#line 866 "parser.l" +{ + /* elapsed time indication, e.g. (0:12) or {10:21.071} */ + return (int) ElapsedTime; +} + YY_BREAK +case 28: +/* rule 28 can match eol */ +YY_RULE_SETUP +#line 871 "parser.l" +{ + /* position diagram enclosed in [-- --] */ + return (int) PositionDiagram; +} + YY_BREAK +case 29: +/* rule 29 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ +(yy_c_buf_p) = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 876 "parser.l" +{ + /* position diagram enclosed in {-- --} */ + return (int) PositionDiagram; +} + YY_BREAK +case 30: +/* rule 30 can match eol */ +YY_RULE_SETUP +#line 881 "parser.l" +{ + return (int) PGNTag; +} + YY_BREAK +case 31: +YY_RULE_SETUP +#line 885 "parser.l" +{ + return (int) GNUChessGame; +} + YY_BREAK +case 32: +/* rule 32 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ +(yy_c_buf_p) = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 889 "parser.l" +{ + return (int) XBoardGame; +} + YY_BREAK +case 33: +YY_RULE_SETUP +#line 893 "parser.l" +{ /* numeric annotation glyph */ + return (int) NAG; +} + YY_BREAK +case 34: +/* rule 34 can match eol */ +YY_RULE_SETUP +#line 897 "parser.l" +{ /* anything in {} */ + return (int) Comment; +} + YY_BREAK +case 35: +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ +(yy_c_buf_p) = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 901 "parser.l" +{ /* ; to end of line */ + return (int) Comment; +} + YY_BREAK +case 36: +/* rule 36 can match eol */ +YY_RULE_SETUP +#line 905 "parser.l" +{ /* anything in [] */ + return (int) Comment; +} + YY_BREAK +case 37: +/* rule 37 can match eol */ +YY_RULE_SETUP +#line 909 "parser.l" +{ /* very nested () */ + return (int) Comment; +} + YY_BREAK +case 38: +/* rule 38 can match eol */ +YY_RULE_SETUP +#line 913 "parser.l" +{ /* >=2 chars in () */ + return (int) Comment; +} + YY_BREAK +case 39: +/* rule 39 can match eol */ +YY_RULE_SETUP +#line 917 "parser.l" +{ + /* Skip mail headers */ +} + YY_BREAK +case 40: +YY_RULE_SETUP +#line 921 "parser.l" +{ + /* Skip random words */ +} + YY_BREAK +case 41: +/* rule 41 can match eol */ +YY_RULE_SETUP +#line 925 "parser.l" +{ + /* Skip everything else */ +} + YY_BREAK +case 42: +YY_RULE_SETUP +#line 929 "parser.l" +ECHO; + YY_BREAK +#line 2976 "parser.c" + case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); + + (yy_state_ptr) = (yy_state_buf); + *(yy_state_ptr)++ = yy_current_state; + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 688 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *(yy_state_ptr)++ = yy_current_state; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + + register YY_CHAR yy_c = 1; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 688 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 687); + if ( ! yy_is_jam ) + *(yy_state_ptr)++ = yy_current_state; + + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((void *) b ); +} + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + + (yy_state_buf) = 0; + (yy_state_ptr) = 0; + (yy_full_match) = 0; + (yy_lp) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + yyfree ( (yy_state_buf) ); + (yy_state_buf) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 929 "parser.l" + + + + +static char *StringToLex; + +#ifndef FLEX_SCANNER +static FILE *lexFP; + +static int input() +{ + int ret; + + if (StringToLex != NULL) { + ret = *StringToLex; + if (ret == NULLCHAR) + ret = EOF; + else + StringToLex++; + } else if (unputCount > 0) { + ret = unputBuffer[--unputCount]; + } else { + ret = fgetc(lexFP); + } + + if (ret == EOF) + return 0; + else + return ret; +} + +/* + * Return offset of next pattern within current file + */ +int yyoffset() +{ + int offset = ftell(lexFP) - unputCount; + + if (offset < 0) { + offset = 0; + } + return(offset); +} + +static void output(ch) + int ch; +{ + if(appData.debugMode) fprintf(debugFP, "PARSER BUG: unmatched character '%c' (0%o)\n", + ch, ch); +} + +static void unput(ch) + int ch; +{ + if (ch == 0) return; + if (StringToLex != NULL) { + StringToLex--; + } else { + if (unputCount >= UNPUT_BUF_SIZE) + if(appData.debugMode) fprintf(debugFP, "PARSER BUG: unput buffer overflow '%c' (0%o)\n", + ch, ch); + unputBuffer[unputCount++] = ch; + } +} + +/* Get ready to lex from a new file. Kludge below sticks + an artificial newline at the front of the file, which the + above grammar ignores, but which makes ^ at start of pattern + match at the real start of the file. +*/ +void yynewfile(f) + FILE *f; +{ + lexFP = f; + StringToLex = NULL; + unputCount = 0; + unput('\n'); /* kludge */ +} + +/* Get ready to lex from a string. ^ at start of pattern WON'T + match at the start of the string! +*/ +void yynewstr(s) + char *s; +{ + lexFP = NULL; + StringToLex = s; + unputCount = 0; +} +#endif /*!FLEX_SCANNER*/ + +#ifdef FLEX_SCANNER +void my_yy_input(buf, result, max_size) + char *buf; + int *result; + int max_size; +{ + int count; + + if (StringToLex != NULL) { + count = 0; + while (*StringToLex != NULLCHAR) { + *buf++ = *StringToLex++; + count++; + } + *result = count; + return; + } else { + count = fread(buf, 1, max_size, yyin); + if (count == 0) { + *result = YY_NULL; + } else { + *result = count; + } + return; + } +} + +static YY_BUFFER_STATE my_file_buffer = NULL; + +/* + Return offset of next pattern in the current file. +*/ +int yyoffset() +{ + int pos = yy_c_buf_p - YY_CURRENT_BUFFER->yy_ch_buf; + + return(ftell(YY_CURRENT_BUFFER->yy_input_file) - + yy_n_chars + pos); +} + + +void yynewstr(s) + char *s; +{ + if (my_file_buffer != NULL) + yy_delete_buffer(my_file_buffer); + StringToLex = s; + my_file_buffer = yy_create_buffer(stdin,YY_BUF_SIZE); + yy_switch_to_buffer(my_file_buffer); +} + +void yynewfile(f) + FILE *f; +{ + if (my_file_buffer != NULL) + yy_delete_buffer(my_file_buffer); + StringToLex = NULL; + my_file_buffer = yy_create_buffer(f,YY_BUF_SIZE); + yy_switch_to_buffer(my_file_buffer); +} +#endif /*FLEX_SCANNER*/ + +int yywrap() +{ + return TRUE; +} + +/* Parse a move from the given string s */ +/* ^ at start of pattern WON'T work here unless using flex */ +ChessMove yylexstr(boardIndex, s, text, len) + int boardIndex, len; + char *s, *text; +{ + ChessMove ret; + char *oldStringToLex; +#ifdef FLEX_SCANNER + YY_BUFFER_STATE buffer, oldBuffer; +#endif + + yyboardindex = boardIndex; + oldStringToLex = StringToLex; + StringToLex = s; +#ifdef FLEX_SCANNER + buffer = yy_create_buffer(stdin,YY_BUF_SIZE); + oldBuffer = YY_CURRENT_BUFFER; + yy_switch_to_buffer(buffer); +#endif /*FLEX_SCANNER*/ + + ret = (ChessMove) yylex(); + strncpy(text, yy_text, len-1); // [HGM] vari: yy_text is not available to caller after buffer switch ?!? + text[len-1] = NULLCHAR; + +#ifdef FLEX_SCANNER + if (oldBuffer != NULL) + yy_switch_to_buffer(oldBuffer); + yy_delete_buffer(buffer); +#endif /*FLEX_SCANNER*/ + StringToLex = oldStringToLex; + + return ret; +} + diff --git a/winboard/parser.c b/winboard/parser.c deleted file mode 100644 index b75d113..0000000 --- a/winboard/parser.c +++ /dev/null @@ -1,3884 +0,0 @@ -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -#include - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include -#include - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -static YY_BUFFER_STATE yy_current_buffer = 0; - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - - -#define YY_USES_REJECT -typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; - -#define YY_NUM_RULES 42 -#define YY_END_OF_BUFFER 43 -static yyconst short int yy_acclist[602] = - { 0, - 43, 41, 42, 41, 42, 41, 42, 40, 41, 42, - 41, 42, 25, 41, 42, 41, 42, 40, 41, 42, - 40, 41, 42,16410, 40, 41, 42,16410, 41, 42, - 40, 41, 42, 40, 41, 42, 40, 41, 42, 40, - 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, - 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, - 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, - 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, - 40, 41, 42, 40, 41, 42, 40, 41, 42, 40, - 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, - - 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, - 40, 41, 42, 41, 42, 41, 42, 40, 41, 42, - 40, 41, 42, 40, 41, 42,16410, 40, 41, 42, - 16410, 41, 42, 40, 41, 42, 40, 41, 42, 40, - 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, - 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, - 40, 41, 42, 40, 41, 42, 40, 41, 42, 40, - 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, - 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, - 40, 41, 42, 40, 41, 42, 40, 41, 42, 40, - - 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, - 42, 40, 41, 42, 41, 42, 33, 40, 17, 40, - 9, 40, 40, 40,16410, 8218, 40, 35, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 9, 40, - 40, 40, 40, 36, 40, 3, 40, 40, 4, 40, - 40, 40, 40, 40, 40, 9, 40, 40, 40, 34, - 40, 40, 9, 40, 40, 40,16410, 8218, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 9, - 40, 40, 40, 40, 40, 3, 40, 40, 4, 40, - 40, 40, 40, 40, 40, 9, 40, 40, 40, 15, - - 9, 40, 23, 40, 23, 8, 40, 8218, 22, 40, - 22, 24, 40, 40, 40, 6, 40, 40, 40, 40, - 40, 40, 9, 40, 40, 40, 40, 4, 40, 40, - 3, 3, 40, 3, 40, 40, 4, 5, 40, 4, - 4, 40, 40, 40, 40, 9, 40, 40, 34, 39, - 9, 40, 23, 40, 8, 40, 22, 40, 35, 40, - 40, 40, 6, 40, 40, 40, 40, 40, 40, 9, - 40, 40, 40, 40, 4, 40, 40, 3, 40, 3, - 40, 40, 5, 40, 4, 40, 40, 40, 40, 9, - 40, 40, 38, 38, 38, 37, 25, 25, 6, 40, - - 10, 6, 40, 7, 40, 6, 40, 6, 40, 40, - 40, 19, 40, 40, 16, 40, 40, 40, 40, 40, - 36, 3, 3, 2, 40, 5, 4, 5, 5, 40, - 40, 4, 4, 40, 40, 25, 39, 40, 6, 40, - 7, 40, 40, 40, 40, 40, 19, 40, 40, 16, - 40, 40, 40, 40, 40, 2, 40, 5, 40, 40, - 4, 40, 40, 38, 7, 7, 1, 40, 20, 40, - 40, 19, 40, 40, 40, 40, 40, 40, 30, 36, - 2, 2, 2, 40, 5, 5, 5, 40, 39, 1, - 40, 40, 40, 19, 40, 40, 40, 40, 40, 40, - - 2, 40, 5, 40, 27, 38, 1, 23, 23, 22, - 22, 24, 24, 1, 1, 40, 21, 20, 40, 40, - 40, 11, 40, 40, 28, 36, 30, 2, 2, 27, - 34, 39, 39, 1, 40, 40, 40, 40, 11, 40, - 40, 18, 1, 24, 1, 21, 19, 40, 40, 40, - 11, 40, 40, 40, 40, 40, 11, 40, 40, 12, - 40, 40, 40, 40, 12, 40, 40, 14, 40, 40, - 40, 14, 40, 40, 40, 39, 40, 40, 40, 40, - 39, 39, 40, 40, 31, 40, 39, 39, 31, 40, - 13, 31, 32, 32, 35, 39, 39, 31, 39, 34, - - 29 - } ; - -static yyconst short int yy_accept[689] = - { 0, - 1, 1, 1, 2, 4, 6, 8, 11, 13, 16, - 18, 21, 25, 29, 31, 34, 37, 40, 43, 46, - 49, 52, 55, 58, 61, 63, 66, 69, 72, 75, - 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, - 108, 111, 114, 116, 118, 121, 124, 128, 132, 134, - 137, 140, 143, 146, 149, 152, 155, 158, 161, 164, - 167, 170, 173, 176, 179, 182, 185, 188, 191, 194, - 197, 200, 203, 206, 209, 212, 215, 217, 217, 218, - 219, 219, 219, 219, 219, 220, 220, 220, 220, 221, - 221, 223, 223, 223, 223, 224, 224, 224, 226, 226, - - 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, - 233, 234, 235, 236, 237, 238, 239, 241, 242, 243, - 244, 244, 244, 244, 244, 245, 246, 248, 248, 249, - 251, 252, 253, 254, 255, 256, 258, 259, 260, 260, - 260, 260, 261, 261, 262, 262, 263, 265, 265, 266, - 268, 268, 270, 270, 271, 272, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 282, 283, 284, 285, 286, - 288, 288, 289, 291, 292, 293, 294, 295, 296, 298, - 299, 300, 300, 300, 300, 300, 300, 300, 300, 300, - 300, 300, 300, 301, 301, 301, 301, 301, 301, 303, - - 305, 306, 308, 309, 309, 309, 309, 311, 312, 313, - 313, 314, 314, 315, 315, 316, 316, 318, 318, 318, - 318, 318, 318, 318, 319, 320, 321, 322, 323, 325, - 326, 327, 328, 328, 328, 328, 328, 330, 330, 331, - 331, 332, 334, 336, 337, 338, 338, 340, 341, 343, - 344, 345, 346, 348, 349, 350, 350, 350, 350, 350, - 351, 353, 355, 357, 359, 359, 360, 360, 361, 362, - 362, 363, 365, 366, 367, 368, 369, 370, 372, 373, - 374, 375, 377, 378, 378, 380, 382, 383, 385, 387, - 388, 389, 390, 392, 393, 393, 393, 394, 395, 395, - - 395, 396, 396, 396, 397, 397, 397, 398, 398, 399, - 399, 400, 400, 400, 400, 401, 401, 401, 401, 401, - 401, 401, 401, 402, 404, 404, 406, 407, 408, 408, - 409, 410, 410, 410, 410, 410, 410, 410, 411, 412, - 414, 414, 415, 417, 418, 419, 420, 421, 421, 421, - 421, 421, 422, 423, 423, 424, 426, 427, 428, 428, - 428, 429, 431, 432, 433, 433, 435, 436, 436, 437, - 437, 437, 437, 437, 438, 438, 439, 439, 439, 441, - 443, 444, 444, 445, 446, 447, 449, 450, 452, 453, - 454, 455, 456, 458, 460, 461, 463, 464, 464, 464, - - 464, 464, 465, 465, 465, 465, 465, 466, 466, 466, - 466, 466, 466, 466, 466, 466, 466, 467, 469, 469, - 469, 469, 469, 469, 470, 471, 472, 472, 474, 474, - 475, 476, 477, 478, 479, 479, 479, 481, 481, 481, - 482, 482, 483, 485, 486, 486, 487, 487, 489, 489, - 489, 489, 489, 489, 489, 489, 490, 490, 490, 492, - 493, 494, 496, 497, 498, 499, 500, 501, 503, 505, - 505, 505, 505, 505, 505, 505, 507, 507, 508, 508, - 509, 509, 510, 510, 511, 511, 512, 512, 513, 513, - 514, 514, 514, 514, 515, 517, 517, 517, 518, 518, - - 518, 519, 520, 520, 520, 520, 520, 520, 521, 522, - 524, 525, 527, 527, 528, 529, 530, 530, 530, 532, - 532, 532, 533, 534, 534, 534, 536, 537, 538, 539, - 541, 542, 542, 543, 543, 543, 543, 543, 544, 544, - 545, 546, 546, 546, 547, 547, 547, 548, 548, 548, - 548, 548, 549, 550, 551, 553, 554, 554, 554, 554, - 554, 554, 555, 556, 557, 559, 560, 560, 560, 560, - 560, 560, 560, 561, 561, 561, 561, 561, 562, 563, - 563, 563, 563, 563, 564, 565, 565, 565, 565, 565, - 566, 566, 566, 566, 567, 568, 570, 570, 570, 570, - - 570, 571, 571, 572, 574, 574, 574, 574, 574, 575, - 576, 576, 576, 576, 576, 577, 578, 579, 579, 579, - 579, 579, 579, 580, 581, 581, 581, 581, 581, 582, - 583, 584, 585, 585, 585, 585, 585, 585, 587, 587, - 587, 587, 587, 588, 589, 591, 591, 591, 592, 592, - 593, 593, 594, 594, 594, 596, 596, 597, 598, 598, - 598, 598, 598, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, - 600, 600, 600, 600, 600, 601, 602, 602 - } ; - -static yyconst int yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 1, 5, 6, 7, 8, 1, 9, 10, - 11, 12, 13, 1, 14, 15, 16, 17, 18, 19, - 20, 20, 20, 20, 20, 20, 20, 21, 22, 1, - 23, 1, 1, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 33, 34, 35, 36, 37, 38, 34, - 34, 39, 40, 33, 41, 33, 42, 43, 33, 33, - 44, 1, 45, 1, 46, 1, 47, 48, 49, 50, - - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 68, 72, 1, 73, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst int yy_meta[74] = - { 0, - 1, 2, 3, 2, 1, 1, 1, 1, 4, 5, - 6, 1, 7, 8, 1, 1, 9, 9, 9, 9, - 10, 1, 11, 1, 12, 12, 12, 12, 12, 12, - 12, 12, 13, 12, 13, 13, 12, 12, 12, 13, - 13, 12, 14, 1, 1, 1, 15, 15, 15, 15, - 16, 15, 15, 15, 15, 15, 15, 15, 17, 18, - 18, 18, 18, 18, 17, 17, 17, 17, 17, 19, - 17, 1, 1 - } ; - -static yyconst short int yy_base[767] = - { 0, - 0, 73, 3814, 3815, 122, 131, 0, 142, 3809, 140, - 151, 171, 162, 3809, 231, 159, 3757, 3746, 119, 3762, - 143, 3757, 3741, 190, 301, 361, 211, 207, 279, 215, - 224, 284, 243, 286, 301, 303, 305, 3759, 232, 3754, - 3738, 264, 351, 3799, 149, 379, 430, 351, 255, 493, - 212, 3748, 3737, 327, 3753, 157, 3748, 3732, 331, 555, - 372, 245, 378, 351, 468, 530, 475, 477, 505, 523, - 508, 576, 578, 385, 579, 610, 615, 3744, 372, 0, - 3786, 309, 630, 431, 3815, 3782, 675, 575, 405, 3776, - 3776, 3774, 450, 639, 3774, 472, 165, 640, 3773, 0, - - 3786, 3815, 0, 699, 0, 744, 0, 648, 787, 652, - 656, 3649, 3636, 3591, 693, 3601, 3594, 697, 3584, 664, - 3585, 856, 352, 929, 3815, 956, 1006, 0, 1031, 1080, - 660, 717, 721, 3563, 3567, 3551, 3514, 3523, 435, 3504, - 757, 3572, 3571, 497, 3496, 517, 607, 550, 681, 1130, - 160, 518, 554, 1193, 1238, 3477, 686, 762, 787, 764, - 617, 676, 750, 3424, 803, 816, 864, 835, 1262, 1312, - 3439, 1337, 1387, 874, 888, 895, 700, 823, 865, 762, - 866, 885, 3360, 583, 610, 626, 652, 676, 944, 949, - 3394, 3260, 3815, 882, 1190, 3328, 3286, 3281, 3270, 3279, - - 3278, 0, 3815, 3277, 3266, 3263, 3262, 3182, 799, 830, - 900, 958, 1412, 928, 962, 966, 1457, 3130, 3120, 3119, - 3130, 3108, 382, 970, 1075, 3071, 759, 2895, 2927, 2884, - 2880, 1108, 572, 1213, 739, 1527, 1591, 0, 1596, 0, - 2927, 2844, 2843, 974, 1202, 1246, 1645, 2840, 2838, 238, - 2799, 2797, 2814, 2743, 3815, 1210, 1084, 2630, 211, 2628, - 1121, 1132, 606, 1253, 697, 2626, 895, 1217, 1688, 2624, - 1258, 1733, 1467, 1472, 901, 1536, 1252, 1532, 1535, 1538, - 1549, 1795, 1800, 2623, 810, 2615, 1556, 1849, 1259, 1573, - 1473, 1474, 1541, 1543, 1583, 2574, 3815, 778, 832, 913, - - 985, 989, 1007, 3815, 1593, 2613, 2612, 2549, 2548, 1281, - 1646, 2568, 2554, 2550, 2550, 585, 2549, 367, 2487, 636, - 1680, 1125, 3815, 2480, 1679, 2479, 2463, 1854, 1678, 3815, - 1287, 2407, 2407, 2403, 2401, 2401, 2402, 2404, 2403, 968, - 510, 598, 0, 2421, 2405, 2406, 2405, 1007, 1161, 1046, - 1354, 2450, 2443, 1455, 3815, 1694, 1510, 2442, 1161, 1585, - 1700, 2441, 1209, 3815, 2389, 0, 2389, 1789, 2445, 1577, - 1711, 2401, 2386, 2443, 403, 1709, 1281, 374, 1131, 1710, - 1866, 2441, 1741, 819, 1744, 1921, 1746, 1315, 1686, 1789, - 1748, 1793, 1754, 1852, 1917, 1571, 1919, 1930, 2392, 1127, - - 2431, 1221, 1244, 1392, 1421, 1486, 2418, 1620, 2429, 2366, - 2427, 2361, 2422, 2359, 2413, 1923, 3815, 1994, 2381, 2377, - 1452, 2377, 2372, 2361, 2421, 1266, 1919, 2420, 688, 2394, - 2370, 2359, 2358, 2412, 1684, 1660, 3815, 2406, 1891, 933, - 1388, 1579, 2399, 2398, 1462, 3815, 2346, 0, 2379, 1928, - 2371, 1645, 2371, 2328, 2321, 1603, 1495, 1269, 2029, 1941, - 1925, 1943, 1928, 1939, 1932, 1947, 1950, 1954, 1957, 1971, - 1350, 1515, 2374, 1568, 1573, 3815, 1976, 1756, 2373, 2372, - 2309, 2308, 2369, 2368, 2305, 2304, 2365, 2357, 2287, 2285, - 2341, 2337, 1959, 1966, 2344, 2293, 2302, 1746, 760, 2299, - - 3815, 2304, 2334, 2293, 2267, 2308, 2285, 2292, 2262, 1655, - 2274, 3815, 1995, 3815, 2301, 3815, 2294, 2070, 2297, 2243, - 2232, 2279, 1791, 1814, 1812, 1991, 2032, 2065, 2071, 2072, - 2073, 1974, 3815, 2230, 2269, 1647, 2089, 2268, 2274, 2271, - 3815, 2214, 2215, 3815, 2181, 2228, 2221, 2169, 2225, 2188, - 2161, 2184, 2156, 2164, 0, 2141, 2093, 2197, 2133, 1836, - 1662, 2074, 2076, 2082, 2095, 2106, 2002, 2130, 2146, 1724, - 2016, 1985, 2033, 1997, 958, 2003, 1946, 2172, 1919, 1903, - 1880, 1767, 1842, 2245, 2108, 2004, 1805, 1815, 1814, 3815, - 1794, 1920, 1960, 2318, 2077, 0, 1788, 1630, 2046, 598, - - 2391, 2114, 2097, 2110, 2125, 1592, 1532, 2109, 1524, 1460, - 1444, 1439, 1810, 758, 2118, 1443, 1374, 2132, 1261, 1257, - 2094, 2095, 1253, 1188, 1154, 1199, 2130, 1866, 2139, 2166, - 1117, 1053, 2147, 2087, 995, 2122, 2155, 0, 1027, 895, - 924, 2152, 2206, 2212, 0, 2154, 839, 3815, 821, 2158, - 787, 3815, 567, 501, 3815, 2155, 2209, 2232, 2219, 380, - 362, 1838, 2233, 2220, 288, 2197, 1969, 2005, 2157, 2270, - 2274, 2292, 2293, 2294, 2296, 2297, 2299, 2300, 2301, 2302, - 2332, 2345, 2347, 2199, 190, 3815, 3815, 2461, 2480, 2493, - 2507, 2526, 2545, 2561, 2580, 2599, 2617, 1883, 1994, 1999, - - 2635, 2654, 2030, 2673, 2692, 2711, 2730, 2749, 2768, 2787, - 2806, 2825, 2837, 2856, 2875, 2894, 2913, 2921, 2148, 2931, - 2947, 2966, 2985, 3004, 3023, 3042, 3061, 3080, 3099, 3118, - 3137, 3156, 3168, 3187, 3206, 3225, 3244, 3260, 3275, 3291, - 3310, 3326, 3345, 3364, 3383, 3402, 3421, 3440, 3459, 3478, - 3497, 3516, 3535, 3554, 3569, 3588, 3607, 3622, 3636, 3655, - 3674, 3693, 3712, 3731, 3750, 3769 - } ; - -static yyconst short int yy_def[767] = - { 0, - 687, 687, 687, 687, 687, 687, 688, 689, 687, 690, - 688, 687, 12, 691, 688, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 692, 688, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 688, 688, 688, - 688, 688, 693, 687, 694, 694, 687, 47, 691, 694, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 694, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 694, 694, 694, 694, 694, 693, 687, 687, 688, - 695, 696, 695, 687, 687, 687, 687, 687, 688, 687, - 688, 687, 697, 697, 688, 697, 687, 12, 687, 688, - - 691, 687, 698, 688, 699, 688, 700, 106, 687, 106, - 106, 688, 688, 688, 106, 104, 688, 106, 688, 106, - 701, 692, 701, 702, 687, 688, 687, 703, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 693, 704, - 693, 687, 705, 694, 687, 694, 694, 687, 694, 687, - 687, 694, 706, 694, 154, 700, 155, 155, 155, 694, - 694, 694, 155, 154, 694, 155, 694, 155, 154, 687, - 703, 154, 687, 694, 694, 694, 694, 694, 694, 694, - 694, 693, 687, 707, 708, 708, 709, 710, 707, 707, - 711, 712, 687, 713, 713, 687, 687, 687, 688, 688, - - 687, 688, 687, 687, 687, 687, 688, 687, 687, 687, - 688, 687, 688, 713, 688, 687, 688, 687, 687, 687, - 687, 687, 687, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 714, 715, 716, 717, 688, 718, 688, 719, - 718, 688, 239, 688, 720, 720, 688, 246, 688, 688, - 688, 688, 688, 688, 687, 693, 687, 721, 687, 722, - 694, 694, 694, 694, 723, 721, 724, 694, 694, 214, - 694, 269, 694, 694, 694, 694, 694, 694, 694, 694, - 694, 694, 269, 719, 694, 283, 694, 282, 694, 694, - 694, 694, 694, 694, 693, 687, 687, 725, 726, 727, - - 728, 725, 729, 687, 730, 731, 731, 732, 732, 687, - 733, 687, 687, 687, 688, 687, 687, 687, 687, 687, - 687, 687, 687, 688, 733, 688, 687, 688, 325, 687, - 688, 687, 687, 687, 687, 687, 687, 688, 688, 688, - 687, 688, 688, 688, 688, 688, 688, 734, 734, 735, - 736, 737, 687, 687, 687, 738, 739, 687, 687, 739, - 739, 688, 688, 687, 687, 688, 688, 693, 687, 687, - 687, 687, 687, 740, 687, 694, 741, 741, 694, 694, - 283, 329, 694, 694, 694, 694, 694, 694, 694, 694, - 694, 694, 742, 694, 694, 694, 694, 693, 687, 727, - - 743, 744, 728, 745, 729, 730, 687, 687, 746, 747, - 748, 749, 750, 751, 687, 687, 687, 688, 687, 687, - 687, 687, 687, 687, 688, 688, 687, 688, 687, 688, - 688, 688, 688, 688, 752, 753, 687, 754, 687, 755, - 755, 755, 688, 687, 687, 687, 687, 688, 687, 693, - 687, 687, 687, 687, 687, 756, 741, 741, 694, 694, - 694, 694, 694, 694, 694, 694, 694, 694, 694, 693, - 687, 744, 757, 728, 745, 687, 730, 758, 746, 746, - 747, 747, 748, 748, 749, 749, 750, 750, 751, 751, - 687, 687, 758, 758, 688, 687, 687, 687, 687, 687, - - 687, 688, 759, 687, 687, 687, 687, 688, 688, 688, - 688, 687, 687, 687, 687, 687, 687, 693, 687, 687, - 687, 756, 756, 741, 741, 694, 694, 694, 694, 694, - 694, 693, 687, 687, 757, 744, 730, 687, 687, 687, - 687, 687, 687, 687, 687, 759, 759, 687, 687, 687, - 687, 688, 688, 688, 688, 688, 693, 687, 687, 741, - 741, 694, 694, 694, 694, 694, 693, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 760, 688, 687, - 687, 741, 741, 761, 694, 693, 687, 687, 687, 687, - 687, 762, 762, 760, 594, 688, 687, 687, 741, 741, - - 761, 762, 601, 694, 693, 687, 687, 762, 594, 594, - 687, 687, 741, 741, 763, 601, 601, 693, 687, 687, - 762, 762, 594, 594, 687, 687, 741, 741, 763, 763, - 601, 601, 693, 687, 687, 762, 762, 594, 764, 687, - 765, 741, 763, 763, 601, 693, 687, 687, 687, 762, - 764, 687, 687, 765, 687, 741, 763, 763, 693, 687, - 687, 741, 763, 693, 687, 741, 693, 766, 766, 766, - 766, 766, 766, 766, 766, 766, 766, 766, 766, 766, - 766, 766, 766, 766, 687, 687, 0, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687 - } ; - -static yyconst short int yy_nxt[3889] = - { 0, - 4, 4, 4, 5, 4, 4, 6, 4, 7, 8, - 4, 9, 10, 7, 4, 4, 11, 12, 13, 13, - 4, 14, 4, 4, 15, 16, 17, 18, 15, 15, - 19, 15, 15, 15, 15, 20, 15, 21, 22, 23, - 15, 24, 15, 25, 4, 4, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 7, - 39, 7, 7, 40, 41, 7, 7, 7, 42, 7, - 7, 43, 4, 4, 4, 4, 5, 4, 44, 6, - 44, 7, 8, 4, 9, 10, 45, 4, 4, 46, - 47, 48, 48, 4, 49, 4, 4, 50, 51, 52, - - 53, 50, 50, 54, 50, 50, 50, 50, 55, 50, - 56, 57, 58, 50, 59, 50, 25, 4, 4, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 45, 73, 45, 45, 74, 75, 45, 45, - 45, 76, 45, 45, 77, 4, 78, 79, 79, 79, - 79, 82, 85, 86, 88, 113, 116, 80, 83, 83, - 83, 83, 109, 260, 89, 93, 90, 91, 78, 145, - 164, 92, 93, 93, 94, 80, 208, 687, 114, 80, - 117, 208, 687, 209, 95, 96, 97, 98, 98, 98, - 98, 99, 686, 109, 165, 100, 100, 100, 100, 100, - - 100, 100, 100, 80, 100, 80, 80, 100, 100, 100, - 80, 80, 100, 80, 109, 109, 110, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 80, - 100, 100, 100, 100, 100, 80, 80, 80, 80, 80, - 80, 80, 103, 120, 104, 135, 105, 106, 106, 106, - 106, 107, 365, 131, 103, 130, 130, 102, 153, 130, - 133, 131, 131, 372, 130, 130, 130, 109, 132, 158, - 131, 131, 373, 104, 130, 130, 130, 108, 108, 108, - 108, 108, 108, 108, 108, 108, 108, 108, 108, 131, - 131, 174, 136, 173, 173, 130, 130, 130, 176, 366, - - 104, 121, 122, 122, 122, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 123, 121, 121, 138, 187, 188, - 113, 121, 121, 121, 121, 131, 131, 130, 130, 130, - 131, 131, 131, 131, 109, 130, 130, 130, 639, 130, - 130, 130, 112, 114, 121, 125, 121, 131, 131, 131, - 131, 131, 131, 140, 93, 130, 130, 130, 130, 130, - 130, 130, 130, 161, 144, 233, 687, 141, 141, 141, - 141, 145, 121, 121, 126, 109, 102, 127, 127, 127, - 127, 128, 88, 208, 168, 209, 162, 80, 79, 79, - 79, 79, 146, 80, 90, 147, 125, 174, 174, 148, - - 173, 173, 173, 129, 456, 145, 456, 130, 130, 131, - 131, 131, 131, 131, 131, 131, 131, 131, 131, 665, - 173, 199, 200, 142, 174, 174, 173, 173, 173, 175, - 129, 93, 93, 94, 458, 180, 337, 140, 80, 533, - 191, 160, 337, 149, 96, 97, 150, 150, 150, 150, - 151, 93, 93, 93, 152, 152, 152, 152, 152, 152, - 152, 152, 144, 152, 144, 144, 152, 152, 152, 144, - 144, 152, 144, 93, 93, 93, 152, 152, 152, 152, - 152, 152, 152, 152, 152, 152, 152, 152, 144, 152, - 152, 152, 152, 152, 144, 144, 144, 144, 144, 144, - - 144, 80, 192, 655, 103, 80, 154, 142, 105, 155, - 155, 155, 155, 156, 174, 174, 103, 145, 173, 173, - 173, 174, 174, 174, 174, 80, 80, 173, 173, 173, - 173, 173, 173, 261, 262, 154, 429, 145, 145, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 174, 174, 260, 174, 174, 266, 267, 429, 173, - 173, 173, 154, 80, 173, 173, 161, 201, 169, 174, - 174, 170, 170, 170, 170, 171, 174, 174, 173, 173, - 173, 173, 173, 173, 80, 349, 80, 80, 196, 162, - 197, 178, 185, 297, 409, 198, 145, 172, 145, 145, - - 102, 173, 173, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 109, 80, 80, 125, 140, 80, 187, - 298, 661, 177, 263, 172, 80, 145, 145, 182, 430, - 145, 141, 141, 141, 141, 187, 298, 145, 179, 185, - 93, 93, 93, 93, 167, 411, 189, 189, 189, 189, - 190, 431, 204, 80, 205, 687, 410, 276, 614, 206, - 687, 300, 301, 181, 217, 217, 217, 217, 217, 217, - 217, 217, 217, 217, 217, 217, 247, 247, 247, 247, - 217, 217, 217, 217, 80, 303, 304, 142, 107, 80, - 105, 194, 194, 194, 194, 107, 145, 264, 224, 266, - - 267, 145, 272, 272, 272, 272, 225, 412, 80, 217, - 217, 217, 217, 217, 217, 217, 217, 107, 232, 506, - 145, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 247, 247, 247, 247, 247, 247, 247, - 247, 507, 276, 351, 107, 211, 211, 211, 211, 211, - 211, 211, 211, 211, 211, 211, 211, 213, 228, 140, - 102, 230, 341, 251, 214, 277, 272, 272, 272, 272, - 80, 252, 80, 141, 141, 141, 141, 256, 272, 272, - 272, 272, 145, 352, 145, 342, 213, 303, 304, 652, - 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, - - 215, 215, 321, 272, 272, 272, 272, 342, 273, 544, - 275, 80, 322, 213, 218, 277, 219, 628, 80, 322, - 355, 220, 221, 145, 501, 222, 279, 80, 223, 142, - 145, 80, 272, 272, 272, 272, 218, 274, 219, 145, - 263, 300, 301, 145, 220, 221, 323, 323, 323, 323, - 222, 272, 272, 272, 272, 223, 121, 122, 122, 122, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 80, 80, 80, 460, 121, 121, 121, 121, - 279, 660, 80, 293, 145, 145, 145, 140, 648, 281, - 288, 288, 288, 288, 145, 214, 80, 102, 295, 121, - - 125, 121, 214, 80, 288, 288, 288, 288, 145, 80, - 280, 288, 288, 288, 288, 145, 324, 324, 324, 324, - 294, 145, 401, 402, 214, 263, 655, 121, 121, 121, - 234, 234, 234, 235, 291, 121, 121, 121, 121, 121, - 121, 687, 441, 121, 121, 292, 653, 377, 687, 121, - 121, 214, 121, 185, 297, 442, 378, 142, 185, 297, - 189, 189, 189, 189, 190, 305, 305, 305, 305, 386, - 687, 427, 121, 125, 325, 325, 325, 325, 326, 326, - 326, 326, 327, 327, 327, 327, 326, 326, 326, 326, - 356, 356, 356, 356, 404, 188, 504, 687, 303, 304, - - 121, 121, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 80, 238, 404, 188, 338, 239, - 349, 504, 80, 80, 80, 80, 240, 428, 241, 652, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 243, 649, - 351, 125, 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 239, 80, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 246, - 352, 326, 326, 326, 326, 369, 247, 247, 247, 247, - - 370, 371, 248, 645, 249, 249, 249, 249, 249, 249, - 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, - 249, 249, 249, 339, 326, 326, 326, 326, 415, 80, - 250, 93, 93, 93, 376, 316, 401, 402, 80, 80, - 80, 145, 416, 144, 96, 645, 150, 150, 150, 150, - 145, 145, 145, 330, 152, 152, 152, 152, 152, 152, - 152, 152, 144, 152, 144, 144, 152, 152, 152, 144, - 144, 152, 144, 347, 435, 365, 152, 152, 152, 152, - 152, 152, 152, 152, 152, 152, 152, 152, 144, 152, - 152, 152, 152, 152, 144, 144, 144, 144, 144, 144, - - 144, 80, 640, 214, 639, 125, 311, 311, 311, 311, - 214, 246, 140, 145, 234, 234, 234, 235, 357, 357, - 357, 357, 364, 447, 248, 80, 368, 368, 368, 368, - 473, 474, 214, 379, 379, 379, 379, 145, 638, 268, - 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - 268, 269, 359, 404, 188, 687, 320, 125, 270, 214, - 80, 80, 687, 687, 687, 687, 80, 80, 687, 364, - 448, 102, 145, 145, 380, 380, 380, 380, 145, 145, - 269, 638, 142, 102, 271, 271, 271, 271, 271, 271, - 271, 271, 271, 271, 271, 271, 687, 407, 407, 407, - - 407, 502, 388, 418, 418, 418, 418, 269, 282, 282, - 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - 80, 238, 635, 80, 502, 283, 634, 457, 144, 144, - 144, 144, 284, 525, 241, 145, 285, 285, 285, 285, - 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, - 285, 285, 285, 285, 286, 436, 436, 436, 287, 287, - 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, - 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, - 144, 283, 144, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 80, 246, 687, 437, 533, - - 144, 473, 474, 288, 288, 288, 288, 145, 534, 248, - 687, 289, 289, 289, 289, 289, 289, 289, 289, 289, - 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, - 404, 188, 632, 144, 144, 144, 144, 290, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, 215, 215, - 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, - 328, 440, 440, 440, 440, 80, 447, 329, 631, 330, - 80, 80, 80, 380, 380, 380, 380, 145, 380, 380, - 380, 380, 145, 145, 145, 185, 476, 102, 626, 328, - - 477, 625, 498, 331, 331, 331, 331, 331, 331, 331, - 331, 331, 331, 331, 331, 384, 498, 498, 624, 360, - 385, 384, 385, 446, 473, 474, 328, 121, 234, 234, - 234, 235, 361, 121, 121, 121, 121, 121, 121, 341, - 80, 121, 121, 80, 80, 389, 80, 121, 121, 80, - 121, 80, 145, 524, 397, 145, 145, 80, 145, 623, - 445, 145, 387, 145, 80, 380, 380, 380, 380, 145, - 121, 125, 393, 393, 393, 393, 145, 404, 188, 80, - 88, 80, 473, 474, 387, 140, 620, 365, 441, 390, - 451, 145, 90, 145, 687, 391, 398, 92, 121, 121, - - 246, 687, 185, 297, 523, 375, 523, 687, 392, 406, - 406, 406, 406, 248, 392, 249, 249, 249, 249, 249, - 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, - 249, 249, 249, 249, 396, 687, 478, 478, 478, 478, - 619, 250, 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 360, 142, 473, 474, 204, 329, - 205, 436, 436, 436, 102, 206, 329, 361, 330, 362, - 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, 329, 413, - 612, 687, 329, 322, 80, 363, 80, 435, 687, 329, - - 322, 687, 80, 441, 437, 554, 145, 80, 145, 360, - 80, 80, 80, 80, 452, 329, 442, 80, 80, 555, - 687, 329, 687, 263, 453, 263, 97, 583, 512, 145, - 145, 99, 417, 413, 271, 271, 271, 271, 271, 271, - 271, 271, 271, 271, 271, 271, 381, 687, 329, 80, - 687, 414, 80, 382, 80, 330, 80, 459, 459, 459, - 459, 145, 80, 441, 145, 493, 145, 144, 145, 102, - 144, 144, 144, 144, 145, 381, 442, 463, 494, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 140, 523, 375, 523, 414, 498, 80, 466, 464, - - 461, 80, 381, 80, 246, 450, 450, 450, 450, 145, - 498, 498, 102, 145, 102, 145, 102, 248, 599, 289, - 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, - 289, 289, 289, 289, 289, 289, 289, 289, 102, 582, - 102, 465, 611, 467, 102, 290, 287, 287, 287, 287, - 287, 287, 287, 287, 287, 287, 287, 287, 360, 607, - 80, 142, 446, 590, 560, 606, 561, 627, 102, 642, - 533, 361, 145, 394, 394, 394, 394, 394, 394, 394, - 394, 394, 394, 394, 394, 394, 394, 394, 394, 394, - 394, 394, 513, 513, 513, 666, 600, 210, 210, 395, - - 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, - 331, 331, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 427, 80, 491, 80, 503, 80, - 140, 447, 140, 80, 598, 514, 80, 145, 492, 145, - 80, 145, 518, 470, 109, 145, 427, 80, 145, 80, - 608, 80, 145, 109, 597, 80, 528, 504, 80, 145, - 527, 145, 80, 145, 516, 80, 505, 145, 687, 596, - 145, 668, 608, 140, 145, 493, 140, 145, 469, 263, - 462, 687, 504, 527, 532, 185, 297, 567, 687, 529, - 608, 530, 537, 537, 537, 537, 513, 513, 513, 80, - - 519, 541, 142, 493, 140, 531, 140, 670, 212, 212, - 592, 145, 608, 216, 216, 586, 494, 605, 495, 495, - 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, - 495, 495, 495, 495, 495, 495, 495, 80, 493, 514, - 80, 142, 592, 142, 245, 245, 142, 591, 102, 145, - 573, 494, 145, 526, 526, 526, 526, 526, 526, 526, - 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, - 526, 526, 140, 80, 142, 588, 142, 255, 177, 80, - 80, 80, 80, 589, 80, 145, 557, 557, 557, 557, - 80, 145, 145, 145, 145, 140, 145, 590, 185, 476, - - 613, 609, 145, 80, 562, 537, 537, 537, 537, 557, - 557, 557, 557, 584, 80, 145, 80, 615, 80, 566, - 375, 616, 564, 610, 608, 608, 145, 140, 145, 636, - 145, 565, 102, 621, 140, 563, 565, 647, 618, 608, - 584, 375, 142, 617, 608, 633, 608, 608, 630, 140, - 650, 648, 608, 637, 102, 622, 140, 102, 604, 670, - 646, 608, 354, 354, 540, 519, 608, 659, 375, 630, - 630, 585, 593, 593, 608, 593, 593, 593, 593, 593, - 641, 593, 593, 593, 593, 608, 593, 593, 608, 587, - 643, 630, 593, 593, 593, 593, 630, 142, 581, 102, - - 580, 670, 595, 656, 142, 650, 579, 608, 375, 662, - 608, 375, 644, 555, 375, 593, 593, 593, 630, 142, - 578, 140, 140, 578, 595, 577, 142, 576, 575, 255, - 574, 547, 664, 667, 375, 375, 630, 663, 547, 630, - 573, 657, 630, 593, 593, 593, 593, 641, 593, 593, - 593, 593, 593, 594, 593, 593, 593, 593, 630, 593, - 593, 630, 630, 630, 630, 602, 593, 593, 593, 572, - 658, 685, 670, 571, 570, 603, 670, 569, 541, 536, - 568, 375, 663, 671, 630, 630, 559, 672, 593, 593, - 593, 142, 142, 558, 670, 670, 670, 603, 670, 670, - - 257, 670, 670, 670, 670, 673, 674, 675, 446, 676, - 677, 516, 678, 679, 680, 681, 593, 593, 593, 593, - 556, 593, 593, 593, 593, 593, 553, 593, 593, 593, - 593, 552, 593, 593, 670, 551, 550, 549, 593, 593, - 593, 593, 255, 548, 547, 682, 255, 670, 595, 670, - 134, 545, 543, 542, 541, 540, 539, 490, 683, 490, - 684, 593, 593, 593, 255, 255, 255, 488, 255, 255, - 595, 255, 255, 255, 255, 488, 486, 486, 484, 484, - 482, 482, 480, 480, 536, 521, 520, 208, 201, 593, - 593, 593, 593, 364, 593, 593, 593, 593, 593, 594, - - 593, 593, 593, 593, 255, 593, 593, 517, 446, 516, - 439, 602, 593, 593, 593, 109, 511, 255, 510, 255, - 509, 603, 508, 427, 109, 501, 500, 499, 497, 496, - 416, 490, 488, 486, 593, 593, 593, 484, 482, 480, - 417, 297, 471, 603, 260, 375, 455, 454, 84, 202, - 449, 446, 364, 355, 439, 434, 433, 432, 202, 426, - 425, 424, 593, 593, 80, 423, 422, 421, 80, 80, - 420, 419, 80, 80, 80, 80, 80, 80, 80, 80, - 81, 81, 81, 81, 81, 330, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 87, - - 87, 417, 330, 208, 87, 87, 87, 101, 101, 101, - 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, - 101, 101, 101, 101, 101, 101, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 144, 208, 202, 201, 144, 144, - 144, 201, 144, 144, 144, 144, 144, 144, 144, 144, - 184, 184, 184, 184, 184, 201, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 186, - - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 203, 203, - 309, 309, 307, 307, 399, 355, 260, 260, 203, 259, - 375, 203, 203, 259, 203, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 236, 236, 236, 236, 236, 236, - 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, - 236, 236, 236, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 258, 258, 258, 258, 258, 258, 258, 258, - - 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, - 258, 265, 265, 265, 265, 265, 265, 265, 265, 265, - 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 299, 299, - 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 299, 299, 299, 299, 299, 299, 302, 302, 302, - 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, - - 302, 302, 302, 302, 302, 302, 306, 306, 347, 306, - 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, - 306, 306, 306, 306, 306, 308, 308, 367, 308, 308, - 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, - 308, 308, 308, 308, 310, 339, 310, 338, 364, 246, - 310, 310, 310, 355, 355, 310, 348, 348, 348, 348, - 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, - 348, 348, 348, 348, 348, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 350, 350, 350, 350, 350, 350, - - 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, - 350, 350, 350, 236, 236, 236, 236, 236, 236, 236, - 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, - 236, 236, 353, 353, 353, 358, 238, 346, 345, 358, - 344, 358, 358, 358, 358, 343, 358, 258, 258, 258, - 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, - 258, 258, 258, 258, 258, 258, 374, 374, 374, 374, - 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, - 374, 374, 374, 374, 374, 265, 265, 265, 265, 265, - 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, - - 265, 265, 265, 265, 101, 101, 101, 101, 101, 101, - 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, - 101, 101, 101, 302, 302, 302, 302, 302, 302, 302, - 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, - 302, 302, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 405, - - 405, 405, 405, 405, 405, 405, 405, 405, 405, 405, - 405, 405, 405, 405, 405, 405, 405, 405, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 306, 306, 340, - 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, - 306, 306, 306, 306, 306, 306, 308, 308, 336, 308, - 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, - 308, 308, 308, 308, 308, 408, 335, 408, 408, 334, - 333, 408, 408, 408, 332, 320, 408, 348, 348, 348, - 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, - - 348, 348, 348, 348, 348, 348, 350, 350, 350, 350, - 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, - 350, 350, 350, 350, 350, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 438, 438, 438, 438, 438, 438, - 438, 438, 438, 438, 438, 438, 438, 438, 438, 438, - 438, 438, 438, 443, 443, 320, 319, 443, 443, 318, - 443, 443, 443, 443, 443, 443, 443, 443, 443, 444, - 317, 316, 316, 315, 314, 444, 444, 444, 444, 313, - 444, 374, 374, 374, 374, 374, 374, 374, 374, 374, - - 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, - 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, - 101, 101, 101, 101, 101, 101, 101, 101, 101, 468, - 468, 312, 309, 468, 468, 468, 468, 468, 468, 468, - 468, 468, 468, 468, 468, 401, 401, 401, 401, 401, - 401, 401, 401, 401, 401, 401, 401, 401, 401, 401, - 401, 401, 401, 401, 472, 472, 472, 472, 472, 472, - 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, - 472, 472, 472, 475, 475, 475, 475, 475, 475, 475, - 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, - - 475, 475, 479, 479, 307, 479, 479, 479, 479, 479, - 479, 479, 479, 479, 479, 479, 479, 479, 479, 479, - 479, 481, 481, 296, 481, 481, 481, 481, 481, 481, - 481, 481, 481, 481, 481, 481, 481, 481, 481, 481, - 483, 483, 260, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 485, - 485, 278, 485, 485, 485, 485, 485, 485, 485, 485, - 485, 485, 485, 485, 485, 485, 485, 485, 487, 487, - 260, 487, 487, 487, 487, 487, 487, 487, 487, 487, - 487, 487, 487, 487, 487, 487, 487, 489, 489, 260, - - 489, 489, 489, 489, 489, 489, 489, 489, 489, 489, - 489, 489, 489, 489, 489, 489, 348, 348, 348, 348, - 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, - 348, 348, 348, 348, 348, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 438, 438, 438, 438, 438, 438, - 438, 438, 438, 438, 438, 438, 438, 438, 438, 438, - 438, 438, 438, 515, 259, 257, 255, 254, 230, 515, - 515, 515, 515, 515, 515, 515, 515, 515, 522, 522, - 522, 522, 522, 522, 522, 522, 522, 522, 522, 522, - - 522, 522, 522, 522, 522, 522, 522, 535, 535, 535, - 535, 202, 535, 535, 535, 535, 535, 535, 535, 535, - 535, 535, 535, 535, 535, 535, 538, 253, 228, 125, - 231, 202, 538, 538, 538, 538, 546, 546, 229, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 594, 594, 227, 594, 594, - 594, 594, 594, 594, 594, 594, 594, 594, 594, 594, - 594, 594, 594, 594, 601, 601, 227, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 593, 593, 226, 593, 593, 593, 593, - - 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, - 593, 593, 629, 629, 629, 629, 629, 629, 629, 629, - 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, - 629, 651, 651, 651, 651, 651, 651, 651, 651, 651, - 651, 651, 651, 651, 651, 651, 651, 651, 651, 651, - 654, 654, 654, 654, 654, 654, 654, 654, 654, 654, - 654, 654, 654, 654, 654, 654, 654, 654, 654, 669, - 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, - 669, 669, 669, 669, 669, 669, 669, 669, 102, 208, - 207, 201, 202, 201, 193, 185, 183, 167, 166, 163, - - 160, 159, 143, 119, 137, 134, 119, 118, 115, 112, - 111, 102, 84, 687, 3, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687 - } ; - -static yyconst short int yy_chk[3889] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 5, 6, 6, 6, - 6, 8, 10, 10, 11, 19, 21, 45, 8, 8, - 8, 8, 16, 151, 11, 13, 11, 11, 5, 45, - 56, 11, 12, 12, 12, 13, 151, 13, 19, 12, - 21, 97, 13, 97, 12, 12, 12, 12, 12, 12, - 12, 12, 685, 24, 56, 12, 12, 12, 12, 12, - - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 27, 51, 16, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 15, 24, 15, 39, 15, 15, 15, 15, - 15, 15, 250, 28, 15, 28, 28, 49, 49, 27, - 28, 30, 30, 259, 30, 30, 30, 42, 27, 51, - 31, 31, 259, 15, 31, 31, 31, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 33, - 33, 62, 39, 62, 62, 33, 33, 33, 62, 250, - - 15, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 42, 82, 82, - 32, 25, 25, 25, 25, 29, 29, 29, 29, 29, - 32, 32, 34, 34, 59, 32, 32, 32, 665, 34, - 34, 34, 29, 32, 25, 25, 25, 35, 35, 36, - 36, 37, 37, 43, 48, 35, 35, 35, 36, 36, - 36, 37, 37, 54, 48, 123, 48, 43, 43, 43, - 43, 48, 25, 25, 26, 61, 378, 26, 26, 26, - 26, 26, 46, 318, 59, 318, 54, 46, 79, 79, - 79, 79, 46, 74, 46, 46, 123, 64, 64, 46, - - 64, 64, 64, 26, 375, 74, 375, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 661, - 61, 89, 89, 43, 63, 63, 63, 63, 63, 61, - 26, 47, 47, 47, 378, 74, 223, 139, 47, 660, - 84, 63, 223, 47, 47, 47, 47, 47, 47, 47, - 47, 93, 93, 93, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 96, 96, 96, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - - 47, 50, 84, 654, 50, 144, 50, 139, 50, 50, - 50, 50, 50, 50, 65, 65, 50, 144, 65, 65, - 65, 67, 67, 68, 68, 146, 152, 67, 67, 67, - 68, 68, 68, 146, 146, 50, 341, 146, 152, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 69, 69, 148, 71, 71, 153, 153, 341, 69, - 69, 69, 50, 60, 71, 71, 66, 148, 60, 70, - 70, 60, 60, 60, 60, 60, 66, 66, 70, 70, - 70, 66, 66, 66, 72, 233, 73, 75, 88, 66, - 88, 73, 184, 184, 316, 88, 72, 60, 73, 75, - - 600, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 76, 263, 147, 233, 77, 76, 185, - 185, 653, 72, 147, 60, 161, 263, 147, 77, 342, - 76, 77, 77, 77, 77, 186, 186, 161, 73, 83, - 94, 94, 94, 98, 75, 320, 83, 83, 83, 83, - 83, 342, 94, 98, 94, 98, 316, 161, 600, 94, - 98, 187, 187, 76, 108, 108, 108, 108, 110, 110, - 110, 110, 111, 111, 111, 111, 131, 131, 131, 131, - 120, 120, 120, 120, 162, 188, 188, 77, 87, 149, - 87, 87, 87, 87, 87, 87, 162, 149, 110, 265, - - 265, 149, 157, 157, 157, 157, 111, 320, 177, 115, - 115, 115, 115, 118, 118, 118, 118, 87, 120, 429, - 177, 87, 87, 87, 87, 87, 87, 87, 87, 87, - 87, 87, 87, 132, 132, 132, 132, 133, 133, 133, - 133, 429, 162, 235, 87, 104, 104, 104, 104, 104, - 104, 104, 104, 104, 104, 104, 104, 106, 115, 141, - 614, 118, 227, 132, 106, 177, 163, 163, 163, 163, - 180, 133, 160, 141, 141, 141, 141, 141, 158, 158, - 158, 158, 180, 235, 160, 227, 106, 298, 298, 651, - 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, - - 106, 106, 209, 159, 159, 159, 159, 227, 158, 499, - 160, 165, 209, 106, 109, 163, 109, 614, 285, 209, - 285, 109, 109, 165, 499, 109, 180, 384, 109, 141, - 285, 178, 166, 166, 166, 166, 109, 159, 109, 384, - 165, 299, 299, 178, 109, 109, 210, 210, 210, 210, - 109, 168, 168, 168, 168, 109, 122, 122, 122, 122, - 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, - 122, 122, 167, 179, 181, 384, 122, 122, 122, 122, - 166, 649, 174, 178, 167, 179, 181, 182, 647, 168, - 174, 174, 174, 174, 174, 194, 175, 267, 182, 122, - - 122, 122, 194, 176, 175, 175, 175, 175, 175, 275, - 167, 176, 176, 176, 176, 176, 211, 211, 211, 211, - 181, 275, 300, 300, 194, 179, 641, 122, 122, 124, - 124, 124, 124, 124, 175, 124, 124, 124, 124, 124, - 124, 214, 440, 124, 124, 176, 640, 267, 214, 124, - 124, 194, 124, 189, 189, 440, 267, 182, 190, 190, - 189, 189, 189, 189, 189, 190, 190, 190, 190, 275, - 214, 340, 124, 124, 212, 212, 212, 212, 215, 215, - 215, 215, 216, 216, 216, 216, 224, 224, 224, 224, - 244, 244, 244, 244, 301, 301, 575, 214, 302, 302, - - 124, 124, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 127, 127, 303, 303, 224, 127, - 348, 575, 127, 127, 127, 127, 127, 340, 127, 639, - 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 127, 127, 127, 127, 127, 635, - 350, 348, 127, 127, 127, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 127, 127, 127, 129, 129, 129, - 129, 129, 129, 129, 129, 129, 129, 129, 129, 130, - 350, 225, 225, 225, 225, 257, 130, 130, 130, 130, - - 257, 257, 130, 632, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 225, 232, 232, 232, 232, 322, 261, - 130, 150, 150, 150, 261, 262, 400, 400, 150, 379, - 262, 261, 322, 150, 150, 631, 150, 150, 150, 150, - 150, 379, 262, 379, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 232, 349, 359, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - - 150, 154, 626, 195, 625, 349, 195, 195, 195, 195, - 195, 245, 256, 154, 234, 234, 234, 234, 245, 245, - 245, 245, 359, 363, 245, 268, 256, 256, 256, 256, - 402, 402, 195, 268, 268, 268, 268, 268, 624, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 155, 245, 403, 403, 246, 264, 234, 155, 195, - 277, 264, 246, 246, 246, 246, 271, 289, 246, 289, - 363, 458, 277, 264, 271, 271, 271, 271, 271, 289, - 155, 623, 256, 377, 155, 155, 155, 155, 155, 155, - 155, 155, 155, 155, 155, 155, 246, 310, 310, 310, - - 310, 426, 277, 331, 331, 331, 331, 155, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 170, 170, 620, 388, 426, 170, 619, 377, 170, 170, - 170, 170, 170, 458, 170, 388, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 351, 351, 351, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 173, 173, 441, 351, 471, - - 173, 404, 404, 173, 173, 173, 173, 173, 471, 173, - 441, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 405, 405, 617, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 213, 213, - 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, - 217, 354, 354, 354, 354, 273, 445, 217, 616, 217, - 274, 291, 292, 273, 273, 273, 273, 273, 274, 274, - 274, 274, 274, 291, 292, 406, 406, 457, 612, 217, - - 406, 611, 421, 217, 217, 217, 217, 217, 217, 217, - 217, 217, 217, 217, 217, 273, 421, 421, 610, 357, - 274, 291, 292, 445, 472, 472, 217, 236, 236, 236, - 236, 236, 357, 236, 236, 236, 236, 236, 236, 276, - 278, 236, 236, 279, 276, 278, 280, 236, 236, 293, - 236, 294, 278, 457, 293, 279, 276, 281, 280, 609, - 357, 293, 276, 294, 287, 281, 281, 281, 281, 281, - 236, 236, 287, 287, 287, 287, 287, 474, 474, 396, - 370, 290, 475, 475, 276, 295, 607, 290, 442, 279, - 370, 396, 370, 290, 360, 280, 295, 370, 236, 236, - - 237, 442, 305, 305, 456, 456, 456, 360, 294, 305, - 305, 305, 305, 237, 281, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 290, 360, 408, 408, 408, 408, - 606, 237, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 247, 295, 536, 536, 452, 311, - 452, 436, 436, 436, 561, 452, 311, 247, 311, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 311, 321, - 598, 329, 325, 321, 389, 247, 269, 435, 329, 325, - - 321, 325, 356, 356, 436, 510, 389, 356, 269, 361, - 356, 356, 356, 356, 371, 311, 356, 376, 380, 510, - 329, 325, 361, 389, 371, 376, 371, 561, 435, 376, - 380, 371, 380, 570, 269, 269, 269, 269, 269, 269, - 269, 269, 269, 269, 269, 269, 272, 329, 325, 383, - 361, 321, 385, 272, 387, 272, 391, 383, 383, 383, - 383, 383, 393, 393, 385, 478, 387, 393, 391, 582, - 393, 393, 393, 393, 393, 272, 393, 387, 478, 272, - 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, - 272, 368, 523, 523, 523, 570, 498, 390, 391, 387, - - 385, 392, 272, 282, 282, 368, 368, 368, 368, 390, - 498, 498, 613, 392, 525, 282, 524, 282, 582, 282, - 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, - 282, 282, 282, 282, 282, 282, 282, 282, 560, 560, - 662, 390, 597, 392, 583, 282, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, 288, 591, - 394, 368, 394, 589, 524, 588, 525, 613, 628, 628, - 587, 288, 394, 288, 288, 288, 288, 288, 288, 288, - 288, 288, 288, 288, 288, 288, 288, 288, 288, 288, - 288, 288, 439, 439, 439, 662, 583, 698, 698, 288, - - 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, - 328, 328, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 386, 395, 416, 397, 427, 386, - 450, 395, 398, 461, 581, 439, 463, 395, 416, 397, - 465, 386, 450, 398, 460, 461, 462, 464, 463, 460, - 592, 462, 465, 467, 580, 466, 463, 427, 467, 464, - 461, 460, 468, 462, 468, 469, 427, 466, 493, 579, - 467, 667, 592, 470, 468, 494, 532, 469, 395, 397, - 386, 493, 427, 461, 470, 477, 477, 532, 494, 464, - 593, 465, 477, 477, 477, 477, 513, 513, 513, 526, - - 450, 526, 398, 418, 567, 466, 586, 668, 699, 699, - 577, 526, 593, 700, 700, 567, 418, 586, 418, 418, - 418, 418, 418, 418, 418, 418, 418, 418, 418, 418, - 418, 418, 418, 418, 418, 418, 418, 459, 459, 513, - 527, 667, 576, 470, 703, 703, 532, 574, 599, 459, - 572, 459, 527, 459, 459, 459, 459, 459, 459, 459, - 459, 459, 459, 459, 459, 459, 459, 459, 459, 459, - 459, 459, 518, 528, 567, 571, 586, 668, 527, 529, - 530, 531, 562, 573, 563, 528, 518, 518, 518, 518, - 564, 529, 530, 531, 562, 557, 563, 573, 537, 537, - - 599, 595, 564, 565, 528, 537, 537, 537, 537, 557, - 557, 557, 557, 562, 566, 565, 585, 602, 604, 531, - 615, 603, 530, 595, 621, 622, 566, 605, 585, 621, - 604, 564, 627, 608, 618, 529, 530, 634, 605, 608, - 563, 629, 518, 603, 602, 618, 621, 622, 615, 633, - 636, 634, 636, 622, 642, 608, 646, 656, 585, 669, - 633, 608, 719, 719, 569, 557, 602, 646, 630, 629, - 615, 566, 578, 578, 636, 578, 578, 578, 578, 578, - 627, 578, 578, 578, 578, 637, 578, 578, 650, 568, - 630, 629, 578, 578, 578, 578, 630, 605, 559, 666, - - 558, 684, 578, 642, 618, 637, 556, 637, 643, 656, - 650, 657, 630, 554, 644, 578, 578, 578, 630, 633, - 553, 659, 664, 552, 578, 551, 646, 550, 549, 669, - 548, 547, 659, 664, 658, 663, 643, 657, 546, 657, - 545, 643, 644, 578, 578, 584, 584, 666, 584, 584, - 584, 584, 584, 584, 584, 584, 584, 584, 643, 584, - 584, 657, 658, 663, 644, 584, 584, 584, 584, 543, - 644, 684, 670, 542, 540, 584, 671, 539, 538, 535, - 534, 522, 658, 670, 658, 663, 521, 671, 584, 584, - 584, 659, 664, 520, 672, 673, 674, 584, 675, 676, - - 519, 677, 678, 679, 680, 672, 673, 674, 517, 675, - 676, 515, 677, 678, 679, 680, 584, 584, 594, 594, - 511, 594, 594, 594, 594, 594, 509, 594, 594, 594, - 594, 508, 594, 594, 681, 507, 506, 505, 594, 594, - 594, 594, 670, 504, 503, 681, 671, 682, 594, 683, - 502, 500, 497, 496, 495, 492, 491, 490, 682, 489, - 683, 594, 594, 594, 672, 673, 674, 488, 675, 676, - 594, 677, 678, 679, 680, 487, 486, 485, 484, 483, - 482, 481, 480, 479, 473, 455, 454, 453, 451, 594, - 594, 601, 601, 449, 601, 601, 601, 601, 601, 601, - - 601, 601, 601, 601, 681, 601, 601, 447, 444, 443, - 438, 601, 601, 601, 601, 434, 433, 682, 432, 683, - 431, 601, 430, 428, 425, 424, 423, 422, 420, 419, - 415, 414, 413, 412, 601, 601, 601, 411, 410, 409, - 407, 401, 399, 601, 382, 374, 373, 372, 369, 367, - 365, 362, 358, 353, 352, 347, 346, 345, 344, 339, - 338, 337, 601, 601, 688, 336, 335, 334, 688, 688, - 333, 332, 688, 688, 688, 688, 688, 688, 688, 688, - 689, 689, 689, 689, 689, 327, 689, 689, 689, 689, - 689, 689, 689, 689, 689, 689, 689, 689, 689, 690, - - 690, 326, 324, 319, 690, 690, 690, 691, 691, 691, - 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, - 691, 691, 691, 691, 691, 691, 692, 692, 692, 692, - 692, 692, 692, 692, 692, 692, 692, 692, 692, 692, - 692, 692, 692, 692, 692, 693, 693, 693, 693, 693, - 693, 693, 693, 693, 693, 693, 693, 693, 693, 693, - 693, 693, 693, 693, 694, 317, 315, 314, 694, 694, - 694, 313, 694, 694, 694, 694, 694, 694, 694, 694, - 695, 695, 695, 695, 695, 312, 695, 695, 695, 695, - 695, 695, 695, 695, 695, 695, 695, 695, 695, 696, - - 696, 696, 696, 696, 696, 696, 696, 696, 696, 696, - 696, 696, 696, 696, 696, 696, 696, 696, 697, 697, - 309, 308, 307, 306, 296, 286, 284, 270, 697, 266, - 260, 697, 697, 258, 697, 701, 701, 701, 701, 701, - 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, - 701, 701, 701, 701, 702, 702, 702, 702, 702, 702, - 702, 702, 702, 702, 702, 702, 702, 702, 702, 702, - 702, 702, 702, 704, 704, 704, 704, 704, 704, 704, - 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, - 704, 704, 705, 705, 705, 705, 705, 705, 705, 705, - - 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, - 705, 706, 706, 706, 706, 706, 706, 706, 706, 706, - 706, 706, 706, 706, 706, 706, 706, 706, 706, 706, - 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, - 707, 707, 707, 707, 707, 707, 707, 707, 707, 708, - 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, - 708, 708, 708, 708, 708, 708, 708, 708, 709, 709, - 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, - 709, 709, 709, 709, 709, 709, 709, 710, 710, 710, - 710, 710, 710, 710, 710, 710, 710, 710, 710, 710, - - 710, 710, 710, 710, 710, 710, 711, 711, 254, 711, - 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, - 711, 711, 711, 711, 711, 712, 712, 253, 712, 712, - 712, 712, 712, 712, 712, 712, 712, 712, 712, 712, - 712, 712, 712, 712, 713, 252, 713, 251, 249, 248, - 713, 713, 713, 243, 242, 713, 714, 714, 714, 714, - 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, - 714, 714, 714, 714, 714, 715, 715, 715, 715, 715, - 715, 715, 715, 715, 715, 715, 715, 715, 715, 715, - 715, 715, 715, 715, 716, 716, 716, 716, 716, 716, - - 716, 716, 716, 716, 716, 716, 716, 716, 716, 716, - 716, 716, 716, 717, 717, 717, 717, 717, 717, 717, - 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, - 717, 717, 718, 718, 718, 720, 241, 231, 230, 720, - 229, 720, 720, 720, 720, 228, 720, 721, 721, 721, - 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, - 721, 721, 721, 721, 721, 721, 722, 722, 722, 722, - 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, - 722, 722, 722, 722, 722, 723, 723, 723, 723, 723, - 723, 723, 723, 723, 723, 723, 723, 723, 723, 723, - - 723, 723, 723, 723, 724, 724, 724, 724, 724, 724, - 724, 724, 724, 724, 724, 724, 724, 724, 724, 724, - 724, 724, 724, 725, 725, 725, 725, 725, 725, 725, - 725, 725, 725, 725, 725, 725, 725, 725, 725, 725, - 725, 725, 726, 726, 726, 726, 726, 726, 726, 726, - 726, 726, 726, 726, 726, 726, 726, 726, 726, 726, - 726, 727, 727, 727, 727, 727, 727, 727, 727, 727, - 727, 727, 727, 727, 727, 727, 727, 727, 727, 727, - 728, 728, 728, 728, 728, 728, 728, 728, 728, 728, - 728, 728, 728, 728, 728, 728, 728, 728, 728, 729, - - 729, 729, 729, 729, 729, 729, 729, 729, 729, 729, - 729, 729, 729, 729, 729, 729, 729, 729, 730, 730, - 730, 730, 730, 730, 730, 730, 730, 730, 730, 730, - 730, 730, 730, 730, 730, 730, 730, 731, 731, 226, - 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, - 731, 731, 731, 731, 731, 731, 732, 732, 222, 732, - 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, - 732, 732, 732, 732, 732, 733, 221, 733, 733, 220, - 219, 733, 733, 733, 218, 208, 733, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - - 734, 734, 734, 734, 734, 734, 735, 735, 735, 735, - 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, - 735, 735, 735, 735, 735, 736, 736, 736, 736, 736, - 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, - 736, 736, 736, 736, 737, 737, 737, 737, 737, 737, - 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, - 737, 737, 737, 738, 738, 207, 206, 738, 738, 205, - 738, 738, 738, 738, 738, 738, 738, 738, 738, 739, - 204, 201, 200, 199, 198, 739, 739, 739, 739, 197, - 739, 740, 740, 740, 740, 740, 740, 740, 740, 740, - - 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, - 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, - 741, 741, 741, 741, 741, 741, 741, 741, 741, 742, - 742, 196, 192, 742, 742, 742, 742, 742, 742, 742, - 742, 742, 742, 742, 742, 743, 743, 743, 743, 743, - 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, - 743, 743, 743, 743, 744, 744, 744, 744, 744, 744, - 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, - 744, 744, 744, 745, 745, 745, 745, 745, 745, 745, - 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, - - 745, 745, 746, 746, 191, 746, 746, 746, 746, 746, - 746, 746, 746, 746, 746, 746, 746, 746, 746, 746, - 746, 747, 747, 183, 747, 747, 747, 747, 747, 747, - 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, - 748, 748, 171, 748, 748, 748, 748, 748, 748, 748, - 748, 748, 748, 748, 748, 748, 748, 748, 748, 749, - 749, 164, 749, 749, 749, 749, 749, 749, 749, 749, - 749, 749, 749, 749, 749, 749, 749, 749, 750, 750, - 156, 750, 750, 750, 750, 750, 750, 750, 750, 750, - 750, 750, 750, 750, 750, 750, 750, 751, 751, 145, - - 751, 751, 751, 751, 751, 751, 751, 751, 751, 751, - 751, 751, 751, 751, 751, 751, 752, 752, 752, 752, - 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, - 752, 752, 752, 752, 752, 753, 753, 753, 753, 753, - 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, - 753, 753, 753, 753, 754, 754, 754, 754, 754, 754, - 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, - 754, 754, 754, 755, 143, 142, 140, 138, 137, 755, - 755, 755, 755, 755, 755, 755, 755, 755, 756, 756, - 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, - - 756, 756, 756, 756, 756, 756, 756, 757, 757, 757, - 757, 136, 757, 757, 757, 757, 757, 757, 757, 757, - 757, 757, 757, 757, 757, 757, 758, 135, 134, 121, - 119, 117, 758, 758, 758, 758, 759, 759, 116, 759, - 759, 759, 759, 759, 759, 759, 759, 759, 759, 759, - 759, 759, 759, 759, 759, 760, 760, 114, 760, 760, - 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, - 760, 760, 760, 760, 761, 761, 113, 761, 761, 761, - 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, - 761, 761, 761, 762, 762, 112, 762, 762, 762, 762, - - 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, - 762, 762, 763, 763, 763, 763, 763, 763, 763, 763, - 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, - 763, 764, 764, 764, 764, 764, 764, 764, 764, 764, - 764, 764, 764, 764, 764, 764, 764, 764, 764, 764, - 765, 765, 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, 765, 766, - 766, 766, 766, 766, 766, 766, 766, 766, 766, 766, - 766, 766, 766, 766, 766, 766, 766, 766, 101, 99, - 95, 92, 91, 90, 86, 81, 78, 58, 57, 55, - - 53, 52, 44, 41, 40, 38, 23, 22, 20, 18, - 17, 14, 9, 3, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - 687, 687, 687, 687, 687, 687, 687, 687 - } ; - -static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; -static char *yy_full_match; -static int yy_lp; -static int yy_looking_for_trail_begin = 0; -static int yy_full_lp; -static int *yy_full_state; -#define YY_TRAILING_MASK 0x2000 -#define YY_TRAILING_HEAD_MASK 0x4000 -#define REJECT \ -{ \ -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \ -yy_cp = yy_full_match; /* restore poss. backed-over text */ \ -yy_lp = yy_full_lp; /* restore orig. accepting pos. */ \ -yy_state_ptr = yy_full_state; /* restore orig. state */ \ -yy_current_state = *yy_state_ptr; /* restore curr. state */ \ -++yy_lp; \ -goto find_rule; \ -} -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#define INITIAL 0 -/* - * parser.l -- lex parser of algebraic chess moves for XBoard - * - * Copyright 1991 by Digital Equipment Corporation, Maynard, - * Massachusetts. - * - * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, - * 2006, 2007, 2008, 2009 Free Software Foundation, Inc. - * - * The following terms apply to Digital Equipment Corporation's copyright - * interest in XBoard: - * ------------------------------------------------------------------------ - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Digital not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR - * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * ------------------------------------------------------------------------ - * - * The following terms apply to the enhanced version of XBoard - * distributed by the Free Software Foundation: - * ------------------------------------------------------------------------ - * - * GNU XBoard is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * GNU XBoard is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - *------------------------------------------------------------------------ - ** See the file ChangeLog for a revision history. */ - -/* This parser handles all forms of promotion. - * The parser resolves ambiguous moves by searching and check-testing. - * It also parses comments of the form [anything] or (anything). - * - * [HGM] Parser extensively modified for bigger boards, Shogi-like syntax, - * and unknow pieces. All pieces are now mandatory upper case, but can be - * any letter A-Z. Files must be lower case (as before), but can run upto 'l'. - * Ranks can be 0-9. The parser returns 0 for off-board files and ranks. - * For an unknown piece (as mover or promotion piece) it returns - * IllegalMove, like it does when the piece doesn't match. - * Promotions can now also be appended Shogi-style, a bare '=' or '+', - * and this is then returned as promotion character. The piece indicator - * can be prefixed by a '+' to indicate it is a promoted piece. - */ - -#include "config.h" - -#define NO_CONSTRAINT -1 -#undef YYLMAX -#define YYLMAX 4096 -#define UNPUT_BUF_SIZE YYLMAX - -#ifdef FLEX_SCANNER -/* yytext is probably a char*, but could be a char[]. yy_text is set - in YY_DECL below, because if yytext is a char*, its value is not - constant. */ -char *yy_text; -#else /*!FLEX_SCANNER*/ -/* yytext is definitely a char[], so yy_text can be set here, statically. */ -char *yy_text = (char *) yytext; -#endif - -#ifdef FLEX_SCANNER -/* This is flex */ -/* [AP] use prototypes in function declarations */ -#define YY_USE_PROTOS - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif -/* end of [AP] fix */ - -#undef YY_INPUT -#define YY_INPUT(buf, result, max_size) my_yy_input(buf, &result, max_size) -#undef YY_DECL -#define YY_DECL \ - int _yylex YY_PROTO((void)); \ - int yylex YY_PROTO((void)) \ - { \ - int result = _yylex(); \ - yy_text = (char *) yytext; \ - return(result); \ - } \ - int _yylex YY_PROTO((void)) -#else -/* This is lex */ -#undef input -#undef output -#undef unput -#endif - -/* The includes must be here, below the #undef input */ - -#include - -#if STDC_HEADERS -# include -# include -#else /* not STDC_HEADERS */ -# if HAVE_STRING_H -# include -# else /* not HAVE_STRING_H */ -# include -# endif /* not HAVE_STRING_H */ -#endif /* not STDC_HEADERS */ - -#if HAVE_UNISTD_H -# include -#endif - -#if defined(_amigados) -# include -# if HAVE_FCNTL_H -# include /* isatty() prototype */ -# endif /* HAVE_FCNTL_H */ -#endif /* defined(_amigados) */ - -#include "common.h" -#include "backend.h" -#include "frontend.h" -#include "parser.h" -#include "moves.h" - -extern int PosFlags P((int)); - -extern Board boards[MAX_MOVES]; -int yyboardindex; -int yyskipmoves = FALSE; -char currentMoveString[YYLMAX]; -#ifndef FLEX_SCANNER -char unputBuffer[UNPUT_BUF_SIZE]; -int unputCount = 0; -#endif - -#ifdef FLEX_SCANNER -void my_yy_input P((char *buf, int *result, int max_size)); -#else /*!FLEX_SCANNER*/ -static int input P((void)); -static void output P((int ch)); -static void unput P((int ch)); -int yylook P((void)); -int yyback P((int *, int)); -#endif -#undef yywrap -int yywrap P((void)); -extern void CopyBoard P((Board to, Board from)); - - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - yy_current_buffer->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ - YY_USER_ACTION - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - - - - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = yy_start; - yy_current_state += YY_AT_BOL(); - yy_state_ptr = yy_state_buf; - *yy_state_ptr++ = yy_current_state; -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 688 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *yy_state_ptr++ = yy_current_state; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 3815 ); - -yy_find_action: - yy_current_state = *--yy_state_ptr; - yy_lp = yy_accept[yy_current_state]; -find_rule: /* we branch to this label when backing up */ - for ( ; ; ) /* until we find what rule we matched */ - { - if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] ) - { - yy_act = yy_acclist[yy_lp]; - if ( yy_act & YY_TRAILING_HEAD_MASK || - yy_looking_for_trail_begin ) - { - if ( yy_act == yy_looking_for_trail_begin ) - { - yy_looking_for_trail_begin = 0; - yy_act &= ~YY_TRAILING_HEAD_MASK; - break; - } - } - else if ( yy_act & YY_TRAILING_MASK ) - { - yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK; - yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK; - } - else - { - yy_full_match = yy_cp; - yy_full_state = yy_state_ptr; - yy_full_lp = yy_lp; - break; - } - ++yy_lp; - goto find_rule; - } - --yy_cp; - yy_current_state = *--yy_state_ptr; - yy_lp = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ -case 1: -YY_RULE_SETUP -{ - /* - * Fully-qualified algebraic move, possibly with promotion - */ - int skip1 = 0, skip2 = 0, skip3 = 0, promoted = 0; - ChessSquare piece; - ChessMove result; - char c; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - if (yytext[0] == '+') skip1 = skip3 = promoted = 1; /* [HGM] Shogi promoted */ - - /* remove the / */ - if (yytext[1+skip1] == '/') skip1++; - - /* remove the [xX:-] */ - if ((yytext[3+skip1] == 'x') || (yytext[3+skip1] == 'X') || - (yytext[3+skip1] == '-') || (yytext[3+skip1] == ':')) skip2 = 1; - - currentMoveString[0] = yytext[1+skip1]; - currentMoveString[1] = yytext[2+skip1]; - currentMoveString[2] = yytext[3+skip1+skip2]; - currentMoveString[3] = yytext[4+skip1+skip2]; - currentMoveString[4] = NULLCHAR; - - if (appData.debugMode) { - fprintf(debugFP, "Parser Qa1b2: yyleng=%d\n", - yyleng); - } - - if (yyleng-skip1-skip2 > 5) { char c; - if (yytext[yyleng-1] == ')') { - c = currentMoveString[4] = ToLower(yytext[yyleng-2]); - } else { - c = currentMoveString[4] = ToLower(yytext[yyleng-1]); - } - currentMoveString[5] = NULLCHAR; - if(c != '=' && c != '+' && CharToPiece(c) == EmptySquare) - return IllegalMove; /* [HGM] promotion to invalid piece */ - } - - if (appData.debugMode) { - fprintf(debugFP, "parser: %s\n", currentMoveString); - } - /* [HGM] do not allow values beyond board size */ - if(currentMoveString[1] - ONE >= BOARD_HEIGHT || - currentMoveString[1] - ONE < 0 || - currentMoveString[0] - AAA >= BOARD_RGHT || - currentMoveString[3] - ONE >= BOARD_HEIGHT || - currentMoveString[3] - ONE < 0 || - currentMoveString[2] - AAA >= BOARD_RGHT || - currentMoveString[0] - AAA < BOARD_LEFT || - currentMoveString[2] - AAA < BOARD_LEFT ) - return 0; - - piece = boards[yyboardindex] - [currentMoveString[1] - ONE][currentMoveString[0] - AAA]; - if(promoted) piece = (ChessSquare) (DEMOTED piece); - c = PieceToChar(piece); - if(c == '~') c = PieceToChar((ChessSquare) (DEMOTED piece)); - if (ToLower(yytext[skip3]) != ToLower(c)) - return (int) IllegalMove; - - result = LegalityTest(boards[yyboardindex], - PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.! - currentMoveString[1] - ONE, - currentMoveString[0] - AAA, - currentMoveString[3] - ONE, - currentMoveString[2] - AAA, - currentMoveString[4]); - - if (currentMoveString[4] == NULLCHAR && - (result == WhitePromotionKnight || result == BlackPromotionKnight || - result == WhitePromotionQueen || result == BlackPromotionQueen)) { - currentMoveString[4] = PieceToChar(BlackQueen); - currentMoveString[5] = NULLCHAR; - } - - return (int) result; -} - YY_BREAK -case 2: -YY_RULE_SETUP -{ - /* - * Simple algebraic move, possibly with promotion - * [HGM] Engine moves are received in this format, with lower-case promoChar! - */ - int skip = 0; - ChessMove result; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - /* remove the [xX:-] */ - if ((yytext[2] == 'x') || (yytext[2] == 'X') || - (yytext[2] == '-') || (yytext[2] == ':')) skip = 1; - - currentMoveString[0] = yytext[0]; - currentMoveString[1] = yytext[1]; - currentMoveString[2] = yytext[2+skip]; - currentMoveString[3] = yytext[3+skip]; - currentMoveString[4] = NULLCHAR; - - if (yyleng-skip > 4) { char c; - if (yytext[yyleng-1] == ')') { - c = currentMoveString[4] = ToLower(yytext[yyleng-2]); - } else { - c = currentMoveString[4] = ToLower(yytext[yyleng-1]); - } - currentMoveString[5] = NULLCHAR; - if(c != '=' && c != '+' && CharToPiece(c) == EmptySquare) - return IllegalMove; - } - - /* [HGM] do not allow values beyond board size */ - if(currentMoveString[1] - ONE >= BOARD_HEIGHT || - currentMoveString[1] - ONE < 0 || - currentMoveString[0] - AAA >= BOARD_RGHT || - currentMoveString[3] - ONE >= BOARD_HEIGHT || - currentMoveString[3] - ONE < 0 || - currentMoveString[2] - AAA >= BOARD_RGHT || - currentMoveString[0] - AAA < BOARD_LEFT || - currentMoveString[2] - AAA < BOARD_LEFT ) - return 0; - - result = LegalityTest(boards[yyboardindex], - PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.! - currentMoveString[1] - ONE, - currentMoveString[0] - AAA, - currentMoveString[3] - ONE, - currentMoveString[2] - AAA, - currentMoveString[4]); - - if (currentMoveString[4] == NULLCHAR && - (result == WhitePromotionKnight || result == BlackPromotionKnight || - result == WhitePromotionQueen || result == BlackPromotionQueen)) { - if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier) - currentMoveString[4] = PieceToChar(BlackFerz); - else if(gameInfo.variant == VariantGreat) - currentMoveString[4] = PieceToChar(BlackMan); - else - currentMoveString[4] = PieceToChar(BlackQueen); - currentMoveString[5] = NULLCHAR; - } - - return (int) result; -} - YY_BREAK -case 3: -YY_RULE_SETUP -{ - /* - * Pawn move, possibly with promotion - */ - DisambiguateClosure cl; - int skip = 0; char c; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - /* remove the =() */ - if (yytext[2] == '=' && yytext[3] != NULLCHAR) skip++; - if (yytext[2+skip] == '(') skip++; - - cl.pieceIn = WhiteOnMove(yyboardindex) ? WhitePawn : BlackPawn; - cl.rfIn = -1; - cl.ffIn = yytext[0] - AAA; - cl.rtIn = yytext[1] - ONE; - cl.ftIn = yytext[0] - AAA; - c = cl.promoCharIn = yytext[2+skip]; - - /* [HGM] do not allow values beyond board size */ - if(cl.rtIn >= BOARD_HEIGHT || - cl.rtIn < 0 || - cl.ffIn >= BOARD_RGHT || - cl.ftIn < BOARD_LEFT ) - return 0; - - if(c != '=' && c != '+' && c != NULLCHAR && CharToPiece(c) == EmptySquare) - return IllegalMove; - - - Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl); - - currentMoveString[0] = cl.ff + AAA; - currentMoveString[1] = cl.rf + ONE; - currentMoveString[2] = cl.ft + AAA; - currentMoveString[3] = cl.rt + ONE; - currentMoveString[4] = cl.promoChar; - currentMoveString[5] = NULLCHAR; - - return (int) cl.kind; -} - YY_BREAK -case 4: -YY_RULE_SETUP -{ - /* - * Pawn capture, possibly with promotion, possibly ambiguous - */ - DisambiguateClosure cl; - int skip1 = 0, skip2 = 0; char c; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - /* remove trailing ep or e.p. (nonstandard PGN) */ - if (yytext[yyleng-1] == 'p') { - yyleng -= 2; - yytext[yyleng] = NULLCHAR; - } else if (yytext[yyleng-1] == '.') { - yyleng -= 4; - yytext[yyleng] = NULLCHAR; - } - - /* remove the [xX:-] and =() */ - if ((yytext[1] == 'x') || (yytext[1] == 'X') - || (yytext[1] == ':') || (yytext[1] == '-')) skip1 = 1; - if (yytext[2+skip1] == '=' && yytext[3+skip1] != NULLCHAR) skip2++; - if (yytext[2+skip1+skip2] == '(') skip2++; - - cl.pieceIn = WhiteOnMove(yyboardindex) ? WhitePawn : BlackPawn; - cl.rfIn = -1; - cl.ffIn = yytext[0] - AAA; - cl.rtIn = -1; - cl.ftIn = yytext[1+skip1] - AAA; - c = cl.promoCharIn = yytext[2+skip1+skip2]; - - /* [HGM] do not allow values beyond board size */ - if(cl.ffIn >= BOARD_RGHT || - cl.ffIn < BOARD_LEFT || - cl.ftIn >= BOARD_RGHT || - cl.ftIn < BOARD_LEFT ) - return 0; - - if(c != '=' && c != '+' && c != NULLCHAR && CharToPiece(c) == EmptySquare) - return IllegalMove; - - Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl); - - currentMoveString[0] = cl.ff + AAA; - currentMoveString[1] = cl.rf + ONE; - currentMoveString[2] = cl.ft + AAA; - currentMoveString[3] = cl.rt + ONE; - currentMoveString[4] = cl.promoChar; - currentMoveString[5] = NULLCHAR; - - return (int) cl.kind; -} - YY_BREAK -case 5: -YY_RULE_SETUP -{ - /* - * unambiguously abbreviated Pawn capture, possibly with promotion - */ - int skip = 0; - ChessMove result; char c; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - /* remove trailing ep or e.p. (nonstandard PGN) */ - if (yytext[yyleng-1] == 'p') { - yyleng -= 2; - yytext[yyleng] = NULLCHAR; - } else if (yytext[yyleng-1] == '.') { - yyleng -= 4; - yytext[yyleng] = NULLCHAR; - } - - /* remove the [xX:-] */ - if ((yytext[1] == 'x') || (yytext[1] == 'X') - || (yytext[1] == ':') || (yytext[1] == '-')) skip = 1; - - currentMoveString[0] = yytext[0]; - currentMoveString[2] = yytext[1+skip]; - currentMoveString[3] = yytext[2+skip]; - - /* [HGM] do not allow values beyond board size */ - if(currentMoveString[0] - AAA >= BOARD_RGHT || - currentMoveString[3] - ONE >= BOARD_HEIGHT || - currentMoveString[3] - ONE < 0 || - currentMoveString[2] - AAA >= BOARD_RGHT || - currentMoveString[0] - AAA < BOARD_LEFT || - currentMoveString[2] - AAA < BOARD_LEFT ) - return 0; - - if (gameInfo.variant == VariantXiangqi && /* [HGM] In Xiangqi rank stays same */ - currentMoveString[0] != currentMoveString[2] ) { - currentMoveString[1] = yytext[2+skip]; - } else - if (WhiteOnMove(yyboardindex)) { - if (yytext[2+skip] == ONE) return (int) ImpossibleMove; - currentMoveString[1] = yytext[2+skip] - 1; - if(boards[yyboardindex][currentMoveString[1]-ONE][currentMoveString[0]-AAA] != WhitePawn) - return ImpossibleMove; - } else { - currentMoveString[1] = currentMoveString[3] + 1; - if (currentMoveString[3] == ONE+BOARD_HEIGHT-1) return (int) ImpossibleMove; - if(boards[yyboardindex][currentMoveString[1]-ONE][currentMoveString[0]-AAA] != BlackPawn) - return ImpossibleMove; - } - if (yyleng-skip > 3) { - if (yytext[yyleng-1] == ')') - c = currentMoveString[4] = ToLower(yytext[yyleng-2]); - else - c = currentMoveString[4] = ToLower(yytext[yyleng-1]); - currentMoveString[5] = NULLCHAR; - if(c != '=' && c != '+' && CharToPiece(c) == EmptySquare) - return IllegalMove; - } else { - currentMoveString[4] = NULLCHAR; - } - - result = LegalityTest(boards[yyboardindex], - PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.! - currentMoveString[1] - ONE, - currentMoveString[0] - AAA, - currentMoveString[3] - ONE, - currentMoveString[2] - AAA, - currentMoveString[4]); - - if (currentMoveString[4] == NULLCHAR && - (result == WhitePromotionQueen || result == BlackPromotionQueen || - result == WhitePromotionKnight || result == BlackPromotionKnight)) { - currentMoveString[4] = PieceToChar(BlackQueen); - // [HGM] shatranj: take care of variants without Queen - if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier) - currentMoveString[4] = PieceToChar(BlackFerz); - if(gameInfo.variant == VariantGreat) - currentMoveString[4] = PieceToChar(BlackMan); - currentMoveString[5] = NULLCHAR; - } - - if (result != IllegalMove) return (int) result; - - /* Special case: improperly written en passant capture */ - if (WhiteOnMove(yyboardindex)) { - if (currentMoveString[3] == '5') { - currentMoveString[1] = '5'; - currentMoveString[3] = '6'; - } else { - return (int) IllegalMove; - } - } else { - if (currentMoveString[3] == '4') { - currentMoveString[1] = '4'; - currentMoveString[3] = '3'; - } else { - return (int) IllegalMove; - } - } - - result = LegalityTest(boards[yyboardindex], - PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.! - currentMoveString[1] - ONE, - currentMoveString[0] - AAA, - currentMoveString[3] - ONE, - currentMoveString[2] - AAA, - currentMoveString[4]); - - if (result == WhiteCapturesEnPassant || result == BlackCapturesEnPassant) - return (int) result; - else - return (int) IllegalMove; -} - YY_BREAK -case 6: -YY_RULE_SETUP -{ - /* - * piece move, possibly ambiguous - */ - DisambiguateClosure cl; - int skip = 0, skip2 = 0, promoted = 0; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - if(yytext[0] == '+') promoted = skip = skip2 = 1; - - /* remove the [xX:-] */ - if ((yytext[1+skip] == 'x') || (yytext[1+skip] == 'X') - || (yytext[1+skip] == ':') || (yytext[1+skip] == '-')) skip++; - - if (WhiteOnMove(yyboardindex)) { - cl.pieceIn = CharToPiece(ToUpper(yytext[skip2])); - } else { - cl.pieceIn = CharToPiece(ToLower(yytext[skip2])); - } - if(promoted) cl.pieceIn = (ChessSquare) (PROMOTED cl.pieceIn); - - cl.rfIn = -1; - cl.ffIn = -1; - cl.rtIn = yytext[2+skip] - ONE; - cl.ftIn = yytext[1+skip] - AAA; - cl.promoCharIn = NULLCHAR; - - if(yyleng-skip > 3) /* [HGM] can have Shogi-style promotion */ - cl.promoCharIn = yytext[yyleng-1]; - - if (appData.debugMode) { - fprintf(debugFP, "Parser Qa1: yyleng=%d, %d(%d,%d)-(%d,%d) = %d (%c)\n", - yyleng, - cl.pieceIn,cl.ffIn,cl.rfIn,cl.ftIn,cl.rtIn,cl.promoCharIn,cl.promoCharIn?cl.promoCharIn:' '); - } - - /* [HGM] but do not allow values beyond board size */ - if(cl.rtIn >= BOARD_HEIGHT || - cl.rtIn < 0 || - cl.ftIn >= BOARD_RGHT || - cl.ftIn < BOARD_LEFT ) - return 0; - - Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl); - - currentMoveString[0] = cl.ff + AAA; - currentMoveString[1] = cl.rf + ONE; - currentMoveString[2] = cl.ft + AAA; - currentMoveString[3] = cl.rt + ONE; - currentMoveString[4] = cl.promoChar; - currentMoveString[5] = NULLCHAR; - - return (int) cl.kind; -} - YY_BREAK -case 7: -YY_RULE_SETUP -{ - /* - * piece move with rank or file disambiguator - */ - DisambiguateClosure cl; - int skip = 0, skip2 = 0; int promoted=0; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - if(yytext[0]=='+') promoted = skip = skip2 = 1; - - /* remove the [xX:-] */ - if ((yytext[2+skip] == 'x') || (yytext[2+skip] == 'X') - || (yytext[2+skip] == ':') || (yytext[2+skip] == '-')) skip++; - - if (WhiteOnMove(yyboardindex)) { - cl.pieceIn = CharToPiece(ToUpper(yytext[skip2])); - } else { - cl.pieceIn = CharToPiece(ToLower(yytext[skip2])); - } - if(promoted) cl.pieceIn = (ChessSquare) (PROMOTED cl.pieceIn); - - if (isalpha(yytext[1+skip2])) { - cl.rfIn = -1; - cl.ffIn = yytext[1+skip2] - AAA; - - if(cl.ffIn >= BOARD_RGHT || - cl.ffIn < BOARD_LEFT ) return 0; - } else { - cl.rfIn = yytext[1+skip2] - ONE; - cl.ffIn = -1; - if(cl.rfIn >= BOARD_HEIGHT || - cl.rfIn < 0) return 0; - } - cl.rtIn = yytext[3+skip] - ONE; - cl.ftIn = yytext[2+skip] - AAA; - cl.promoCharIn = NULLCHAR; - - if(yyleng-skip > 4) /* [HGM] can have Shogi-style promotion */ - cl.promoCharIn = yytext[yyleng-1]; - - /* [HGM] do not allow values beyond board size */ - if(cl.rtIn >= BOARD_HEIGHT || - cl.rtIn < 0 || - cl.ftIn >= BOARD_RGHT || - cl.ftIn < BOARD_LEFT ) - return 0; - - Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl); - - currentMoveString[0] = cl.ff + AAA; - currentMoveString[1] = cl.rf + ONE; - currentMoveString[2] = cl.ft + AAA; - currentMoveString[3] = cl.rt + ONE; - currentMoveString[4] = cl.promoChar; - currentMoveString[5] = NULLCHAR; - - return (int) cl.kind; -} - YY_BREAK -case 8: -YY_RULE_SETUP -{ - int rf, ff, rt, ft; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - /* [HGM] all squares referenced to board edges in stead of absolute */ - if (WhiteOnMove(yyboardindex)) { - if (boards[yyboardindex][0][(BOARD_WIDTH-1)>>1] == WhiteKing) { - /* ICS wild castling */ - rf = 0; - ff = (BOARD_WIDTH-1)>>1; - rt = 0; - ft = BOARD_RGHT-3; - } else { - rf = 0; - ff = BOARD_WIDTH>>1; - rt = 0; - ft = BOARD_LEFT+2; - } - } else{ - if (boards[yyboardindex][BOARD_HEIGHT-1][(BOARD_WIDTH-1)>>1] == BlackKing) { - /* ICS wild castling */ - rf = BOARD_HEIGHT-1; - ff = (BOARD_WIDTH-1)>>1; - rt = BOARD_HEIGHT-1; - ft = BOARD_RGHT-3; - } else { - rf = BOARD_HEIGHT-1; - ff = BOARD_WIDTH>>1; - rt = BOARD_HEIGHT-1; - ft = BOARD_LEFT+2; - } - } - if(PosFlags(0) & F_FRC_TYPE_CASTLING) { - if (WhiteOnMove(yyboardindex)) { - ff = initialRights[2]; - ft = initialRights[1]; - } else { - ff = initialRights[5]; - ft = initialRights[4]; - } - if (appData.debugMode) - { - fprintf(debugFP, "Parser FRC long %d %d\n", ff, ft); - }; - if(ff < 0 || ft < 0) return 0; - } - sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); - if (appData.debugMode) { - fprintf(debugFP, "long castling %d %d\n", ff, ft); - } - return (int) LegalityTest(boards[yyboardindex], - PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: e.p.! - rf, ff, rt, ft, NULLCHAR); -} - YY_BREAK -case 9: -YY_RULE_SETUP -{ - int rf, ff, rt, ft; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - if (WhiteOnMove(yyboardindex)) { - if (boards[yyboardindex][0][(BOARD_WIDTH-1)>>1] == WhiteKing) { - /* ICS wild castling */ - rf = 0; - ff = (BOARD_WIDTH-1)>>1; - rt = 0; - ft = BOARD_LEFT+1; - } else { - rf = 0; - ff = BOARD_WIDTH>>1; - rt = 0; - ft = BOARD_RGHT-2; - } - } else { - if (boards[yyboardindex][BOARD_HEIGHT-1][(BOARD_WIDTH-1)>>1] == BlackKing) { - /* ICS wild castling */ - rf = BOARD_HEIGHT-1; - ff = (BOARD_WIDTH-1)>>1; - rt = BOARD_HEIGHT-1; - ft = BOARD_LEFT+1; - } else { - rf = BOARD_HEIGHT-1; - ff = BOARD_WIDTH>>1; - rt = BOARD_HEIGHT-1; - ft = BOARD_RGHT-2; - } - } - if(PosFlags(0) & F_FRC_TYPE_CASTLING) { - if (WhiteOnMove(yyboardindex)) { - ff = initialRights[2]; - ft = initialRights[0]; - } else { - ff = initialRights[5]; - ft = initialRights[3]; - } - if (appData.debugMode) { - fprintf(debugFP, "Parser FRC short %d %d\n", ff, ft); - } - if(ff < 0 || ft < 0) return 0; - } - sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); - if (appData.debugMode) { - fprintf(debugFP, "short castling %d %d\n", ff, ft); - } - - return (int) LegalityTest(boards[yyboardindex], - PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: e.p.! - rf, ff, rt, ft, NULLCHAR); -} - YY_BREAK -case 10: -YY_RULE_SETUP -{ - /* Bughouse piece drop. No legality checking for now. */ - currentMoveString[1] = '@'; - currentMoveString[2] = yytext[2]; - currentMoveString[3] = yytext[3]; - currentMoveString[4] = NULLCHAR; - - if (appData.debugMode) { - fprintf(debugFP, "Drop: %s\n", currentMoveString); - } - /* [HGM] do not allow values beyond board size */ - if(currentMoveString[3] - ONE >= BOARD_HEIGHT || - currentMoveString[2] - AAA >= BOARD_WIDTH ) - return 0; - - if (WhiteOnMove(yyboardindex)) { - currentMoveString[0] = ToUpper(yytext[0]); - return (int) WhiteDrop; - } else { - currentMoveString[0] = ToLower(yytext[0]); - return (int) BlackDrop; - } -} - YY_BREAK -case 11: -YY_RULE_SETUP -{ - if (WhiteOnMove(yyboardindex)) - return (int) BlackWins; - else - return (int) WhiteWins; -} - YY_BREAK -case 12: -YY_RULE_SETUP -{ - return (int) (ToUpper(yytext[0]) == 'W' ? BlackWins : WhiteWins); -} - YY_BREAK -case 13: -YY_RULE_SETUP -{ - return (int) GameUnfinished; -} - YY_BREAK -case 14: -YY_RULE_SETUP -{ - return (int) GameIsDrawn; -} - YY_BREAK -case 15: -YY_RULE_SETUP -{ - return (int) GameIsDrawn; -} - YY_BREAK -case 16: -YY_RULE_SETUP -{ - if (WhiteOnMove(yyboardindex)) - return (int) BlackWins; - else - return (int) WhiteWins; -} - YY_BREAK -case 17: -YY_RULE_SETUP -{ - if (WhiteOnMove(yyboardindex)) - return (int) BlackWins; - else - return (int) WhiteWins; -} - YY_BREAK -case 18: -YY_RULE_SETUP -{ - return (int) GameIsDrawn; -} - YY_BREAK -case 19: -YY_RULE_SETUP -{ - return (int) GameIsDrawn; -} - YY_BREAK -case 20: -YY_RULE_SETUP -{ - return (int) (ToUpper(yytext[0]) == 'W' ? WhiteWins : BlackWins); -} - YY_BREAK -case 21: -YY_RULE_SETUP -{ - return (int) (ToUpper(yytext[0]) == 'W' ? BlackWins : WhiteWins); -} - YY_BREAK -case 22: -YY_RULE_SETUP -{ - return (int) WhiteWins; -} - YY_BREAK -case 23: -YY_RULE_SETUP -{ - return (int) BlackWins; -} - YY_BREAK -case 24: -YY_RULE_SETUP -{ - return (int) GameIsDrawn; -} - YY_BREAK -case 25: -YY_RULE_SETUP -{ - return (int) GameUnfinished; -} - YY_BREAK -case 26: -YY_RULE_SETUP -{ - /* move numbers */ - if ((yyleng == 1) && (yytext[0] == '1')) - return (int) MoveNumberOne; -} - YY_BREAK -case 27: -YY_RULE_SETUP -{ - /* elapsed time indication, e.g. (0:12) or {10:21.071} */ - return (int) ElapsedTime; -} - YY_BREAK -case 28: -YY_RULE_SETUP -{ - /* position diagram enclosed in [-- --] */ - return (int) PositionDiagram; -} - YY_BREAK -case 29: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -{ - /* position diagram enclosed in {-- --} */ - return (int) PositionDiagram; -} - YY_BREAK -case 30: -YY_RULE_SETUP -{ - return (int) PGNTag; -} - YY_BREAK -case 31: -YY_RULE_SETUP -{ - return (int) GNUChessGame; -} - YY_BREAK -case 32: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -{ - return (int) XBoardGame; -} - YY_BREAK -case 33: -YY_RULE_SETUP -{ /* numeric annotation glyph */ - return (int) NAG; -} - YY_BREAK -case 34: -YY_RULE_SETUP -{ /* anything in {} */ - return (int) Comment; -} - YY_BREAK -case 35: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -{ /* ; to end of line */ - return (int) Comment; -} - YY_BREAK -case 36: -YY_RULE_SETUP -{ /* anything in [] */ - return (int) Comment; -} - YY_BREAK -case 37: -YY_RULE_SETUP -{ /* very nested () */ - return (int) Comment; -} - YY_BREAK -case 38: -YY_RULE_SETUP -{ /* >=2 chars in () */ - return (int) Comment; -} - YY_BREAK -case 39: -YY_RULE_SETUP -{ - /* Skip mail headers */ -} - YY_BREAK -case 40: -YY_RULE_SETUP -{ - /* Skip random words */ -} - YY_BREAK -case 41: -YY_RULE_SETUP -{ - /* Skip everything else */ -} - YY_BREAK -case 42: -YY_RULE_SETUP -ECHO; - YY_BREAK - case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -static yy_state_type yy_get_previous_state() - { - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = yy_start; - yy_current_state += YY_AT_BOL(); - yy_state_ptr = yy_state_buf; - *yy_state_ptr++ = yy_current_state; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 688 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *yy_state_ptr++ = yy_current_state; - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { - register int yy_is_jam; - - register YY_CHAR yy_c = 1; - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 688 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 687); - if ( ! yy_is_jam ) - *yy_state_ptr++ = yy_current_state; - - return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - - -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( yyin ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - - yy_current_buffer->yy_at_bol = (c == '\n'); - - return c; - } - - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } - - -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } - - -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif - - - -static char *StringToLex; - -#ifndef FLEX_SCANNER -static FILE *lexFP; - -static int input() -{ - int ret; - - if (StringToLex != NULL) { - ret = *StringToLex; - if (ret == NULLCHAR) - ret = EOF; - else - StringToLex++; - } else if (unputCount > 0) { - ret = unputBuffer[--unputCount]; - } else { - ret = fgetc(lexFP); - } - - if (ret == EOF) - return 0; - else - return ret; -} - -/* - * Return offset of next pattern within current file - */ -int yyoffset() -{ - int offset = ftell(lexFP) - unputCount; - - if (offset < 0) { - offset = 0; - } - return(offset); -} - -static void output(ch) - int ch; -{ - if(appData.debugMode) fprintf(debugFP, "PARSER BUG: unmatched character '%c' (0%o)\n", - ch, ch); -} - -static void unput(ch) - int ch; -{ - if (ch == 0) return; - if (StringToLex != NULL) { - StringToLex--; - } else { - if (unputCount >= UNPUT_BUF_SIZE) - if(appData.debugMode) fprintf(debugFP, "PARSER BUG: unput buffer overflow '%c' (0%o)\n", - ch, ch); - unputBuffer[unputCount++] = ch; - } -} - -/* Get ready to lex from a new file. Kludge below sticks - an artificial newline at the front of the file, which the - above grammar ignores, but which makes ^ at start of pattern - match at the real start of the file. -*/ -void yynewfile(f) - FILE *f; -{ - lexFP = f; - StringToLex = NULL; - unputCount = 0; - unput('\n'); /* kludge */ -} - -/* Get ready to lex from a string. ^ at start of pattern WON'T - match at the start of the string! -*/ -void yynewstr(s) - char *s; -{ - lexFP = NULL; - StringToLex = s; - unputCount = 0; -} -#endif /*!FLEX_SCANNER*/ - -#ifdef FLEX_SCANNER -void my_yy_input(buf, result, max_size) - char *buf; - int *result; - int max_size; -{ - int count; - - if (StringToLex != NULL) { - count = 0; - while (*StringToLex != NULLCHAR) { - *buf++ = *StringToLex++; - count++; - } - *result = count; - return; - } else { - count = fread(buf, 1, max_size, yyin); - if (count == 0) { - *result = YY_NULL; - } else { - *result = count; - } - return; - } -} - -static YY_BUFFER_STATE my_file_buffer = NULL; - -/* - Return offset of next pattern in the current file. -*/ -int yyoffset() -{ - int pos = yy_c_buf_p - YY_CURRENT_BUFFER->yy_ch_buf; - - return(ftell(YY_CURRENT_BUFFER->yy_input_file) - - yy_n_chars + pos); -} - - -void yynewstr(s) - char *s; -{ - if (my_file_buffer != NULL) - yy_delete_buffer(my_file_buffer); - StringToLex = s; - my_file_buffer = yy_create_buffer(stdin, YY_BUF_SIZE); - yy_switch_to_buffer(my_file_buffer); -} - -void yynewfile(f) - FILE *f; -{ - if (my_file_buffer != NULL) - yy_delete_buffer(my_file_buffer); - StringToLex = NULL; - my_file_buffer = yy_create_buffer(f, YY_BUF_SIZE); - yy_switch_to_buffer(my_file_buffer); -} -#endif /*FLEX_SCANNER*/ - -int yywrap() -{ - return TRUE; -} - -/* Parse a move from the given string s */ -/* ^ at start of pattern WON'T work here unless using flex */ -ChessMove yylexstr(boardIndex, s) - int boardIndex; - char *s; -{ - ChessMove ret; - char *oldStringToLex; -#ifdef FLEX_SCANNER - YY_BUFFER_STATE buffer, oldBuffer; -#endif - - yyboardindex = boardIndex; - oldStringToLex = StringToLex; - StringToLex = s; -#ifdef FLEX_SCANNER - buffer = yy_create_buffer(stdin, YY_BUF_SIZE); - oldBuffer = YY_CURRENT_BUFFER; - yy_switch_to_buffer(buffer); -#endif /*FLEX_SCANNER*/ - - ret = (ChessMove) yylex(); - -#ifdef FLEX_SCANNER - if (oldBuffer != NULL) - yy_switch_to_buffer(oldBuffer); - yy_delete_buffer(buffer); -#endif /*FLEX_SCANNER*/ - StringToLex = oldStringToLex; - - return ret; -} -- 1.7.0.4