-
-#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 <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. 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 <inttypes.h>
-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 43
-#define YY_END_OF_BUFFER 44
-/* 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[623] =
- { 0,
- 44, 42, 43, 42, 43, 42, 43, 41, 42, 43,
- 42, 43, 26, 42, 43, 42, 43, 41, 42, 43,
- 41, 42, 43,16411, 41, 42, 43,16411, 42, 43,
- 41, 42, 43, 41, 42, 43, 41, 42, 43, 41,
- 42, 43, 41, 42, 43, 41, 42, 43, 41, 42,
- 43, 41, 42, 43, 41, 42, 43, 41, 42, 43,
- 41, 42, 43, 42, 43, 41, 42, 43, 41, 42,
- 43, 41, 42, 43, 41, 42, 43, 41, 42, 43,
- 41, 42, 43, 41, 42, 43, 41, 42, 43, 41,
- 42, 43, 41, 42, 43, 41, 42, 43, 41, 42,
-
- 43, 41, 42, 43, 41, 42, 43, 41, 42, 43,
- 41, 42, 43, 41, 42, 43, 42, 43, 42, 43,
- 41, 42, 43, 41, 42, 43, 41, 42, 43,16411,
- 41, 42, 43,16411, 42, 43, 41, 42, 43, 41,
- 42, 43, 41, 42, 43, 41, 42, 43, 41, 42,
- 43, 41, 42, 43, 41, 42, 43, 41, 42, 43,
- 41, 42, 43, 41, 42, 43, 41, 42, 43, 41,
- 42, 43, 41, 42, 43, 41, 42, 43, 41, 42,
- 43, 41, 42, 43, 41, 42, 43, 41, 42, 43,
- 41, 42, 43, 41, 42, 43, 41, 42, 43, 41,
-
- 42, 43, 41, 42, 43, 41, 42, 43, 41, 42,
- 43, 41, 42, 43, 41, 42, 43, 41, 42, 43,
- 42, 43, 34, 41, 18, 41, 10, 41, 41, 41,
- 16411, 8219, 41, 36, 41, 41, 41, 41, 41, 41,
- 41, 41, 41, 41, 41, 10, 41, 41, 41, 41,
- 37, 41, 4, 41, 41, 5, 41, 41, 41, 41,
- 41, 41, 10, 41, 41, 41, 35, 41, 41, 10,
- 41, 41, 41,16411, 8219, 41, 41, 41, 41, 41,
- 41, 41, 41, 41, 41, 41, 41, 10, 41, 41,
- 41, 41, 41, 4, 41, 41, 5, 41, 41, 41,
-
- 41, 41, 41, 10, 41, 41, 41, 16, 10, 41,
- 24, 41, 24, 9, 41, 8219, 23, 41, 23, 25,
- 41, 41, 41, 41, 41, 7, 41, 41, 41, 41,
- 41, 41, 10, 41, 41, 41, 41, 5, 41, 41,
- 4, 4, 41, 4, 41, 4, 41, 5, 6, 41,
- 5, 5, 41, 41, 41, 41, 10, 41, 41, 35,
- 40, 10, 41, 24, 41, 9, 41, 23, 41, 36,
- 41, 41, 41, 41, 41, 7, 41, 41, 41, 41,
- 41, 41, 10, 41, 41, 41, 41, 5, 41, 41,
- 4, 41, 4, 41, 4, 41, 6, 41, 5, 41,
-
- 41, 41, 41, 10, 41, 41, 39, 39, 39, 38,
- 26, 26, 7, 41, 11, 7, 41, 3, 41, 8,
- 41, 7, 41, 7, 41, 41, 41, 20, 41, 41,
- 17, 41, 41, 41, 41, 41, 37, 4, 41, 4,
- 2, 41, 6, 5, 6, 6, 41, 41, 5, 5,
- 41, 41, 26, 40, 41, 7, 41, 3, 41, 8,
- 41, 41, 41, 41, 41, 20, 41, 41, 17, 41,
- 41, 41, 41, 41, 41, 2, 41, 6, 41, 41,
- 5, 41, 41, 39, 8, 3, 8, 1, 41, 21,
- 41, 41, 20, 41, 41, 41, 41, 41, 41, 31,
-
- 37, 2, 2, 2, 41, 6, 6, 6, 41, 40,
- 1, 41, 41, 41, 20, 41, 41, 41, 41, 41,
- 41, 2, 41, 6, 41, 28, 39, 1, 24, 24,
- 23, 23, 25, 25, 1, 1, 41, 22, 21, 41,
- 41, 41, 12, 41, 41, 29, 37, 31, 2, 2,
- 28, 35, 40, 40, 1, 41, 41, 41, 41, 12,
- 41, 41, 19, 1, 25, 1, 22, 20, 41, 41,
- 41, 12, 41, 41, 41, 41, 41, 12, 41, 41,
- 13, 41, 41, 41, 41, 13, 41, 41, 15, 41,
- 41, 41, 15, 41, 41, 41, 40, 41, 41, 41,
-
- 41, 40, 40, 41, 41, 32, 41, 40, 40, 32,
- 41, 14, 32, 33, 33, 36, 40, 40, 32, 40,
- 35, 30
- } ;
-
-static yyconst flex_int16_t yy_accept[705] =
- { 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, 64, 66, 69, 72, 75,
- 78, 81, 84, 87, 90, 93, 96, 99, 102, 105,
- 108, 111, 114, 117, 119, 121, 124, 127, 131, 135,
- 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, 218, 221, 223,
- 223, 224, 225, 225, 225, 225, 225, 226, 226, 226,
- 226, 227, 227, 229, 229, 229, 229, 230, 230, 230,
-
- 232, 232, 234, 234, 235, 235, 236, 236, 237, 237,
- 238, 238, 239, 240, 241, 242, 243, 244, 245, 246,
- 248, 249, 250, 251, 251, 251, 251, 251, 252, 253,
- 255, 255, 256, 258, 259, 260, 261, 262, 263, 265,
- 266, 267, 267, 267, 267, 268, 268, 269, 269, 270,
- 272, 272, 273, 275, 275, 277, 277, 278, 279, 279,
- 280, 281, 282, 283, 284, 285, 286, 287, 288, 290,
- 291, 292, 293, 294, 296, 296, 297, 299, 300, 301,
- 302, 303, 304, 306, 307, 308, 308, 308, 308, 308,
- 308, 308, 308, 308, 308, 308, 308, 309, 309, 309,
-
- 309, 309, 309, 311, 313, 314, 316, 317, 317, 317,
- 317, 319, 320, 321, 321, 322, 322, 323, 323, 324,
- 325, 325, 326, 328, 328, 328, 328, 328, 328, 328,
- 328, 329, 330, 331, 332, 333, 335, 336, 337, 338,
- 338, 338, 338, 338, 340, 340, 341, 341, 342, 344,
- 346, 348, 349, 349, 351, 352, 354, 355, 356, 357,
- 359, 360, 361, 361, 361, 361, 361, 362, 364, 366,
- 368, 370, 370, 371, 371, 372, 373, 373, 374, 375,
- 376, 378, 378, 379, 380, 381, 382, 383, 385, 386,
- 387, 388, 390, 391, 391, 393, 395, 397, 399, 401,
-
- 402, 403, 404, 406, 407, 407, 407, 408, 409, 409,
- 409, 410, 410, 410, 411, 411, 411, 412, 412, 413,
- 413, 414, 414, 414, 414, 415, 415, 415, 415, 415,
- 415, 415, 415, 416, 418, 418, 418, 420, 422, 423,
- 424, 424, 425, 426, 426, 426, 426, 426, 426, 426,
- 427, 428, 430, 430, 431, 433, 434, 435, 436, 437,
- 437, 437, 437, 437, 438, 439, 440, 440, 441, 443,
- 444, 445, 445, 445, 446, 448, 449, 450, 450, 452,
- 453, 453, 454, 454, 454, 454, 454, 455, 455, 456,
- 456, 456, 458, 460, 462, 463, 463, 464, 465, 466,
-
- 468, 469, 471, 472, 473, 474, 475, 476, 478, 480,
- 481, 483, 484, 484, 484, 484, 484, 485, 485, 485,
- 485, 485, 486, 486, 486, 486, 486, 486, 486, 486,
- 486, 486, 487, 488, 490, 490, 490, 490, 490, 490,
- 491, 492, 493, 493, 495, 495, 496, 497, 498, 499,
- 500, 500, 500, 502, 502, 502, 503, 503, 504, 506,
- 507, 507, 508, 508, 510, 510, 510, 510, 510, 510,
- 510, 510, 511, 511, 511, 513, 514, 515, 517, 518,
- 519, 520, 521, 522, 524, 526, 526, 526, 526, 526,
- 526, 526, 528, 528, 529, 529, 530, 530, 531, 531,
-
- 532, 532, 533, 533, 534, 534, 535, 535, 535, 535,
- 536, 538, 538, 538, 539, 539, 539, 540, 541, 541,
- 541, 541, 541, 541, 542, 543, 545, 546, 548, 548,
- 549, 550, 551, 551, 551, 553, 553, 553, 554, 555,
- 555, 555, 557, 558, 559, 560, 562, 563, 563, 564,
- 564, 564, 564, 564, 565, 565, 566, 567, 567, 567,
- 568, 568, 568, 569, 569, 569, 569, 569, 570, 571,
- 572, 574, 575, 575, 575, 575, 575, 575, 576, 577,
- 578, 580, 581, 581, 581, 581, 581, 581, 581, 582,
- 582, 582, 582, 582, 583, 584, 584, 584, 584, 584,
-
- 585, 586, 586, 586, 586, 586, 587, 587, 587, 587,
- 588, 589, 591, 591, 591, 591, 591, 592, 592, 593,
- 595, 595, 595, 595, 595, 596, 597, 597, 597, 597,
- 597, 598, 599, 600, 600, 600, 600, 600, 600, 601,
- 602, 602, 602, 602, 602, 603, 604, 605, 606, 606,
- 606, 606, 606, 606, 608, 608, 608, 608, 608, 609,
- 610, 612, 612, 612, 613, 613, 614, 614, 615, 615,
- 615, 617, 617, 618, 619, 619, 619, 619, 619, 621,
- 621, 621, 621, 621, 621, 621, 621, 621, 621, 621,
- 621, 621, 621, 621, 621, 621, 621, 621, 621, 621,
-
- 621, 622, 623, 623
- } ;
-
-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, 39,
- 39, 40, 41, 42, 43, 42, 44, 45, 42, 42,
- 46, 1, 47, 1, 48, 1, 49, 50, 51, 52,
-
- 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
- 73, 70, 74, 1, 75, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 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[76] =
- { 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, 12,
- 13, 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[785] =
- { 0,
- 0, 75, 3642, 4141, 126, 135, 0, 146, 3633, 144,
- 155, 175, 166, 3633, 237, 163, 3579, 3568, 123, 249,
- 245, 261, 253, 283, 300, 356, 418, 256, 259, 272,
- 277, 286, 336, 293, 227, 295, 347, 334, 3584, 159,
- 3569, 3551, 194, 405, 3614, 153, 412, 489, 396, 309,
- 554, 328, 3482, 3471, 124, 430, 423, 562, 434, 566,
- 440, 626, 395, 362, 433, 412, 538, 540, 445, 566,
- 570, 592, 589, 325, 644, 366, 645, 652, 685, 3478,
- 613, 0, 3522, 371, 699, 178, 4141, 3516, 747, 641,
- 471, 3493, 3475, 3311, 509, 708, 3308, 533, 164, 711,
-
- 3307, 0, 3320, 4141, 0, 771, 0, 823, 0, 883,
- 928, 3233, 3224, 3226, 3231, 3204, 650, 3118, 3147, 3143,
- 3113, 3130, 3120, 3112, 999, 300, 1074, 4141, 1101, 1153,
- 0, 1178, 1230, 672, 677, 716, 3072, 2971, 2967, 2962,
- 2971, 334, 2874, 720, 2942, 2941, 380, 2939, 733, 735,
- 416, 736, 1302, 655, 406, 561, 1367, 1419, 2938, 1479,
- 2892, 2887, 722, 737, 764, 757, 2871, 2900, 770, 2870,
- 738, 2879, 1503, 1555, 2897, 1580, 1632, 889, 896, 966,
- 902, 772, 773, 909, 903, 917, 2821, 587, 607, 626,
- 653, 690, 1007, 1019, 2872, 2807, 4141, 741, 1035, 2877,
-
- 2815, 2814, 2803, 2797, 2783, 0, 4141, 2782, 2779, 2778,
- 2777, 2773, 940, 792, 797, 929, 1681, 1717, 933, 978,
- 1014, 1032, 1764, 1027, 2719, 2712, 2711, 2724, 2719, 630,
- 1051, 1074, 2700, 989, 2717, 2755, 2711, 2707, 1096, 824,
- 1128, 701, 1836, 1902, 0, 1907, 0, 2756, 2754, 2753,
- 1086, 1124, 1376, 1958, 2753, 2751, 610, 2710, 2709, 2744,
- 2689, 4141, 1491, 766, 2752, 666, 2752, 825, 953, 950,
- 969, 785, 2750, 1323, 1091, 2003, 2749, 1118, 1383, 1380,
- 2050, 2745, 1495, 1708, 1370, 1498, 1497, 1108, 1744, 1770,
- 1785, 2114, 2119, 2744, 956, 2736, 1779, 2170, 970, 1368,
-
- 1496, 1774, 1304, 1833, 1240, 2693, 4141, 859, 911, 915,
- 1032, 1040, 1077, 4141, 1744, 2734, 2733, 2668, 2667, 1290,
- 1841, 2723, 2722, 2721, 2721, 1091, 2720, 180, 2719, 1421,
- 1849, 710, 4141, 2711, 1852, 1503, 0, 2710, 2709, 2175,
- 1835, 4141, 1523, 2664, 2664, 2662, 2656, 2656, 2660, 2662,
- 2659, 1320, 1118, 1220, 0, 2669, 2647, 2648, 2647, 1152,
- 1154, 922, 1676, 2694, 2687, 1701, 1809, 4141, 1875, 1851,
- 2686, 1333, 1855, 1867, 2685, 1334, 4141, 2631, 0, 2631,
- 1897, 2689, 1905, 2000, 2643, 2628, 2687, 565, 1772, 256,
- 1137, 1858, 1421, 1882, 2187, 2685, 2030, 1961, 2006, 2004,
-
- 2058, 1558, 2059, 1867, 1897, 2060, 2065, 2111, 1771, 2239,
- 1635, 2241, 1966, 2635, 1108, 2676, 1113, 1231, 1235, 1267,
- 1370, 2663, 1814, 2674, 2608, 2671, 2606, 2669, 2604, 2656,
- 1883, 4141, 4141, 2295, 2622, 2618, 2024, 2618, 2613, 2602,
- 2664, 420, 2209, 2663, 1411, 2634, 2609, 2599, 2596, 2651,
- 1530, 1971, 4141, 2649, 1975, 1996, 2000, 2065, 2638, 2637,
- 1743, 4141, 2583, 0, 2631, 2112, 2620, 2073, 2615, 2566,
- 2559, 1599, 1807, 1719, 2332, 2247, 2246, 2248, 2244, 2249,
- 2255, 2285, 2257, 1996, 2117, 2269, 983, 1424, 2614, 1455,
- 1516, 4141, 2171, 2088, 2613, 2612, 2547, 2546, 2609, 2608,
-
- 2543, 2541, 2604, 2603, 2537, 2533, 2583, 2577, 2261, 2264,
- 2580, 2527, 2536, 2224, 1783, 2533, 4141, 2532, 2569, 2521,
- 2500, 2539, 2504, 2510, 2480, 1973, 2495, 4141, 2114, 4141,
- 2531, 4141, 2522, 2375, 2528, 2464, 2458, 2510, 1949, 392,
- 271, 2277, 2370, 2272, 2276, 2375, 2376, 2276, 4141, 2455,
- 2464, 1560, 2370, 2463, 2463, 2462, 4141, 2395, 2399, 4141,
- 2392, 2438, 2412, 2319, 2352, 2313, 2282, 2307, 2278, 2264,
- 0, 2247, 2383, 2310, 2244, 1644, 1500, 2389, 2280, 2395,
- 2287, 2396, 2404, 2248, 2290, 1798, 2218, 2195, 2066, 2169,
- 2004, 2151, 2116, 2479, 2112, 2024, 2019, 1757, 842, 2554,
-
- 2390, 2418, 1974, 1956, 1924, 4141, 1903, 2041, 2081, 2629,
- 2135, 0, 1897, 1839, 2159, 1721, 2704, 2378, 2169, 2290,
- 2421, 1845, 1814, 2389, 1618, 1584, 1583, 1486, 787, 598,
- 2405, 1509, 1440, 2423, 1322, 1282, 2264, 2384, 1285, 1198,
- 1093, 1124, 2040, 1753, 2410, 2474, 1097, 913, 2437, 2381,
- 872, 2398, 2415, 0, 916, 764, 769, 2163, 2473, 2475,
- 0, 2449, 718, 4141, 686, 2400, 618, 4141, 440, 373,
- 4141, 2349, 2485, 2466, 2458, 293, 273, 1809, 2517, 2468,
- 168, 2409, 1309, 2347, 2456, 2504, 2508, 2532, 2535, 2536,
- 2538, 2568, 2581, 2583, 2584, 2589, 2590, 2591, 2603, 2470,
-
- 165, 4141, 4141, 2776, 2795, 2808, 2822, 2841, 2860, 2876,
- 2895, 2914, 2932, 1933, 2030, 2148, 2950, 2969, 2170, 2988,
- 3007, 3023, 3042, 3061, 3080, 3099, 3118, 3137, 3156, 3168,
- 3187, 3206, 3225, 3244, 3252, 2205, 3267, 3283, 3302, 3318,
- 3337, 3356, 3375, 3394, 3413, 3432, 3451, 3470, 3489, 3508,
- 3520, 3539, 3558, 3577, 3596, 3612, 3627, 3643, 3662, 3678,
- 3697, 3716, 3735, 3754, 3773, 3792, 3811, 3830, 3849, 3868,
- 3887, 3906, 3921, 3940, 3959, 3974, 3988, 4007, 4026, 4045,
- 4064, 4083, 4102, 4121
- } ;
-
-static yyconst flex_int16_t yy_def[785] =
- { 0,
- 703, 703, 703, 703, 703, 703, 704, 705, 703, 706,
- 704, 703, 12, 707, 704, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 708, 704, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 704, 704,
- 704, 704, 704, 709, 703, 710, 710, 703, 48, 707,
- 710, 51, 51, 51, 51, 51, 51, 51, 51, 51,
- 51, 710, 62, 62, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 710, 710, 710, 710, 710, 709, 703,
- 703, 704, 711, 712, 711, 703, 703, 703, 703, 703,
- 704, 703, 704, 703, 713, 713, 704, 713, 703, 12,
-
- 703, 704, 707, 703, 714, 704, 715, 703, 716, 704,
- 703, 110, 110, 704, 704, 704, 110, 110, 106, 704,
- 110, 704, 110, 717, 708, 717, 718, 703, 704, 703,
- 719, 704, 703, 704, 704, 704, 704, 704, 704, 704,
- 704, 709, 720, 709, 703, 721, 722, 703, 722, 722,
- 703, 722, 703, 703, 722, 723, 722, 703, 716, 157,
- 160, 160, 722, 722, 722, 160, 160, 157, 722, 160,
- 722, 160, 157, 703, 719, 157, 703, 722, 722, 722,
- 722, 722, 722, 722, 722, 709, 703, 724, 725, 725,
- 726, 727, 724, 724, 728, 729, 703, 730, 730, 703,
-
- 703, 703, 704, 704, 703, 704, 703, 703, 703, 703,
- 704, 703, 703, 703, 704, 703, 704, 703, 704, 704,
- 703, 217, 222, 730, 703, 703, 703, 703, 703, 703,
- 704, 704, 704, 704, 704, 704, 704, 704, 704, 731,
- 732, 733, 734, 704, 735, 704, 736, 735, 704, 246,
- 704, 737, 737, 704, 253, 704, 704, 704, 704, 704,
- 704, 703, 709, 703, 738, 703, 739, 740, 740, 740,
- 740, 741, 738, 742, 740, 740, 218, 740, 740, 276,
- 280, 224, 740, 740, 740, 740, 740, 740, 740, 740,
- 740, 740, 280, 736, 740, 293, 740, 292, 740, 740,
-
- 740, 740, 740, 740, 709, 703, 703, 743, 744, 745,
- 746, 743, 747, 703, 748, 749, 749, 750, 750, 703,
- 751, 703, 703, 703, 704, 703, 703, 703, 703, 703,
- 703, 703, 703, 704, 751, 703, 704, 704, 703, 704,
- 335, 703, 704, 703, 703, 703, 703, 703, 703, 704,
- 704, 704, 703, 704, 704, 704, 704, 704, 704, 752,
- 752, 753, 754, 755, 703, 704, 703, 703, 756, 757,
- 703, 703, 757, 757, 704, 704, 703, 703, 704, 704,
- 709, 703, 703, 703, 703, 703, 758, 703, 740, 759,
- 759, 740, 740, 740, 293, 341, 740, 740, 740, 740,
-
- 740, 740, 740, 740, 740, 740, 740, 760, 740, 740,
- 740, 740, 709, 703, 745, 761, 762, 746, 763, 747,
- 748, 703, 703, 764, 765, 766, 767, 768, 769, 703,
- 703, 703, 703, 704, 703, 703, 703, 703, 703, 703,
- 704, 704, 703, 704, 703, 704, 704, 704, 704, 704,
- 770, 771, 703, 772, 703, 773, 773, 773, 704, 703,
- 703, 703, 703, 704, 703, 709, 703, 703, 703, 703,
- 703, 774, 759, 759, 740, 740, 740, 740, 740, 740,
- 740, 740, 740, 740, 740, 709, 703, 762, 775, 746,
- 763, 703, 748, 776, 764, 764, 765, 765, 766, 766,
-
- 767, 767, 768, 768, 769, 769, 703, 703, 776, 776,
- 704, 703, 703, 703, 703, 703, 703, 704, 777, 703,
- 703, 703, 703, 704, 704, 704, 704, 703, 703, 703,
- 703, 703, 703, 709, 703, 703, 703, 774, 774, 759,
- 759, 740, 740, 740, 740, 740, 740, 709, 703, 703,
- 775, 762, 748, 703, 703, 703, 703, 703, 703, 703,
- 703, 777, 777, 703, 703, 703, 703, 704, 704, 704,
- 704, 704, 709, 703, 703, 759, 759, 740, 740, 740,
- 740, 740, 709, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 778, 704, 703, 703, 759, 759, 779,
-
- 740, 709, 703, 703, 703, 703, 703, 780, 780, 778,
- 610, 704, 703, 703, 759, 759, 779, 780, 617, 740,
- 709, 703, 703, 780, 610, 610, 703, 703, 759, 759,
- 781, 617, 617, 709, 703, 703, 780, 780, 610, 610,
- 703, 703, 759, 759, 781, 781, 617, 617, 709, 703,
- 703, 780, 780, 610, 782, 703, 783, 759, 781, 781,
- 617, 709, 703, 703, 703, 780, 782, 703, 703, 783,
- 703, 759, 781, 781, 709, 703, 703, 759, 781, 709,
- 703, 759, 709, 784, 784, 784, 784, 784, 784, 784,
- 784, 784, 784, 784, 784, 784, 784, 784, 784, 784,
-
- 703, 703, 0, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703
- } ;
-
-static yyconst flex_int16_t yy_nxt[4217] =
- { 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, 21, 22, 21, 23,
- 24, 21, 21, 25, 21, 26, 4, 4, 27, 28,
- 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
- 39, 7, 40, 7, 7, 41, 42, 7, 7, 7,
- 43, 7, 7, 44, 4, 4, 4, 4, 5, 4,
- 45, 6, 45, 7, 8, 4, 9, 10, 46, 4,
- 4, 47, 48, 49, 49, 4, 50, 4, 4, 51,
-
- 52, 53, 54, 51, 51, 55, 51, 51, 51, 51,
- 56, 57, 58, 57, 59, 60, 57, 57, 61, 57,
- 26, 4, 4, 62, 63, 64, 65, 66, 67, 68,
- 69, 70, 71, 72, 73, 74, 46, 75, 46, 46,
- 76, 77, 46, 46, 46, 78, 46, 46, 79, 4,
- 80, 81, 81, 81, 81, 84, 87, 88, 90, 115,
- 164, 82, 85, 85, 85, 85, 111, 702, 91, 95,
- 92, 93, 138, 148, 80, 94, 95, 95, 96, 82,
- 212, 703, 213, 82, 116, 165, 703, 195, 97, 98,
- 99, 100, 100, 100, 100, 101, 212, 111, 213, 102,
-
- 102, 102, 102, 102, 102, 102, 102, 82, 102, 82,
- 82, 102, 102, 102, 102, 82, 82, 82, 102, 82,
- 655, 139, 112, 102, 102, 102, 102, 102, 102, 102,
- 102, 102, 102, 102, 102, 82, 102, 102, 102, 102,
- 102, 82, 82, 82, 82, 82, 82, 82, 105, 141,
- 106, 196, 107, 108, 108, 108, 108, 109, 104, 111,
- 105, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 104, 119, 134, 134, 117, 117, 117,
- 117, 106, 133, 133, 133, 110, 110, 110, 110, 110,
- 110, 110, 110, 110, 110, 110, 110, 118, 120, 117,
-
- 117, 117, 117, 111, 473, 121, 133, 134, 106, 133,
- 133, 104, 156, 240, 136, 135, 117, 117, 117, 117,
- 134, 134, 133, 133, 133, 134, 134, 577, 133, 133,
- 133, 111, 681, 82, 134, 134, 143, 114, 133, 133,
- 133, 134, 134, 134, 134, 148, 128, 133, 133, 133,
- 122, 133, 133, 133, 549, 123, 124, 125, 125, 125,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 126,
- 124, 124, 115, 181, 82, 671, 124, 124, 124, 124,
- 191, 192, 134, 134, 134, 134, 148, 161, 82, 133,
- 133, 133, 133, 133, 104, 134, 134, 116, 111, 95,
-
- 148, 124, 128, 124, 133, 133, 133, 143, 145, 147,
- 178, 703, 177, 177, 82, 90, 148, 180, 184, 267,
- 82, 144, 144, 144, 144, 149, 148, 92, 150, 124,
- 124, 129, 151, 205, 130, 130, 130, 130, 131, 166,
- 166, 166, 166, 111, 576, 177, 166, 166, 166, 166,
- 166, 166, 166, 166, 179, 518, 166, 166, 166, 166,
- 178, 178, 132, 177, 177, 177, 133, 133, 134, 134,
- 134, 134, 134, 134, 134, 134, 134, 134, 167, 145,
- 518, 178, 178, 177, 177, 177, 170, 203, 204, 132,
- 95, 95, 96, 178, 178, 172, 677, 82, 163, 177,
-
- 177, 177, 152, 98, 99, 153, 153, 153, 153, 154,
- 95, 95, 95, 155, 155, 155, 155, 155, 155, 155,
- 155, 147, 155, 147, 147, 155, 155, 155, 155, 147,
- 147, 147, 155, 147, 95, 95, 95, 155, 155, 155,
- 155, 155, 155, 155, 155, 155, 155, 155, 155, 147,
- 155, 155, 155, 155, 155, 147, 147, 147, 147, 147,
- 147, 147, 82, 273, 274, 105, 472, 157, 472, 107,
- 158, 158, 158, 158, 159, 168, 164, 105, 166, 166,
- 166, 166, 166, 166, 166, 166, 178, 178, 178, 178,
- 177, 177, 177, 177, 177, 177, 189, 307, 157, 169,
-
- 104, 165, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 178, 178, 191, 308, 178, 178,
- 668, 177, 177, 177, 378, 157, 177, 177, 177, 81,
- 81, 81, 81, 171, 82, 191, 308, 178, 178, 173,
- 178, 178, 174, 174, 174, 174, 175, 177, 177, 177,
- 177, 177, 82, 82, 200, 111, 201, 182, 267, 644,
- 82, 202, 310, 311, 148, 148, 82, 82, 82, 82,
- 176, 212, 148, 379, 177, 177, 178, 178, 178, 178,
- 178, 178, 178, 178, 178, 178, 349, 143, 254, 254,
- 254, 254, 349, 254, 254, 254, 254, 176, 186, 313,
-
- 314, 144, 144, 144, 144, 363, 183, 185, 189, 95,
- 95, 95, 171, 430, 95, 193, 193, 193, 193, 194,
- 385, 208, 143, 209, 82, 258, 703, 431, 210, 386,
- 82, 703, 254, 254, 254, 254, 144, 144, 144, 144,
- 263, 82, 148, 82, 82, 82, 82, 364, 676, 268,
- 269, 270, 271, 148, 224, 148, 148, 148, 148, 145,
- 109, 224, 107, 198, 198, 198, 198, 109, 259, 664,
- 285, 671, 82, 147, 147, 147, 147, 382, 82, 286,
- 82, 82, 383, 384, 148, 224, 290, 273, 274, 104,
- 148, 109, 148, 148, 145, 199, 199, 199, 199, 199,
-
- 199, 199, 199, 199, 199, 199, 199, 270, 333, 333,
- 333, 333, 224, 334, 334, 334, 334, 669, 109, 215,
- 215, 215, 215, 215, 215, 215, 215, 215, 215, 215,
- 215, 82, 286, 82, 303, 270, 217, 361, 389, 82,
- 82, 82, 82, 218, 104, 148, 643, 219, 219, 219,
- 219, 219, 219, 219, 219, 219, 219, 219, 82, 82,
- 82, 82, 82, 82, 82, 82, 82, 217, 313, 314,
- 128, 220, 220, 220, 220, 220, 220, 220, 220, 220,
- 220, 220, 220, 82, 82, 82, 82, 82, 82, 82,
- 82, 82, 82, 82, 217, 82, 222, 82, 616, 223,
-
- 223, 223, 223, 224, 82, 298, 298, 298, 298, 148,
- 82, 82, 298, 298, 298, 298, 148, 82, 668, 143,
- 310, 311, 148, 148, 416, 417, 363, 222, 665, 148,
- 305, 220, 220, 220, 220, 220, 220, 220, 220, 220,
- 220, 220, 220, 331, 301, 335, 335, 335, 335, 337,
- 337, 337, 337, 332, 222, 225, 326, 226, 82, 304,
- 332, 82, 227, 228, 82, 661, 368, 229, 364, 287,
- 148, 230, 330, 148, 82, 289, 148, 82, 82, 225,
- 377, 226, 298, 298, 298, 298, 148, 227, 228, 148,
- 148, 145, 353, 229, 338, 338, 338, 338, 230, 124,
-
- 125, 125, 125, 124, 124, 124, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 354, 189, 307, 302, 124,
- 124, 124, 124, 193, 193, 193, 193, 194, 189, 307,
- 339, 339, 339, 339, 549, 315, 315, 315, 315, 354,
- 703, 419, 192, 550, 124, 128, 124, 703, 224, 313,
- 314, 321, 321, 321, 321, 224, 82, 82, 82, 82,
- 82, 82, 82, 82, 82, 82, 82, 338, 338, 338,
- 338, 703, 124, 124, 124, 241, 241, 241, 242, 224,
- 124, 124, 124, 124, 124, 124, 419, 192, 124, 124,
- 338, 338, 338, 338, 124, 124, 368, 124, 703, 82,
-
- 424, 350, 369, 369, 369, 369, 224, 392, 392, 392,
- 392, 148, 338, 338, 338, 338, 82, 416, 417, 124,
- 128, 403, 489, 490, 351, 661, 82, 656, 148, 241,
- 241, 241, 242, 253, 393, 393, 393, 393, 148, 104,
- 370, 370, 370, 370, 445, 655, 255, 124, 124, 244,
- 244, 244, 244, 244, 244, 244, 244, 244, 244, 244,
- 244, 82, 245, 359, 425, 361, 246, 451, 445, 82,
- 82, 82, 82, 247, 128, 248, 372, 249, 249, 249,
- 249, 249, 249, 249, 249, 249, 249, 249, 249, 249,
- 249, 249, 249, 249, 249, 249, 249, 250, 128, 474,
-
- 128, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 249, 249, 249, 249, 249, 249, 249,
- 249, 249, 249, 249, 250, 249, 133, 133, 133, 133,
- 133, 133, 133, 133, 133, 133, 133, 133, 82, 253,
- 419, 192, 143, 82, 489, 490, 254, 254, 254, 254,
- 654, 446, 255, 413, 256, 256, 256, 256, 256, 256,
- 256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
- 256, 256, 256, 256, 256, 447, 419, 192, 82, 82,
- 82, 82, 257, 82, 82, 82, 82, 82, 82, 82,
- 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
-
- 82, 82, 82, 95, 95, 95, 422, 422, 422, 422,
- 82, 684, 82, 654, 145, 147, 98, 412, 153, 153,
- 153, 153, 148, 443, 148, 104, 155, 155, 155, 155,
- 155, 155, 155, 155, 147, 155, 147, 147, 155, 155,
- 155, 155, 147, 147, 147, 155, 147, 378, 463, 651,
- 155, 155, 155, 155, 155, 155, 155, 155, 155, 155,
- 155, 155, 147, 155, 155, 155, 155, 155, 147, 147,
- 147, 147, 147, 147, 147, 82, 82, 390, 82, 189,
- 492, 444, 378, 145, 493, 703, 391, 148, 148, 650,
- 148, 82, 703, 703, 703, 703, 377, 464, 703, 394,
-
- 394, 394, 394, 148, 147, 147, 147, 147, 147, 147,
- 147, 147, 147, 147, 147, 275, 275, 275, 275, 275,
- 275, 275, 275, 275, 275, 275, 275, 82, 703, 82,
- 426, 411, 276, 489, 490, 147, 147, 147, 147, 277,
- 400, 148, 522, 278, 278, 278, 278, 278, 278, 278,
- 278, 278, 278, 278, 147, 147, 147, 147, 147, 147,
- 147, 147, 147, 276, 419, 192, 523, 279, 279, 279,
- 279, 279, 279, 279, 279, 279, 279, 279, 279, 147,
- 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
- 276, 147, 280, 143, 427, 281, 281, 281, 281, 282,
-
- 648, 353, 104, 82, 82, 82, 82, 381, 381, 381,
- 381, 394, 394, 394, 394, 148, 148, 148, 148, 432,
- 432, 432, 432, 280, 401, 489, 490, 279, 279, 279,
- 279, 279, 279, 279, 279, 279, 279, 279, 279, 434,
- 434, 434, 434, 451, 647, 398, 398, 642, 401, 402,
- 280, 292, 292, 292, 292, 292, 292, 292, 292, 292,
- 292, 292, 292, 82, 245, 145, 82, 599, 293, 489,
- 490, 147, 147, 147, 147, 294, 528, 248, 148, 295,
- 295, 295, 295, 295, 295, 295, 295, 295, 295, 295,
- 295, 295, 295, 295, 295, 295, 295, 295, 295, 296,
-
- 539, 388, 539, 297, 297, 297, 297, 297, 297, 297,
- 297, 297, 297, 297, 297, 295, 295, 295, 295, 295,
- 295, 295, 295, 295, 295, 295, 296, 295, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
- 82, 253, 641, 82, 640, 147, 104, 598, 298, 298,
- 298, 298, 148, 639, 255, 148, 299, 299, 299, 299,
- 299, 299, 299, 299, 299, 299, 299, 299, 299, 299,
- 299, 299, 299, 299, 299, 299, 299, 452, 452, 452,
- 147, 147, 147, 147, 300, 147, 147, 147, 147, 147,
- 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
-
- 147, 147, 147, 147, 147, 219, 219, 219, 219, 219,
- 219, 219, 219, 219, 219, 219, 82, 369, 369, 369,
- 369, 104, 453, 104, 394, 394, 394, 394, 148, 220,
- 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
- 220, 336, 336, 336, 336, 336, 336, 336, 336, 336,
- 336, 336, 82, 189, 307, 104, 658, 463, 399, 104,
- 421, 421, 421, 421, 148, 320, 320, 320, 320, 320,
- 320, 320, 320, 320, 320, 320, 320, 340, 82, 82,
- 82, 462, 82, 630, 341, 541, 342, 82, 270, 368,
- 148, 148, 148, 82, 148, 408, 408, 408, 408, 148,
-
- 404, 394, 394, 394, 394, 148, 462, 428, 340, 104,
- 615, 104, 343, 343, 343, 343, 343, 343, 343, 343,
- 343, 343, 343, 343, 399, 456, 456, 456, 456, 405,
- 494, 494, 494, 494, 560, 340, 124, 241, 241, 241,
- 242, 82, 124, 124, 124, 124, 124, 124, 703, 517,
- 124, 124, 406, 148, 341, 703, 124, 124, 428, 124,
- 373, 341, 332, 342, 703, 341, 82, 540, 682, 332,
- 636, 429, 341, 374, 703, 82, 373, 703, 148, 703,
- 342, 124, 128, 82, 457, 341, 507, 148, 82, 703,
- 82, 82, 82, 82, 82, 635, 341, 458, 508, 143,
-
- 406, 628, 148, 461, 433, 82, 703, 703, 90, 124,
- 124, 253, 341, 466, 466, 466, 466, 148, 467, 703,
- 92, 481, 429, 341, 255, 94, 256, 256, 256, 256,
- 256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
- 256, 256, 256, 256, 256, 256, 256, 214, 214, 482,
- 539, 388, 539, 627, 257, 366, 366, 366, 366, 366,
- 366, 366, 366, 366, 366, 366, 366, 373, 143, 82,
- 623, 145, 452, 452, 452, 606, 529, 529, 529, 486,
- 374, 148, 375, 375, 375, 375, 375, 375, 375, 375,
- 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
-
- 375, 375, 375, 468, 82, 457, 532, 443, 622, 703,
- 376, 82, 82, 469, 82, 99, 148, 453, 458, 476,
- 101, 530, 703, 148, 148, 570, 148, 278, 278, 278,
- 278, 278, 278, 278, 278, 278, 278, 278, 82, 571,
- 145, 549, 104, 520, 216, 216, 475, 475, 475, 475,
- 148, 279, 279, 279, 279, 279, 279, 279, 279, 279,
- 279, 279, 279, 395, 477, 478, 82, 82, 82, 520,
- 396, 624, 342, 82, 457, 614, 514, 613, 148, 148,
- 148, 408, 408, 408, 408, 148, 208, 703, 209, 479,
- 514, 514, 657, 210, 395, 624, 270, 509, 397, 397,
-
- 397, 397, 397, 397, 397, 397, 397, 397, 397, 397,
- 510, 624, 483, 480, 143, 529, 529, 529, 605, 82,
- 457, 395, 82, 253, 147, 82, 534, 147, 147, 147,
- 147, 148, 606, 458, 148, 624, 255, 148, 299, 299,
- 299, 299, 299, 299, 299, 299, 299, 299, 299, 299,
- 299, 299, 299, 299, 299, 299, 299, 299, 299, 625,
- 530, 104, 221, 221, 612, 104, 300, 407, 407, 407,
- 407, 407, 407, 407, 407, 407, 407, 407, 407, 373,
- 189, 307, 608, 626, 252, 252, 535, 553, 553, 553,
- 553, 608, 374, 632, 409, 409, 409, 409, 409, 409,
-
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 629, 672, 633, 519, 367,
- 367, 607, 410, 343, 343, 343, 343, 343, 343, 343,
- 343, 343, 343, 343, 343, 397, 397, 397, 397, 397,
- 397, 397, 397, 397, 397, 397, 397, 82, 520, 82,
- 111, 443, 82, 463, 82, 82, 82, 82, 521, 148,
- 111, 148, 589, 82, 148, 82, 148, 148, 148, 148,
- 703, 143, 544, 509, 520, 148, 514, 148, 143, 604,
- 82, 543, 548, 703, 82, 82, 703, 557, 82, 583,
- 514, 514, 148, 82, 624, 82, 148, 148, 82, 652,
-
- 148, 545, 485, 270, 509, 148, 543, 148, 556, 603,
- 148, 597, 578, 596, 595, 571, 546, 510, 624, 511,
- 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
- 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
- 82, 509, 579, 145, 594, 547, 600, 594, 593, 686,
- 145, 104, 148, 592, 510, 591, 542, 542, 542, 542,
- 542, 542, 542, 542, 542, 542, 542, 542, 542, 542,
- 542, 542, 542, 542, 542, 542, 542, 143, 82, 189,
- 492, 631, 590, 82, 82, 143, 553, 553, 553, 553,
- 148, 573, 573, 573, 573, 148, 148, 82, 82, 573,
-
- 573, 573, 573, 82, 82, 678, 143, 388, 624, 148,
- 148, 104, 388, 637, 624, 148, 148, 602, 181, 624,
- 143, 262, 563, 143, 582, 143, 666, 580, 624, 600,
- 624, 621, 624, 663, 634, 646, 649, 638, 624, 143,
- 646, 581, 620, 624, 653, 624, 581, 664, 563, 145,
- 662, 143, 624, 589, 624, 588, 587, 535, 686, 646,
- 143, 657, 675, 601, 646, 586, 585, 666, 388, 624,
- 143, 680, 686, 557, 552, 388, 388, 388, 145, 609,
- 609, 683, 609, 609, 609, 609, 609, 388, 609, 609,
- 609, 609, 145, 609, 609, 145, 646, 145, 659, 609,
-
- 609, 609, 609, 646, 646, 646, 686, 584, 673, 611,
- 686, 145, 388, 679, 575, 646, 574, 687, 679, 388,
- 646, 688, 660, 145, 609, 609, 609, 646, 646, 646,
- 262, 264, 145, 611, 686, 674, 462, 686, 686, 646,
- 686, 532, 145, 572, 701, 689, 569, 646, 690, 691,
- 568, 692, 609, 609, 609, 609, 567, 609, 609, 609,
- 609, 609, 610, 609, 609, 609, 609, 566, 609, 609,
- 686, 646, 565, 564, 618, 609, 609, 609, 262, 563,
- 137, 693, 262, 686, 619, 686, 686, 561, 559, 558,
- 557, 686, 686, 686, 694, 556, 695, 696, 555, 609,
-
- 609, 609, 697, 698, 699, 686, 262, 506, 619, 262,
- 262, 506, 262, 504, 504, 502, 700, 502, 500, 500,
- 498, 498, 496, 496, 552, 537, 536, 609, 609, 609,
- 609, 212, 609, 609, 609, 609, 609, 205, 609, 609,
- 609, 609, 262, 609, 609, 377, 533, 462, 532, 609,
- 609, 609, 609, 455, 111, 262, 527, 262, 262, 611,
- 526, 525, 524, 262, 262, 262, 443, 111, 517, 516,
- 515, 513, 512, 431, 609, 609, 609, 262, 506, 504,
- 502, 500, 498, 611, 496, 433, 307, 487, 267, 388,
- 471, 470, 86, 206, 465, 462, 377, 368, 455, 450,
-
- 449, 448, 609, 609, 609, 609, 206, 609, 609, 609,
- 609, 609, 610, 609, 609, 609, 609, 442, 609, 609,
- 441, 440, 439, 438, 618, 609, 609, 609, 437, 436,
- 435, 342, 433, 342, 619, 212, 212, 206, 205, 205,
- 205, 319, 319, 317, 317, 414, 368, 267, 267, 609,
- 609, 609, 267, 266, 388, 266, 359, 380, 619, 351,
- 350, 377, 253, 368, 368, 245, 358, 357, 356, 355,
- 352, 348, 347, 346, 345, 344, 330, 609, 609, 82,
- 330, 329, 328, 82, 82, 327, 326, 82, 82, 82,
- 82, 82, 82, 82, 82, 83, 83, 83, 83, 83,
-
- 326, 83, 83, 83, 83, 83, 83, 83, 83, 83,
- 83, 83, 83, 83, 89, 89, 325, 324, 323, 89,
- 89, 89, 103, 103, 103, 103, 103, 103, 103, 103,
- 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
- 103, 127, 127, 127, 127, 127, 127, 127, 127, 127,
- 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 147,
- 322, 319, 317, 147, 147, 147, 306, 147, 147, 147,
- 147, 147, 147, 147, 147, 188, 188, 188, 188, 188,
-
- 267, 188, 188, 188, 188, 188, 188, 188, 188, 188,
- 188, 188, 188, 188, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 207, 207, 291, 289, 288, 287, 284,
- 283, 267, 267, 207, 266, 264, 207, 207, 262, 207,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 243,
- 243, 243, 243, 243, 243, 243, 243, 243, 243, 243,
- 243, 243, 243, 243, 243, 243, 243, 243, 143, 143,
- 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
-
- 143, 143, 143, 143, 143, 143, 143, 265, 265, 265,
- 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- 265, 265, 265, 265, 265, 265, 147, 261, 237, 206,
- 147, 147, 147, 260, 147, 147, 147, 147, 147, 147,
- 147, 147, 272, 272, 272, 272, 272, 272, 272, 272,
- 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
- 272, 188, 188, 188, 188, 188, 188, 188, 188, 188,
- 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 309,
-
- 309, 309, 309, 309, 309, 309, 309, 309, 309, 309,
- 309, 309, 309, 309, 309, 309, 309, 309, 312, 312,
- 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
- 312, 312, 312, 312, 312, 312, 312, 316, 316, 235,
- 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
- 316, 316, 316, 316, 316, 316, 318, 318, 128, 318,
- 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
- 318, 318, 318, 318, 318, 320, 239, 320, 238, 237,
- 206, 320, 320, 320, 236, 235, 320, 360, 360, 360,
- 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
-
- 360, 360, 360, 360, 360, 360, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 362, 362, 362, 362, 362,
- 362, 362, 362, 362, 362, 362, 362, 362, 362, 362,
- 362, 362, 362, 362, 243, 243, 243, 243, 243, 243,
- 243, 243, 243, 243, 243, 243, 243, 243, 243, 243,
- 243, 243, 243, 365, 365, 365, 365, 365, 365, 365,
- 365, 371, 234, 234, 233, 371, 232, 371, 371, 371,
- 371, 231, 371, 265, 265, 265, 265, 265, 265, 265,
- 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
-
- 265, 265, 387, 387, 387, 387, 387, 387, 387, 387,
- 387, 387, 387, 387, 387, 387, 387, 387, 387, 387,
- 387, 147, 104, 212, 211, 147, 147, 147, 205, 147,
- 147, 147, 147, 147, 147, 147, 147, 272, 272, 272,
- 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
- 272, 272, 272, 272, 272, 272, 103, 103, 103, 103,
- 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
- 103, 103, 103, 103, 103, 312, 312, 312, 312, 312,
- 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
- 312, 312, 312, 312, 309, 309, 309, 309, 309, 309,
-
- 309, 309, 309, 309, 309, 309, 309, 309, 309, 309,
- 309, 309, 309, 415, 415, 415, 415, 415, 415, 415,
- 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
- 415, 415, 418, 418, 418, 418, 418, 418, 418, 418,
- 418, 418, 418, 418, 418, 418, 418, 418, 418, 418,
- 418, 420, 420, 420, 420, 420, 420, 420, 420, 420,
- 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
- 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
- 188, 188, 188, 188, 188, 188, 188, 188, 188, 316,
- 316, 206, 316, 316, 316, 316, 316, 316, 316, 316,
-
- 316, 316, 316, 316, 316, 316, 316, 316, 318, 318,
- 205, 318, 318, 318, 318, 318, 318, 318, 318, 318,
- 318, 318, 318, 318, 318, 318, 318, 423, 197, 423,
- 423, 189, 187, 423, 423, 423, 163, 162, 423, 360,
- 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
- 360, 360, 360, 360, 360, 360, 360, 360, 362, 362,
- 362, 362, 362, 362, 362, 362, 362, 362, 362, 362,
- 362, 362, 362, 362, 362, 362, 362, 124, 124, 124,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 124, 454, 454, 454, 454,
-
- 454, 454, 454, 454, 454, 454, 454, 454, 454, 454,
- 454, 454, 454, 454, 454, 459, 459, 146, 122, 459,
- 459, 140, 459, 459, 459, 459, 459, 459, 459, 459,
- 459, 460, 137, 114, 113, 104, 86, 460, 460, 460,
- 460, 703, 460, 387, 387, 387, 387, 387, 387, 387,
- 387, 387, 387, 387, 387, 387, 387, 387, 387, 387,
- 387, 387, 103, 103, 103, 103, 103, 103, 103, 103,
- 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
- 103, 484, 484, 703, 703, 484, 484, 484, 484, 484,
- 484, 484, 484, 484, 484, 484, 484, 416, 416, 416,
-
- 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
- 416, 416, 416, 416, 416, 416, 488, 488, 488, 488,
- 488, 488, 488, 488, 488, 488, 488, 488, 488, 488,
- 488, 488, 488, 488, 488, 491, 491, 491, 491, 491,
- 491, 491, 491, 491, 491, 491, 491, 491, 491, 491,
- 491, 491, 491, 491, 495, 495, 703, 495, 495, 495,
- 495, 495, 495, 495, 495, 495, 495, 495, 495, 495,
- 495, 495, 495, 497, 497, 703, 497, 497, 497, 497,
- 497, 497, 497, 497, 497, 497, 497, 497, 497, 497,
- 497, 497, 499, 499, 703, 499, 499, 499, 499, 499,
-
- 499, 499, 499, 499, 499, 499, 499, 499, 499, 499,
- 499, 501, 501, 703, 501, 501, 501, 501, 501, 501,
- 501, 501, 501, 501, 501, 501, 501, 501, 501, 501,
- 503, 503, 703, 503, 503, 503, 503, 503, 503, 503,
- 503, 503, 503, 503, 503, 503, 503, 503, 503, 505,
- 505, 703, 505, 505, 505, 505, 505, 505, 505, 505,
- 505, 505, 505, 505, 505, 505, 505, 505, 360, 360,
- 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
- 360, 360, 360, 360, 360, 360, 360, 124, 124, 124,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-
- 124, 124, 124, 124, 124, 124, 454, 454, 454, 454,
- 454, 454, 454, 454, 454, 454, 454, 454, 454, 454,
- 454, 454, 454, 454, 454, 531, 703, 703, 703, 703,
- 703, 531, 531, 531, 531, 531, 531, 531, 531, 531,
- 538, 538, 538, 538, 538, 538, 538, 538, 538, 538,
- 538, 538, 538, 538, 538, 538, 538, 538, 538, 551,
- 551, 551, 551, 703, 551, 551, 551, 551, 551, 551,
- 551, 551, 551, 551, 551, 551, 551, 551, 554, 703,
- 703, 703, 703, 703, 554, 554, 554, 554, 562, 562,
- 703, 562, 562, 562, 562, 562, 562, 562, 562, 562,
-
- 562, 562, 562, 562, 562, 562, 562, 610, 610, 703,
- 610, 610, 610, 610, 610, 610, 610, 610, 610, 610,
- 610, 610, 610, 610, 610, 610, 617, 617, 703, 617,
- 617, 617, 617, 617, 617, 617, 617, 617, 617, 617,
- 617, 617, 617, 617, 617, 609, 609, 703, 609, 609,
- 609, 609, 609, 609, 609, 609, 609, 609, 609, 609,
- 609, 609, 609, 609, 645, 645, 645, 645, 645, 645,
- 645, 645, 645, 645, 645, 645, 645, 645, 645, 645,
- 645, 645, 645, 667, 667, 667, 667, 667, 667, 667,
- 667, 667, 667, 667, 667, 667, 667, 667, 667, 667,
-
- 667, 667, 670, 670, 670, 670, 670, 670, 670, 670,
- 670, 670, 670, 670, 670, 670, 670, 670, 670, 670,
- 670, 685, 685, 685, 685, 685, 685, 685, 685, 685,
- 685, 685, 685, 685, 685, 685, 685, 685, 685, 685,
- 3, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
-
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703
- } ;
-
-static yyconst flex_int16_t yy_chk[4217] =
- { 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, 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, 2, 2,
- 5, 6, 6, 6, 6, 8, 10, 10, 11, 19,
- 55, 46, 8, 8, 8, 8, 16, 701, 11, 13,
- 11, 11, 40, 46, 5, 11, 12, 12, 12, 13,
- 99, 13, 99, 12, 19, 55, 13, 86, 12, 12,
- 12, 12, 12, 12, 12, 12, 328, 43, 328, 12,
-
- 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
- 681, 40, 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, 43,
- 15, 86, 15, 15, 15, 15, 15, 15, 390, 28,
- 15, 21, 21, 21, 21, 20, 20, 20, 20, 23,
- 23, 23, 23, 541, 22, 35, 35, 22, 22, 22,
- 22, 15, 35, 35, 35, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 20, 22, 24,
-
- 24, 24, 24, 25, 390, 23, 28, 29, 15, 29,
- 29, 50, 50, 126, 29, 28, 25, 25, 25, 25,
- 30, 30, 30, 30, 30, 31, 31, 541, 31, 31,
- 31, 52, 677, 74, 32, 32, 142, 30, 32, 32,
- 32, 34, 34, 36, 36, 74, 126, 34, 34, 34,
- 24, 36, 36, 36, 676, 25, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
- 26, 26, 33, 74, 76, 670, 26, 26, 26, 26,
- 84, 84, 38, 38, 33, 33, 76, 52, 147, 33,
- 33, 33, 38, 38, 540, 37, 37, 33, 63, 49,
-
- 147, 26, 26, 26, 37, 37, 37, 44, 142, 49,
- 64, 49, 64, 64, 155, 47, 49, 64, 76, 151,
- 47, 44, 44, 44, 44, 47, 155, 47, 47, 26,
- 26, 27, 47, 151, 27, 27, 27, 27, 27, 57,
- 57, 57, 57, 61, 540, 63, 56, 56, 56, 56,
- 59, 59, 59, 59, 63, 442, 61, 61, 61, 61,
- 66, 66, 27, 66, 66, 66, 27, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 56, 44,
- 442, 65, 65, 65, 65, 65, 59, 91, 91, 27,
- 48, 48, 48, 69, 69, 61, 669, 48, 65, 69,
-
- 69, 69, 48, 48, 48, 48, 48, 48, 48, 48,
- 95, 95, 95, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 98, 98, 98, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 51, 156, 156, 51, 388, 51, 388, 51,
- 51, 51, 51, 51, 51, 58, 68, 51, 58, 58,
- 58, 58, 60, 60, 60, 60, 67, 67, 68, 68,
- 67, 67, 67, 68, 68, 68, 188, 188, 51, 58,
-
- 630, 68, 51, 51, 51, 51, 51, 51, 51, 51,
- 51, 51, 51, 51, 70, 70, 189, 189, 71, 71,
- 667, 70, 70, 70, 257, 51, 71, 71, 71, 81,
- 81, 81, 81, 60, 62, 190, 190, 73, 73, 62,
- 72, 72, 62, 62, 62, 62, 62, 73, 73, 72,
- 72, 72, 75, 77, 90, 78, 90, 75, 154, 630,
- 78, 90, 191, 191, 75, 77, 117, 117, 117, 117,
- 62, 154, 78, 257, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 62, 62, 62, 230, 79, 134, 134,
- 134, 134, 230, 135, 135, 135, 135, 62, 79, 192,
-
- 192, 79, 79, 79, 79, 242, 75, 78, 85, 96,
- 96, 96, 77, 332, 100, 85, 85, 85, 85, 85,
- 266, 96, 144, 96, 100, 135, 100, 332, 96, 266,
- 163, 100, 136, 136, 136, 136, 144, 144, 144, 144,
- 144, 149, 163, 150, 152, 164, 171, 242, 665, 149,
- 149, 150, 152, 149, 198, 150, 152, 164, 171, 79,
- 89, 198, 89, 89, 89, 89, 89, 89, 136, 663,
- 163, 657, 165, 166, 166, 166, 166, 264, 169, 164,
- 182, 183, 264, 264, 165, 198, 171, 272, 272, 629,
- 169, 89, 182, 183, 144, 89, 89, 89, 89, 89,
-
- 89, 89, 89, 89, 89, 89, 89, 169, 214, 214,
- 214, 214, 198, 215, 215, 215, 215, 656, 89, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 108, 165, 268, 182, 183, 108, 240, 268, 108,
- 108, 108, 108, 108, 599, 268, 629, 108, 108, 108,
- 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
- 108, 108, 108, 108, 108, 108, 108, 108, 308, 308,
- 240, 108, 108, 108, 108, 108, 108, 108, 108, 108,
- 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
- 108, 108, 108, 108, 108, 108, 110, 178, 599, 110,
-
- 110, 110, 110, 110, 179, 178, 178, 178, 178, 178,
- 181, 185, 179, 179, 179, 179, 179, 184, 655, 186,
- 309, 309, 181, 185, 310, 310, 362, 110, 651, 184,
- 186, 110, 110, 110, 110, 110, 110, 110, 110, 110,
- 110, 110, 110, 213, 179, 216, 216, 216, 216, 219,
- 219, 219, 219, 213, 110, 111, 269, 111, 270, 185,
- 213, 269, 111, 111, 295, 648, 295, 111, 362, 181,
- 270, 111, 271, 269, 180, 184, 295, 271, 299, 111,
- 299, 111, 180, 180, 180, 180, 180, 111, 111, 271,
- 299, 186, 234, 111, 220, 220, 220, 220, 111, 125,
-
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 234, 193, 193, 180, 125,
- 125, 125, 125, 193, 193, 193, 193, 193, 194, 194,
- 221, 221, 221, 221, 487, 194, 194, 194, 194, 234,
- 224, 311, 311, 487, 125, 125, 125, 224, 199, 312,
- 312, 199, 199, 199, 199, 199, 222, 222, 222, 222,
- 222, 222, 222, 222, 222, 222, 222, 231, 231, 231,
- 231, 224, 125, 125, 127, 127, 127, 127, 127, 199,
- 127, 127, 127, 127, 127, 127, 313, 313, 127, 127,
- 232, 232, 232, 232, 127, 127, 251, 127, 224, 275,
-
- 326, 231, 251, 251, 251, 251, 199, 275, 275, 275,
- 275, 275, 239, 239, 239, 239, 288, 415, 415, 127,
- 127, 288, 417, 417, 232, 647, 278, 642, 288, 241,
- 241, 241, 241, 252, 278, 278, 278, 278, 278, 391,
- 252, 252, 252, 252, 353, 641, 252, 127, 127, 129,
- 129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
- 129, 130, 130, 239, 326, 360, 130, 361, 353, 130,
- 130, 130, 130, 130, 241, 130, 252, 130, 130, 130,
- 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
- 130, 130, 130, 130, 130, 130, 130, 130, 360, 391,
-
- 361, 130, 130, 130, 130, 130, 130, 130, 130, 130,
- 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
- 130, 130, 130, 130, 130, 130, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132, 133, 133,
- 418, 418, 305, 133, 419, 419, 133, 133, 133, 133,
- 640, 354, 133, 305, 133, 133, 133, 133, 133, 133,
- 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
- 133, 133, 133, 133, 133, 354, 420, 420, 133, 133,
- 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
- 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
-
- 133, 133, 133, 153, 153, 153, 320, 320, 320, 320,
- 153, 683, 303, 639, 305, 153, 153, 303, 153, 153,
- 153, 153, 153, 352, 303, 274, 153, 153, 153, 153,
- 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
- 153, 153, 153, 153, 153, 153, 153, 372, 376, 636,
- 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
- 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
- 153, 153, 153, 153, 153, 157, 300, 274, 285, 421,
- 421, 352, 300, 683, 421, 253, 274, 157, 300, 635,
- 285, 279, 253, 253, 253, 253, 372, 376, 253, 279,
-
- 279, 279, 279, 279, 280, 280, 280, 280, 280, 280,
- 280, 280, 280, 280, 280, 157, 157, 157, 157, 157,
- 157, 157, 157, 157, 157, 157, 157, 158, 253, 393,
- 330, 300, 158, 488, 488, 158, 158, 158, 158, 158,
- 285, 393, 445, 158, 158, 158, 158, 158, 158, 158,
- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
- 158, 158, 158, 158, 490, 490, 445, 158, 158, 158,
- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
- 158, 158, 160, 263, 330, 160, 160, 160, 160, 160,
-
- 633, 286, 577, 283, 301, 287, 286, 263, 263, 263,
- 263, 283, 283, 283, 283, 283, 301, 287, 286, 336,
- 336, 336, 336, 160, 286, 491, 491, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 343,
- 343, 343, 343, 451, 632, 283, 301, 628, 286, 287,
- 160, 173, 173, 173, 173, 173, 173, 173, 173, 173,
- 173, 173, 173, 174, 174, 263, 402, 577, 174, 552,
- 552, 174, 174, 174, 174, 174, 451, 174, 402, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
-
- 472, 472, 472, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 176, 176,
- 176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
- 177, 177, 627, 411, 626, 177, 576, 576, 177, 177,
- 177, 177, 177, 625, 177, 411, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 363, 363, 363,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
-
- 177, 177, 177, 177, 177, 217, 217, 217, 217, 217,
- 217, 217, 217, 217, 217, 217, 284, 366, 366, 366,
- 366, 474, 363, 616, 284, 284, 284, 284, 284, 217,
- 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
- 217, 218, 218, 218, 218, 218, 218, 218, 218, 218,
- 218, 218, 289, 315, 315, 644, 644, 461, 284, 598,
- 315, 315, 315, 315, 289, 218, 218, 218, 218, 218,
- 218, 218, 218, 218, 218, 218, 218, 223, 290, 409,
- 389, 409, 302, 616, 223, 474, 223, 297, 389, 297,
- 290, 409, 389, 291, 302, 297, 297, 297, 297, 297,
-
- 289, 291, 291, 291, 291, 291, 461, 586, 223, 473,
- 598, 678, 223, 223, 223, 223, 223, 223, 223, 223,
- 223, 223, 223, 223, 302, 367, 367, 367, 367, 290,
- 423, 423, 423, 423, 515, 223, 243, 243, 243, 243,
- 243, 304, 243, 243, 243, 243, 243, 243, 341, 515,
- 243, 243, 291, 304, 321, 341, 243, 243, 331, 243,
- 370, 321, 331, 321, 373, 335, 392, 473, 678, 331,
- 623, 586, 335, 370, 335, 404, 374, 373, 392, 341,
- 392, 243, 243, 369, 369, 321, 431, 404, 369, 374,
- 394, 369, 369, 369, 369, 622, 335, 369, 431, 381,
-
- 304, 614, 394, 370, 394, 405, 341, 373, 383, 243,
- 243, 244, 321, 381, 381, 381, 381, 405, 383, 374,
- 383, 404, 331, 335, 244, 383, 244, 244, 244, 244,
- 244, 244, 244, 244, 244, 244, 244, 244, 244, 244,
- 244, 244, 244, 244, 244, 244, 244, 714, 714, 405,
- 539, 539, 539, 613, 244, 246, 246, 246, 246, 246,
- 246, 246, 246, 246, 246, 246, 246, 254, 413, 398,
- 607, 381, 452, 452, 452, 605, 455, 455, 455, 413,
- 254, 398, 254, 254, 254, 254, 254, 254, 254, 254,
- 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-
- 254, 254, 254, 384, 484, 456, 484, 400, 604, 457,
- 254, 276, 400, 384, 399, 384, 484, 452, 456, 398,
- 384, 455, 457, 276, 400, 526, 399, 276, 276, 276,
- 276, 276, 276, 276, 276, 276, 276, 276, 397, 526,
- 413, 603, 643, 591, 715, 715, 397, 397, 397, 397,
- 397, 276, 276, 276, 276, 276, 276, 276, 276, 276,
- 276, 276, 276, 281, 399, 400, 401, 403, 406, 591,
- 281, 608, 281, 407, 458, 597, 437, 596, 401, 403,
- 406, 407, 407, 407, 407, 407, 468, 458, 468, 401,
- 437, 437, 643, 468, 281, 608, 403, 494, 281, 281,
-
- 281, 281, 281, 281, 281, 281, 281, 281, 281, 281,
- 494, 609, 406, 401, 466, 529, 529, 529, 589, 408,
- 408, 281, 292, 292, 408, 485, 466, 408, 408, 408,
- 408, 408, 589, 408, 292, 609, 292, 485, 292, 292,
- 292, 292, 292, 292, 292, 292, 292, 292, 292, 292,
- 292, 292, 292, 292, 292, 292, 292, 292, 292, 611,
- 529, 615, 716, 716, 595, 658, 292, 293, 293, 293,
- 293, 293, 293, 293, 293, 293, 293, 293, 293, 298,
- 493, 493, 593, 611, 719, 719, 466, 493, 493, 493,
- 493, 592, 298, 619, 298, 298, 298, 298, 298, 298,
-
- 298, 298, 298, 298, 298, 298, 298, 298, 298, 298,
- 298, 298, 298, 298, 298, 615, 658, 619, 443, 736,
- 736, 590, 298, 340, 340, 340, 340, 340, 340, 340,
- 340, 340, 340, 340, 340, 395, 395, 395, 395, 395,
- 395, 395, 395, 395, 395, 395, 395, 410, 443, 412,
- 476, 478, 479, 410, 477, 476, 478, 480, 443, 410,
- 483, 412, 588, 481, 479, 483, 477, 476, 478, 480,
- 509, 486, 479, 510, 443, 481, 514, 483, 548, 587,
- 544, 477, 486, 509, 545, 542, 510, 542, 579, 548,
- 514, 514, 544, 482, 637, 581, 545, 542, 620, 637,
-
- 579, 480, 410, 412, 434, 482, 477, 581, 585, 584,
- 620, 575, 544, 574, 572, 570, 481, 434, 637, 434,
- 434, 434, 434, 434, 434, 434, 434, 434, 434, 434,
- 434, 434, 434, 434, 434, 434, 434, 434, 434, 434,
- 475, 475, 545, 486, 569, 482, 579, 568, 567, 684,
- 548, 672, 475, 566, 475, 565, 475, 475, 475, 475,
- 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
- 475, 475, 475, 475, 475, 475, 475, 534, 543, 553,
- 553, 618, 564, 546, 547, 573, 553, 553, 553, 553,
- 543, 534, 534, 534, 534, 546, 547, 578, 601, 573,
-
- 573, 573, 573, 580, 582, 672, 583, 631, 618, 578,
- 601, 682, 645, 624, 638, 580, 582, 583, 543, 624,
- 602, 684, 563, 621, 547, 634, 652, 546, 652, 578,
- 666, 602, 618, 650, 621, 631, 634, 624, 638, 649,
- 645, 546, 601, 624, 638, 653, 580, 650, 562, 534,
- 649, 662, 652, 561, 666, 559, 558, 573, 685, 631,
- 675, 682, 662, 582, 645, 556, 555, 653, 674, 653,
- 680, 675, 700, 554, 551, 659, 646, 660, 583, 594,
- 594, 680, 594, 594, 594, 594, 594, 673, 594, 594,
- 594, 594, 602, 594, 594, 621, 674, 634, 646, 594,
-
- 594, 594, 594, 659, 646, 660, 686, 550, 659, 594,
- 687, 649, 538, 673, 537, 673, 536, 686, 674, 679,
- 674, 687, 646, 662, 594, 594, 594, 659, 646, 660,
- 685, 535, 675, 594, 688, 660, 533, 689, 690, 673,
- 691, 531, 680, 527, 700, 688, 525, 679, 689, 690,
- 524, 691, 594, 594, 600, 600, 523, 600, 600, 600,
- 600, 600, 600, 600, 600, 600, 600, 522, 600, 600,
- 692, 679, 521, 520, 600, 600, 600, 600, 686, 519,
- 518, 692, 687, 693, 600, 694, 695, 516, 513, 512,
- 511, 696, 697, 698, 693, 508, 694, 695, 507, 600,
-
- 600, 600, 696, 697, 698, 699, 688, 506, 600, 689,
- 690, 505, 691, 504, 503, 502, 699, 501, 500, 499,
- 498, 497, 496, 495, 489, 471, 470, 600, 600, 610,
- 610, 469, 610, 610, 610, 610, 610, 467, 610, 610,
- 610, 610, 692, 610, 610, 465, 463, 460, 459, 610,
- 610, 610, 610, 454, 450, 693, 449, 694, 695, 610,
- 448, 447, 446, 696, 697, 698, 444, 441, 440, 439,
- 438, 436, 435, 430, 610, 610, 610, 699, 429, 428,
- 427, 426, 425, 610, 424, 422, 416, 414, 396, 387,
- 386, 385, 382, 380, 378, 375, 371, 365, 364, 359,
-
- 358, 357, 610, 610, 617, 617, 356, 617, 617, 617,
- 617, 617, 617, 617, 617, 617, 617, 351, 617, 617,
- 350, 349, 348, 347, 617, 617, 617, 617, 346, 345,
- 344, 339, 338, 334, 617, 329, 327, 325, 324, 323,
- 322, 319, 318, 317, 316, 306, 296, 294, 282, 617,
- 617, 617, 277, 273, 267, 265, 261, 260, 617, 259,
- 258, 256, 255, 250, 249, 248, 238, 237, 236, 235,
- 233, 229, 228, 227, 226, 225, 212, 617, 617, 704,
- 211, 210, 209, 704, 704, 208, 205, 704, 704, 704,
- 704, 704, 704, 704, 704, 705, 705, 705, 705, 705,
-
- 204, 705, 705, 705, 705, 705, 705, 705, 705, 705,
- 705, 705, 705, 705, 706, 706, 203, 202, 201, 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,
- 200, 196, 195, 710, 710, 710, 187, 710, 710, 710,
- 710, 710, 710, 710, 710, 711, 711, 711, 711, 711,
-
- 175, 711, 711, 711, 711, 711, 711, 711, 711, 711,
- 711, 711, 711, 711, 712, 712, 712, 712, 712, 712,
- 712, 712, 712, 712, 712, 712, 712, 712, 712, 712,
- 712, 712, 712, 713, 713, 172, 170, 168, 167, 162,
- 161, 159, 148, 713, 146, 145, 713, 713, 143, 713,
- 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
- 717, 717, 717, 717, 717, 717, 717, 717, 717, 718,
- 718, 718, 718, 718, 718, 718, 718, 718, 718, 718,
- 718, 718, 718, 718, 718, 718, 718, 718, 720, 720,
- 720, 720, 720, 720, 720, 720, 720, 720, 720, 720,
-
- 720, 720, 720, 720, 720, 720, 720, 721, 721, 721,
- 721, 721, 721, 721, 721, 721, 721, 721, 721, 721,
- 721, 721, 721, 721, 721, 721, 722, 141, 140, 139,
- 722, 722, 722, 138, 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, 137,
- 728, 728, 728, 728, 728, 728, 728, 728, 728, 728,
- 728, 728, 728, 728, 728, 728, 729, 729, 124, 729,
- 729, 729, 729, 729, 729, 729, 729, 729, 729, 729,
- 729, 729, 729, 729, 729, 730, 123, 730, 122, 121,
- 120, 730, 730, 730, 119, 118, 730, 731, 731, 731,
- 731, 731, 731, 731, 731, 731, 731, 731, 731, 731,
-
- 731, 731, 731, 731, 731, 731, 732, 732, 732, 732,
- 732, 732, 732, 732, 732, 732, 732, 732, 732, 732,
- 732, 732, 732, 732, 732, 733, 733, 733, 733, 733,
- 733, 733, 733, 733, 733, 733, 733, 733, 733, 733,
- 733, 733, 733, 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, 737, 116, 115, 114, 737, 113, 737, 737, 737,
- 737, 112, 737, 738, 738, 738, 738, 738, 738, 738,
- 738, 738, 738, 738, 738, 738, 738, 738, 738, 738,
-
- 738, 738, 739, 739, 739, 739, 739, 739, 739, 739,
- 739, 739, 739, 739, 739, 739, 739, 739, 739, 739,
- 739, 740, 103, 101, 97, 740, 740, 740, 94, 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, 742, 742,
- 742, 742, 742, 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, 746, 746, 746, 746, 746, 746,
- 746, 746, 746, 746, 746, 746, 746, 746, 746, 746,
- 746, 747, 747, 747, 747, 747, 747, 747, 747, 747,
- 747, 747, 747, 747, 747, 747, 747, 747, 747, 747,
- 748, 748, 748, 748, 748, 748, 748, 748, 748, 748,
- 748, 748, 748, 748, 748, 748, 748, 748, 748, 749,
- 749, 93, 749, 749, 749, 749, 749, 749, 749, 749,
-
- 749, 749, 749, 749, 749, 749, 749, 749, 750, 750,
- 92, 750, 750, 750, 750, 750, 750, 750, 750, 750,
- 750, 750, 750, 750, 750, 750, 750, 751, 88, 751,
- 751, 83, 80, 751, 751, 751, 54, 53, 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, 755, 755, 755,
-
- 755, 755, 755, 755, 755, 755, 755, 755, 755, 755,
- 755, 755, 755, 755, 755, 756, 756, 45, 42, 756,
- 756, 41, 756, 756, 756, 756, 756, 756, 756, 756,
- 756, 757, 39, 18, 17, 14, 9, 757, 757, 757,
- 757, 3, 757, 758, 758, 758, 758, 758, 758, 758,
- 758, 758, 758, 758, 758, 758, 758, 758, 758, 758,
- 758, 758, 759, 759, 759, 759, 759, 759, 759, 759,
- 759, 759, 759, 759, 759, 759, 759, 759, 759, 759,
- 759, 760, 760, 0, 0, 760, 760, 760, 760, 760,
- 760, 760, 760, 760, 760, 760, 760, 761, 761, 761,
-
- 761, 761, 761, 761, 761, 761, 761, 761, 761, 761,
- 761, 761, 761, 761, 761, 761, 762, 762, 762, 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, 0, 764, 764, 764,
- 764, 764, 764, 764, 764, 764, 764, 764, 764, 764,
- 764, 764, 764, 765, 765, 0, 765, 765, 765, 765,
- 765, 765, 765, 765, 765, 765, 765, 765, 765, 765,
- 765, 765, 766, 766, 0, 766, 766, 766, 766, 766,
-
- 766, 766, 766, 766, 766, 766, 766, 766, 766, 766,
- 766, 767, 767, 0, 767, 767, 767, 767, 767, 767,
- 767, 767, 767, 767, 767, 767, 767, 767, 767, 767,
- 768, 768, 0, 768, 768, 768, 768, 768, 768, 768,
- 768, 768, 768, 768, 768, 768, 768, 768, 768, 769,
- 769, 0, 769, 769, 769, 769, 769, 769, 769, 769,
- 769, 769, 769, 769, 769, 769, 769, 769, 770, 770,
- 770, 770, 770, 770, 770, 770, 770, 770, 770, 770,
- 770, 770, 770, 770, 770, 770, 770, 771, 771, 771,
- 771, 771, 771, 771, 771, 771, 771, 771, 771, 771,
-
- 771, 771, 771, 771, 771, 771, 772, 772, 772, 772,
- 772, 772, 772, 772, 772, 772, 772, 772, 772, 772,
- 772, 772, 772, 772, 772, 773, 0, 0, 0, 0,
- 0, 773, 773, 773, 773, 773, 773, 773, 773, 773,
- 774, 774, 774, 774, 774, 774, 774, 774, 774, 774,
- 774, 774, 774, 774, 774, 774, 774, 774, 774, 775,
- 775, 775, 775, 0, 775, 775, 775, 775, 775, 775,
- 775, 775, 775, 775, 775, 775, 775, 775, 776, 0,
- 0, 0, 0, 0, 776, 776, 776, 776, 777, 777,
- 0, 777, 777, 777, 777, 777, 777, 777, 777, 777,
-
- 777, 777, 777, 777, 777, 777, 777, 778, 778, 0,
- 778, 778, 778, 778, 778, 778, 778, 778, 778, 778,
- 778, 778, 778, 778, 778, 778, 779, 779, 0, 779,
- 779, 779, 779, 779, 779, 779, 779, 779, 779, 779,
- 779, 779, 779, 779, 779, 780, 780, 0, 780, 780,
- 780, 780, 780, 780, 780, 780, 780, 780, 780, 780,
- 780, 780, 780, 780, 781, 781, 781, 781, 781, 781,
- 781, 781, 781, 781, 781, 781, 781, 781, 781, 781,
- 781, 781, 781, 782, 782, 782, 782, 782, 782, 782,
- 782, 782, 782, 782, 782, 782, 782, 782, 782, 782,
-
- 782, 782, 783, 783, 783, 783, 783, 783, 783, 783,
- 783, 783, 783, 783, 783, 783, 783, 783, 783, 783,
- 783, 784, 784, 784, 784, 784, 784, 784, 784, 784,
- 784, 784, 784, 784, 784, 784, 784, 784, 784, 784,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
-
- 703, 703, 703, 703, 703, 703, 703, 703, 703, 703,
- 703, 703, 703, 703, 703, 703
- } ;
-
-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"
-/*\r
- * parser.l -- lex parser of algebraic chess moves for XBoard\r
- *\r
- * Copyright 1991 by Digital Equipment Corporation, Maynard,\r
- * Massachusetts.\r
- *\r
- * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005,\r
- * 2006, 2007, 2008, 2009 Free Software Foundation, Inc.\r
- *\r
- * The following terms apply to Digital Equipment Corporation's copyright\r
- * interest in XBoard:\r
- * ------------------------------------------------------------------------\r
- * All Rights Reserved\r
- *\r
- * Permission to use, copy, modify, and distribute this software and its\r
- * documentation for any purpose and without fee is hereby granted,\r
- * provided that the above copyright notice appear in all copies and that\r
- * both that copyright notice and this permission notice appear in\r
- * supporting documentation, and that the name of Digital not be\r
- * used in advertising or publicity pertaining to distribution of the\r
- * software without specific, written prior permission.\r
- *\r
- * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING\r
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL\r
- * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR\r
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\r
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\r
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\r
- * SOFTWARE.\r
- * ------------------------------------------------------------------------\r
- *\r
- * The following terms apply to the enhanced version of XBoard\r
- * distributed by the Free Software Foundation:\r
- * ------------------------------------------------------------------------\r
- *\r
- * GNU XBoard is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or (at\r
- * your option) any later version.\r
- *\r
- * GNU XBoard is distributed in the hope that it will be useful, but\r
- * WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
- * General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program. If not, see http://www.gnu.org/licenses/. \r
- *\r
- *------------------------------------------------------------------------\r
- ** See the file ChangeLog for a revision history. */\r
-\r
-/* This parser handles all forms of promotion.\r
- * The parser resolves ambiguous moves by searching and check-testing.\r
- * It also parses comments of the form [anything] or (anything).\r
- *\r
- * [HGM] Parser extensively modified for bigger boards, Shogi-like syntax,\r
- * and unknow pieces. All pieces are now mandatory upper case, but can be\r
- * any letter A-Z. Files must be lower case (as before), but can run upto 'l'.\r
- * Ranks can be 0-9. The parser returns 0 for off-board files and ranks.\r
- * For an unknown piece (as mover or promotion piece) it returns\r
- * IllegalMove, like it does when the piece doesn't match.\r
- * Promotions can now also be appended Shogi-style, a bare '=' or '+',\r
- * and this is then returned as promotion character. The piece indicator\r
- * can be prefixed by a '+' to indicate it is a promoted piece.\r
- */\r
+// New PGN parser by by HGM. I was dissatisfied with the old flex-generated parser for several reasons:\r
+// 1) It required flex to build\r
+// 2) It was not possible to use variant-dependent syntax, which gave trouble for '+' as Sogi promoChar vs check symbol\r
+// 3) It could not handle double-digit rank numbers\r
+// 4) It could not handle PSN moves, with (alpha rank and file digit)\r
+// 5) Having more than 12 ranks would require extension of the rules anyway\r
+// 6) It was cumbersome to maintain, which much code duplication that had to be kept in sync when changing something\r
+// 7) It needed special handling for packaging, because we wanted to include parser.c for people who had no flex\r
+// 8) It was quite large because of the table-driven flex algorithm.\r
+// This new parser suffers from none of that. It might even accomodate traditional Xiangqi notation at some future time.\r
\r
#include "config.h"\r
-\r
-#define NO_CONSTRAINT -1\r
-#undef YYLMAX\r
-#define YYLMAX 4096\r
-#define UNPUT_BUF_SIZE YYLMAX\r
-\r
-#ifdef FLEX_SCANNER\r
-/* yytext is probably a char*, but could be a char[]. yy_text is set\r
- in YY_DECL below, because if yytext is a char*, its value is not\r
- constant. */\r
-char *yy_text;\r
-#else /*!FLEX_SCANNER*/\r
-/* yytext is definitely a char[], so yy_text can be set here, statically. */\r
-char *yy_text = (char *) yytext;\r
-#endif\r
-\r
-#ifdef FLEX_SCANNER\r
-/* This is flex */\r
-/* [AP] use prototypes in function declarations */\r
-#define YY_USE_PROTOS\r
-\r
-#ifdef YY_USE_PROTOS\r
-#define YY_PROTO(proto) proto\r
-#else\r
-#define YY_PROTO(proto) ()\r
-#endif\r
-/* end of [AP] fix */\r
-\r
-#undef YY_INPUT\r
-#define YY_INPUT(buf, result, max_size) my_yy_input(buf, &result, max_size)\r
-#undef YY_DECL\r
-#define YY_DECL \\r
- int _yylex YY_PROTO((void)); \\r
- int yylex YY_PROTO((void)) \\r
- { \\r
- int result = _yylex(); \\r
- yy_text = (char *) yytext; \\r
- return(result); \\r
- } \\r
- int _yylex YY_PROTO((void))\r
-#else\r
-/* This is lex */\r
-#undef input\r
-#undef output\r
-#undef unput\r
-#endif\r
-\r
-/* The includes must be here, below the #undef input */\r
-\r
+#include <stdio.h>\r
#include <ctype.h>\r
-\r
-#if STDC_HEADERS\r
-# include <stdlib.h>\r
-# include <string.h>\r
-#else /* not STDC_HEADERS */\r
-# if HAVE_STRING_H\r
-# include <string.h>\r
-# else /* not HAVE_STRING_H */\r
-# include <strings.h>\r
-# endif /* not HAVE_STRING_H */\r
-#endif /* not STDC_HEADERS */\r
-\r
-#if HAVE_UNISTD_H\r
-# include <unistd.h>\r
-#endif\r
-\r
-#if defined(_amigados)\r
-# include <errno.h>\r
-# if HAVE_FCNTL_H\r
-# include <fcntl.h> /* isatty() prototype */\r
-# endif /* HAVE_FCNTL_H */\r
-#endif /* defined(_amigados) */\r
-\r
+#include <string.h>\r
#include "common.h"\r
#include "backend.h"\r
#include "frontend.h"\r
#include "parser.h"\r
#include "moves.h"\r
\r
-extern int PosFlags P((int));\r
\r
extern Board boards[MAX_MOVES];\r
+extern int PosFlags(int nr);\r
int yyboardindex;\r
int yyskipmoves = FALSE;\r
-char currentMoveString[YYLMAX];\r
-#ifndef FLEX_SCANNER\r
-char unputBuffer[UNPUT_BUF_SIZE];\r
-int unputCount = 0;\r
-#endif\r
-\r
-#ifdef FLEX_SCANNER\r
-void my_yy_input P((char *buf, int *result, int max_size));\r
-#else /*!FLEX_SCANNER*/\r
-static int input P((void));\r
-static void output P((int ch));\r
-static void unput P((int ch));\r
-int yylook P((void));\r
-int yyback P((int *, int));\r
-#endif\r
-#undef yywrap\r
-int yywrap P((void));\r
-extern void CopyBoard P((Board to, Board from));\r
-\r
-#line 1892 "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 <unistd.h>
-#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"
-
-\r
-#line 2051 "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 >= 704 )
- 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] != 4141 );
-
-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"
-{\r
- /*\r
- * Fully-qualified algebraic move, possibly with promotion\r
- */\r
- int skip1 = 0, skip2 = 0, skip3 = 0, promoted = 0;\r
- ChessSquare piece;\r
- ChessMove result;\r
- char c;\r
- \r
- if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */\r
-\r
- if (yytext[0] == '+') skip1 = skip3 = promoted = 1; /* [HGM] Shogi promoted */\r
-\r
- /* remove the / */\r
- if (yytext[1+skip1] == '/') skip1++; \r
- \r
- /* remove the [xX:-] */\r
- if ((yytext[3+skip1] == 'x') || (yytext[3+skip1] == 'X') ||\r
- (yytext[3+skip1] == '-') || (yytext[3+skip1] == ':')) skip2 = 1;\r
- \r
- currentMoveString[0] = yytext[1+skip1];\r
- currentMoveString[1] = yytext[2+skip1];\r
- currentMoveString[2] = yytext[3+skip1+skip2];\r
- currentMoveString[3] = yytext[4+skip1+skip2];\r
- currentMoveString[4] = NULLCHAR;\r
- \r
- if (appData.debugMode) {\r
- fprintf(debugFP, "Parser Qa1b2: yyleng=%d\n",\r
- yyleng);\r
- }\r
-\r
- if (yyleng-skip1-skip2 > 5) { char c;\r
- if (yytext[yyleng-1] == ')') {\r
- c = currentMoveString[4] = ToLower(yytext[yyleng-2]);\r
- } else {\r
- c = currentMoveString[4] = ToLower(yytext[yyleng-1]);\r
- }\r
- currentMoveString[5] = NULLCHAR;\r
- if(c != '=' && c != '+' && CharToPiece(c) == EmptySquare)\r
- return IllegalMove; /* [HGM] promotion to invalid piece */\r
- }\r
-\r
- if (appData.debugMode) {\r
- fprintf(debugFP, "parser: %s\n", currentMoveString);\r
- }\r
- /* [HGM] do not allow values beyond board size */\r
- if(currentMoveString[1] - ONE >= BOARD_HEIGHT ||\r
- currentMoveString[1] - ONE < 0 ||\r
- currentMoveString[0] - AAA >= BOARD_RGHT ||\r
- currentMoveString[3] - ONE >= BOARD_HEIGHT ||\r
- currentMoveString[3] - ONE < 0 ||\r
- currentMoveString[2] - AAA >= BOARD_RGHT ||\r
- currentMoveString[0] - AAA < BOARD_LEFT ||\r
- currentMoveString[2] - AAA < BOARD_LEFT )\r
- return ImpossibleMove;\r
-\r
- piece = boards[yyboardindex]\r
- [currentMoveString[1] - ONE][currentMoveString[0] - AAA];\r
- if(promoted) piece = (ChessSquare) (DEMOTED piece);\r
- c = PieceToChar(piece);\r
- if(c == '~') c = PieceToChar((ChessSquare) (DEMOTED piece));\r
- if (ToLower(yytext[skip3]) != ToLower(c))\r
- return (int) IllegalMove;\r
-\r
- result = LegalityTest(boards[yyboardindex],\r
- PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.!\r
- currentMoveString[1] - ONE,\r
- currentMoveString[0] - AAA,\r
- currentMoveString[3] - ONE,\r
- currentMoveString[2] - AAA,\r
- currentMoveString[4]);\r
+char currentMoveString[4096]; // a bit ridiculous size?\r
+char *yy_text;\r
\r
- if (currentMoveString[4] == NULLCHAR &&\r
- (result == WhitePromotionKnight || result == BlackPromotionKnight ||\r
- result == WhitePromotionQueen || result == BlackPromotionQueen)) {\r
- currentMoveString[4] = PieceToChar(BlackQueen);\r
- currentMoveString[5] = NULLCHAR;\r
+#define PARSEBUFSIZE 10000\r
+\r
+static FILE *inputFile;\r
+static char *inPtr, *parsePtr, *parseStart;\r
+static char inputBuf[PARSEBUFSIZE];\r
+static char yytext[PARSEBUFSIZE];\r
+static char fromString = 0, lastChar = '\n';\r
+\r
+#define NOTHING 0\r
+#define NUMERIC 1\r
+#define ALPHABETIC 2\r
+#define BADNUMBER (-2000000000)\r
+\r
+int ReadLine()\r
+{ // Read one line from the input file, and append to the buffer\r
+ char c, *start = inPtr;\r
+ if(fromString) return 0; // parsing string, so the end is a hard end\r
+ if(!inputFile) return 0;\r
+ while((c = fgetc(inputFile)) != EOF) {\r
+ *inPtr++ = c;\r
+ if(c == '\n') { *inPtr = NULLCHAR; return 1; }\r
+ if(inPtr - inputBuf > PARSEBUFSIZE-2) inPtr--; //prevent crash on overflow\r
}\r
-\r
- return (int) result;\r
+ if(inPtr == start) return 0;\r
+ *inPtr++ = '\n', *inPtr = NULLCHAR; // repair missing linefeed at EOF\r
+ return 1;\r
}\r
- YY_BREAK
-case 2:
-YY_RULE_SETUP
-#line 263 "parser.l"
-{\r
- /*\r
- * Simple algebraic move, possibly with promotion\r
- * [HGM] Engine moves are received in this format, with lower-case promoChar!\r
- */\r
- int skip = 0;\r
- ChessMove result;\r
-\r
- if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */\r
-\r
- /* remove the [xX:-] */\r
- if ((yytext[2] == 'x') || (yytext[2] == 'X') ||\r
- (yytext[2] == '-') || (yytext[2] == ':')) skip = 1;\r
-\r
- currentMoveString[0] = yytext[0];\r
- currentMoveString[1] = yytext[1];\r
- currentMoveString[2] = yytext[2+skip];\r
- currentMoveString[3] = yytext[3+skip];\r
- currentMoveString[4] = NULLCHAR;\r
-\r
- if (yyleng-skip > 4) { char c;\r
- if (yytext[yyleng-1] == ')') {\r
- c = currentMoveString[4] = ToLower(yytext[yyleng-2]);\r
- } else {\r
- c = currentMoveString[4] = ToLower(yytext[yyleng-1]);\r
- }\r
- currentMoveString[5] = NULLCHAR;\r
- if(c != '=' && c != '+' && CharToPiece(c) == EmptySquare)\r
- return IllegalMove;\r
- }\r
-\r
- /* [HGM] do not allow values beyond board size */\r
- if(currentMoveString[1] - ONE >= BOARD_HEIGHT ||\r
- currentMoveString[1] - ONE < 0 ||\r
- currentMoveString[0] - AAA >= BOARD_RGHT ||\r
- currentMoveString[3] - ONE >= BOARD_HEIGHT ||\r
- currentMoveString[3] - ONE < 0 ||\r
- currentMoveString[2] - AAA >= BOARD_RGHT ||\r
- currentMoveString[0] - AAA < BOARD_LEFT ||\r
- currentMoveString[2] - AAA < BOARD_LEFT )\r
- return ImpossibleMove;\r
-\r
- result = LegalityTest(boards[yyboardindex],\r
- PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.!\r
- currentMoveString[1] - ONE,\r
- currentMoveString[0] - AAA,\r
- currentMoveString[3] - ONE,\r
- currentMoveString[2] - AAA,\r
- currentMoveString[4]);\r
\r
- if (currentMoveString[4] == NULLCHAR) {
- if(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;
- }
- } else if(appData.testLegality && // strip off unnecessary and false promo characters
- !(result == WhitePromotionQueen || result == BlackPromotionQueen ||
- result == WhiteNonPromotion || result == BlackNonPromotion)) currentMoveString[4] = NULLCHAR;
-
- return (int) result;
-}
- YY_BREAK
-case 3:
-YY_RULE_SETUP
-#line 331 "parser.l"
-{
- /*
- * Simple algebraic move, in capitals
- * [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]+32;
- currentMoveString[1] = yytext[1];
- currentMoveString[2] = yytext[2+skip]+32;
- currentMoveString[3] = yytext[3+skip];
- currentMoveString[4] = NULLCHAR;
-
- /* [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 ImpossibleMove;
-
- 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 &&\r
- (result == WhitePromotionKnight || result == BlackPromotionKnight ||\r
- result == WhitePromotionQueen || result == BlackPromotionQueen)) {\r
- if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || gameInfo.variant == VariantMakruk)\r
- currentMoveString[4] = PieceToChar(BlackFerz);\r
- else if(gameInfo.variant == VariantGreat)\r
- currentMoveString[4] = PieceToChar(BlackMan);\r
- else\r
- currentMoveString[4] = PieceToChar(BlackQueen);\r
- currentMoveString[5] = NULLCHAR;\r
- } else if(appData.testLegality && // strip off unnecessary and false promo characters
- !(result == WhitePromotionQueen || result == BlackPromotionQueen ||
- result == WhiteNonPromotion || result == BlackNonPromotion)) currentMoveString[4] = NULLCHAR;
-\r
- return (int) result;\r
+int Scan(char c, char **p)\r
+{ // line-spanning skip to mentioned character or EOF\r
+ do {\r
+ while(**p) if(*(*p)++ == c) return 0;\r
+ } while(ReadLine());\r
+ // no closing bracket; force match for entire rest of file.\r
+ return 1;\r
}\r
- YY_BREAK
-case 4:
-YY_RULE_SETUP
-#line 387 "parser.l"
-{\r
- /*\r
- * Pawn move, possibly with promotion\r
- */\r
- DisambiguateClosure cl;\r
- int skip = 0; char c;\r
-\r
- if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */\r
\r
- /* remove the =() */\r
- if (yytext[2] == '=' && yytext[3] != NULLCHAR) skip++;\r
- if (yytext[2+skip] == '(') skip++;\r
-\r
- cl.pieceIn = WhiteOnMove(yyboardindex) ? WhitePawn : BlackPawn;\r
- cl.rfIn = -1;\r
- cl.ffIn = yytext[0] - AAA;\r
- cl.rtIn = yytext[1] - ONE;\r
- cl.ftIn = yytext[0] - AAA;\r
- c = cl.promoCharIn = ToLower(yytext[2+skip]);\r
-\r
- /* [HGM] do not allow values beyond board size */\r
- if(cl.rtIn >= BOARD_HEIGHT ||\r
- cl.rtIn < 0 ||\r
- cl.ffIn >= BOARD_RGHT ||\r
- cl.ftIn < BOARD_LEFT )\r
- return ImpossibleMove;\r
-\r
- if(c != '=' && c != '+' && c != NULLCHAR && CharToPiece(c) == EmptySquare)\r
- return IllegalMove;\r
-\r
-\r
- Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl);\r
-\r
- currentMoveString[0] = cl.ff + AAA;\r
- currentMoveString[1] = cl.rf + ONE;\r
- currentMoveString[2] = cl.ft + AAA;\r
- currentMoveString[3] = cl.rt + ONE;\r
- currentMoveString[4] = cl.promoChar;\r
- currentMoveString[5] = NULLCHAR;\r
-\r
- return (int) cl.kind;\r
+int SkipWhite(char **p)\r
+{ // skip spaces tabs and newlines; return 1 if anything was skipped\r
+ char *start = *p;\r
+ do{\r
+ while(**p == ' ' || **p == '\t' || **p == '\n' || **p == '\r') (*p)++;\r
+ } while(**p == NULLCHAR && ReadLine()); // continue as long as ReadLine reads something\r
+ return *p != start;\r
}\r
- YY_BREAK
-case 5:
-YY_RULE_SETUP
-#line 431 "parser.l"
-{\r
- /*\r
- * Pawn capture, possibly with promotion, possibly ambiguous\r
- */\r
- DisambiguateClosure cl;\r
- int skip1 = 0, skip2 = 0; char c;\r
-\r
- if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */\r
-\r
- /* remove trailing ep or e.p. (nonstandard PGN) */\r
- if (yytext[yyleng-1] == 'p') {\r
- yyleng -= 2;\r
- yytext[yyleng] = NULLCHAR;\r
- } else if (yytext[yyleng-1] == '.') {\r
- yyleng -= 4;\r
- yytext[yyleng] = NULLCHAR;\r
- }\r
-\r
- /* remove the [xX:-] and =() */\r
- if ((yytext[1] == 'x') || (yytext[1] == 'X')\r
- || (yytext[1] == ':') || (yytext[1] == '-')) skip1 = 1;\r
- if (yytext[2+skip1] == '=' && yytext[3+skip1] != NULLCHAR) skip2++;\r
- if (yytext[2+skip1+skip2] == '(') skip2++;\r
-\r
- cl.pieceIn = WhiteOnMove(yyboardindex) ? WhitePawn : BlackPawn;\r
- cl.rfIn = -1;\r
- cl.ffIn = yytext[0] - AAA;\r
- cl.rtIn = -1;\r
- cl.ftIn = yytext[1+skip1] - AAA;\r
- c = cl.promoCharIn = yytext[2+skip1+skip2];\r
\r
- /* [HGM] do not allow values beyond board size */\r
- if(cl.ffIn >= BOARD_RGHT ||\r
- cl.ffIn < BOARD_LEFT ||\r
- cl.ftIn >= BOARD_RGHT ||\r
- cl.ftIn < BOARD_LEFT )\r
- return ImpossibleMove;\r
-\r
- if(c != '=' && c != '+' && c != NULLCHAR && CharToPiece(c) == EmptySquare)\r
- return IllegalMove;\r
-\r
- Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl);\r
-\r
- currentMoveString[0] = cl.ff + AAA;\r
- currentMoveString[1] = cl.rf + ONE;\r
- currentMoveString[2] = cl.ft + AAA;\r
- currentMoveString[3] = cl.rt + ONE;\r
- currentMoveString[4] = cl.promoChar;\r
- currentMoveString[5] = NULLCHAR;\r
-\r
- return (int) cl.kind;\r
-}\r
- YY_BREAK
-case 6:
-YY_RULE_SETUP
-#line 484 "parser.l"
+int Match(char *pattern, char **ptr)\r
{\r
- /*\r
- * unambiguously abbreviated Pawn capture, possibly with promotion\r
- */\r
- int skip = 0;\r
- ChessMove result; char c;\r
-\r
- if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */\r
-\r
- /* remove trailing ep or e.p. (nonstandard PGN) */\r
- if (yytext[yyleng-1] == 'p') {\r
- yyleng -= 2;\r
- yytext[yyleng] = NULLCHAR;\r
- } else if (yytext[yyleng-1] == '.') {\r
- yyleng -= 4;\r
- yytext[yyleng] = NULLCHAR;\r
- }\r
-\r
- /* remove the [xX:-] */\r
- if ((yytext[1] == 'x') || (yytext[1] == 'X')\r
- || (yytext[1] == ':') || (yytext[1] == '-')) skip = 1;\r
-\r
- currentMoveString[0] = yytext[0];\r
- currentMoveString[2] = yytext[1+skip];\r
- currentMoveString[3] = yytext[2+skip];\r
-\r
- /* [HGM] do not allow values beyond board size */\r
- if(currentMoveString[0] - AAA >= BOARD_RGHT ||\r
- currentMoveString[3] - ONE >= BOARD_HEIGHT ||\r
- currentMoveString[3] - ONE < 0 ||\r
- currentMoveString[2] - AAA >= BOARD_RGHT ||\r
- currentMoveString[0] - AAA < BOARD_LEFT ||\r
- currentMoveString[2] - AAA < BOARD_LEFT )\r
- return ImpossibleMove;\r
-\r
- if (gameInfo.variant == VariantXiangqi && /* [HGM] In Xiangqi rank stays same */\r
- currentMoveString[0] != currentMoveString[2] ) {\r
- currentMoveString[1] = yytext[2+skip];\r
- } else \r
- if (WhiteOnMove(yyboardindex)) {\r
- if (yytext[2+skip] == ONE) return (int) ImpossibleMove;\r
- currentMoveString[1] = yytext[2+skip] - 1;\r
- if(boards[yyboardindex][currentMoveString[1]-ONE][currentMoveString[0]-AAA] != WhitePawn) \r
- return ImpossibleMove;\r
- } else {\r
- currentMoveString[1] = currentMoveString[3] + 1;\r
- if (currentMoveString[3] == ONE+BOARD_HEIGHT-1) return (int) ImpossibleMove;\r
- if(boards[yyboardindex][currentMoveString[1]-ONE][currentMoveString[0]-AAA] != BlackPawn) \r
- return ImpossibleMove;\r
- }\r
- if (yyleng-skip > 3) {\r
- if (yytext[yyleng-1] == ')')\r
- c = currentMoveString[4] = ToLower(yytext[yyleng-2]);\r
- else\r
- c = currentMoveString[4] = ToLower(yytext[yyleng-1]);\r
- currentMoveString[5] = NULLCHAR;\r
- if(c != '=' && c != '+' && CharToPiece(c) == EmptySquare)\r
- return IllegalMove;\r
- } else {\r
- currentMoveString[4] = NULLCHAR;\r
- }\r
-\r
- result = LegalityTest(boards[yyboardindex],\r
- PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.!\r
- currentMoveString[1] - ONE,\r
- currentMoveString[0] - AAA,\r
- currentMoveString[3] - ONE,\r
- currentMoveString[2] - AAA,\r
- currentMoveString[4]);\r
-\r
- if (currentMoveString[4] == NULLCHAR &&\r
- (result == WhitePromotionQueen || result == BlackPromotionQueen ||\r
- result == WhitePromotionKnight || result == BlackPromotionKnight)) {\r
- currentMoveString[4] = PieceToChar(BlackQueen);\r
- // [HGM] shatranj: take care of variants without Queen\r
- if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || gameInfo.variant == VariantMakruk)\r
- currentMoveString[4] = PieceToChar(BlackFerz);\r
- if(gameInfo.variant == VariantGreat)\r
- currentMoveString[4] = PieceToChar(BlackMan);\r
- currentMoveString[5] = NULLCHAR;\r
+ char *p = pattern, *s = *ptr;\r
+ while(*p && (*p == *s++ || s[-1] == '\r' && *p--)) p++;\r
+ if(*p == 0) {\r
+ *ptr = s;\r
+ return 1;\r
}\r
+ return 0; // no match, no ptr update\r
+}\r
\r
- if (result != IllegalMove) return (int) result;\r
-\r
- /* Special case: improperly written en passant capture */\r
- if (WhiteOnMove(yyboardindex)) {\r
- if (currentMoveString[3] == '5') {\r
- currentMoveString[1] = '5';\r
- currentMoveString[3] = '6';\r
- } else {\r
- return (int) IllegalMove;\r
- }\r
- } else {\r
- if (currentMoveString[3] == '4') {\r
- currentMoveString[1] = '4';\r
- currentMoveString[3] = '3';\r
- } else {\r
- return (int) IllegalMove;\r
- }\r
+int Word(char *pattern, char **p)\r
+{\r
+ if(Match(pattern, p)) return 1;\r
+ if(*pattern >= 'a' && *pattern <= 'z' && *pattern - **p == 'a' - 'A') { // capitalized\r
+ (*p)++;\r
+ if(Match(pattern + 1, p)) return 1;\r
+ (*p)--;\r
}\r
-\r
- result = LegalityTest(boards[yyboardindex],\r
- PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.!\r
- currentMoveString[1] - ONE,\r
- currentMoveString[0] - AAA,\r
- currentMoveString[3] - ONE,\r
- currentMoveString[2] - AAA,\r
- currentMoveString[4]);\r
-\r
- if (result == WhiteCapturesEnPassant || result == BlackCapturesEnPassant)\r
- return (int) result;\r
- else\r
- return (int) IllegalMove;\r
+ return 0;\r
}\r
- YY_BREAK
-case 7:
-YY_RULE_SETUP
-#line 599 "parser.l"
-{\r
- /*\r
- * piece move, possibly ambiguous\r
- */\r
- DisambiguateClosure cl;\r
- int skip = 0, skip2 = 0, promoted = 0;\r
-\r
- if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */\r
\r
- if(yytext[0] == '+') promoted = skip = skip2 = 1;\r
+int Verb(char *pattern, char **p)\r
+{\r
+ int res = Word(pattern, p);\r
+ if(res && !Match("s", p)) Match("ed", p); // eat conjugation suffix, if any\r
+ return res;\r
+}\r
\r
- /* remove the [xX:-] */\r
- if ((yytext[1+skip] == 'x') || (yytext[1+skip] == 'X')\r
- || (yytext[1+skip] == ':') || (yytext[1+skip] == '-')) skip++;\r
\r
- if (WhiteOnMove(yyboardindex)) {\r
- cl.pieceIn = CharToPiece(ToUpper(yytext[skip2]));\r
- } else {\r
- cl.pieceIn = CharToPiece(ToLower(yytext[skip2]));\r
+int Number(char **p)\r
+{\r
+ int val = 0;\r
+ if(**p < '0' || **p > '9') return BADNUMBER;\r
+ while(**p >= '0' && **p <= '9') {\r
+ val = 10*val + *(*p)++ - '0';\r
}\r
- if(promoted) cl.pieceIn = (ChessSquare) (PROMOTED cl.pieceIn);\r
-\r
- cl.rfIn = -1;\r
- cl.ffIn = -1;\r
- cl.rtIn = yytext[2+skip] - ONE;\r
- cl.ftIn = yytext[1+skip] - AAA;\r
- cl.promoCharIn = NULLCHAR;\r
-\r
- if(yyleng-skip > 3) /* [HGM] can have Shogi-style promotion */\r
- cl.promoCharIn = yytext[yyleng-1];\r
+ return val;\r
+}\r
\r
- if (appData.debugMode) {\r
- fprintf(debugFP, "Parser Qa1: yyleng=%d, %d(%d,%d)-(%d,%d) = %d (%c)\n",\r
- yyleng,\r
- cl.pieceIn,cl.ffIn,cl.rfIn,cl.ftIn,cl.rtIn,cl.promoCharIn,cl.promoCharIn?cl.promoCharIn:' ');\r
+int RdTime(char c, char **p)\r
+{\r
+ char *start = ++(*p), *sec; // increment *p, as it was pointing to the opening ( or {\r
+ if(Number(p) == BADNUMBER) return 0;\r
+ sec = *p;\r
+ if(Match(":", p) && Number(p) != BADNUMBER && *p - sec == 3) { // well formed\r
+ sec = *p;\r
+ if(Match(".", p) && Number(p) != BADNUMBER && *(*p)++ == c) return 1; // well-formed fraction\r
+ *p = sec;\r
+ if(*(*p)++ == c) return 1; // matching bracket without fraction\r
}\r
-\r
- /* [HGM] but do not allow values beyond board size */\r
- if(cl.rtIn >= BOARD_HEIGHT ||\r
- cl.rtIn < 0 ||\r
- cl.ftIn >= BOARD_RGHT ||\r
- cl.ftIn < BOARD_LEFT )\r
- return ImpossibleMove;\r
-\r
- Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl);\r
-\r
- currentMoveString[0] = cl.ff + AAA;\r
- currentMoveString[1] = cl.rf + ONE;\r
- currentMoveString[2] = cl.ft + AAA;\r
- currentMoveString[3] = cl.rt + ONE;\r
- currentMoveString[4] = cl.promoChar;\r
- currentMoveString[5] = NULLCHAR;\r
-\r
- return (int) cl.kind;\r
+ *p = start; // failure\r
+ return 0;\r
}\r
- YY_BREAK
-case 8:
-YY_RULE_SETUP
-#line 655 "parser.l"
-{\r
- /*\r
- * piece move with rank or file disambiguator\r
- */\r
- DisambiguateClosure cl;\r
- int skip = 0, skip2 = 0; int promoted=0;\r
-\r
- if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */\r
-\r
- if(yytext[0]=='+') promoted = skip = skip2 = 1;\r
\r
- /* remove the [xX:-] */\r
- if ((yytext[2+skip] == 'x') || (yytext[2+skip] == 'X')\r
- || (yytext[2+skip] == ':') || (yytext[2+skip] == '-')) skip++;\r
-\r
- if (WhiteOnMove(yyboardindex)) {\r
- cl.pieceIn = CharToPiece(ToUpper(yytext[skip2]));\r
- } else {\r
- cl.pieceIn = CharToPiece(ToLower(yytext[skip2]));\r
- }\r
- if(promoted) cl.pieceIn = (ChessSquare) (PROMOTED cl.pieceIn);\r
+char PromoSuffix(char **p)\r
+{\r
+ char *start = *p;\r
+ if(**p == 'e' && (Match("ep", p) || Match("e.p.", p))) { *p = start; return NULLCHAR; } // non-compliant e.p. suffix is no promoChar!\r
+ if(**p == '+' && gameInfo.variant == VariantShogi) { (*p)++; return '+'; } \r
+ if(**p == '=') (*p)++; //optional =\r
+ if(**p == '(' && (*p)[2] == ')' && isalpha( (*p)[1] )) { (*p) += 3; return (*p)[-2]; }\r
+ if(isalpha(**p)) return *(*p)++;\r
+ if(*p != start) return '='; // must be the optional =\r
+ return NULLCHAR; // no suffix detected\r
+}\r
\r
- if (isalpha(yytext[1+skip2])) {\r
- cl.rfIn = -1;\r
- cl.ffIn = yytext[1+skip2] - AAA;\r
- \r
- if(cl.ffIn >= BOARD_RGHT ||\r
- cl.ffIn < BOARD_LEFT ) return 0;\r
- } else {\r
- cl.rfIn = yytext[1+skip2] - ONE;\r
- cl.ffIn = -1;\r
- if(cl.rfIn >= BOARD_HEIGHT ||\r
- cl.rfIn < 0) return 0;\r
- }\r
- cl.rtIn = yytext[3+skip] - ONE;\r
- cl.ftIn = yytext[2+skip] - AAA;\r
- cl.promoCharIn = NULLCHAR;\r
+int NextUnit(char **p)\r
+{ // Main parser routine\r
+ int coord[4], n, result, piece, i;\r
+ char type[4], promoted, separator, slash, *oldp, *commentEnd, c;\r
+ int wom = WhiteOnMove(yyboardindex);\r
\r
- if(yyleng-skip > 4) /* [HGM] can have Shogi-style promotion */\r
- cl.promoCharIn = yytext[yyleng-1];\r
+ // ********* try white first, because it is so common **************************\r
+ if(**p == ' ' || **p == '\n' || **p == '\t') { parseStart = (*p)++; return Nothing; }\r
\r
- /* [HGM] do not allow values beyond board size */\r
- if(cl.rtIn >= BOARD_HEIGHT ||\r
- cl.rtIn < 0 ||\r
- cl.ftIn >= BOARD_RGHT ||\r
- cl.ftIn < BOARD_LEFT )\r
- return ImpossibleMove;\r
\r
- Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl);\r
+ if(**p == NULLCHAR) { // make sure there is something to parse\r
+ if(fromString) return 0; // we are parsing string, so the end is really the end\r
+ *p = inPtr = inputBuf;\r
+ if(!ReadLine()) return 0; // EOF\r
+ }\r
+ parseStart = oldp = *p; // remember where we begin\r
+\r
+ // Next we do some common symbols where the first character commits us to things that cannot possibly be a move\r
+ // (but not {} comments, as those force time-consuming matching of PGN results immediately after it)\r
+\r
+ // ********* PGN tags ******************************************\r
+ if(**p == '[') {\r
+ oldp = ++(*p);\r
+ if(Match("--", p)) { // "[--" could be start of position diagram\r
+ if(!Scan(']', p) && (*p)[-3] == '-' && (*p)[-2] == '-') return PositionDiagram; \r
+ *p = oldp;\r
+ }\r
+ SkipWhite(p);\r
+ if(isdigit(**p) || isalpha(**p)) {\r
+ do (*p)++; while(isdigit(**p) || isalpha(**p) || **p == '+' ||\r
+ **p == '-' || **p == '=' || **p == '_' || **p == '#');\r
+ SkipWhite(p);\r
+ if(*(*p)++ == '"') {\r
+ while(**p != '\n' && (*(*p)++ != '"'|| (*p)[-2] == '\\')); // look for unescaped quote\r
+ if((*p)[-1] !='"') { *p = oldp; Scan(']', p); return Comment; } // string closing delimiter missing\r
+ SkipWhite(p); if(*(*p)++ == ']') return PGNTag;\r
+ }\r
+ }\r
+ Scan(']', p); return Comment;\r
+ }\r
\r
- currentMoveString[0] = cl.ff + AAA;\r
- currentMoveString[1] = cl.rf + ONE;\r
- currentMoveString[2] = cl.ft + AAA;\r
- currentMoveString[3] = cl.rt + ONE;\r
- currentMoveString[4] = cl.promoChar;\r
- currentMoveString[5] = NULLCHAR;\r
\r
- return (int) cl.kind;\r
-}\r
- YY_BREAK
-case 9:
-YY_RULE_SETUP
-#line 715 "parser.l"
-{\r
- int rf, ff, rt, ft;\r
+ // ********* variations (nesting) ******************************\r
+ if(**p =='(') {\r
+ if(RdTime(')', p)) return ElapsedTime;\r
+ return Open;\r
+ }\r
+ if(**p ==')') { (*p)++; return Close; }\r
+ if(**p == ';') { while(**p != '\n') (*p)++; return Comment; }\r
\r
- if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */\r
\r
- /* [HGM] all squares referenced to board edges in stead of absolute */\r
- if (WhiteOnMove(yyboardindex)) {\r
- if (boards[yyboardindex][0][(BOARD_WIDTH-1)>>1] == WhiteKing) {\r
- /* ICS wild castling */\r
- rf = 0;\r
- ff = (BOARD_WIDTH-1)>>1;\r
- rt = 0;\r
- ft = BOARD_RGHT-3;\r
- } else {\r
- rf = 0;\r
- ff = BOARD_WIDTH>>1;\r
- rt = 0;\r
- ft = BOARD_LEFT+2;\r
+ // ********* attempt to recognize a SAN move in the leading non-blank text *****\r
+ piece = separator = promoted = slash = n = 0;\r
+ for(i=0; i<4; i++) coord[i] = -1, type[i] = NOTHING;\r
+ if(**p == '+') (*p)++, promoted++;\r
+ if(**p >= 'A' && **p <= 'Z') {\r
+ piece = *(*p)++; // Note we could test for 2-byte non-ascii names here\r
+ if(**p == '/') slash = *(*p)++;\r
}\r
- } else{ \r
- if (boards[yyboardindex][BOARD_HEIGHT-1][(BOARD_WIDTH-1)>>1] == BlackKing) {\r
- /* ICS wild castling */\r
- rf = BOARD_HEIGHT-1;\r
- ff = (BOARD_WIDTH-1)>>1;\r
- rt = BOARD_HEIGHT-1;\r
- ft = BOARD_RGHT-3;\r
- } else {\r
- rf = BOARD_HEIGHT-1;\r
- ff = BOARD_WIDTH>>1;\r
- rt = BOARD_HEIGHT-1;\r
- ft = BOARD_LEFT+2;\r
+ while(n < 4) {\r
+ if(**p >= 'a' && **p < 'x') coord[n] = *(*p)++ - 'a', type[n++] = ALPHABETIC;\r
+ else if((i = Number(p)) != BADNUMBER) coord[n] = i, type[n++] = NUMERIC;\r
+ else break;\r
+ if(n == 2 && type[0] == type[1]) { // if two identical types, the opposite type in between must have been missing\r
+ type[2] = type[1]; coord[2] = coord[1];\r
+ type[1] = NOTHING; coord[1] = -1; n++;\r
+ }\r
}\r
- }\r
- if(PosFlags(0) & F_FRC_TYPE_CASTLING) {
- if (WhiteOnMove(yyboardindex)) {\r
- ff = initialRights[2];\r
- ft = initialRights[1];\r
- } else {\r
- ff = initialRights[5];\r
- ft = initialRights[4];\r
- }\r
- if (appData.debugMode) \r
- {\r
- fprintf(debugFP, "Parser FRC long %d %d\n", ff, ft);\r
- };\r
- if(ff < 0 || ft < 0) return 0;\r
- }\r
- sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE);\r
- if (appData.debugMode) {\r
- fprintf(debugFP, "long castling %d %d\n", ff, ft);\r
- }\r
- return (int) LegalityTest(boards[yyboardindex],\r
- PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: e.p.!\r
- rf, ff, rt, ft, NULLCHAR);\r
-}\r
- YY_BREAK
-case 10:
-YY_RULE_SETUP
-#line 771 "parser.l"
-{\r
- int rf, ff, rt, ft;\r
-\r
- if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */\r
-\r
- if (WhiteOnMove(yyboardindex)) {\r
- if (boards[yyboardindex][0][(BOARD_WIDTH-1)>>1] == WhiteKing) {\r
- /* ICS wild castling */\r
- rf = 0;\r
- ff = (BOARD_WIDTH-1)>>1;\r
- rt = 0;\r
- ft = BOARD_LEFT+1;\r
- } else {\r
- rf = 0;\r
- ff = BOARD_WIDTH>>1;\r
- rt = 0;\r
- ft = BOARD_RGHT-2;\r
+ // we always get here, and might have read a +, a piece, and upto 4 potential coordinates\r
+ if(n <= 2) { // could be from-square or disambiguator, when -:xX follow, or drop with @ directly after piece, but also to-square\r
+ if(**p == '-' || **p == ':' || **p == 'x' || **p == 'X' || // these cannot be move suffix, so to-square must follow\r
+ (**p == '@' || **p == '*') && n == 0 && !promoted && piece) { // P@ must also be followed by to-square\r
+ separator = *(*p)++;\r
+ if(n == 1) coord[1] = coord[0]; // must be disambiguator, but we do not know which yet\r
+ n = 2;\r
+ while(n < 4) { // attempt to read to-square\r
+ if(**p >= 'a' && **p < 'x') coord[n] = *(*p)++ - 'a', type[n++] = ALPHABETIC;\r
+ else if((i = Number(p)) != BADNUMBER) coord[n] = i, type[n++] = NUMERIC;\r
+ else break;\r
+ }\r
+ } else if((**p == '+' || **p == '=') && n == 1 && piece && type[0] == NUMERIC) { // can be traditional Xiangqi notation\r
+ separator = *(*p)++;\r
+ n = 2;\r
+ if((i = Number(p)) != BADNUMBER) coord[n] = i, type[n++] = NUMERIC;\r
+ } else if(n == 2) { // only one square mentioned, must be to-square\r
+ while(n < 4) { coord[n] = coord[n-2], type[n] = type[n-2], coord[n-2] = -1, type[n-2] = NOTHING; n++; }\r
+ }\r
+ } else if(n == 3 && type[1] != NOTHING) { // must be hyphenless disambiguator + to-square\r
+ for(i=3; i>0; i--) coord[i] = coord[i-1], type[i] = type[i-1]; // move to-square to where it belongs\r
+ type[1] = NOTHING; // disambiguator goes in first two positions\r
+ n = 4;\r
}\r
- } else {\r
- if (boards[yyboardindex][BOARD_HEIGHT-1][(BOARD_WIDTH-1)>>1] == BlackKing) {\r
- /* ICS wild castling */\r
- rf = BOARD_HEIGHT-1;\r
- ff = (BOARD_WIDTH-1)>>1;\r
- rt = BOARD_HEIGHT-1;\r
- ft = BOARD_LEFT+1;\r
- } else {\r
- rf = BOARD_HEIGHT-1;\r
- ff = BOARD_WIDTH>>1;\r
- rt = BOARD_HEIGHT-1;\r
- ft = BOARD_RGHT-2;\r
+if(appData.debugMode)fprintf(debugFP, "trial %d,%d,%d,%d type %d%d%d%d\n", coord[0], coord[1], coord[2], coord[3], type[0], type[1], type[2], type[3]);\r
+ // we always get here; move must be completely read now, with to-square coord(s) at end\r
+ if(n == 3) { // incomplete to-square. Could be Xiangqi traditional, or stuff like fxg\r
+ if(piece && type[1] == NOTHING && type[0] == NUMERIC && type[2] == NUMERIC && \r
+ (separator == '+' || separator == '=' || separator == '-')) {\r
+ // Xiangqi traditional\r
+\r
+ return ImpossibleMove; // for now treat as invalid\r
+ }\r
+ // fxg stuff, but also things like 0-0, 0-1 and 1-0\r
+ if(!piece && type[1] == NOTHING && type[0] == ALPHABETIC && type[2] == ALPHABETIC
+ && (coord[0] != 14 || coord[2] != 14) /* reserve oo for castling! */ ) {
+ piece = 'P'; n = 4; // kludge alert: fake full to-square\r
+ }\r
}\r
- }\r
- if(PosFlags(0) & F_FRC_TYPE_CASTLING) {
- if (WhiteOnMove(yyboardindex)) {\r
- ff = initialRights[2];\r
- ft = initialRights[0];\r
- } else {\r
- ff = initialRights[5];\r
- ft = initialRights[3];\r
- }\r
- if (appData.debugMode) {\r
- fprintf(debugFP, "Parser FRC short %d %d\n", ff, ft);\r
- }\r
- if(ff < 0 || ft < 0) return 0;\r
- }\r
- sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE);\r
- if (appData.debugMode) {\r
- fprintf(debugFP, "short castling %d %d\n", ff, ft);\r
- }\r
-\r
- return (int) LegalityTest(boards[yyboardindex],\r
+ if(n == 4 && type[2] != type[3] && // we have a valid to-square (kludge: type[3] can be NOTHING on fxg type move)\r
+ (piece || !promoted) && // promoted indicator only valid on named piece type\r
+ (type[2] == ALPHABETIC || gameInfo.variant == VariantShogi)) { // in Shogi also allow alphabetic rank\r
+ DisambiguateClosure cl;\r
+ int fromX, fromY, toX, toY;\r
+\r
+ if(slash && (!piece || type[1] == NOTHING)) goto badMove; // slash after piece only in ICS long format\r
+ if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */\r
+\r
+ if(type[2] == NUMERIC) { // alpha-rank\r
+ coord[2] = BOARD_RGHT - BOARD_LEFT - coord[2];\r
+ coord[3] = BOARD_HEIGHT - coord[3];\r
+ if(coord[0] >= 0) coord[0] = BOARD_RGHT - BOARD_LEFT - coord[0];\r
+ if(coord[1] >= 0) coord[1] = BOARD_HEIGHT - coord[1];\r
+ }\r
+ toX = cl.ftIn = (currentMoveString[2] = coord[2] + 'a') - AAA;\r
+ toY = cl.rtIn = (currentMoveString[3] = coord[3] + '0') - ONE;\r
+ if(type[3] == NOTHING) cl.rtIn = -1; // for fxg type moves ask for toY disambiguation\r
+ else if(toY >= BOARD_HEIGHT || toY < 0) return ImpossibleMove; // vert off-board to-square\r
+ if(toX < BOARD_LEFT || toX >= BOARD_RGHT) return ImpossibleMove;\r
+ if(piece) {\r
+ cl.pieceIn = CharToPiece(wom ? piece : ToLower(piece));\r
+ if(cl.pieceIn == EmptySquare) return ImpossibleMove; // non-existent piece\r
+ if(promoted) cl.pieceIn = (ChessSquare) (PROMOTED cl.pieceIn);\r
+ } else cl.pieceIn = EmptySquare;\r
+ if(separator == '@' || separator == '*') { // drop move. We only get here without from-square or promoted piece\r
+ fromY = DROP_RANK; fromX = cl.pieceIn;\r
+ currentMoveString[0] = piece;\r
+ currentMoveString[1] = '@';\r
+ return LegalityTest(boards[yyboardindex], PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, fromY, fromX, toY, toX, NULLCHAR);\r
+ }\r
+ if(type[1] == NOTHING && type[0] != NOTHING) { // there is a disambiguator\r
+ if(type[0] != type[2]) coord[0] = -1, type[1] = type[0], type[0] = NOTHING; // it was a rank-disambiguator\r
+ }\r
+ if( type[1] != type[2] && // means fromY is of opposite type as ToX, or NOTHING\r
+ (type[0] == NOTHING || type[0] == type[2]) ) { // well formed\r
+\r
+ fromX = (currentMoveString[0] = coord[0] + 'a') - AAA;\r
+ fromY = (currentMoveString[1] = coord[1] + '0') - ONE;\r
+ currentMoveString[4] = cl.promoCharIn = PromoSuffix(p);\r
+ currentMoveString[5] = NULLCHAR;\r
+ if(type[0] != NOTHING && type[1] != NOTHING && type[3] != NOTHING) { // fully specified.\r
+ // Note that Disambiguate does not work for illegal moves, but flags them as impossible\r
+ if(piece) { // check if correct piece indicated\r
+ ChessSquare realPiece = boards[yyboardindex][fromY][fromX];\r
+ if(PieceToChar(realPiece) == '~') realPiece = (ChessSquare) (DEMOTED realPiece);\r
+ if(!(appData.icsActive && PieceToChar(realPiece) == '+') && // trust ICS if it moves promoted pieces\r
+ piece && realPiece != cl.pieceIn) return ImpossibleMove;\r
+ }\r
+ result = LegalityTest(boards[yyboardindex], PosFlags(yyboardindex), fromY, fromX, toY, toX, cl.promoCharIn);\r
+ if (currentMoveString[4] == NULLCHAR) { // suppy missing mandatory promotion character\r
+ if(result == WhitePromotion || result == BlackPromotion) {\r
+ switch(gameInfo.variant) {\r
+ case VariantCourier:\r
+ case VariantShatranj: currentMoveString[4] = PieceToChar(BlackFerz); break;\r
+ case VariantGreat: currentMoveString[4] = PieceToChar(BlackMan); break;\r
+ case VariantShogi: currentMoveString[4] = '+'; break;\r
+ default: currentMoveString[4] = PieceToChar(BlackQueen);\r
+ }\r
+ } else if(result == WhiteNonPromotion || result == BlackNonPromotion) {\r
+ currentMoveString[4] = '=';\r
+ }\r
+ } else if(appData.testLegality && gameInfo.variant != VariantSChess && // strip off unnecessary and false promo characters\r
+ !(result == WhitePromotion || result == BlackPromotion ||\r
+ result == WhiteNonPromotion || result == BlackNonPromotion)) currentMoveString[4] = NULLCHAR;\r
+ return result;\r
+ } else if(cl.pieceIn == EmptySquare) cl.pieceIn = wom ? WhitePawn : BlackPawn;\r
+ cl.ffIn = type[0] == NOTHING ? -1 : coord[0] + 'a' - AAA;\r
+ cl.rfIn = type[1] == NOTHING ? -1 : coord[1] + '0' - ONE;\r
+\r
+ Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl);\r
+\r
+ if(cl.kind == ImpossibleMove && !piece && type[1] == NOTHING // fxg5 type\r
+ && toY == (wom ? 4 : 3)) { // could be improperly written e.p.\r
+ cl.rtIn += wom ? 1 : -1; // shift target square to e.p. square\r
+ Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl);\r
+ if((cl.kind != WhiteCapturesEnPassant && cl.kind != BlackCapturesEnPassant))\r
+ return ImpossibleMove; // nice try, but no cigar\r
+ }\r
+\r
+ currentMoveString[0] = cl.ff + AAA;\r
+ currentMoveString[1] = cl.rf + ONE;\r
+ currentMoveString[3] = cl.rt + ONE;\r
+ currentMoveString[4] = cl.promoChar;\r
+\r
+ if((cl.kind == WhiteCapturesEnPassant || cl.kind == BlackCapturesEnPassant) && (Match("ep", p) || Match("e.p.", p)));\r
+\r
+ return (int) cl.kind;\r
+ }\r
+ }\r
+badMove:// we failed to find algebraic move\r
+\r
+\r
+ // ********* SAN Castings *************************************\r
+ *p = oldp;\r
+ if(**p == 'O' || **p == 'o' || **p == '0') {\r
+ int castlingType = 0;\r
+ if(Match("O-O-O", p) || Match("o-o-o", p) || Match("0-0-0", p) || \r
+ Match("OOO", p) || Match("ooo", p) || Match("000", p)) castlingType = 2;\r
+ else if(Match("O-O", p) || Match("o-o", p) || Match("0-0", p) ||\r
+ Match("OO", p) || Match("oo", p) || Match("00", p)) castlingType = 1;\r
+ if(castlingType) { //code from old parser, collapsed for both castling types, and streamlined a bit\r
+ int rf, ff, rt, ft; ChessSquare king;\r
+\r
+ if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */\r
+\r
+ if (wom) {\r
+ rf = 0;\r
+ rt = 0;\r
+ king = WhiteKing;\r
+ } else {\r
+ rf = BOARD_HEIGHT-1;\r
+ rt = BOARD_HEIGHT-1;\r
+ king = BlackKing;\r
+ }\r
+ ff = (BOARD_WIDTH-1)>>1; // this would be d-file\r
+ if (boards[yyboardindex][rf][ff] == king) {\r
+ /* ICS wild castling */\r
+ ft = castlingType == 1 ? BOARD_LEFT+1 : BOARD_RGHT-3;\r
+ } else {\r
+ ff = BOARD_WIDTH>>1; // e-file\r
+ ft = castlingType == 1 ? BOARD_RGHT-2 : BOARD_LEFT+2;\r
+ }\r
+ if(PosFlags(0) & F_FRC_TYPE_CASTLING) {\r
+ if (wom) {\r
+ ff = initialRights[2];\r
+ ft = initialRights[castlingType-1];\r
+ } else {\r
+ ff = initialRights[5];\r
+ ft = initialRights[castlingType+2];\r
+ }\r
+ if (appData.debugMode) fprintf(debugFP, "Parser FRC (type=%d) %d %d\n", castlingType, ff, ft);\r
+ if(ff == NoRights || ft == NoRights) return ImpossibleMove;\r
+ }\r
+ sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE);\r
+ if (appData.debugMode) fprintf(debugFP, "(%d-type) castling %d %d\n", castlingType, ff, ft);\r
+\r
+ return (int) LegalityTest(boards[yyboardindex],\r
PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: e.p.!\r
rf, ff, rt, ft, NULLCHAR);\r
-}\r
- YY_BREAK
-case 11:
-YY_RULE_SETUP
-#line 826 "parser.l"
-{\r
- /* Bughouse piece drop. No legality checking for now. */\r
- currentMoveString[1] = '@';\r
- currentMoveString[2] = yytext[2];\r
- currentMoveString[3] = yytext[3];\r
- currentMoveString[4] = NULLCHAR;\r
-\r
- if (appData.debugMode) {\r
- fprintf(debugFP, "Drop: %s\n", currentMoveString);\r
- }\r
- /* [HGM] do not allow values beyond board size */\r
- if(currentMoveString[3] - ONE >= BOARD_HEIGHT ||\r
- currentMoveString[2] - AAA >= BOARD_WIDTH )\r
- return ImpossibleMove;\r
-\r
- if (WhiteOnMove(yyboardindex)) {\r
- currentMoveString[0] = ToUpper(yytext[0]);\r
- return (int) WhiteDrop;\r
- } else {\r
- currentMoveString[0] = ToLower(yytext[0]);\r
- return (int) BlackDrop;\r
- }\r
-}\r
- YY_BREAK
-case 12:
-YY_RULE_SETUP
-#line 850 "parser.l"
-{\r
- if (WhiteOnMove(yyboardindex))\r
- return (int) BlackWins;\r
- else\r
- return (int) WhiteWins;\r
-}\r
- YY_BREAK
-case 13:
-YY_RULE_SETUP
-#line 857 "parser.l"
-{\r
- return (int) (ToUpper(yytext[0]) == 'W' ? BlackWins : WhiteWins);\r
-}\r
- YY_BREAK
-case 14:
-YY_RULE_SETUP
-#line 861 "parser.l"
-{\r
- return (int) GameUnfinished;\r
-}\r
- YY_BREAK
-case 15:
-YY_RULE_SETUP
-#line 865 "parser.l"
-{\r
- return (int) GameIsDrawn;\r
-}\r
- YY_BREAK
-case 16:
-YY_RULE_SETUP
-#line 869 "parser.l"
-{\r
- return (int) GameIsDrawn;\r
-}\r
- YY_BREAK
-case 17:
-YY_RULE_SETUP
-#line 873 "parser.l"
-{\r
- if (WhiteOnMove(yyboardindex))\r
- return (int) BlackWins;\r
- else\r
- return (int) WhiteWins;\r
-}\r
- YY_BREAK
-case 18:
-YY_RULE_SETUP
-#line 880 "parser.l"
-{\r
- if (WhiteOnMove(yyboardindex))\r
- return (int) BlackWins;\r
- else\r
- return (int) WhiteWins;\r
-}\r
- YY_BREAK
-case 19:
-YY_RULE_SETUP
-#line 887 "parser.l"
-{\r
- return (int) GameIsDrawn;\r
-}\r
- YY_BREAK
-case 20:
-YY_RULE_SETUP
-#line 891 "parser.l"
-{\r
- return (int) GameIsDrawn;\r
-}\r
- YY_BREAK
-case 21:
-YY_RULE_SETUP
-#line 895 "parser.l"
-{ \r
- return (int) (ToUpper(yytext[0]) == 'W' ? WhiteWins : BlackWins);\r
-}\r
- YY_BREAK
-case 22:
-YY_RULE_SETUP
-#line 899 "parser.l"
-{ \r
- return (int) (ToUpper(yytext[0]) == 'W' ? BlackWins : WhiteWins);\r
-}\r
- YY_BREAK
-case 23:
-YY_RULE_SETUP
-#line 903 "parser.l"
-{ \r
- return (int) WhiteWins;\r
-}\r
- YY_BREAK
-case 24:
-YY_RULE_SETUP
-#line 907 "parser.l"
-{ \r
- return (int) BlackWins;\r
-}\r
- YY_BREAK
-case 25:
-YY_RULE_SETUP
-#line 911 "parser.l"
-{\r
- return (int) GameIsDrawn;\r
-}\r
- YY_BREAK
-case 26:
-YY_RULE_SETUP
-#line 915 "parser.l"
-{\r
- return (int) GameUnfinished;\r
-}\r
- YY_BREAK
-case 27:
-/* rule 27 can match eol */
-YY_RULE_SETUP
-#line 919 "parser.l"
-{\r
- /* move numbers */\r
- if ((yyleng == 1) && (yytext[0] == '1'))\r
- return (int) MoveNumberOne;\r
-}\r
- YY_BREAK
-case 28:
-YY_RULE_SETUP
-#line 925 "parser.l"
-{\r
- /* elapsed time indication, e.g. (0:12) or {10:21.071} */ \r
- return (int) ElapsedTime;\r
-}\r
- YY_BREAK
-case 29:
-/* rule 29 can match eol */
-YY_RULE_SETUP
-#line 930 "parser.l"
-{\r
- /* position diagram enclosed in [-- --] */\r
- return (int) PositionDiagram;\r
-}\r
- YY_BREAK
-case 30:
-/* rule 30 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 935 "parser.l"
-{\r
- /* position diagram enclosed in {-- --} */\r
- return (int) PositionDiagram;\r
-}\r
- YY_BREAK
-case 31:
-/* rule 31 can match eol */
-YY_RULE_SETUP
-#line 940 "parser.l"
-{\r
- return (int) PGNTag;\r
-} \r
- YY_BREAK
-case 32:
-YY_RULE_SETUP
-#line 944 "parser.l"
-{\r
- return (int) GNUChessGame;\r
-}\r
- YY_BREAK
-case 33:
-/* rule 33 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 948 "parser.l"
-{\r
- return (int) XBoardGame;\r
-}\r
- YY_BREAK
-case 34:
-YY_RULE_SETUP
-#line 952 "parser.l"
-{ /* numeric annotation glyph */\r
- return (int) NAG;\r
-}\r
- YY_BREAK
-case 35:
-/* rule 35 can match eol */
-YY_RULE_SETUP
-#line 956 "parser.l"
-{ /* anything in {} */\r
- return (int) Comment; \r
-}\r
- YY_BREAK
-case 36:
-*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 960 "parser.l"
-{ /* ; to end of line */\r
- return (int) Comment;\r
-}\r
- YY_BREAK
-case 37:
-/* rule 37 can match eol */
-YY_RULE_SETUP
-#line 964 "parser.l"
-{ /* anything in [] */\r
- return (int) Comment; \r
-}\r
- YY_BREAK
-case 38:
-/* rule 38 can match eol */
-YY_RULE_SETUP
-#line 968 "parser.l"
-{ /* very nested () */\r
- return (int) Comment; \r
-}\r
- YY_BREAK
-case 39:
-/* rule 39 can match eol */
-YY_RULE_SETUP
-#line 972 "parser.l"
-{ /* >=2 chars in () */\r
- return (int) Comment; \r
-} \r
- YY_BREAK
-case 40:
-/* rule 40 can match eol */
-YY_RULE_SETUP
-#line 976 "parser.l"
-{\r
- /* Skip mail headers */\r
-}\r
- YY_BREAK
-case 41:
-YY_RULE_SETUP
-#line 980 "parser.l"
-{\r
- /* Skip random words */\r
-}\r
- YY_BREAK
-case 42:
-/* rule 42 can match eol */
-YY_RULE_SETUP
-#line 984 "parser.l"
-{\r
- /* Skip everything else */\r
-}\r
- YY_BREAK
-case 43:
-YY_RULE_SETUP
-#line 988 "parser.l"
-ECHO;
- YY_BREAK
-#line 3121 "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 >= 704 )
- 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 >= 704 )
- 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 == 703);
- 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 988 "parser.l"
-
-
+ }\r
+ }\r
\r
\r
-static char *StringToLex;\r
+ // ********* Comments and result messages **********************\r
+ *p = oldp; commentEnd = NULL; result = 0;\r
+ if(**p == '{') {\r
+ if(RdTime('}', p)) return ElapsedTime;\r
+ if(lastChar == '\n' && Match("--------------\n", p)) {\r
+ char *q;\r
+ i = Scan ('}', p); q = *p - 16;\r
+ if(Match("\n--------------}\n", &q)) return PositionDiagram;\r
+ } else i = Scan('}', p);\r
+ commentEnd = *p; if(i) return Comment; // return comment that runs to EOF immediately\r
+ }\r
+ if(commentEnd) SkipWhite(p);\r
+ if(Match("*", p)) result = GameUnfinished;\r
+ else if(**p == '0') {\r
+ if( Match("0-1", p) || Match("0/1", p) || Match("0:1", p) ||\r
+ Match("0 - 1", p) || Match("0 / 1", p) || Match("0 : 1", p)) result = BlackWins;\r
+ } else if(**p == '1') {\r
+ if( Match("1-0", p) || Match("1/0", p) || Match("1:0", p) ||\r
+ Match("1 - 0", p) || Match("1 / 0", p) || Match("1 : 0", p)) result = WhiteWins;\r
+ else if(Match("1/2 - 1/2", p) || Match("1/2:1/2", p) || Match("1/2 : 1/2", p) || Match("1 / 2 - 1 / 2", p) ||\r
+ Match("1 / 2 : 1 / 2", p) || Match("1/2", p) || Match("1 / 2", p)) result = GameIsDrawn;\r
+ }\r
+ if(result) {\r
+ if(Match(" (", p) && !Scan(')', p) || Match(" {", p) && !Scan('}', p)) { // there is a comment after the PGN result!\r
+ if(commentEnd) { *p = commentEnd; return Comment; } // so comment before it is normal comment; return that first\r
+ }\r
+ return result; // this returns a possible preceeding comment as result details\r
+ }\r
+ if(commentEnd) { *p = commentEnd; return Comment; } // there was no PGN result following, so return as normal comment\r
+\r
+\r
+ // ********* Move numbers (after castlings or PGN results!) ***********\r
+ if((i = Number(p)) != BADNUMBER) { // a single number was read as part of our attempt to read a move\r
+ char *numEnd = *p;\r
+ if(**p == '.') (*p)++; SkipWhite(p);\r
+ if(**p == '+' || isalpha(**p) || gameInfo.variant == VariantShogi && *p != numEnd && isdigit(**p)) {\r
+ *p = numEnd;\r
+ return i == 1 ? MoveNumberOne : Nothing;\r
+ }\r
+ *p = numEnd; return Nothing;\r
+ }\r
\r
-#ifndef FLEX_SCANNER\r
-static FILE *lexFP;\r
\r
-static int input()\r
-{\r
- int ret;\r
- \r
- if (StringToLex != NULL) {\r
- ret = *StringToLex;\r
- if (ret == NULLCHAR)\r
- ret = EOF;\r
- else\r
- StringToLex++;\r
- } else if (unputCount > 0) {\r
- ret = unputBuffer[--unputCount];\r
- } else {\r
- ret = fgetc(lexFP);\r
- } \r
+ // ********* non-compliant game-result indicators *********************\r
+ if(Match("+-+", p) || Word("stalemate", p)) return GameIsDrawn;\r
+ if(Match("++", p) || Verb("resign", p) || (Word("check", p) || 1) && Word("mate", p) )\r
+ return (wom ? BlackWins : WhiteWins);\r
+ c = ToUpper(**p);\r
+ if(Word("w", p) && (Match("hite", p) || 1) || Word("b", p) && (Match("lack", p) || 1) ) {\r
+ if(**p != ' ') return Nothing;\r
+ ++*p;\r
+ if(Verb("disconnect", p)) return GameUnfinished;\r
+ if(Verb("resign", p) || Verb("forfeit", p) || Word("mated", p) || Word("lost", p) || Word("loses", p))\r
+ return (c == 'W' ? BlackWins : WhiteWins);\r
+ if(Word("mates", p) || Word("wins", p) || Word("won", p))\r
+ return (c != 'W' ? BlackWins : WhiteWins);\r
+ return Nothing;\r
+ }\r
+ if(Word("draw", p)) {\r
+ if(**p == 'n') (*p)++;\r
+ if(**p != ' ') return GameIsDrawn;\r
+ oldp = ++*p;\r
+ if(Word("agreed", p)) return GameIsDrawn;\r
+ if(Match("by ", p) && (Word("repetition", p) || Word("agreement", p)) ) return GameIsDrawn;\r
+ *p = oldp;\r
+ if(*(*p)++ == '(') {\r
+ while(**p != '\n') if(*(*p)++ == ')') break;\r
+ if((*p)[-1] == ')') return GameIsDrawn;\r
+ }\r
+ *p = oldp - 1; return GameIsDrawn;\r
+ }\r
\r
- if (ret == EOF) \r
- return 0;\r
- else\r
- return ret;\r
-}\r
\r
-/*\r
- * Return offset of next pattern within current file\r
- */\r
-int yyoffset()\r
-{\r
- int offset = ftell(lexFP) - unputCount;\r
+ // ********* Numeric annotation glyph **********************************\r
+ if(**p == '$') { (*p)++; if(Number(p) != BADNUMBER) return NAG; return Nothing; }\r
\r
- if (offset < 0) {\r
- offset = 0;\r
- }\r
- return(offset);\r
-}\r
- \r
-static void output(ch)\r
- int ch;\r
-{\r
- if(appData.debugMode) fprintf(debugFP, "PARSER BUG: unmatched character '%c' (0%o)\n",\r
- ch, ch);\r
-}\r
\r
-static void unput(ch)\r
- int ch;\r
-{\r
- if (ch == 0) return;\r
- if (StringToLex != NULL) {\r
- StringToLex--;\r
- } else {\r
- if (unputCount >= UNPUT_BUF_SIZE)\r
- if(appData.debugMode) fprintf(debugFP, "PARSER BUG: unput buffer overflow '%c' (0%o)\n",\r
- ch, ch);\r
- unputBuffer[unputCount++] = ch;\r
- }\r
-}\r
+ // ********** by now we are getting down to the silly stuff ************\r
+ if(Word("gnu", p) || Match("GNU", p)) {\r
+ if(**p == ' ') (*p)++;\r
+ if(Word("chess", p) || Match("CHESS", p)) {\r
+ char *q;\r
+ if((q = strstr(*p, "game")) || (q = strstr(*p, "GAME")) || (q = strstr(*p, "Game"))) {\r
+ (*p) = q + 4; return GNUChessGame;\r
+ }\r
+ }\r
+ return Nothing;\r
+ }\r
+ if(lastChar == '\n' && (Match("# ", p) || Match("; ", p) || Match("% ", p))) {\r
+ while(**p != '\n' && **p != ' ') (*p)++;\r
+ if(**p == ' ' && (Match(" game file", p) || Match(" position file", p))) {\r
+ while(**p != '\n') (*p)++; // skip to EOLN\r
+ return XBoardGame;\r
+ }\r
+ *p = oldp; // we might need to re-match the skipped stuff\r
+ }\r
\r
-/* Get ready to lex from a new file. Kludge below sticks\r
- an artificial newline at the front of the file, which the\r
- above grammar ignores, but which makes ^ at start of pattern\r
- match at the real start of the file.\r
-*/\r
-void yynewfile(f)\r
- FILE *f;\r
-{\r
- lexFP = f;\r
- StringToLex = NULL;\r
- unputCount = 0;\r
- unput('\n'); /* kludge */\r
-}\r
\r
-/* Get ready to lex from a string. ^ at start of pattern WON'T\r
- match at the start of the string!\r
-*/\r
-void yynewstr(s)\r
- char *s;\r
-{\r
- lexFP = NULL;\r
- StringToLex = s;\r
- unputCount = 0;\r
-}\r
-#endif /*!FLEX_SCANNER*/\r
+ // ********* Efficient skipping of (mostly) alphabetic chatter **********\r
+ while(isdigit(**p) || isalpha(**p) || **p == '-') (*p)++;\r
+ if(*p != oldp) {\r
+ if(**p == '\'') {\r
+ while(isdigit(**p) || isalpha(**p) || **p == '-' || **p == '\'') (*p)++;\r
+ return Nothing; // random word\r
+ }\r
+ if(lastChar == '\n' && Match(": ", p)) { // mail header, skip indented lines\r
+ do {\r
+ while(**p != '\n') (*p)++;\r
+ if(!ReadLine()) return Nothing; // append next line if not EOF\r
+ } while(Match("\n ", p) || Match("\n\t", p));\r
+ }\r
+ return Nothing;\r
+ }\r
\r
-#ifdef FLEX_SCANNER\r
-void my_yy_input(buf, result, max_size)\r
- char *buf;\r
- int *result;\r
- int max_size;\r
-{\r
- int count;\r
\r
- if (StringToLex != NULL) {\r
- count = 0;\r
- while (*StringToLex != NULLCHAR) {\r
- *buf++ = *StringToLex++;\r
- count++;\r
- }\r
- *result = count;\r
- return;\r
- } else {\r
- count = fread(buf, 1, max_size, yyin);\r
- if (count == 0) {\r
- *result = YY_NULL;\r
- } else {\r
- *result = count;\r
- }\r
- return;\r
- } \r
+ // ********* Could not match to anything. Return offending character ****\r
+ (*p)++;\r
+ return Nothing;\r
}\r
\r
-static YY_BUFFER_STATE my_file_buffer = NULL;\r
-\r
/*\r
Return offset of next pattern in the current file.\r
*/\r
int yyoffset()\r
{\r
- int pos = yy_c_buf_p - YY_CURRENT_BUFFER->yy_ch_buf;\r
-\r
- return(ftell(YY_CURRENT_BUFFER->yy_input_file) -\r
- yy_n_chars + pos);\r
+ return ftell(inputFile) - (inPtr - parsePtr); // subtract what is read but not yet parsed\r
}\r
\r
+void yynewfile (FILE *f)\r
+{ // prepare parse buffer for reading file\r
+ inputFile = f;\r
+ inPtr = parsePtr = inputBuf;\r
+ fromString = 0;\r
+ lastChar = '\n';\r
+ *inPtr = NULLCHAR; // make sure we will start by reading a line\r
+}\r
\r
-void yynewstr(s)\r
- char *s;\r
+void yynewstr P((char *s))\r
{\r
- if (my_file_buffer != NULL)\r
- yy_delete_buffer(my_file_buffer);\r
- StringToLex = s;\r
- my_file_buffer = yy_create_buffer(stdin,YY_BUF_SIZE);\r
- yy_switch_to_buffer(my_file_buffer);\r
+ parsePtr = s;\r
+ inputFile = NULL;\r
+ fromString = 1;\r
}\r
\r
-void yynewfile(f)\r
- FILE *f;\r
-{\r
- if (my_file_buffer != NULL)\r
- yy_delete_buffer(my_file_buffer);\r
- StringToLex = NULL;\r
- my_file_buffer = yy_create_buffer(f,YY_BUF_SIZE);\r
- yy_switch_to_buffer(my_file_buffer);\r
+int yylex()\r
+{ // this replaces the flex-generated parser\r
+ int result = NextUnit(&parsePtr);\r
+ char *p = parseStart, *q = yytext;\r
+ while(p < parsePtr) *q++ = *p++; // copy the matched text to yytext[]\r
+ *q = NULLCHAR;\r
+ lastChar = q[-1];\r
+ return result;\r
}\r
-#endif /*FLEX_SCANNER*/\r
\r
-int yywrap()\r
-{\r
- return TRUE;\r
+int Myylex()\r
+{ // [HGM] wrapper for yylex, which treats nesting of parentheses\r
+ int symbol, nestingLevel = 0, i=0;\r
+ char *p;\r
+ static char buf[256*MSG_SIZ];\r
+ buf[0] = NULLCHAR;\r
+ do { // eat away anything not at level 0\r
+ symbol = yylex();\r
+ if(symbol == Open) nestingLevel++;\r
+ if(nestingLevel) { // save all parsed text between (and including) the ()\r
+ for(p=yytext; *p && i<256*MSG_SIZ-2;) buf[i++] = *p++;\r
+ buf[i] = NULLCHAR;\r
+ }\r
+ if(symbol == 0) break; // ran into EOF\r
+ if(symbol == Close) symbol = Comment, nestingLevel--;\r
+ } while(nestingLevel || symbol == Nothing);\r
+ yy_text = buf[0] ? buf : (char*)yytext;\r
+ return symbol;\r
}\r
\r
-/* Parse a move from the given string s */\r
-/* ^ at start of pattern WON'T work here unless using flex */\r
-ChessMove yylexstr(boardIndex, s, text, len)\r
- int boardIndex, len;\r
- char *s, *text;\r
-{
+ChessMove yylexstr(int boardIndex, char *s, char *buf, int buflen)\r
+{\r
ChessMove ret;\r
- char *oldStringToLex;\r
-#ifdef FLEX_SCANNER\r
- YY_BUFFER_STATE buffer, oldBuffer;\r
-#endif\r
- \r
+ char *savPP = parsePtr;\r
+ fromString = 1;\r
yyboardindex = boardIndex;\r
- oldStringToLex = StringToLex;\r
- StringToLex = s;\r
-#ifdef FLEX_SCANNER\r
- buffer = yy_create_buffer(stdin,YY_BUF_SIZE);\r
- oldBuffer = YY_CURRENT_BUFFER;\r
- yy_switch_to_buffer(buffer);\r
-#endif /*FLEX_SCANNER*/\r
-\r
- 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;\r
-\r
-#ifdef FLEX_SCANNER\r
- if (oldBuffer != NULL) \r
- yy_switch_to_buffer(oldBuffer);\r
- yy_delete_buffer(buffer);\r
-#endif /*FLEX_SCANNER*/\r
- StringToLex = oldStringToLex;\r
-\r
+ parsePtr = s;\r
+ ret = (ChessMove) Myylex();\r
+ strncpy(buf, yy_text, buflen-1);\r
+ buf[buflen-1] = NULLCHAR;\r
+ parsePtr = savPP;\r
+ fromString = 0;\r
return ret;\r
}\r
-