updated parser.c form parser.l
[xboard.git] / parser.c
1
2 #line 3 "parser.c"
3
4 #define  YY_INT_ALIGNED short int
5
6 /* A lexical scanner generated by flex */
7
8 #define FLEX_SCANNER
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 5
11 #define YY_FLEX_SUBMINOR_VERSION 35
12 #if YY_FLEX_SUBMINOR_VERSION > 0
13 #define FLEX_BETA
14 #endif
15
16 /* First, we deal with  platform-specific or compiler-specific issues. */
17
18 /* begin standard C headers. */
19 #include <stdio.h>
20 #include <string.h>
21 #include <errno.h>
22 #include <stdlib.h>
23
24 /* end standard C headers. */
25
26 /* flex integer type definitions */
27
28 #ifndef FLEXINT_H
29 #define FLEXINT_H
30
31 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
32
33 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
34
35 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
36  * if you want the limit (max/min) macros for int types. 
37  */
38 #ifndef __STDC_LIMIT_MACROS
39 #define __STDC_LIMIT_MACROS 1
40 #endif
41
42 #include <inttypes.h>
43 typedef int8_t flex_int8_t;
44 typedef uint8_t flex_uint8_t;
45 typedef int16_t flex_int16_t;
46 typedef uint16_t flex_uint16_t;
47 typedef int32_t flex_int32_t;
48 typedef uint32_t flex_uint32_t;
49 #else
50 typedef signed char flex_int8_t;
51 typedef short int flex_int16_t;
52 typedef int flex_int32_t;
53 typedef unsigned char flex_uint8_t; 
54 typedef unsigned short int flex_uint16_t;
55 typedef unsigned int flex_uint32_t;
56 #endif /* ! C99 */
57
58 /* Limits of integral types. */
59 #ifndef INT8_MIN
60 #define INT8_MIN               (-128)
61 #endif
62 #ifndef INT16_MIN
63 #define INT16_MIN              (-32767-1)
64 #endif
65 #ifndef INT32_MIN
66 #define INT32_MIN              (-2147483647-1)
67 #endif
68 #ifndef INT8_MAX
69 #define INT8_MAX               (127)
70 #endif
71 #ifndef INT16_MAX
72 #define INT16_MAX              (32767)
73 #endif
74 #ifndef INT32_MAX
75 #define INT32_MAX              (2147483647)
76 #endif
77 #ifndef UINT8_MAX
78 #define UINT8_MAX              (255U)
79 #endif
80 #ifndef UINT16_MAX
81 #define UINT16_MAX             (65535U)
82 #endif
83 #ifndef UINT32_MAX
84 #define UINT32_MAX             (4294967295U)
85 #endif
86
87 #endif /* ! FLEXINT_H */
88
89 #ifdef __cplusplus
90
91 /* The "const" storage-class-modifier is valid. */
92 #define YY_USE_CONST
93
94 #else   /* ! __cplusplus */
95
96 /* C99 requires __STDC__ to be defined as 1. */
97 #if defined (__STDC__)
98
99 #define YY_USE_CONST
100
101 #endif  /* defined (__STDC__) */
102 #endif  /* ! __cplusplus */
103
104 #ifdef YY_USE_CONST
105 #define yyconst const
106 #else
107 #define yyconst
108 #endif
109
110 /* Returned upon end-of-file. */
111 #define YY_NULL 0
112
113 /* Promotes a possibly negative, possibly signed char to an unsigned
114  * integer for use as an array index.  If the signed char is negative,
115  * we want to instead treat it as an 8-bit unsigned char, hence the
116  * double cast.
117  */
118 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
119
120 /* Enter a start condition.  This macro really ought to take a parameter,
121  * but we do it the disgusting crufty way forced on us by the ()-less
122  * definition of BEGIN.
123  */
124 #define BEGIN (yy_start) = 1 + 2 *
125
126 /* Translate the current start state into a value that can be later handed
127  * to BEGIN to return to the state.  The YYSTATE alias is for lex
128  * compatibility.
129  */
130 #define YY_START (((yy_start) - 1) / 2)
131 #define YYSTATE YY_START
132
133 /* Action number for EOF rule of a given start state. */
134 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
135
136 /* Special action meaning "start processing a new file". */
137 #define YY_NEW_FILE yyrestart(yyin  )
138
139 #define YY_END_OF_BUFFER_CHAR 0
140
141 /* Size of default input buffer. */
142 #ifndef YY_BUF_SIZE
143 #define YY_BUF_SIZE 16384
144 #endif
145
146 /* The state buf must be large enough to hold one state per character in the main buffer.
147  */
148 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
149
150 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
151 #define YY_TYPEDEF_YY_BUFFER_STATE
152 typedef struct yy_buffer_state *YY_BUFFER_STATE;
153 #endif
154
155 extern int yyleng;
156
157 extern FILE *yyin, *yyout;
158
159 #define EOB_ACT_CONTINUE_SCAN 0
160 #define EOB_ACT_END_OF_FILE 1
161 #define EOB_ACT_LAST_MATCH 2
162
163     #define YY_LESS_LINENO(n)
164     
165 /* Return all but the first "n" matched characters back to the input stream. */
166 #define yyless(n) \
167         do \
168                 { \
169                 /* Undo effects of setting up yytext. */ \
170         int yyless_macro_arg = (n); \
171         YY_LESS_LINENO(yyless_macro_arg);\
172                 *yy_cp = (yy_hold_char); \
173                 YY_RESTORE_YY_MORE_OFFSET \
174                 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
175                 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
176                 } \
177         while ( 0 )
178
179 #define unput(c) yyunput( c, (yytext_ptr)  )
180
181 #ifndef YY_TYPEDEF_YY_SIZE_T
182 #define YY_TYPEDEF_YY_SIZE_T
183 typedef size_t yy_size_t;
184 #endif
185
186 #ifndef YY_STRUCT_YY_BUFFER_STATE
187 #define YY_STRUCT_YY_BUFFER_STATE
188 struct yy_buffer_state
189         {
190         FILE *yy_input_file;
191
192         char *yy_ch_buf;                /* input buffer */
193         char *yy_buf_pos;               /* current position in input buffer */
194
195         /* Size of input buffer in bytes, not including room for EOB
196          * characters.
197          */
198         yy_size_t yy_buf_size;
199
200         /* Number of characters read into yy_ch_buf, not including EOB
201          * characters.
202          */
203         int yy_n_chars;
204
205         /* Whether we "own" the buffer - i.e., we know we created it,
206          * and can realloc() it to grow it, and should free() it to
207          * delete it.
208          */
209         int yy_is_our_buffer;
210
211         /* Whether this is an "interactive" input source; if so, and
212          * if we're using stdio for input, then we want to use getc()
213          * instead of fread(), to make sure we stop fetching input after
214          * each newline.
215          */
216         int yy_is_interactive;
217
218         /* Whether we're considered to be at the beginning of a line.
219          * If so, '^' rules will be active on the next match, otherwise
220          * not.
221          */
222         int yy_at_bol;
223
224     int yy_bs_lineno; /**< The line count. */
225     int yy_bs_column; /**< The column count. */
226     
227         /* Whether to try to fill the input buffer when we reach the
228          * end of it.
229          */
230         int yy_fill_buffer;
231
232         int yy_buffer_status;
233
234 #define YY_BUFFER_NEW 0
235 #define YY_BUFFER_NORMAL 1
236         /* When an EOF's been seen but there's still some text to process
237          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
238          * shouldn't try reading from the input source any more.  We might
239          * still have a bunch of tokens to match, though, because of
240          * possible backing-up.
241          *
242          * When we actually see the EOF, we change the status to "new"
243          * (via yyrestart()), so that the user can continue scanning by
244          * just pointing yyin at a new input file.
245          */
246 #define YY_BUFFER_EOF_PENDING 2
247
248         };
249 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
250
251 /* Stack of input buffers. */
252 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
253 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
254 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
255
256 /* We provide macros for accessing buffer states in case in the
257  * future we want to put the buffer states in a more general
258  * "scanner state".
259  *
260  * Returns the top of the stack, or NULL.
261  */
262 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
263                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
264                           : NULL)
265
266 /* Same as previous macro, but useful when we know that the buffer stack is not
267  * NULL or when we need an lvalue. For internal use only.
268  */
269 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
270
271 /* yy_hold_char holds the character lost when yytext is formed. */
272 static char yy_hold_char;
273 static int yy_n_chars;          /* number of characters read into yy_ch_buf */
274 int yyleng;
275
276 /* Points to current character in buffer. */
277 static char *yy_c_buf_p = (char *) 0;
278 static int yy_init = 0;         /* whether we need to initialize */
279 static int yy_start = 0;        /* start state number */
280
281 /* Flag which is used to allow yywrap()'s to do buffer switches
282  * instead of setting up a fresh yyin.  A bit of a hack ...
283  */
284 static int yy_did_buffer_switch_on_eof;
285
286 void yyrestart (FILE *input_file  );
287 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
288 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size  );
289 void yy_delete_buffer (YY_BUFFER_STATE b  );
290 void yy_flush_buffer (YY_BUFFER_STATE b  );
291 void yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
292 void yypop_buffer_state (void );
293
294 static void yyensure_buffer_stack (void );
295 static void yy_load_buffer_state (void );
296 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );
297
298 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
299
300 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );
301 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  );
302 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len  );
303
304 void *yyalloc (yy_size_t  );
305 void *yyrealloc (void *,yy_size_t  );
306 void yyfree (void *  );
307
308 #define yy_new_buffer yy_create_buffer
309
310 #define yy_set_interactive(is_interactive) \
311         { \
312         if ( ! YY_CURRENT_BUFFER ){ \
313         yyensure_buffer_stack (); \
314                 YY_CURRENT_BUFFER_LVALUE =    \
315             yy_create_buffer(yyin,YY_BUF_SIZE ); \
316         } \
317         YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
318         }
319
320 #define yy_set_bol(at_bol) \
321         { \
322         if ( ! YY_CURRENT_BUFFER ){\
323         yyensure_buffer_stack (); \
324                 YY_CURRENT_BUFFER_LVALUE =    \
325             yy_create_buffer(yyin,YY_BUF_SIZE ); \
326         } \
327         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
328         }
329
330 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
331
332 /* Begin user sect3 */
333
334 typedef unsigned char YY_CHAR;
335
336 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
337
338 typedef int yy_state_type;
339
340 extern int yylineno;
341
342 int yylineno = 1;
343
344 extern char *yytext;
345 #define yytext_ptr yytext
346
347 static yy_state_type yy_get_previous_state (void );
348 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
349 static int yy_get_next_buffer (void );
350 static void yy_fatal_error (yyconst char msg[]  );
351
352 /* Done after the current pattern has been matched and before the
353  * corresponding action - sets up yytext.
354  */
355 #define YY_DO_BEFORE_ACTION \
356         (yytext_ptr) = yy_bp; \
357         yyleng = (size_t) (yy_cp - yy_bp); \
358         (yy_hold_char) = *yy_cp; \
359         *yy_cp = '\0'; \
360         (yy_c_buf_p) = yy_cp;
361
362 #define YY_NUM_RULES 43
363 #define YY_END_OF_BUFFER 44
364 /* This struct is not used in this scanner,
365    but its presence is necessary. */
366 struct yy_trans_info
367         {
368         flex_int32_t yy_verify;
369         flex_int32_t yy_nxt;
370         };
371 static yyconst flex_int16_t yy_acclist[643] =
372     {   0,
373        44,   42,   43,   42,   43,   42,   43,   41,   42,   43,
374        38,   42,   43,   39,   42,   43,   26,   42,   43,   42,
375        43,   41,   42,   43,   41,   42,   43,16411,   41,   42,
376        43,16411,   42,   43,   41,   42,   43,   41,   42,   43,
377        41,   42,   43,   41,   42,   43,   41,   42,   43,   41,
378        42,   43,   41,   42,   43,   41,   42,   43,   41,   42,
379        43,   41,   42,   43,   41,   42,   43,   42,   43,   41,
380        42,   43,   41,   42,   43,   41,   42,   43,   41,   42,
381        43,   41,   42,   43,   41,   42,   43,   41,   42,   43,
382        41,   42,   43,   41,   42,   43,   41,   42,   43,   41,
383
384        42,   43,   41,   42,   43,   41,   42,   43,   41,   42,
385        43,   41,   42,   43,   41,   42,   43,   41,   42,   43,
386        41,   42,   43,   42,   43,   42,   43,   41,   42,   43,
387        41,   42,   43,   41,   42,   43,16411,   41,   42,   43,
388     16411,   42,   43,   41,   42,   43,   41,   42,   43,   41,
389        42,   43,   41,   42,   43,   41,   42,   43,   41,   42,
390        43,   41,   42,   43,   41,   42,   43,   41,   42,   43,
391        41,   42,   43,   41,   42,   43,   41,   42,   43,   41,
392        42,   43,   41,   42,   43,   41,   42,   43,   41,   42,
393        43,   41,   42,   43,   41,   42,   43,   41,   42,   43,
394
395        41,   42,   43,   41,   42,   43,   41,   42,   43,   41,
396        42,   43,   41,   42,   43,   41,   42,   43,   41,   42,
397        43,   41,   42,   43,   41,   42,   43,   41,   42,   43,
398        42,   43,   34,   41,   18,   41,   10,   41, 8219,   41,
399        41,16411, 8219,   41,   36,   41,   41,   41,   41,   41,
400        41,   41,   41,   41,   41,   41,   10,   41,   41,   41,
401        41,   37,   41,    4,   41,   41,    5,   41,   41,   41,
402        41,   41,   41,   10,   41,   41,   41,   35,   41,   41,
403        10,   41,   41,   41,16411, 8219,   41,   41,   41,   41,
404        41,   41,   41,   41,   41,   41,   41,   41,   10,   41,
405
406        41,   41,   41,   41,    4,   41,   41,    5,   41,   41,
407        41,   41,   41,   41,   10,   41,   41,   41,   16,   10,
408        41,   24,   41,   24,    9,   41,   23,   41,   23,   25,
409        41,   41,   41,   41,   41,    7,   41,   41,   41,   41,
410        41,   41,   10,   41,   41,   41,   41,    5,   41,    4,
411        41,    4,    4,   41,    4,   41,    4,   41,    5,    6,
412        41,    5,    5,   41,   41,   41,   41,   10,   41,   41,
413        40,   10,   41,   24,   41,    9,   41,   23,   41,   36,
414        41,   41,   41,   41,   41,    7,   41,   41,   41,   41,
415        41,   41,   10,   41,   41,   41,   41,    5,   41,   41,
416
417         4,   41,    4,   41,    4,   41,    6,   41,    5,   41,
418        41,   41,   41,   10,   41,   41,   26,   26,    7,   41,
419        11,    7,   41,    3,   41,    8,   41,    7,    7,   41,
420         7,    7,   41,    7,   41,   41,   41,   41,   20,   41,
421        41,   17,   41,   41,   41,   41,   41,   37,    4,   41,
422         2,   41,    6,    5,    6,    6,    6,   41,   41,    5,
423         5,   41,   41,   26,   40,   41,    7,   41,    3,   41,
424         8,   41,   41,    7,   41,    7,   41,   41,   41,   41,
425        20,   41,   41,   17,   41,   41,   41,   41,   41,   41,
426         2,   41,    6,   41,   41,    5,   41,   41,    8,    7,
427
428         7,    3,    8,    8,    8,   41,    1,   41,   21,   41,
429        41,   20,   41,   41,   41,   41,   41,   41,   31,   37,
430         2,    2,    2,    2,   41,    6,    6,   41,   40,    8,
431        41,    1,   41,   41,   41,   20,   41,   41,   41,   41,
432        41,   41,    2,   41,    6,   41,   28,    8,    1,   24,
433        24,   23,   23,   25,   25,    1,    1,    1,   41,   22,
434        21,   41,   41,   41,   12,   41,   41,   29,   37,   31,
435         2,   28,   35,   40,   40,    1,   41,   41,   41,   41,
436        12,   41,   41,   19,    1,   25,   22,   20,   41,   41,
437        41,   12,   41,   41,   41,   41,   41,   12,   41,   41,
438
439        13,   41,   41,   41,   41,   13,   41,   41,   15,   41,
440        41,   41,   15,   41,   41,   41,   40,   41,   41,   41,
441        41,   40,   40,   41,   41,   32,   41,   40,   40,   32,
442        41,   14,   32,   33,   33,   36,   40,   40,   32,   40,
443        35,   30
444     } ;
445
446 static yyconst flex_int16_t yy_accept[695] =
447     {   0,
448         1,    1,    1,    2,    4,    6,    8,   11,   14,   17,
449        20,   22,   25,   29,   33,   35,   38,   41,   44,   47,
450        50,   53,   56,   59,   62,   65,   68,   70,   73,   76,
451        79,   82,   85,   88,   91,   94,   97,  100,  103,  106,
452       109,  112,  115,  118,  121,  124,  126,  128,  131,  134,
453       138,  142,  144,  147,  150,  153,  156,  159,  162,  165,
454       168,  171,  174,  177,  180,  183,  186,  189,  192,  195,
455       198,  201,  204,  207,  210,  213,  216,  219,  222,  225,
456       228,  231,  233,  233,  234,  235,  235,  235,  236,  236,
457       236,  236,  237,  237,  239,  239,  239,  239,  240,  241,
458
459       241,  241,  243,  243,  245,  245,  246,  246,  247,  247,
460       248,  248,  249,  249,  250,  251,  252,  253,  254,  255,
461       256,  257,  259,  260,  261,  262,  262,  262,  262,  262,
462       263,  264,  266,  266,  267,  269,  270,  271,  272,  273,
463       274,  276,  277,  278,  278,  278,  279,  279,  280,  280,
464       281,  283,  283,  284,  286,  286,  288,  288,  289,  290,
465       290,  291,  292,  293,  294,  295,  296,  297,  298,  299,
466       301,  302,  303,  304,  305,  307,  307,  308,  310,  311,
467       312,  313,  314,  315,  317,  318,  319,  319,  319,  319,
468       319,  319,  320,  320,  320,  320,  320,  320,  322,  324,
469
470       325,  327,  327,  327,  327,  329,  330,  331,  331,  332,
471       332,  333,  333,  334,  335,  335,  336,  338,  338,  338,
472       338,  338,  338,  338,  338,  339,  340,  341,  342,  343,
473       345,  346,  347,  348,  348,  348,  348,  348,  350,  350,
474       351,  352,  352,  353,  355,  357,  359,  360,  360,  362,
475       363,  365,  366,  367,  368,  370,  371,  371,  371,  371,
476       371,  372,  374,  376,  378,  380,  380,  381,  381,  382,
477       383,  383,  384,  385,  386,  388,  388,  389,  390,  391,
478       392,  393,  395,  396,  397,  398,  400,  401,  401,  403,
479       405,  407,  409,  411,  412,  413,  414,  416,  417,  417,
480
481       417,  417,  417,  418,  418,  419,  419,  420,  420,  420,
482       420,  421,  421,  421,  421,  421,  421,  421,  421,  422,
483       424,  424,  424,  426,  428,  429,  429,  430,  431,  431,
484       431,  432,  434,  436,  437,  437,  437,  437,  437,  437,
485       437,  438,  439,  441,  441,  442,  444,  445,  446,  447,
486       448,  448,  448,  448,  448,  449,  450,  451,  451,  453,
487       454,  455,  455,  455,  456,  457,  459,  460,  461,  461,
488       463,  464,  464,  465,  465,  465,  465,  465,  466,  466,
489       467,  467,  467,  469,  471,  473,  474,  474,  476,  478,
490       479,  480,  481,  483,  484,  486,  487,  488,  489,  490,
491
492       491,  493,  495,  496,  498,  499,  499,  499,  499,  500,
493       501,  502,  502,  502,  502,  502,  502,  502,  502,  502,
494       502,  503,  503,  504,  504,  505,  507,  509,  509,  509,
495       509,  509,  509,  510,  511,  512,  512,  514,  514,  515,
496       516,  517,  518,  519,  519,  519,  521,  521,  521,  522,
497       522,  523,  523,  524,  526,  527,  527,  527,  529,  529,
498       529,  529,  529,  529,  529,  529,  530,  530,  530,  532,
499       534,  535,  536,  538,  539,  540,  541,  542,  543,  545,
500       547,  547,  547,  548,  548,  549,  550,  550,  551,  551,
501       552,  552,  553,  553,  554,  554,  555,  555,  556,  556,
502
503       556,  556,  557,  557,  558,  560,  560,  560,  561,  561,
504       561,  562,  563,  563,  563,  563,  563,  563,  564,  565,
505       567,  568,  570,  570,  571,  572,  572,  572,  574,  574,
506       574,  575,  576,  576,  576,  578,  579,  580,  581,  583,
507       584,  584,  585,  585,  585,  586,  586,  587,  587,  587,
508       588,  588,  588,  589,  589,  589,  589,  589,  590,  591,
509       592,  594,  595,  595,  595,  595,  595,  595,  596,  597,
510       598,  600,  601,  601,  601,  601,  601,  601,  601,  602,
511       602,  602,  602,  602,  603,  604,  604,  604,  604,  604,
512       605,  606,  606,  606,  606,  606,  607,  607,  607,  607,
513
514       608,  609,  611,  611,  611,  611,  611,  612,  612,  613,
515       615,  615,  615,  615,  615,  616,  617,  617,  617,  617,
516       617,  618,  619,  620,  620,  620,  620,  620,  620,  621,
517       622,  622,  622,  622,  622,  623,  624,  625,  626,  626,
518       626,  626,  626,  626,  628,  628,  628,  628,  628,  629,
519       630,  632,  632,  632,  633,  633,  634,  634,  635,  635,
520       635,  637,  637,  638,  639,  639,  639,  639,  639,  641,
521       641,  641,  641,  641,  641,  641,  641,  641,  641,  641,
522       641,  641,  641,  641,  641,  641,  641,  641,  641,  641,
523       641,  642,  643,  643
524
525     } ;
526
527 static yyconst flex_int32_t yy_ec[256] =
528     {   0,
529         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
530         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
531         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
532         1,    4,    1,    5,    6,    7,    8,    1,    9,   10,
533        11,   12,   13,    1,   14,   15,   16,   17,   18,   19,
534        20,   20,   20,   20,   20,   20,   20,   21,   22,    1,
535        23,    1,    1,   24,   25,   26,   27,   28,   29,   30,
536        31,   32,   33,   33,   33,   34,   35,   36,   37,   38,
537        38,   39,   40,   38,   41,   38,   42,   43,   38,   38,
538        44,    1,   45,    1,   46,    1,   47,   48,   49,   50,
539
540        51,   52,   53,   54,   55,   56,   57,   58,   59,   60,
541        61,   62,   63,   64,   65,   66,   67,   68,   69,   70,
542        71,   68,   72,    1,   73,    1,    1,    1,    1,    1,
543         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
544         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
545         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
546         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
547         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
548         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
549         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
550
551         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
552         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
553         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
554         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
555         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
556         1,    1,    1,    1,    1
557     } ;
558
559 static yyconst flex_int32_t yy_meta[74] =
560     {   0,
561         1,    2,    3,    2,    1,    1,    1,    1,    4,    5,
562         1,    1,    6,    7,    8,    9,   10,   10,   10,   10,
563        11,    1,    5,    1,   12,   12,   12,   12,   12,   12,
564        12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
565        12,   12,   13,    1,    1,    1,   14,   14,   14,   14,
566        15,   14,   14,   14,   14,   14,   14,   14,   16,   17,
567        17,   17,   17,   17,   16,   16,   16,   16,   16,   18,
568        16,    1,    1
569     } ;
570
571 static yyconst flex_int16_t yy_base[756] =
572     {   0,
573         0,   73, 3125, 3806,  122,  131,    0,  135, 3806, 3104,
574       143,  154,  174,  244, 3087,  304,  155, 2960, 2945,  124,
575       162,  144,  182,  186,  203,  212,  374,  434,  168,  161,
576       223,  204,  228,  241,  237,  180,  249,  279,  282,  295,
577       161,  379,  174,  326,  390,  326, 3004,  203,  396,  503,
578       573,  162,  636,  210, 2953, 2942,  242,  389,  314,  408,
579       350,  412,  439,  693,  411,  388,  415,  420,  447,  478,
580       318,  454,  480,  486,  376,  536,  537,  542,  586,  543,
581       592,  600, 2952,  456,    0,  604,  228, 3806, 2990,  750,
582       564,  232, 2984, 2969, 2955,  537,  660, 3806, 2955,  624,
583
584       422,    0, 2953,    0, 2966, 3806,    0,  774,    0,  824,
585         0,  882,  925, 2853, 2843, 2846, 2851, 2824,  616, 2815,
586      2842, 2841, 2811, 2828, 2816, 2825,  994,  253, 1067, 3806,
587      1094, 1144,    0, 1169, 1218,  648,  652,  678, 2803, 2807,
588      2806, 2801, 2810, 2791,  683,  279, 2859,  395, 2858,  699,
589       494,  345,  591, 1268,  282,  440,  493, 1331, 1381, 2857,
590      1439, 2813, 2808,  706,  538,  544,  704, 2792, 2820,  638,
591      2791,  710, 2800, 1463, 1513, 2850, 1538, 1588,  756,  763,
592       895,  769,  888,  889,  640,  896,  407, 2788,  715, 2840,
593      2777, 3806,  716, 1010, 2845, 2844, 2843, 2829, 2838, 2837,
594
595         0, 2836, 2835, 2834, 2833, 2832,  775,  794,  798,  901,
596      1635, 1669,  924,  951,  961, 1016, 1719,  942, 2780, 2773,
597      2772, 2785, 2779,  544,  973, 1015, 2760,  602, 2777, 2813,
598      2771, 2767, 1037,  303, 1056,  162, 1790, 1854,    0, 3806,
599      1859,    0, 2810, 2808, 2807, 1075, 1087, 1104, 1908, 2807,
600      2803,  349, 2754, 2749, 2783, 2730, 1115,  743, 2791,  732,
601      2791,  825,  902,  717,  953,  627, 2789,  958, 1099, 1951,
602      2788, 1281, 1286, 1283, 2001, 2787, 1311, 1344,  945, 1270,
603      1064, 1116, 1081,  967, 1337, 2064, 2107, 2786, 1221, 2778,
604      1452, 2156, 1254, 1794, 1453, 1455, 1259, 1255,  666, 2737,
605
606      1305, 2776, 2775, 2712, 2711, 1324, 2198, 2765, 2764, 2763,
607      2762,  605, 2761,  735, 2760,  715, 1803,  791, 3806, 2259,
608      1802, 1330,    0, 2293, 1381, 1809, 3806, 2290, 2766, 1806,
609      2765, 2763, 2759, 1349, 2704, 2704, 2702, 2700, 2700, 2704,
610      2706, 2705,  598,  820,  816,    0, 2724, 2707, 2708, 2706,
611       536,  774,  673, 1423, 2751, 2744, 1353, 1357, 1834,  935,
612      2742,  911, 1808, 3806, 2742, 2736,  957, 3806, 2684,    0,
613      2684, 1657, 2740, 1463, 1825, 2689, 2669, 2722,  920, 1787,
614       171,  904, 2339, 1042, 2381, 2378, 2720, 1817, 2712, 1849,
615      1821, 1911, 1952, 1943, 1075, 1257, 1078, 1457, 1852, 2100,
616
617      2428, 1944, 2067, 1147, 2113,  854, 2671,  747, 2114, 2710,
618      2709, 1481, 2708, 2645, 2706, 2643, 2704, 2641, 2695, 1521,
619      3806, 2122, 3806, 2702, 2696, 2693, 2442, 2652, 2645, 1923,
620      2645, 2639, 2628, 2688,  978, 2103, 2687, 1208, 2660, 2637,
621      2626, 2622, 2676, 1007, 1555, 3806, 2674, 1668, 2123, 2190,
622      3806, 2247, 2248, 2663, 2662, 1047, 2610,    0, 2642, 1008,
623      2630, 1690, 2630, 2586, 2577, 1503, 1675, 1033, 2132, 2476,
624      2201, 2511, 2258, 2102, 1945, 2257, 2159, 2379, 2342, 1722,
625       914, 1346, 3806, 1690, 2626, 2376, 2607, 2605, 2542, 2541,
626      2599, 2595, 2527, 2522, 2573, 2564, 2501, 2496, 2549, 2543,
627
628      2440, 3806, 2547, 2541, 2537, 2482, 2491, 2150, 1063, 2488,
629      3806, 2490, 2520, 2478, 2426, 2462, 2439, 2447, 2401, 1294,
630      2417, 3806, 1922, 3806, 2451, 2388, 1973,  788, 2351, 2346,
631      2384, 1630, 1452, 1480, 2384, 1948, 2131, 2105, 2479, 2512,
632      1086, 3806, 2334, 2293, 2350, 2356, 2355, 2298, 2302, 3806,
633      2296, 2339, 2304, 2252, 2304, 2243, 2209, 2204, 2177, 2170,
634         0, 2143, 2476, 2200, 2111,  833, 1123, 2513, 2375, 2514,
635      1949, 2515, 1219, 2084, 2106, 1221, 2052, 2044, 1809, 2032,
636      1287, 2037, 1982, 2581, 1943, 1910, 1875, 1187, 1709, 2654,
637      2256, 1451, 1861, 1847, 1760, 3806, 1699, 1265, 1710, 2727,
638
639      1808,    0, 1650, 1620, 1868, 1804, 2800, 2494, 1875, 2004,
640      1826, 1630, 1618, 2514, 1577, 1542, 1541, 1425,  526, 1926,
641      2523, 1440, 1395, 1890, 1326, 1201, 2408, 2119, 1205, 1178,
642      1115, 1156, 1477, 1600, 2524, 2525, 1100, 1014, 1914, 2208,
643       971, 2055, 2507,    0,  979,  895,  905, 2302, 2576, 2577,
644         0, 2002,  790, 3806,  667, 1992,  679, 3806,  542,  510,
645      3806, 1916, 2537, 2568, 2203,  281,  250, 2144, 2570, 2384,
646       146, 1478, 1607, 2075, 2076, 2549, 2595, 2610, 2614, 2617,
647      2629, 2630, 2632, 2635, 2636, 2637, 2638, 2668, 2681, 2170,
648      1711, 2442, 3806, 2870, 2883, 2895, 2913, 2931, 2949, 2964,
649
650      2981, 2998, 1822, 1887, 2066, 3015, 3033, 2161, 3051, 3069,
651      3087, 3105, 3117, 3135, 3153, 3171, 3189, 3196, 2266, 3210,
652      3225, 3243, 3261, 3279, 3297, 3315, 3327, 3341, 3354, 3372,
653      3390, 3408, 3423, 3437, 3452, 3470, 3485, 3499, 3512, 3530,
654      3548, 3566, 3584, 3602, 3616, 3634, 3648, 3661, 3679, 3697,
655      3715, 3733, 3751, 3769, 3787
656     } ;
657
658 static yyconst flex_int16_t yy_def[756] =
659     {   0,
660       693,  693,  693,  693,  693,  693,  694,  693,  693,  693,
661       695,  694,  696,  696,  697,  694,   16,   16,   16,   16,
662        16,   16,   16,   16,   16,   16,  698,   16,   28,   28,
663        28,   28,   28,   28,   28,   28,   28,   28,   28,  694,
664       694,  694,  694,  694,  694,  699,  693,  700,  700,  701,
665       701,  697,  700,   53,   53,   53,   53,   53,   53,   53,
666        53,   53,   53,   53,   64,   64,   64,   64,   64,   64,
667        64,   64,   64,   64,   64,  700,  700,  700,  700,  700,
668       700,  699,  693,  693,  694,  693,  693,  693,  693,  693,
669       693,  694,  693,  694,  693,  702,  702,  693,  694,  702,
670
671       693,   14,  693,  694,  697,  693,  703,  694,  704,  693,
672       705,  694,  693,  112,  112,  694,  694,  694,  112,  112,
673       108,  694,  112,  694,  112,  706,  698,  706,  707,  693,
674       694,  693,  708,  694,  694,  694,  694,  694,  694,  694,
675       694,  694,  694,  699,  699,  693,  709,  700,  693,  700,
676       700,  693,  700,  701,  693,  700,  710,  700,  693,  705,
677       158,  161,  161,  700,  700,  700,  161,  161,  158,  700,
678       161,  700,  161,  158,  693,  708,  158,  693,  700,  700,
679       700,  700,  700,  700,  700,  700,  699,  693,  693,  711,
680       712,  693,  713,  713,  693,  693,  693,  694,  694,  693,
681
682       694,  693,  693,  693,  694,  693,  693,  693,  694,  693,
683       694,  693,  694,  694,  693,  211,  693,  713,  693,  693,
684       693,  693,  693,  693,  694,  694,  694,  694,  694,  694,
685       694,  694,  694,  714,  715,  716,  717,  694,  718,  693,
686       694,  719,  718,  694,  241,  694,  720,  720,  694,  248,
687       694,  694,  694,  694,  694,  694,  699,  693,  721,  693,
688       722,  700,  700,  700,  700,  723,  721,  724,  700,  700,
689       212,  700,  700,  270,  693,  218,  700,  700,  700,  700,
690       700,  700,  700,  700,  700,  700,  700,  719,  700,  287,
691       700,  286,  700,  700,  700,  700,  700,  700,  699,  693,
692
693       693,  725,  725,  726,  726,  693,  693,  693,  693,  693,
694       694,  693,  693,  693,  693,  693,  693,  693,  693,  694,
695       727,  693,  694,  694,  728,  728,  693,  694,  326,  727,
696       326,  694,  328,  694,  693,  693,  693,  693,  693,  693,
697       694,  694,  694,  693,  694,  694,  694,  694,  694,  694,
698       729,  729,  730,  731,  732,  693,  694,  693,  733,  734,
699       693,  693,  734,  693,  363,  694,  694,  693,  693,  694,
700       694,  699,  693,  693,  693,  693,  693,  735,  693,  700,
701       736,  736,  286,  700,  383,  287,  330,  700,  386,  700,
702       700,  700,  700,  700,  700,  700,  700,  700,  700,  700,
703
704       737,  700,  700,  700,  700,  699,  693,  693,  738,  693,
705       330,  693,  739,  740,  741,  742,  743,  744,  693,  693,
706       693,  738,  693,  422,  422,  694,  694,  693,  693,  693,
707       693,  693,  693,  694,  694,  693,  694,  693,  694,  694,
708       694,  694,  694,  729,  731,  693,  732,  693,  745,  745,
709       693,  745,  745,  694,  693,  693,  693,  694,  693,  699,
710       693,  693,  693,  693,  693,  746,  736,  736,  700,  383,
711       700,  700,  700,  700,  700,  700,  700,  700,  700,  700,
712       699,  693,  693,  693,  693,  747,  739,  739,  740,  740,
713       741,  741,  742,  742,  743,  743,  744,  744,  693,  693,
714
715       747,  693,  501,  501,  694,  693,  693,  693,  693,  693,
716       693,  694,  748,  693,  693,  693,  693,  694,  694,  694,
717       694,  693,  693,  693,  693,  693,  699,  693,  693,  693,
718       746,  746,  736,  736,  700,  700,  700,  700,  700,  700,
719       699,  693,  693,  693,  693,  693,  693,  693,  693,  693,
720       693,  748,  748,  693,  693,  693,  693,  694,  694,  694,
721       694,  694,  699,  693,  693,  736,  736,  700,  700,  700,
722       700,  700,  699,  693,  693,  693,  693,  693,  693,  693,
723       693,  693,  693,  749,  694,  693,  693,  736,  736,  750,
724       700,  699,  693,  693,  693,  693,  693,  751,  751,  749,
725
726       600,  694,  693,  693,  736,  736,  750,  751,  607,  700,
727       699,  693,  693,  751,  600,  600,  693,  693,  736,  736,
728       752,  607,  607,  699,  693,  693,  751,  751,  600,  600,
729       693,  693,  736,  736,  752,  752,  607,  607,  699,  693,
730       693,  751,  751,  600,  753,  693,  754,  736,  752,  752,
731       607,  699,  693,  693,  693,  751,  753,  693,  693,  754,
732       693,  736,  752,  752,  699,  693,  693,  736,  752,  699,
733       693,  736,  699,  755,  755,  755,  755,  755,  755,  755,
734       755,  755,  755,  755,  755,  755,  755,  755,  755,  755,
735       693,  693,    0,  693,  693,  693,  693,  693,  693,  693,
736
737       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
738       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
739       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
740       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
741       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
742       693,  693,  693,  693,  693
743     } ;
744
745 static yyconst flex_int16_t yy_nxt[3880] =
746     {   0,
747         4,    4,    4,    5,    4,    4,    6,    4,    7,    8,
748         9,   10,   11,    7,    4,    4,   12,   13,   14,   14,
749         4,   15,    4,    4,   16,   17,   18,   19,   16,   16,
750        20,   16,   16,   16,   21,   22,   23,   22,   24,   25,
751        22,   26,   22,   27,    4,    4,   28,   29,   30,   31,
752        32,   33,   34,   35,   36,   37,   38,   39,   40,   41,
753        42,   41,   41,   43,   44,   41,   41,   41,   45,   41,
754        41,   46,    4,    4,    4,    4,    5,    4,   47,    6,
755        47,    7,    8,    9,   10,   11,   48,    4,    4,   49,
756        50,   51,   51,    4,   52,    4,    4,   53,   54,   55,
757
758        56,   53,   53,   57,   53,   53,   53,   58,   59,   60,
759        59,   61,   62,   59,   63,   59,   27,    4,    4,   64,
760        65,   66,   67,   68,   69,   70,   71,   72,   73,   74,
761        75,   76,   77,   78,   77,   77,   79,   80,   77,   77,
762        77,   81,   77,   77,   82,    4,   83,   84,   84,   84,
763        84,   86,   86,   86,   86,   88,   89,   91,  113,  117,
764       119,  119,  119,  119,  106,  157,  354,   92,   83,   93,
765        94,  113,  107,  106,   95,   96,   96,   97,  119,  119,
766       119,  119,   85,  118,  107,  107,   98,   99,  100,  101,
767       102,  102,  102,  102,  103,  121,  645,  107,  119,  119,
768
769       119,  119,  119,  119,  119,  119,  355,  136,  120,  135,
770       135,   85,  114,  113,  138,  113,  135,  467,  122,  119,
771       119,  119,  119,  149,  142,  137,  136,  136,  119,  119,
772       119,  119,   85,  135,  135,  135,  123,  190,   85,   85,
773        85,   85,   85,   85,   85,   96,   96,   96,  198,  199,
774       136,  136,   85,  135,  135,  135,   98,   85,  100,  693,
775       102,  102,  102,  102,  693,  125,  234,  162,  124,  136,
776       136,  135,  135,  135,  136,  136,  117,  165,  135,  135,
777       135,  258,  258,  136,  136,  261,  116,  136,  136,  135,
778       135,  135,  135,  135,  135,  136,  136,  130,  206,  191,
779
780       118,  166,   85,  135,  135,  135,  107,  671,   85,   85,
781        85,   85,   85,   85,   85,  107,  352,  108,  107,  109,
782       110,  110,  110,  110,  111,  136,  136,  107,  136,  136,
783       167,  167,  167,  167,  135,  135,  135,  107,  135,  135,
784       542,  139,  145,  145,  145,  145,  108,  130,  261,  107,
785       112,  112,  112,  112,  112,  112,  112,  112,  112,  112,
786       112,  112,  200,  369,  179,  179,  167,  167,  167,  167,
787       178,  178,  178,  108,  126,  127,  127,  127,  126,  126,
788       126,  126,  126,  126,  126,  126,  126,  128,  126,  126,
789       107,  124,  140,  113,  126,  126,  126,  126,  146,   91,
790
791       171,  107,  107,   85,   85,  167,  167,  167,  167,  150,
792       370,   93,  151,  107,  113,  149,  152,  126,  130,  126,
793       299,  169,  179,  179,  167,  167,  167,  167,  167,  167,
794       167,  167,  178,  178,  179,  168,  178,  178,  206,  141,
795       207,  181,  113,  143,  170,  126,  126,  131,   85,  693,
796       132,  132,  132,  132,  133,  167,  167,  167,  167,  178,
797       149,  179,  179,  178,  178,  178,  179,  179,  180,  178,
798       178,  178,   84,   84,   84,   84,  134,  172,  164,  146,
799       135,  135,  136,  136,  136,  136,  136,  136,  136,  136,
800       136,  136,  173,  179,  179,  267,  268,  178,  178,  178,
801
802       179,  179,   85,  134,   96,   96,   97,  178,  178,  178,
803       264,   85,  661,  165,  149,   98,  153,  100,  101,  154,
804       154,  154,  154,  155,  179,  179,  179,  179,  106,  178,
805       178,  178,  179,  179,  178,  178,  178,  166,   96,   96,
806        96,  178,  178,  178,   85,   85,   85,  107,  107,  352,
807        85,   85,   85,  107,  107,  183,  149,  149,  149,  107,
808       107,  148,  149,  149,  149,  107,  107,  148,  148,  148,
809       148,  148,  148,  148,   96,   96,   96,  195,  280,  196,
810       130,   85,  182,  633,  197,   98,  148,  100,  693,  154,
811       154,  154,  154,  149,   85,  113,  667,  107,  340,   85,
812
813        85,  436,  184,  107,  340,  344,  149,  265,  172,  107,
814       280,  149,  149,  187,  413,  107,  145,  145,  145,  145,
815        86,   86,   86,   86,  189,   96,   96,   96,  345,  267,
816       268,  148,   85,   85,   85,   85,  185,  148,  148,  148,
817       148,  148,  148,  148,   85,  186,   85,  107,   85,  158,
818       345,  109,  159,  159,  159,  159,  160,  437,  149,  107,
819       149,   96,   96,   96,  249,  249,  249,  249,  249,  249,
820       249,  249,  146,  202,  264,  203,  414,  354,  158,  406,
821       204,  658,  161,  161,  161,  161,  161,  161,  161,  161,
822       161,  161,  161,  161,  249,  249,  249,  249,  253,  145,
823
824       145,  145,  145,  257,  283,  158,  174,   85,  693,  175,
825       175,  175,  175,  176,   85,  262,  263,  355,   85,  149,
826       148,  148,  148,  148,  415,   85,  149,  666,  254,  218,
827       149,  301,  301,  301,  301,  177,  218,  149,  146,  178,
828       178,  179,  179,  179,  179,  179,  179,  179,  179,  179,
829       179,  206,  279,  207,  373,  146,  284,  483,  218,  374,
830       375,  484,  177,  111,   85,  109,  193,  193,  193,  193,
831       111,   85,  292,  292,  292,  292,  149,   85,  317,  292,
832       292,  292,  292,  149,  376,  218,  416,  444,  318,  149,
833       258,  258,  111,  377,  419,  318,  194,  194,  194,  194,
834
835       194,  194,  194,  194,  194,  194,  194,  194,  420,  295,
836       319,  319,  319,  319,  320,  320,  320,  320,  130,  111,
837       209,  209,  209,  209,  209,  209,  209,  209,  209,  209,
838       209,  209,   85,   85,  281,  106,  588,  211,  380,  654,
839        85,   85,   85,   85,  212,  149,  438,  439,  213,  213,
840       213,  213,  213,  213,  213,  213,  213,  213,   85,   85,
841        85,   85,   85,   85,   85,   85,  211,  481,  438,  440,
842       214,  214,  214,  214,  214,  214,  214,  214,  214,  214,
843       214,  214,   85,   85,   85,   85,   85,   85,   85,   85,
844        85,   85,   85,  211,   85,  216,   85,   85,  217,  217,
845
846       217,  217,  218,   85,   85,  312,  106,  661,  149,  149,
847        85,  292,  292,  292,  292,  149,  149,  321,  321,  321,
848       321,  466,  149,  466,  216,  369,  146,  541,  214,  214,
849       214,  214,  214,  214,  214,  214,  214,  214,  214,  214,
850       323,  323,  323,  323,  363,  296,  659,  364,  297,  264,
851       298,  216,  219,   85,  220,  693,  316,  365,  221,  222,
852       106,   85,  693,  223,  468,  149,  224,  324,  324,  324,
853       324,  457,  368,  149,  219,   85,  220,  325,  325,  325,
854       325,  658,  221,  222,  693,  456,  146,  149,  223,  324,
855       324,  324,  324,  224,  126,  127,  127,  127,  126,  126,
856
857       126,  126,  126,  126,  126,  126,  126,  126,  126,  126,
858       381,  693,  512,  393,  126,  126,  126,  126,  458,  382,
859       444,  341,  527,  218,  398,  655,  307,  307,  307,  307,
860       218,  324,  324,  324,  324,  106,  512,  126,  130,  126,
861        85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
862        85,  522,  218,  324,  324,  324,  324,  235,  235,  235,
863       236,  457,  149,  342,  651,  126,  126,  126,  235,  235,
864       235,  236,   85,  126,  126,  126,  126,  126,  126,  218,
865       528,  126,  126,   85,  149,  240,   85,  126,  126,   85,
866       126,  359,  359,  359,  359,  149,  248,  534,  149,  573,
867
868       130,  149,  350,  360,  360,  360,  360,   85,  364,  250,
869       126,  130,  550,  693,  395,  383,  383,  383,  383,  149,
870       693,  693,  693,  693,   85,  106,  693,  511,  651,  396,
871       476,  372,  372,  372,  372,  397,  149,  362,  126,  126,
872       238,  238,  238,  238,  238,  238,  238,  238,  238,  238,
873       238,  238,   85,  239,  693,   85,  240,  241,  146,  646,
874        85,   85,   85,   85,  242,  645,  243,  149,  244,  244,
875       244,  244,  244,  244,  244,  244,  244,  244,  244,  244,
876       244,  244,  244,  244,  244,  244,  245,  146,  589,  106,
877       246,  246,  246,  246,  246,  246,  246,  246,  246,  246,
878
879       246,  246,  244,  244,  244,  244,  244,  244,  244,  244,
880       244,  244,  244,  245,  244,  135,  135,  135,  135,  135,
881       135,  135,  135,  135,  135,  135,  135,  248,  644,   85,
882       417,  240,  592,  644,  249,  249,  249,  249,  605,  516,
883       250,  149,  251,  251,  251,  251,  251,  251,  251,  251,
884       251,  251,  251,  251,  251,  251,  251,  251,  251,  251,
885       251,  517,   85,   85,  368,   85,  641,   85,  252,   96,
886        96,   96,  405,  344,  149,  149,   85,  149,   85,  149,
887        98,  148,  100,  693,  154,  154,  154,  154,  149,   85,
888       149,  146,  418,  264,   85,  614,  394,  384,  384,  384,
889
890       384,  149,  385,  385,  385,  385,  149,  148,  148,  148,
891       148,  148,  148,  148,  148,  148,  148,  614,  394,   85,
892       399,  408,  408,  408,  408,  514,  148,  385,  385,  385,
893       385,  149,  148,  148,  148,  148,  148,  148,  148,   85,
894       409,  409,  409,  409,  560,   85,  421,  421,  421,  421,
895       514,  149,   85,  385,  385,  385,  385,  149,  561,  391,
896       385,  385,  385,  385,  149,  427,  427,  427,  427,  359,
897       359,  359,  359,  449,  449,  449,  449,  269,  269,  269,
898       269,  269,  269,  269,  269,  269,  269,  269,  269,   85,
899       326,  640,  392,  327,  270,  542,  329,  148,  148,  148,
900
901       148,  271,  399,  331,  543,  272,  272,  272,  272,  272,
902       272,  272,  272,  272,  272,  148,  148,  148,  148,  148,
903       148,  148,  148,  270,  445,  445,  445,  273,  273,  273,
904       273,  273,  273,  273,  273,  273,  273,  273,  273,  148,
905       148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
906       270,  148,  274,  638,  106,  275,  275,  275,  275,  276,
907        85,   85,  240,   85,  611,   85,   91,  446,  401,  401,
908       401,  401,  149,  149,  637,  149,  461,  149,   93,  106,
909       106,  274,  106,   95,  632,  273,  273,  273,  273,  273,
910       273,  273,  273,  273,  273,  273,  273,  486,  486,  486,
911
912       486,  391,  566,  392,  532,  379,  532,  477,  274,  286,
913       286,  286,  286,  286,  286,  286,  286,  286,  286,  286,
914       286,   85,  239,  146,  499,  240,  287,  647,  647,  148,
915       148,  148,  148,  288,  567,  243,  500,  289,  289,  289,
916       289,  289,  289,  289,  289,  289,  289,  289,  289,  289,
917       289,  289,  289,  289,  289,  290,  445,  445,  445,  291,
918       291,  291,  291,  291,  291,  291,  291,  291,  291,  291,
919       291,  289,  289,  289,  289,  289,  289,  289,  289,  289,
920       289,  289,  290,  289,  178,  178,  178,  178,  178,  178,
921       178,  178,  178,  178,  178,  178,   85,  248,  631,  446,
922
923       630,  148,  106,  648,  292,  292,  292,  292,  149,  674,
924       250,  629,  293,  293,  293,  293,  293,  293,  293,  293,
925       293,  293,  293,  293,  293,  293,  293,  293,  293,  293,
926       293,  532,  379,  532,  148,  148,  148,  148,  294,  148,
927       148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
928       148,  148,  148,  148,  148,  148,  148,  148,  148,  213,
929       213,  213,  213,  213,  213,  213,  213,  213,  213,  523,
930       523,  523,  626,  460,  460,  460,  460,  106,  625,  146,
931       618,  214,  214,  214,  214,  214,  214,  214,  214,  214,
932       214,  214,  214,  322,  322,  322,  322,  322,  322,  322,
933
934       322,  322,  322,  202,  617,  203,  544,  544,  544,  544,
935       204,  106,  524,  692,  258,  306,  306,  306,  306,  306,
936       306,  306,  306,  306,  306,  306,  306,   85,  326,  146,
937        85,  327,  328,  533,  329,   85,   85,   85,   85,  330,
938       614,  331,  149,  332,  332,  332,  332,  332,  332,  332,
939       332,  332,  332,  332,  332,  332,  332,  332,  332,  332,
940       332,  333,  614,  606,  613,  334,  334,  334,  334,  334,
941       334,  334,  334,  334,  334,  334,  334,   85,   85,   85,
942        85,   85,   85,   85,   85,   85,   85,   85,  328,   85,
943       126,  235,  235,  235,  236,   85,  126,  126,  126,  126,
944
945       126,  126,   85,  264,  126,  126,  106,  149,  369,  596,
946       126,  126,  417,  126,  149,  330,  318,  693,  693,  693,
947       693,  693,  330,  318,  693,   85,  693,  327,  462,   85,
948       693,  693,  615,  126,  130,  208,  208,  149,  463,  624,
949       101,  149,   85,  450,  330,  103,  451,   85,  693,  452,
950        85,   85,   85,   85,  616,  404,  453,   85,  693,  595,
951        85,  126,  126,  248,  620,  470,  470,  470,  470,  149,
952       106,  330,  149,  596,  418,  693,  250,  471,  251,  251,
953       251,  251,  251,  251,  251,  251,  251,  251,  251,  251,
954       251,  251,  251,  251,  251,  251,  251,  612,  146,  622,
955
956       210,  210,  478,  639,  252,  357,  357,  357,  357,  357,
957       357,  357,  357,  357,  357,  357,  357,  363,  106,   85,
958       364,  623,  619,  523,  523,  523,  542,  652,  106,  604,
959       365,  149,  366,  366,  366,  366,  366,  366,  366,  366,
960       366,  366,  366,  366,  366,  366,  366,  366,  366,  366,
961       366,   85,   85,   85,  364,  436,   85,   85,  367,   85,
962        85,  603,  146,  149,  149,  149,  524,  472,  149,  149,
963       668,  149,  149,  508,  474,  272,  272,  272,  272,  272,
964       272,  272,  272,  272,  272,  634,  146,  508,  508,  563,
965       563,  563,  563,  602,  182,  538,  475,  273,  273,  273,
966
967       273,  273,  273,  273,  273,  273,  273,  273,  273,   85,
968       326,  473,   85,  327,  386,  665,  329,  148,  148,  148,
969       148,  387,  614,  331,  149,  388,  388,  388,  388,  388,
970       388,  388,  388,  388,  388,  388,  388,  388,  388,  388,
971       388,  388,  388,  389,  614,  146,  598,  390,  390,  390,
972       390,  390,  390,  390,  390,  390,  390,  390,  390,  148,
973       148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
974       386,  148,   85,  248,  146,   85,  598,  676,  676,  215,
975       215,  457,  597,  656,  149,  614,  250,  149,  293,  293,
976       293,  293,  293,  293,  293,  293,  293,  293,  293,  293,
977
978       293,  293,  293,  293,  293,  293,  293,  614,   85,  579,
979        85,  594,  513,   85,  294,   85,  401,  401,  401,  401,
980       149,   85,  149,  422,  547,  149,  423,  149,  480,  424,
981       537,  693,  450,  149,  693,  451,  425,  693,  452,   85,
982        85,  514,  423,  593,  693,  453,  106,  146,  146,  614,
983       515,  149,  149,  400,  400,  400,  400,  400,  400,  400,
984       400,  400,  400,  400,  400,  363,  514,   85,  364,  569,
985       568,  614,  676,  264,  247,  247,  587,  643,  365,  149,
986       402,  402,  402,  402,  402,  402,  402,  402,  402,  402,
987       402,  402,  402,  402,  402,  402,  402,  402,  402,  693,
988
989       508,  672,  693,  586,  113,  693,  403,  326,  585,   85,
990       327,  330,  693,  329,  508,  508,  670,  540,  330,  561,
991       331,  149,  410,  410,  410,  410,  410,  410,  410,  410,
992       410,  410,  410,  410,  410,  410,  410,  410,  410,  410,
993       411,  584,  691,  584,  412,  412,  412,  412,  412,  412,
994       412,  412,  412,  412,  412,  412,  450,  450,  653,  693,
995       693,  436,  693,  693,   85,   85,   85,  330,  326,  693,
996       693,  327,  654,  583,  329,  146,  149,  149,  149,  358,
997       358,  331,  582,  332,  332,  332,  332,  332,  332,  332,
998       332,  332,  332,  332,  332,  332,  332,  332,  332,  332,
999
1000       332,  332,  422,  483,  106,  423,  610,  581,  424,  544,
1001       544,  544,  544,  580,  553,  425,  539,  426,  426,  426,
1002       426,  426,  426,  426,  426,  426,  426,  426,  426,  426,
1003       426,  426,  426,  426,  426,  426,  334,  334,  334,  334,
1004       334,  334,  334,  334,  334,  334,  334,  334,  326,  553,
1005        85,  327,  451,  662,  329,  579,  578,  577,  576,  575,
1006       502,  331,  149,  388,  388,  388,  388,  388,  388,  388,
1007       388,  388,  388,  388,  388,  388,  388,  388,  388,  388,
1008       388,  388,  113,   85,  574,  501,  379,   85,  502,  148,
1009       422,  503,   85,  423,  502,  149,  424,  673,  504,  149,
1010
1011       565,  564,  364,  425,  149,  469,  469,  469,  469,  469,
1012       469,  469,  469,  469,  469,  469,  469,  469,  469,  469,
1013       469,  469,  469,  469,  390,  390,  390,  390,  390,  390,
1014       390,  390,  390,  390,  390,  390,   85,  450,  614,  590,
1015       451,  148,  642,  452,  148,  148,  148,  148,  149,  693,
1016       453,  501,  693,  373,  502,  693,  146,  503,  374,  375,
1017       614,  451,  693,  562,  504,  559,  505,  505,  505,  505,
1018       505,  505,  505,  505,  505,  505,  505,  505,  505,  505,
1019       505,  505,  505,  505,  505,  501,  558,   85,  502,  557,
1020       556,  503,  563,  563,  563,  563,  555,  621,  504,  149,
1021
1022       535,  535,  535,  535,  535,  535,  535,  535,  535,  535,
1023       535,  535,  535,  535,  535,  535,  535,  535,  535,   85,
1024        85,   85,   85,   85,  614,  379,  379,  379,  554,  570,
1025       553,  149,  149,  149,  149,  149,  139,  614,  627,  379,
1026       551,  549,  548,  571,  614,  536,  614,  502,  528,  649,
1027       501,  676,  590,  636,  636,  636,  501,  656,  572,  614,
1028       628,  547,  677,  571,  546,  669,  614,  636,  498,  536,
1029       379,  650,  379,  498,  496,  636,  636,  636,  379,  379,
1030       591,  599,  599,  496,  599,  599,  599,  599,  599,  636,
1031       599,  599,  599,  599,  494,  599,  599,  676,  636,  494,
1032
1033       636,  599,  599,  599,  599,  492,  636,  636,  678,  492,
1034       663,  601,  676,  490,  490,  488,  676,  488,  669,  676,
1035       636,  146,  636,  679,  599,  599,  599,  680,  636,  636,
1036       681,  676,  676,  601,  676,  664,  423,  676,  676,  676,
1037       676,  530,  682,  683,  529,  684,  206,  200,  685,  686,
1038       687,  688,  599,  599,  599,  599,  368,  599,  599,  599,
1039       599,  599,  600,  599,  599,  599,  599,  146,  599,  599,
1040       676,  526,  364,  451,  608,  599,  599,  599,  448,  113,
1041       521,  689,  146,  676,  609,  520,  146,  519,  518,  146,
1042       436,  113,  511,  510,  690,  509,  507,  599,  599,  599,
1043
1044       506,  146,  146,  423,  146,  422,  609,  146,  146,  146,
1045       146,  422,  420,  498,  496,  494,  492,  490,  488,  327,
1046       327,  482,  327,  261,  379,  599,  599,  599,  599,  465,
1047       599,  599,  599,  599,  599,  464,  599,  599,  599,  599,
1048       146,  599,  599,   87,  201,  459,  364,  599,  599,  599,
1049       599,  363,  368,  146,  240,  448,  443,  601,  442,  441,
1050       201,  435,  434,  433,  432,  431,  430,  429,  428,  327,
1051       599,  599,  599,  327,  326,  326,  206,  206,  201,  601,
1052       200,  200,  200,  305,  305,  303,  303,  407,  240,  261,
1053       261,  261,  260,  379,  260,  350,  371,  342,  599,  599,
1054
1055       599,  599,  341,  599,  599,  599,  599,  599,  600,  599,
1056       599,  599,  599,  368,  599,  599,  248,  240,  240,  239,
1057       608,  599,  599,  599,  349,  348,  347,  346,  343,  339,
1058       609,  338,  337,  336,  335,  316,  316,  315,  314,  313,
1059       312,  312,  311,  599,  599,  599,  310,  309,  308,  305,
1060       303,  300,  609,  261,  285,  283,  282,  281,  278,  277,
1061       261,  261,  260,  146,  256,  231,  201,  255,  229,  130,
1062       233,  599,  599,   85,  232,  231,   85,  201,  230,   85,
1063       229,   85,   85,   85,   85,   85,   85,   85,   90,   90,
1064       228,  228,  227,  226,   90,   90,  104,  104,  104,  225,
1065
1066       104,  104,  104,  104,  104,  104,  104,  104,  104,  104,
1067       104,  104,  104,  105,  105,  105,  105,  105,  105,  105,
1068       105,  105,  105,  105,  105,  105,  105,  105,  105,  105,
1069       105,  129,  129,  129,  129,  129,  129,  129,  129,  129,
1070       129,  129,  129,  129,  129,  129,  129,  129,  129,  144,
1071       144,  144,  144,  144,  144,  144,  144,  144,  144,  144,
1072       144,  144,  144,  144,  144,  144,  144,  148,  106,  206,
1073       148,  205,  200,  148,  148,  148,  148,  148,  148,  148,
1074       148,  148,  156,  156,  156,  201,  156,  156,  156,  156,
1075       156,  156,  156,  156,  156,  156,  156,  156,  156,   98,
1076
1077        98,  200,  192,   98,  188,  164,  163,  147,  116,   98,
1078        98,   98,   98,  115,   98,  126,  126,  126,  126,  126,
1079       126,  126,  126,  126,  126,  126,  126,  126,  126,  126,
1080       126,  126,  126,  237,  237,  237,  237,  237,  237,  237,
1081       237,  237,  237,  237,  237,  237,  237,  237,  237,  237,
1082       237,  259,  259,  259,  259,  259,  259,  259,  259,  259,
1083       259,  259,  259,  259,  259,  259,  259,  259,  259,  266,
1084       266,  266,  266,  266,  266,  266,  266,  266,  266,  266,
1085       266,  266,  266,  266,  266,  266,  266,  302,  302,  106,
1086       302,  302,  302,  302,  302,  302,  302,  302,  302,  302,
1087
1088       302,  302,  302,  302,  302,  304,  304,   87,  304,  304,
1089       304,  304,  304,  304,  304,  304,  304,  304,  304,  304,
1090       304,  304,  304,  306,  693,  693,  693,  306,  693,  306,
1091       306,  306,  693,  693,  306,  351,  351,  351,  351,  351,
1092       351,  351,  351,  351,  351,  351,  351,  351,  351,  351,
1093       351,  351,  351,  126,  126,  126,  126,  126,  126,  126,
1094       126,  126,  126,  126,  126,  126,  126,  126,  126,  126,
1095       126,  353,  353,  353,  353,  353,  353,  353,  353,  353,
1096       353,  353,  353,  353,  353,  353,  353,  353,  353,  237,
1097       237,  237,  237,  237,  237,  237,  237,  237,  237,  237,
1098
1099       237,  237,  237,  237,  237,  237,  237,  356,  356,  356,
1100       356,  356,  356,  356,  361,  693,  693,  693,  693,  361,
1101       693,  361,  361,  693,  361,  259,  259,  259,  259,  259,
1102       259,  259,  259,  259,  259,  259,  259,  259,  259,  259,
1103       259,  259,  259,  378,  378,  378,  378,  378,  378,  378,
1104       378,  378,  378,  378,  378,  378,  378,  378,  378,  378,
1105       378,  266,  266,  266,  266,  266,  266,  266,  266,  266,
1106       266,  266,  266,  266,  266,  266,  266,  266,  266,  105,
1107       105,  105,  105,  105,  105,  105,  105,  105,  105,  105,
1108       105,  105,  105,  105,  105,  105,  105,  302,  302,  693,
1109
1110       302,  302,  302,  302,  302,  302,  302,  302,  302,  302,
1111       302,  302,  302,  302,  302,  304,  304,  693,  304,  304,
1112       304,  304,  304,  304,  304,  304,  304,  304,  304,  304,
1113       304,  304,  304,  412,  693,  693,  693,  412,  693,  412,
1114       412,  412,  693,  693,  412,  410,  410,  693,  693,  410,
1115       693,  693,  410,  410,  351,  351,  351,  351,  351,  351,
1116       351,  351,  351,  351,  351,  351,  351,  351,  351,  351,
1117       351,  351,  353,  353,  353,  353,  353,  353,  353,  353,
1118       353,  353,  353,  353,  353,  353,  353,  353,  353,  353,
1119       126,  126,  126,  126,  126,  126,  126,  126,  126,  126,
1120
1121       126,  126,  126,  126,  126,  126,  126,  126,  447,  447,
1122       447,  447,  447,  447,  447,  447,  447,  447,  447,  447,
1123       447,  447,  447,  447,  447,  447,  454,  454,  454,  454,
1124       693,  454,  454,  693,  454,  454,  454,  454,  454,  454,
1125       454,  455,  455,  693,  693,  693,  693,  693,  455,  455,
1126       693,  455,  378,  378,  378,  378,  378,  378,  378,  378,
1127       378,  378,  378,  378,  378,  378,  378,  378,  378,  378,
1128       105,  105,  105,  105,  105,  105,  105,  105,  105,  105,
1129       105,  105,  105,  105,  105,  105,  105,  105,  479,  479,
1130       479,  479,  693,  479,  479,  479,  479,  479,  479,  479,
1131
1132       479,  479,  479,  485,  485,  693,  693,  485,  693,  693,
1133       485,  485,  487,  487,  693,  487,  487,  487,  487,  487,
1134       487,  487,  487,  487,  487,  487,  487,  487,  487,  487,
1135       489,  489,  693,  489,  489,  489,  489,  489,  489,  489,
1136       489,  489,  489,  489,  489,  489,  489,  489,  491,  491,
1137       693,  491,  491,  491,  491,  491,  491,  491,  491,  491,
1138       491,  491,  491,  491,  491,  491,  493,  493,  693,  493,
1139       493,  493,  493,  493,  493,  493,  493,  493,  493,  493,
1140       493,  493,  493,  493,  495,  495,  693,  495,  495,  495,
1141       495,  495,  495,  495,  495,  495,  495,  495,  495,  495,
1142
1143       495,  495,  497,  497,  693,  497,  497,  497,  497,  497,
1144       497,  497,  497,  497,  497,  497,  497,  497,  497,  497,
1145       525,  525,  693,  693,  525,  693,  693,  525,  525,  525,
1146       525,  525,  525,  525,  531,  531,  531,  531,  531,  531,
1147       531,  531,  531,  531,  531,  531,  531,  531,  531,  531,
1148       531,  531,  545,  545,  693,  693,  545,  693,  693,  545,
1149       545,  552,  552,  693,  552,  552,  552,  552,  552,  552,
1150       552,  552,  552,  552,  552,  552,  552,  552,  552,  600,
1151       600,  693,  600,  600,  600,  600,  600,  600,  600,  600,
1152       600,  600,  600,  600,  600,  600,  600,  607,  607,  693,
1153
1154       607,  607,  607,  607,  607,  607,  607,  607,  607,  607,
1155       607,  607,  607,  607,  607,  599,  599,  693,  599,  599,
1156       599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
1157       599,  599,  599,  635,  635,  635,  635,  635,  635,  635,
1158       635,  635,  635,  635,  635,  635,  635,  635,  635,  635,
1159       635,  657,  657,  657,  657,  657,  657,  657,  657,  657,
1160       657,  657,  657,  657,  657,  657,  657,  657,  657,  660,
1161       660,  660,  660,  660,  660,  660,  660,  660,  660,  660,
1162       660,  660,  660,  660,  660,  660,  660,  675,  675,  675,
1163       675,  675,  675,  675,  675,  675,  675,  675,  675,  675,
1164
1165       675,  675,  675,  675,  675,    3,  693,  693,  693,  693,
1166       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
1167       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
1168       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
1169       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
1170       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
1171       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
1172       693,  693,  693,  693,  693,  693,  693,  693,  693
1173     } ;
1174
1175 static yyconst flex_int16_t yy_chk[3880] =
1176     {   0,
1177         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
1178         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
1179         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
1180         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
1181         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
1182         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
1183         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
1184         1,    1,    1,    2,    2,    2,    2,    2,    2,    2,
1185         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
1186         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
1187
1188         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
1189         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
1190         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
1191         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
1192         2,    2,    2,    2,    2,    2,    5,    6,    6,    6,
1193         6,    8,    8,    8,    8,   11,   11,   12,   17,   20,
1194        22,   22,   22,   22,   52,   52,  236,   12,    5,   12,
1195        12,   29,   41,  381,   12,   13,   13,   13,   21,   21,
1196        21,   21,   13,   20,   41,   43,   13,   13,   13,   13,
1197        13,   13,   13,   13,   13,   23,  671,   43,   23,   23,
1198
1199        23,   23,   24,   24,   24,   24,  236,   30,   21,   30,
1200        30,   48,   17,   54,   30,   26,   29,  381,   23,   25,
1201        25,   25,   25,   48,   43,   29,   36,   36,   26,   26,
1202        26,   26,   13,   36,   36,   36,   24,   87,   13,   13,
1203        13,   13,   13,   13,   13,   14,   14,   14,   92,   92,
1204        32,   32,   14,   32,   32,   32,   14,   14,   14,   14,
1205        14,   14,   14,   14,   14,   26,  128,   54,   25,   31,
1206        31,   31,   31,   31,   33,   33,   34,   57,   33,   33,
1207        33,  146,  146,   35,   35,  155,   31,   34,   34,   35,
1208        35,   35,   34,   34,   34,   37,   37,  128,  155,   87,
1209
1210        34,   57,   14,   37,   37,   37,   40,  667,   14,   14,
1211        14,   14,   14,   14,   14,   16,  234,   16,   40,   16,
1212        16,   16,   16,   16,   16,   38,   38,   16,   39,   39,
1213        59,   59,   59,   59,   38,   38,   38,   44,   39,   39,
1214       666,   40,   46,   46,   46,   46,   16,  234,  152,   44,
1215        16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
1216        16,   16,  152,  252,   71,   71,   61,   61,   61,   61,
1217        71,   71,   71,   16,   27,   27,   27,   27,   27,   27,
1218        27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
1219        42,   44,   42,   45,   27,   27,   27,   27,   46,   49,
1220
1221        61,   45,   42,  148,   49,   58,   58,   58,   58,   49,
1222       252,   49,   49,   45,   65,  148,   49,   27,   27,   27,
1223       187,   60,   75,   75,   60,   60,   60,   60,   62,   62,
1224        62,   62,   75,   75,   66,   58,   66,   66,  101,   42,
1225       101,   66,   63,   45,   60,   27,   27,   28,  156,   28,
1226        28,   28,   28,   28,   28,   63,   63,   63,   63,   65,
1227       156,   67,   67,   67,   67,   67,   68,   68,   65,   68,
1228        68,   68,   84,   84,   84,   84,   28,   62,   67,  187,
1229        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
1230        28,   28,   63,   69,   69,  157,  157,   69,   69,   69,
1231
1232        72,   72,  151,   28,   50,   50,   50,   72,   72,   72,
1233       151,   50,  660,   70,  151,   50,   50,   50,   50,   50,
1234        50,   50,   50,   50,   70,   70,   73,   73,  619,   70,
1235        70,   70,   74,   74,   73,   73,   73,   70,   96,   96,
1236        96,   74,   74,   74,   76,   77,  165,   76,   77,  351,
1237        78,   80,  166,   78,   80,   78,   76,   77,  165,   76,
1238        77,   50,   78,   80,  166,   78,   80,   50,   50,   50,
1239        50,   50,   50,   50,   51,   51,   51,   91,  165,   91,
1240       351,   51,   76,  619,   91,   51,   51,   51,   51,   51,
1241        51,   51,   51,   51,   79,   81,  659,   79,  224,  153,
1242
1243        81,  343,   78,   81,  224,  228,   79,  153,   80,   79,
1244       166,  153,   81,   82,  312,   81,   82,   82,   82,   82,
1245        86,   86,   86,   86,   86,  100,  100,  100,  228,  266,
1246       266,   51,  119,  119,  119,  119,   79,   51,   51,   51,
1247        51,   51,   51,   51,   53,   81,  170,   53,  185,   53,
1248       228,   53,   53,   53,   53,   53,   53,  343,  170,   53,
1249       185,   97,   97,   97,  136,  136,  136,  136,  137,  137,
1250       137,  137,   82,   97,  170,   97,  312,  353,   53,  299,
1251        97,  657,   53,   53,   53,   53,   53,   53,   53,   53,
1252        53,   53,   53,   53,  138,  138,  138,  138,  137,  145,
1253
1254       145,  145,  145,  145,  185,   53,   64,  150,   64,   64,
1255        64,   64,   64,   64,  164,  150,  150,  353,  172,  150,
1256       167,  167,  167,  167,  316,  264,  164,  655,  138,  193,
1257       172,  189,  189,  189,  189,   64,  193,  264,  299,   64,
1258        64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
1259        64,  314,  164,  314,  258,  145,  172,  408,  193,  258,
1260       258,  408,   64,   90,  179,   90,   90,   90,   90,   90,
1261        90,  180,  179,  179,  179,  179,  179,  182,  207,  180,
1262       180,  180,  180,  180,  260,  193,  316,  352,  207,  182,
1263       528,  528,   90,  260,  318,  207,   90,   90,   90,   90,
1264
1265        90,   90,   90,   90,   90,   90,   90,   90,  318,  180,
1266       208,  208,  208,  208,  209,  209,  209,  209,  352,   90,
1267       108,  108,  108,  108,  108,  108,  108,  108,  108,  108,
1268       108,  108,  110,  262,  182,  566,  566,  110,  262,  653,
1269       110,  110,  110,  110,  110,  262,  344,  345,  110,  110,
1270       110,  110,  110,  110,  110,  110,  110,  110,  110,  110,
1271       110,  110,  110,  110,  110,  110,  110,  406,  344,  345,
1272       110,  110,  110,  110,  110,  110,  110,  110,  110,  110,
1273       110,  110,  110,  110,  110,  110,  110,  110,  110,  110,
1274       110,  110,  110,  110,  110,  112,  183,  184,  112,  112,
1275
1276       112,  112,  112,  181,  186,  263,  382,  647,  183,  184,
1277       263,  181,  181,  181,  181,  181,  186,  210,  210,  210,
1278       210,  379,  263,  379,  112,  362,  406,  481,  112,  112,
1279       112,  112,  112,  112,  112,  112,  112,  112,  112,  112,
1280       213,  213,  213,  213,  360,  181,  646,  360,  183,  184,
1281       186,  112,  113,  279,  113,  218,  265,  360,  113,  113,
1282       268,  265,  218,  113,  382,  279,  113,  214,  214,  214,
1283       214,  367,  362,  265,  113,  284,  113,  215,  215,  215,
1284       215,  645,  113,  113,  218,  360,  481,  284,  113,  225,
1285       225,  225,  225,  113,  127,  127,  127,  127,  127,  127,
1286
1287       127,  127,  127,  127,  127,  127,  127,  127,  127,  127,
1288       268,  218,  435,  279,  127,  127,  127,  127,  367,  268,
1289       444,  225,  460,  194,  284,  641,  194,  194,  194,  194,
1290       194,  226,  226,  226,  226,  468,  435,  127,  127,  127,
1291       216,  216,  216,  216,  216,  216,  216,  216,  216,  216,
1292       384,  444,  194,  233,  233,  233,  233,  235,  235,  235,
1293       235,  456,  384,  226,  638,  127,  127,  129,  129,  129,
1294       129,  129,  281,  129,  129,  129,  129,  129,  129,  194,
1295       460,  129,  129,  395,  281,  246,  397,  129,  129,  283,
1296       129,  246,  246,  246,  246,  395,  247,  468,  397,  541,
1297
1298       235,  283,  233,  247,  247,  247,  247,  269,  456,  247,
1299       129,  129,  509,  248,  281,  269,  269,  269,  269,  269,
1300       248,  248,  248,  248,  282,  567,  248,  509,  637,  282,
1301       397,  257,  257,  257,  257,  283,  282,  247,  129,  129,
1302       131,  131,  131,  131,  131,  131,  131,  131,  131,  131,
1303       131,  131,  132,  132,  248,  404,  132,  132,  541,  632,
1304       132,  132,  132,  132,  132,  631,  132,  404,  132,  132,
1305       132,  132,  132,  132,  132,  132,  132,  132,  132,  132,
1306       132,  132,  132,  132,  132,  132,  132,  257,  567,  588,
1307       132,  132,  132,  132,  132,  132,  132,  132,  132,  132,
1308
1309       132,  132,  132,  132,  132,  132,  132,  132,  132,  132,
1310       132,  132,  132,  132,  132,  134,  134,  134,  134,  134,
1311       134,  134,  134,  134,  134,  134,  134,  135,  630,  289,
1312       576,  289,  573,  629,  135,  135,  135,  135,  588,  438,
1313       135,  289,  135,  135,  135,  135,  135,  135,  135,  135,
1314       135,  135,  135,  135,  135,  135,  135,  135,  135,  135,
1315       135,  438,  293,  298,  293,  396,  626,  297,  135,  154,
1316       154,  154,  297,  280,  293,  298,  154,  396,  280,  297,
1317       154,  154,  154,  154,  154,  154,  154,  154,  154,  272,
1318       280,  573,  576,  396,  273,  598,  280,  272,  272,  272,
1319
1320       272,  272,  273,  273,  273,  273,  273,  274,  274,  274,
1321       274,  274,  274,  274,  274,  274,  274,  598,  280,  277,
1322       298,  301,  301,  301,  301,  581,  154,  277,  277,  277,
1323       277,  277,  154,  154,  154,  154,  154,  154,  154,  158,
1324       306,  306,  306,  306,  520,  285,  322,  322,  322,  322,
1325       581,  158,  278,  285,  285,  285,  285,  285,  520,  277,
1326       278,  278,  278,  278,  278,  334,  334,  334,  334,  357,
1327       357,  357,  357,  358,  358,  358,  358,  158,  158,  158,
1328       158,  158,  158,  158,  158,  158,  158,  158,  158,  159,
1329       325,  625,  278,  325,  159,  482,  325,  159,  159,  159,
1330
1331       159,  159,  285,  325,  482,  159,  159,  159,  159,  159,
1332       159,  159,  159,  159,  159,  159,  159,  159,  159,  159,
1333       159,  159,  159,  159,  354,  354,  354,  159,  159,  159,
1334       159,  159,  159,  159,  159,  159,  159,  159,  159,  159,
1335       159,  159,  159,  159,  159,  159,  159,  159,  159,  159,
1336       159,  159,  161,  623,  533,  161,  161,  161,  161,  161,
1337       291,  295,  291,  296,  592,  398,  374,  354,  291,  291,
1338       291,  291,  291,  295,  622,  296,  374,  398,  374,  633,
1339       672,  161,  534,  374,  618,  161,  161,  161,  161,  161,
1340       161,  161,  161,  161,  161,  161,  161,  412,  412,  412,
1341
1342       412,  295,  533,  296,  466,  466,  466,  398,  161,  174,
1343       174,  174,  174,  174,  174,  174,  174,  174,  174,  174,
1344       174,  175,  175,  592,  420,  175,  175,  633,  672,  175,
1345       175,  175,  175,  175,  534,  175,  420,  175,  175,  175,
1346       175,  175,  175,  175,  175,  175,  175,  175,  175,  175,
1347       175,  175,  175,  175,  175,  175,  445,  445,  445,  175,
1348       175,  175,  175,  175,  175,  175,  175,  175,  175,  175,
1349       175,  175,  175,  175,  175,  175,  175,  175,  175,  175,
1350       175,  175,  175,  175,  177,  177,  177,  177,  177,  177,
1351       177,  177,  177,  177,  177,  177,  178,  178,  617,  445,
1352
1353       616,  178,  634,  634,  178,  178,  178,  178,  178,  673,
1354       178,  615,  178,  178,  178,  178,  178,  178,  178,  178,
1355       178,  178,  178,  178,  178,  178,  178,  178,  178,  178,
1356       178,  532,  532,  532,  178,  178,  178,  178,  178,  178,
1357       178,  178,  178,  178,  178,  178,  178,  178,  178,  178,
1358       178,  178,  178,  178,  178,  178,  178,  178,  178,  211,
1359       211,  211,  211,  211,  211,  211,  211,  211,  211,  448,
1360       448,  448,  613,  372,  372,  372,  372,  467,  612,  673,
1361       604,  211,  211,  211,  211,  211,  211,  211,  211,  211,
1362       211,  211,  211,  212,  212,  212,  212,  212,  212,  212,
1363
1364       212,  212,  212,  462,  603,  462,  484,  484,  484,  484,
1365       462,  589,  448,  691,  691,  212,  212,  212,  212,  212,
1366       212,  212,  212,  212,  212,  212,  212,  217,  217,  372,
1367       480,  217,  217,  467,  217,  217,  217,  217,  217,  217,
1368       599,  217,  480,  217,  217,  217,  217,  217,  217,  217,
1369       217,  217,  217,  217,  217,  217,  217,  217,  217,  217,
1370       217,  217,  599,  589,  597,  217,  217,  217,  217,  217,
1371       217,  217,  217,  217,  217,  217,  217,  217,  217,  217,
1372       217,  217,  217,  217,  217,  217,  217,  217,  217,  217,
1373       237,  237,  237,  237,  237,  380,  237,  237,  237,  237,
1374
1375       237,  237,  294,  380,  237,  237,  606,  380,  294,  595,
1376       237,  237,  317,  237,  294,  321,  317,  363,  326,  330,
1377       363,  326,  321,  317,  326,  388,  330,  388,  375,  391,
1378       363,  326,  601,  237,  237,  703,  703,  388,  375,  611,
1379       375,  391,  359,  359,  321,  375,  359,  359,  330,  359,
1380       359,  359,  359,  359,  601,  294,  359,  390,  363,  579,
1381       399,  237,  237,  238,  606,  390,  390,  390,  390,  390,
1382       605,  321,  399,  579,  317,  330,  238,  391,  238,  238,
1383       238,  238,  238,  238,  238,  238,  238,  238,  238,  238,
1384       238,  238,  238,  238,  238,  238,  238,  594,  611,  609,
1385
1386       704,  704,  399,  624,  238,  241,  241,  241,  241,  241,
1387       241,  241,  241,  241,  241,  241,  241,  249,  662,  392,
1388       249,  609,  605,  523,  523,  523,  593,  639,  620,  587,
1389       249,  392,  249,  249,  249,  249,  249,  249,  249,  249,
1390       249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
1391       249,  394,  402,  475,  402,  393,  536,  571,  249,  270,
1392       393,  586,  624,  394,  402,  475,  523,  392,  536,  571,
1393       662,  270,  393,  430,  394,  270,  270,  270,  270,  270,
1394       270,  270,  270,  270,  270,  620,  639,  430,  430,  527,
1395       527,  527,  527,  585,  536,  475,  394,  270,  270,  270,
1396
1397       270,  270,  270,  270,  270,  270,  270,  270,  270,  275,
1398       275,  393,  610,  275,  275,  652,  275,  275,  275,  275,
1399       275,  275,  656,  275,  610,  275,  275,  275,  275,  275,
1400       275,  275,  275,  275,  275,  275,  275,  275,  275,  275,
1401       275,  275,  275,  275,  656,  527,  583,  275,  275,  275,
1402       275,  275,  275,  275,  275,  275,  275,  275,  275,  275,
1403       275,  275,  275,  275,  275,  275,  275,  275,  275,  275,
1404       275,  275,  286,  286,  652,  403,  582,  674,  675,  705,
1405       705,  403,  580,  642,  286,  642,  286,  403,  286,  286,
1406       286,  286,  286,  286,  286,  286,  286,  286,  286,  286,
1407
1408       286,  286,  286,  286,  286,  286,  286,  642,  400,  578,
1409       474,  577,  436,  538,  286,  287,  400,  400,  400,  400,
1410       400,  405,  474,  409,  575,  538,  409,  287,  403,  409,
1411       474,  422,  449,  405,  422,  449,  409,  422,  449,  537,
1412       469,  436,  469,  574,  422,  449,  668,  674,  675,  628,
1413       436,  537,  469,  287,  287,  287,  287,  287,  287,  287,
1414       287,  287,  287,  287,  287,  292,  436,  477,  292,  538,
1415       537,  628,  690,  405,  708,  708,  565,  628,  292,  477,
1416       292,  292,  292,  292,  292,  292,  292,  292,  292,  292,
1417       292,  292,  292,  292,  292,  292,  292,  292,  292,  450,
1418
1419       508,  668,  450,  564,  471,  450,  292,  307,  562,  471,
1420       307,  307,  450,  307,  508,  508,  665,  477,  307,  560,
1421       307,  471,  307,  307,  307,  307,  307,  307,  307,  307,
1422       307,  307,  307,  307,  307,  307,  307,  307,  307,  307,
1423       307,  559,  690,  558,  307,  307,  307,  307,  307,  307,
1424       307,  307,  307,  307,  307,  307,  452,  453,  640,  452,
1425       453,  473,  452,  453,  591,  476,  473,  307,  320,  452,
1426       453,  320,  640,  557,  320,  665,  591,  476,  473,  719,
1427       719,  320,  556,  320,  320,  320,  320,  320,  320,  320,
1428       320,  320,  320,  320,  320,  320,  320,  320,  320,  320,
1429
1430       320,  320,  324,  544,  648,  324,  591,  555,  324,  544,
1431       544,  544,  544,  554,  553,  324,  476,  324,  324,  324,
1432       324,  324,  324,  324,  324,  324,  324,  324,  324,  324,
1433       324,  324,  324,  324,  324,  324,  328,  328,  328,  328,
1434       328,  328,  328,  328,  328,  328,  328,  328,  383,  552,
1435       479,  383,  479,  648,  383,  551,  549,  548,  547,  546,
1436       545,  383,  479,  383,  383,  383,  383,  383,  383,  383,
1437       383,  383,  383,  383,  383,  383,  383,  383,  383,  383,
1438       383,  383,  478,  569,  543,  486,  531,  478,  486,  383,
1439       385,  486,  535,  385,  535,  569,  385,  670,  486,  478,
1440
1441       530,  529,  526,  385,  535,  385,  385,  385,  385,  385,
1442       385,  385,  385,  385,  385,  385,  385,  385,  385,  385,
1443       385,  385,  385,  385,  386,  386,  386,  386,  386,  386,
1444       386,  386,  386,  386,  386,  386,  401,  401,  627,  569,
1445       401,  401,  627,  401,  401,  401,  401,  401,  401,  501,
1446       401,  427,  501,  692,  427,  501,  670,  427,  692,  692,
1447       627,  525,  501,  521,  427,  519,  427,  427,  427,  427,
1448       427,  427,  427,  427,  427,  427,  427,  427,  427,  427,
1449       427,  427,  427,  427,  427,  470,  518,  539,  470,  517,
1450       516,  470,  563,  563,  563,  563,  515,  608,  470,  539,
1451
1452       470,  470,  470,  470,  470,  470,  470,  470,  470,  470,
1453       470,  470,  470,  470,  470,  470,  470,  470,  470,  472,
1454       540,  568,  570,  572,  608,  621,  635,  636,  514,  539,
1455       513,  472,  540,  568,  570,  572,  512,  643,  614,  663,
1456       510,  507,  506,  539,  614,  472,  608,  505,  563,  636,
1457       504,  676,  568,  621,  635,  636,  503,  643,  540,  643,
1458       614,  500,  676,  570,  499,  663,  614,  663,  498,  472,
1459       664,  636,  669,  497,  496,  621,  635,  636,  649,  650,
1460       572,  584,  584,  495,  584,  584,  584,  584,  584,  663,
1461       584,  584,  584,  584,  494,  584,  584,  677,  664,  493,
1462
1463       669,  584,  584,  584,  584,  492,  649,  650,  677,  491,
1464       649,  584,  678,  490,  489,  488,  679,  487,  664,  680,
1465       664,  676,  669,  678,  584,  584,  584,  679,  649,  650,
1466       680,  681,  682,  584,  683,  650,  485,  684,  685,  686,
1467       687,  465,  681,  682,  464,  683,  463,  461,  684,  685,
1468       686,  687,  584,  584,  590,  590,  459,  590,  590,  590,
1469       590,  590,  590,  590,  590,  590,  590,  677,  590,  590,
1470       688,  457,  455,  454,  590,  590,  590,  590,  447,  443,
1471       442,  688,  678,  689,  590,  441,  679,  440,  439,  680,
1472       437,  434,  433,  432,  689,  431,  429,  590,  590,  590,
1473
1474       428,  681,  682,  426,  683,  425,  590,  684,  685,  686,
1475       687,  424,  419,  418,  417,  416,  415,  414,  413,  411,
1476       410,  407,  389,  387,  378,  590,  590,  600,  600,  377,
1477       600,  600,  600,  600,  600,  376,  600,  600,  600,  600,
1478       688,  600,  600,  373,  371,  369,  366,  600,  600,  600,
1479       600,  365,  361,  689,  356,  355,  350,  600,  349,  348,
1480       347,  342,  341,  340,  339,  338,  337,  336,  335,  333,
1481       600,  600,  600,  332,  331,  329,  315,  313,  311,  600,
1482       310,  309,  308,  305,  304,  303,  302,  300,  290,  288,
1483       276,  271,  267,  261,  259,  256,  255,  254,  600,  600,
1484
1485       607,  607,  253,  607,  607,  607,  607,  607,  607,  607,
1486       607,  607,  607,  251,  607,  607,  250,  245,  244,  243,
1487       607,  607,  607,  607,  232,  231,  230,  229,  227,  223,
1488       607,  222,  221,  220,  219,  206,  205,  204,  203,  202,
1489       200,  199,  198,  607,  607,  607,  197,  196,  195,  191,
1490       190,  188,  607,  176,  173,  171,  169,  168,  163,  162,
1491       160,  149,  147,  144,  143,  142,  141,  140,  139,  126,
1492       125,  607,  607,  694,  124,  123,  694,  122,  121,  694,
1493       120,  694,  694,  694,  694,  694,  694,  694,  695,  695,
1494       118,  117,  116,  115,  695,  695,  696,  696,  696,  114,
1495
1496       696,  696,  696,  696,  696,  696,  696,  696,  696,  696,
1497       696,  696,  696,  697,  697,  697,  697,  697,  697,  697,
1498       697,  697,  697,  697,  697,  697,  697,  697,  697,  697,
1499       697,  698,  698,  698,  698,  698,  698,  698,  698,  698,
1500       698,  698,  698,  698,  698,  698,  698,  698,  698,  699,
1501       699,  699,  699,  699,  699,  699,  699,  699,  699,  699,
1502       699,  699,  699,  699,  699,  699,  699,  700,  105,  103,
1503       700,   99,   95,  700,  700,  700,  700,  700,  700,  700,
1504       700,  700,  701,  701,  701,   94,  701,  701,  701,  701,
1505       701,  701,  701,  701,  701,  701,  701,  701,  701,  702,
1506
1507       702,   93,   89,  702,   83,   56,   55,   47,   19,  702,
1508       702,  702,  702,   18,  702,  706,  706,  706,  706,  706,
1509       706,  706,  706,  706,  706,  706,  706,  706,  706,  706,
1510       706,  706,  706,  707,  707,  707,  707,  707,  707,  707,
1511       707,  707,  707,  707,  707,  707,  707,  707,  707,  707,
1512       707,  709,  709,  709,  709,  709,  709,  709,  709,  709,
1513       709,  709,  709,  709,  709,  709,  709,  709,  709,  710,
1514       710,  710,  710,  710,  710,  710,  710,  710,  710,  710,
1515       710,  710,  710,  710,  710,  710,  710,  711,  711,   15,
1516       711,  711,  711,  711,  711,  711,  711,  711,  711,  711,
1517
1518       711,  711,  711,  711,  711,  712,  712,   10,  712,  712,
1519       712,  712,  712,  712,  712,  712,  712,  712,  712,  712,
1520       712,  712,  712,  713,    3,    0,    0,  713,    0,  713,
1521       713,  713,    0,    0,  713,  714,  714,  714,  714,  714,
1522       714,  714,  714,  714,  714,  714,  714,  714,  714,  714,
1523       714,  714,  714,  715,  715,  715,  715,  715,  715,  715,
1524       715,  715,  715,  715,  715,  715,  715,  715,  715,  715,
1525       715,  716,  716,  716,  716,  716,  716,  716,  716,  716,
1526       716,  716,  716,  716,  716,  716,  716,  716,  716,  717,
1527       717,  717,  717,  717,  717,  717,  717,  717,  717,  717,
1528
1529       717,  717,  717,  717,  717,  717,  717,  718,  718,  718,
1530       718,  718,  718,  718,  720,    0,    0,    0,    0,  720,
1531         0,  720,  720,    0,  720,  721,  721,  721,  721,  721,
1532       721,  721,  721,  721,  721,  721,  721,  721,  721,  721,
1533       721,  721,  721,  722,  722,  722,  722,  722,  722,  722,
1534       722,  722,  722,  722,  722,  722,  722,  722,  722,  722,
1535       722,  723,  723,  723,  723,  723,  723,  723,  723,  723,
1536       723,  723,  723,  723,  723,  723,  723,  723,  723,  724,
1537       724,  724,  724,  724,  724,  724,  724,  724,  724,  724,
1538       724,  724,  724,  724,  724,  724,  724,  725,  725,    0,
1539
1540       725,  725,  725,  725,  725,  725,  725,  725,  725,  725,
1541       725,  725,  725,  725,  725,  726,  726,    0,  726,  726,
1542       726,  726,  726,  726,  726,  726,  726,  726,  726,  726,
1543       726,  726,  726,  727,    0,    0,    0,  727,    0,  727,
1544       727,  727,    0,    0,  727,  728,  728,    0,    0,  728,
1545         0,    0,  728,  728,  729,  729,  729,  729,  729,  729,
1546       729,  729,  729,  729,  729,  729,  729,  729,  729,  729,
1547       729,  729,  730,  730,  730,  730,  730,  730,  730,  730,
1548       730,  730,  730,  730,  730,  730,  730,  730,  730,  730,
1549       731,  731,  731,  731,  731,  731,  731,  731,  731,  731,
1550
1551       731,  731,  731,  731,  731,  731,  731,  731,  732,  732,
1552       732,  732,  732,  732,  732,  732,  732,  732,  732,  732,
1553       732,  732,  732,  732,  732,  732,  733,  733,  733,  733,
1554         0,  733,  733,    0,  733,  733,  733,  733,  733,  733,
1555       733,  734,  734,    0,    0,    0,    0,    0,  734,  734,
1556         0,  734,  735,  735,  735,  735,  735,  735,  735,  735,
1557       735,  735,  735,  735,  735,  735,  735,  735,  735,  735,
1558       736,  736,  736,  736,  736,  736,  736,  736,  736,  736,
1559       736,  736,  736,  736,  736,  736,  736,  736,  737,  737,
1560       737,  737,    0,  737,  737,  737,  737,  737,  737,  737,
1561
1562       737,  737,  737,  738,  738,    0,    0,  738,    0,    0,
1563       738,  738,  739,  739,    0,  739,  739,  739,  739,  739,
1564       739,  739,  739,  739,  739,  739,  739,  739,  739,  739,
1565       740,  740,    0,  740,  740,  740,  740,  740,  740,  740,
1566       740,  740,  740,  740,  740,  740,  740,  740,  741,  741,
1567         0,  741,  741,  741,  741,  741,  741,  741,  741,  741,
1568       741,  741,  741,  741,  741,  741,  742,  742,    0,  742,
1569       742,  742,  742,  742,  742,  742,  742,  742,  742,  742,
1570       742,  742,  742,  742,  743,  743,    0,  743,  743,  743,
1571       743,  743,  743,  743,  743,  743,  743,  743,  743,  743,
1572
1573       743,  743,  744,  744,    0,  744,  744,  744,  744,  744,
1574       744,  744,  744,  744,  744,  744,  744,  744,  744,  744,
1575       745,  745,    0,    0,  745,    0,    0,  745,  745,  745,
1576       745,  745,  745,  745,  746,  746,  746,  746,  746,  746,
1577       746,  746,  746,  746,  746,  746,  746,  746,  746,  746,
1578       746,  746,  747,  747,    0,    0,  747,    0,    0,  747,
1579       747,  748,  748,    0,  748,  748,  748,  748,  748,  748,
1580       748,  748,  748,  748,  748,  748,  748,  748,  748,  749,
1581       749,    0,  749,  749,  749,  749,  749,  749,  749,  749,
1582       749,  749,  749,  749,  749,  749,  749,  750,  750,    0,
1583
1584       750,  750,  750,  750,  750,  750,  750,  750,  750,  750,
1585       750,  750,  750,  750,  750,  751,  751,    0,  751,  751,
1586       751,  751,  751,  751,  751,  751,  751,  751,  751,  751,
1587       751,  751,  751,  752,  752,  752,  752,  752,  752,  752,
1588       752,  752,  752,  752,  752,  752,  752,  752,  752,  752,
1589       752,  753,  753,  753,  753,  753,  753,  753,  753,  753,
1590       753,  753,  753,  753,  753,  753,  753,  753,  753,  754,
1591       754,  754,  754,  754,  754,  754,  754,  754,  754,  754,
1592       754,  754,  754,  754,  754,  754,  754,  755,  755,  755,
1593       755,  755,  755,  755,  755,  755,  755,  755,  755,  755,
1594
1595       755,  755,  755,  755,  755,  693,  693,  693,  693,  693,
1596       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
1597       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
1598       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
1599       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
1600       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
1601       693,  693,  693,  693,  693,  693,  693,  693,  693,  693,
1602       693,  693,  693,  693,  693,  693,  693,  693,  693
1603     } ;
1604
1605 extern int yy_flex_debug;
1606 int yy_flex_debug = 0;
1607
1608 static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
1609 static char *yy_full_match;
1610 static int yy_lp;
1611 static int yy_looking_for_trail_begin = 0;
1612 static int yy_full_lp;
1613 static int *yy_full_state;
1614 #define YY_TRAILING_MASK 0x2000
1615 #define YY_TRAILING_HEAD_MASK 0x4000
1616 #define REJECT \
1617 { \
1618 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \
1619 yy_cp = (yy_full_match); /* restore poss. backed-over text */ \
1620 (yy_lp) = (yy_full_lp); /* restore orig. accepting pos. */ \
1621 (yy_state_ptr) = (yy_full_state); /* restore orig. state */ \
1622 yy_current_state = *(yy_state_ptr); /* restore curr. state */ \
1623 ++(yy_lp); \
1624 goto find_rule; \
1625 }
1626
1627 #define yymore() yymore_used_but_not_detected
1628 #define YY_MORE_ADJ 0
1629 #define YY_RESTORE_YY_MORE_OFFSET
1630 char *yytext;
1631 #line 1 "parser.l"
1632 #line 8 "parser.l"
1633 /*
1634  * parser.l -- lex parser of algebraic chess moves for XBoard
1635  *
1636  * Copyright 1991 by Digital Equipment Corporation, Maynard,
1637  * Massachusetts.
1638  *
1639  * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005,
1640  * 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
1641  *
1642  * The following terms apply to Digital Equipment Corporation's copyright
1643  * interest in XBoard:
1644  * ------------------------------------------------------------------------
1645  * All Rights Reserved
1646  *
1647  * Permission to use, copy, modify, and distribute this software and its
1648  * documentation for any purpose and without fee is hereby granted,
1649  * provided that the above copyright notice appear in all copies and that
1650  * both that copyright notice and this permission notice appear in
1651  * supporting documentation, and that the name of Digital not be
1652  * used in advertising or publicity pertaining to distribution of the
1653  * software without specific, written prior permission.
1654  *
1655  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
1656  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
1657  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
1658  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
1659  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
1660  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
1661  * SOFTWARE.
1662  * ------------------------------------------------------------------------
1663  *
1664  * The following terms apply to the enhanced version of XBoard
1665  * distributed by the Free Software Foundation:
1666  * ------------------------------------------------------------------------
1667  *
1668  * GNU XBoard is free software: you can redistribute it and/or modify
1669  * it under the terms of the GNU General Public License as published by
1670  * the Free Software Foundation, either version 3 of the License, or (at
1671  * your option) any later version.
1672  *
1673  * GNU XBoard is distributed in the hope that it will be useful, but
1674  * WITHOUT ANY WARRANTY; without even the implied warranty of
1675  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1676  * General Public License for more details.
1677  *
1678  * You should have received a copy of the GNU General Public License
1679  * along with this program. If not, see http://www.gnu.org/licenses/.  
1680  *
1681  *------------------------------------------------------------------------
1682  ** See the file ChangeLog for a revision history.  */
1683
1684 /* This parser handles all forms of promotion.
1685  * The parser resolves ambiguous moves by searching and check-testing.
1686  * It also parses comments of the form [anything] or (anything).
1687  *
1688  * [HGM] Parser extensively modified for bigger boards, Shogi-like syntax,
1689  * and unknow pieces. All pieces are now mandatory upper case, but can be
1690  * any letter A-Z. Files must be lower case (as before), but can run upto 'l'.
1691  * Ranks can be 0-9. The parser returns 0 for off-board files and ranks.
1692  * For an unknown piece (as mover or promotion piece) it returns
1693  * IllegalMove, like it does when the piece doesn't match.
1694  * Promotions can now also be appended Shogi-style, a bare '=' or '+',
1695  * and this is then returned as promotion character. The piece indicator
1696  * can be prefixed by a '+' to indicate it is a promoted piece.
1697  */
1698
1699 #include "config.h"
1700
1701 #define NO_CONSTRAINT   -1
1702 #undef YYLMAX
1703 #define YYLMAX                  4096
1704 #define UNPUT_BUF_SIZE          YYLMAX
1705
1706 #ifdef FLEX_SCANNER
1707 /* yytext is probably a char*, but could be a char[].  yy_text is set
1708    in YY_DECL below, because if yytext is a char*, its value is not
1709    constant. */
1710 char *yy_text;
1711 #else /*!FLEX_SCANNER*/
1712 /* yytext is definitely a char[], so yy_text can be set here, statically. */
1713 char *yy_text = (char *) yytext;
1714 #endif
1715
1716 #ifdef FLEX_SCANNER
1717 /* This is flex */
1718 /* [AP] use prototypes in function declarations */
1719 #define YY_USE_PROTOS
1720
1721 #ifdef YY_USE_PROTOS
1722 #define YY_PROTO(proto) proto
1723 #else
1724 #define YY_PROTO(proto) ()
1725 #endif
1726 /* end of [AP] fix */
1727
1728 #undef YY_INPUT
1729 #define YY_INPUT(buf, result, max_size) my_yy_input(buf, &result, max_size)
1730 #undef YY_DECL
1731 #define YY_DECL                     \
1732     int _yylex YY_PROTO((void));    \
1733     int yylex YY_PROTO((void))      \
1734     {                               \
1735         int result = _yylex();      \
1736         yy_text = (char *) yytext;  \
1737         return(result);             \
1738     }                               \
1739     int _yylex YY_PROTO((void))
1740 #else
1741 /* This is lex */
1742 #undef input
1743 #undef output
1744 #undef unput
1745 #endif
1746
1747 /* The includes must be here, below the #undef input */
1748
1749 #include <ctype.h>
1750
1751 #if STDC_HEADERS
1752 # include <stdlib.h>
1753 # include <string.h>
1754 #else /* not STDC_HEADERS */
1755 # if HAVE_STRING_H
1756 #  include <string.h>
1757 # else /* not HAVE_STRING_H */
1758 #  include <strings.h>
1759 # endif /* not HAVE_STRING_H */
1760 #endif /* not STDC_HEADERS */
1761
1762 #if HAVE_UNISTD_H
1763 # include <unistd.h>
1764 #endif
1765
1766 #if defined(_amigados)
1767 # include <errno.h>
1768 # if HAVE_FCNTL_H
1769 #  include <fcntl.h>    /*  isatty() prototype  */
1770 # endif /*  HAVE_FCNTL_H        */
1771 #endif  /*  defined(_amigados)  */
1772
1773 #include "common.h"
1774 #include "backend.h"
1775 #include "frontend.h"
1776 #include "parser.h"
1777 #include "moves.h"
1778
1779 extern int PosFlags P((int));
1780
1781 extern Board    boards[MAX_MOVES];
1782 int             yyboardindex;
1783 int             yyskipmoves = FALSE;
1784 char            currentMoveString[YYLMAX];
1785 #ifndef FLEX_SCANNER
1786 char            unputBuffer[UNPUT_BUF_SIZE];
1787 int             unputCount = 0;
1788 #endif
1789
1790 #ifdef FLEX_SCANNER
1791 void my_yy_input P((char *buf, int *result, int max_size));
1792 #else /*!FLEX_SCANNER*/
1793 static int input P((void));
1794 static void output P((int ch));
1795 static void unput P((int ch));
1796 int yylook P((void));
1797 int yyback P((int *, int));
1798 #endif
1799 #undef yywrap
1800 int yywrap P((void));
1801 extern void CopyBoard P((Board to, Board from));
1802
1803 #line 1804 "parser.c"
1804
1805 #define INITIAL 0
1806
1807 #ifndef YY_NO_UNISTD_H
1808 /* Special case for "unistd.h", since it is non-ANSI. We include it way
1809  * down here because we want the user's section 1 to have been scanned first.
1810  * The user has a chance to override it with an option.
1811  */
1812 #include <unistd.h>
1813 #endif
1814
1815 #ifndef YY_EXTRA_TYPE
1816 #define YY_EXTRA_TYPE void *
1817 #endif
1818
1819 static int yy_init_globals (void );
1820
1821 /* Accessor methods to globals.
1822    These are made visible to non-reentrant scanners for convenience. */
1823
1824 int yylex_destroy (void );
1825
1826 int yyget_debug (void );
1827
1828 void yyset_debug (int debug_flag  );
1829
1830 YY_EXTRA_TYPE yyget_extra (void );
1831
1832 void yyset_extra (YY_EXTRA_TYPE user_defined  );
1833
1834 FILE *yyget_in (void );
1835
1836 void yyset_in  (FILE * in_str  );
1837
1838 FILE *yyget_out (void );
1839
1840 void yyset_out  (FILE * out_str  );
1841
1842 int yyget_leng (void );
1843
1844 char *yyget_text (void );
1845
1846 int yyget_lineno (void );
1847
1848 void yyset_lineno (int line_number  );
1849
1850 /* Macros after this point can all be overridden by user definitions in
1851  * section 1.
1852  */
1853
1854 #ifndef YY_SKIP_YYWRAP
1855 #ifdef __cplusplus
1856 extern "C" int yywrap (void );
1857 #else
1858 extern int yywrap (void );
1859 #endif
1860 #endif
1861
1862     static void yyunput (int c,char *buf_ptr  );
1863     
1864 #ifndef yytext_ptr
1865 static void yy_flex_strncpy (char *,yyconst char *,int );
1866 #endif
1867
1868 #ifdef YY_NEED_STRLEN
1869 static int yy_flex_strlen (yyconst char * );
1870 #endif
1871
1872 #ifndef YY_NO_INPUT
1873
1874 #ifdef __cplusplus
1875 static int yyinput (void );
1876 #else
1877 static int input (void );
1878 #endif
1879
1880 #endif
1881
1882 /* Amount of stuff to slurp up with each read. */
1883 #ifndef YY_READ_BUF_SIZE
1884 #define YY_READ_BUF_SIZE 8192
1885 #endif
1886
1887 /* Copy whatever the last rule matched to the standard output. */
1888 #ifndef ECHO
1889 /* This used to be an fputs(), but since the string might contain NUL's,
1890  * we now use fwrite().
1891  */
1892 #define ECHO fwrite( yytext, yyleng, 1, yyout )
1893 #endif
1894
1895 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
1896  * is returned in "result".
1897  */
1898 #ifndef YY_INPUT
1899 #define YY_INPUT(buf,result,max_size) \
1900         if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1901                 { \
1902                 int c = '*'; \
1903                 int n; \
1904                 for ( n = 0; n < max_size && \
1905                              (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1906                         buf[n] = (char) c; \
1907                 if ( c == '\n' ) \
1908                         buf[n++] = (char) c; \
1909                 if ( c == EOF && ferror( yyin ) ) \
1910                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
1911                 result = n; \
1912                 } \
1913         else \
1914                 { \
1915                 errno=0; \
1916                 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
1917                         { \
1918                         if( errno != EINTR) \
1919                                 { \
1920                                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1921                                 break; \
1922                                 } \
1923                         errno=0; \
1924                         clearerr(yyin); \
1925                         } \
1926                 }\
1927 \
1928
1929 #endif
1930
1931 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1932  * we don't want an extra ';' after the "return" because that will cause
1933  * some compilers to complain about unreachable statements.
1934  */
1935 #ifndef yyterminate
1936 #define yyterminate() return YY_NULL
1937 #endif
1938
1939 /* Number of entries by which start-condition stack grows. */
1940 #ifndef YY_START_STACK_INCR
1941 #define YY_START_STACK_INCR 25
1942 #endif
1943
1944 /* Report a fatal error. */
1945 #ifndef YY_FATAL_ERROR
1946 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1947 #endif
1948
1949 /* end tables serialization structures and prototypes */
1950
1951 /* Default declaration of generated scanner - a define so the user can
1952  * easily add parameters.
1953  */
1954 #ifndef YY_DECL
1955 #define YY_DECL_IS_OURS 1
1956
1957 extern int yylex (void);
1958
1959 #define YY_DECL int yylex (void)
1960 #endif /* !YY_DECL */
1961
1962 /* Code executed at the beginning of each rule, after yytext and yyleng
1963  * have been set up.
1964  */
1965 #ifndef YY_USER_ACTION
1966 #define YY_USER_ACTION
1967 #endif
1968
1969 /* Code executed at the end of each rule. */
1970 #ifndef YY_BREAK
1971 #define YY_BREAK break;
1972 #endif
1973
1974 #define YY_RULE_SETUP \
1975         if ( yyleng > 0 ) \
1976                 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
1977                                 (yytext[yyleng - 1] == '\n'); \
1978         YY_USER_ACTION
1979
1980 /** The main scanner function which does all the work.
1981  */
1982 YY_DECL
1983 {
1984         register yy_state_type yy_current_state;
1985         register char *yy_cp, *yy_bp;
1986         register int yy_act;
1987     
1988 #line 179 "parser.l"
1989
1990
1991 #line 1992 "parser.c"
1992
1993         if ( !(yy_init) )
1994                 {
1995                 (yy_init) = 1;
1996
1997 #ifdef YY_USER_INIT
1998                 YY_USER_INIT;
1999 #endif
2000
2001         /* Create the reject buffer large enough to save one state per allowed character. */
2002         if ( ! (yy_state_buf) )
2003             (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE  );
2004             if ( ! (yy_state_buf) )
2005                 YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
2006
2007                 if ( ! (yy_start) )
2008                         (yy_start) = 1; /* first start state */
2009
2010                 if ( ! yyin )
2011                         yyin = stdin;
2012
2013                 if ( ! yyout )
2014                         yyout = stdout;
2015
2016                 if ( ! YY_CURRENT_BUFFER ) {
2017                         yyensure_buffer_stack ();
2018                         YY_CURRENT_BUFFER_LVALUE =
2019                                 yy_create_buffer(yyin,YY_BUF_SIZE );
2020                 }
2021
2022                 yy_load_buffer_state( );
2023                 }
2024
2025         while ( 1 )             /* loops until end-of-file is reached */
2026                 {
2027                 yy_cp = (yy_c_buf_p);
2028
2029                 /* Support of yytext. */
2030                 *yy_cp = (yy_hold_char);
2031
2032                 /* yy_bp points to the position in yy_ch_buf of the start of
2033                  * the current run.
2034                  */
2035                 yy_bp = yy_cp;
2036
2037                 yy_current_state = (yy_start);
2038                 yy_current_state += YY_AT_BOL();
2039
2040                 (yy_state_ptr) = (yy_state_buf);
2041                 *(yy_state_ptr)++ = yy_current_state;
2042
2043 yy_match:
2044                 do
2045                         {
2046                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
2047                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2048                                 {
2049                                 yy_current_state = (int) yy_def[yy_current_state];
2050                                 if ( yy_current_state >= 694 )
2051                                         yy_c = yy_meta[(unsigned int) yy_c];
2052                                 }
2053                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2054                         *(yy_state_ptr)++ = yy_current_state;
2055                         ++yy_cp;
2056                         }
2057                 while ( yy_base[yy_current_state] != 3806 );
2058
2059 yy_find_action:
2060                 yy_current_state = *--(yy_state_ptr);
2061                 (yy_lp) = yy_accept[yy_current_state];
2062 find_rule: /* we branch to this label when backing up */
2063                 for ( ; ; ) /* until we find what rule we matched */
2064                         {
2065                         if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] )
2066                                 {
2067                                 yy_act = yy_acclist[(yy_lp)];
2068                                 if ( yy_act & YY_TRAILING_HEAD_MASK ||
2069                                      (yy_looking_for_trail_begin) )
2070                                         {
2071                                         if ( yy_act == (yy_looking_for_trail_begin) )
2072                                                 {
2073                                                 (yy_looking_for_trail_begin) = 0;
2074                                                 yy_act &= ~YY_TRAILING_HEAD_MASK;
2075                                                 break;
2076                                                 }
2077                                         }
2078                                 else if ( yy_act & YY_TRAILING_MASK )
2079                                         {
2080                                         (yy_looking_for_trail_begin) = yy_act & ~YY_TRAILING_MASK;
2081                                         (yy_looking_for_trail_begin) |= YY_TRAILING_HEAD_MASK;
2082                                         }
2083                                 else
2084                                         {
2085                                         (yy_full_match) = yy_cp;
2086                                         (yy_full_state) = (yy_state_ptr);
2087                                         (yy_full_lp) = (yy_lp);
2088                                         break;
2089                                         }
2090                                 ++(yy_lp);
2091                                 goto find_rule;
2092                                 }
2093                         --yy_cp;
2094                         yy_current_state = *--(yy_state_ptr);
2095                         (yy_lp) = yy_accept[yy_current_state];
2096                         }
2097
2098                 YY_DO_BEFORE_ACTION;
2099
2100 do_action:      /* This label is used only to access EOF actions. */
2101
2102                 switch ( yy_act )
2103         { /* beginning of action switch */
2104 case 1:
2105 YY_RULE_SETUP
2106 #line 181 "parser.l"
2107 {
2108     /*
2109      * Fully-qualified algebraic move, possibly with promotion
2110      */
2111     int skip1 = 0, skip2 = 0, skip3 = 0, promoted = 0;
2112     ChessSquare piece;
2113     ChessMove result;
2114     char c;
2115     
2116     if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */
2117
2118     if (yytext[0] == '+') skip1 = skip3 = promoted = 1; /* [HGM] Shogi promoted */
2119
2120     /* remove the / */
2121     if (yytext[1+skip1] == '/')  skip1++; 
2122     
2123     /* remove the [xX:-] */
2124     if ((yytext[3+skip1] == 'x') || (yytext[3+skip1] == 'X') ||
2125         (yytext[3+skip1] == '-') || (yytext[3+skip1] == ':')) skip2 = 1;
2126     
2127     currentMoveString[0] = yytext[1+skip1];
2128     currentMoveString[1] = yytext[2+skip1];
2129     currentMoveString[2] = yytext[3+skip1+skip2];
2130     currentMoveString[3] = yytext[4+skip1+skip2];
2131     currentMoveString[4] = NULLCHAR;
2132     
2133     if (appData.debugMode) {
2134         fprintf(debugFP, "Parser Qa1b2: yyleng=%d\n",
2135         yyleng);
2136     }
2137
2138     if (yyleng-skip1-skip2 > 5) { char c;
2139         if (yytext[yyleng-1] == ')') {
2140             c = currentMoveString[4] = ToLower(yytext[yyleng-2]);
2141         } else {
2142             c = currentMoveString[4] = ToLower(yytext[yyleng-1]);
2143         }
2144         if(c == '+' && gameInfo.variant != VariantShogi) c = currentMoveString[4] = NULLCHAR; // + means check outside Shogi
2145         currentMoveString[5] = NULLCHAR;
2146     }
2147
2148     if (appData.debugMode) {
2149         fprintf(debugFP, "parser: %s\n", currentMoveString);
2150     }
2151     /* [HGM] do not allow values beyond board size */
2152     if(currentMoveString[1] - ONE >= BOARD_HEIGHT ||
2153        currentMoveString[1] - ONE <  0            ||
2154        currentMoveString[0] - AAA >= BOARD_RGHT   ||
2155        currentMoveString[3] - ONE >= BOARD_HEIGHT ||
2156        currentMoveString[3] - ONE <  0            ||
2157        currentMoveString[2] - AAA >= BOARD_RGHT   ||
2158        currentMoveString[0] - AAA <  BOARD_LEFT   ||
2159        currentMoveString[2] - AAA <  BOARD_LEFT     )
2160       return ImpossibleMove;
2161
2162     piece = boards[yyboardindex]
2163       [currentMoveString[1] - ONE][currentMoveString[0] - AAA];
2164     if(PieceToChar(piece) == '+' && appData.icsActive) promoted = 1, yytext[skip3] = PieceToChar(DEMOTED piece); // trust ICS
2165     if(promoted) piece = (ChessSquare) (DEMOTED piece);
2166     c = PieceToChar(piece);
2167     if(c == '~') c = PieceToChar((ChessSquare) (DEMOTED piece));
2168     if (ToLower(yytext[skip3]) != ToLower(c))
2169       return (int) IllegalMove;
2170
2171     result = LegalityTest(boards[yyboardindex],
2172                           PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.!
2173                           currentMoveString[1] - ONE,
2174                           currentMoveString[0] - AAA,
2175                           currentMoveString[3] - ONE,
2176                           currentMoveString[2] - AAA,
2177                           currentMoveString[4]);
2178
2179     if (currentMoveString[4] == NULLCHAR) {
2180       if(result == WhitePromotion  || result == BlackPromotion) {
2181         if(gameInfo.variant == VariantCourier || gameInfo.variant == VariantShatranj)
2182             currentMoveString[4] = PieceToChar(BlackFerz);
2183         else if(gameInfo.variant == VariantGreat)
2184             currentMoveString[4] = PieceToChar(BlackMan);
2185         else if(gameInfo.variant == VariantShogi)
2186             currentMoveString[4] = '+';
2187         else
2188             currentMoveString[4] = PieceToChar(BlackQueen);
2189       } else if(result == WhiteNonPromotion  || result == BlackNonPromotion)
2190             currentMoveString[4] = '=';
2191       currentMoveString[5] = NULLCHAR;
2192     }
2193
2194     return (int) result;
2195 }
2196         YY_BREAK
2197 case 2:
2198 YY_RULE_SETUP
2199 #line 271 "parser.l"
2200 {
2201     /*
2202      * Simple algebraic move, possibly with promotion
2203      * [HGM] Engine moves are received in this format, with lower-case promoChar!
2204      */
2205     int skip = 0;
2206     ChessMove result;
2207
2208     if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */
2209
2210     /* remove the [xX:-] */
2211     if ((yytext[2] == 'x') || (yytext[2] == 'X') ||
2212         (yytext[2] == '-') || (yytext[2] == ':')) skip = 1;
2213
2214     currentMoveString[0] = yytext[0];
2215     currentMoveString[1] = yytext[1];
2216     currentMoveString[2] = yytext[2+skip];
2217     currentMoveString[3] = yytext[3+skip];
2218     currentMoveString[4] = NULLCHAR;
2219
2220     if (yyleng-skip > 4) { char c;
2221         if (yytext[yyleng-1] == ')') {
2222             c = currentMoveString[4] = ToLower(yytext[yyleng-2]);
2223         } else {
2224             c = currentMoveString[4] = ToLower(yytext[yyleng-1]);
2225         }
2226         if(c == '+' && gameInfo.variant != VariantShogi) currentMoveString[4] = NULLCHAR; // + means check outside Shogi
2227         currentMoveString[5] = NULLCHAR;
2228     }
2229
2230     /* [HGM] do not allow values beyond board size */
2231     if(currentMoveString[1] - ONE >= BOARD_HEIGHT ||
2232        currentMoveString[1] - ONE <  0            ||
2233        currentMoveString[0] - AAA >= BOARD_RGHT   ||
2234        currentMoveString[3] - ONE >= BOARD_HEIGHT ||
2235        currentMoveString[3] - ONE <  0            ||
2236        currentMoveString[2] - AAA >= BOARD_RGHT   ||
2237        currentMoveString[0] - AAA <  BOARD_LEFT   ||
2238        currentMoveString[2] - AAA <  BOARD_LEFT     )
2239       return ImpossibleMove;
2240
2241     result = LegalityTest(boards[yyboardindex],
2242                           PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.!
2243                           currentMoveString[1] - ONE,
2244                           currentMoveString[0] - AAA,
2245                           currentMoveString[3] - ONE,
2246                           currentMoveString[2] - AAA,
2247                           currentMoveString[4]);
2248
2249     if (currentMoveString[4] == NULLCHAR) {
2250       if(result == WhitePromotion  || result == BlackPromotion) {
2251         if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || gameInfo.variant == VariantMakruk)
2252             currentMoveString[4] = PieceToChar(BlackFerz);
2253         else if(gameInfo.variant == VariantGreat)
2254             currentMoveString[4] = PieceToChar(BlackMan);
2255         else if(gameInfo.variant == VariantShogi)
2256             currentMoveString[4] = '+'; // Queen might not be defined in mini variants!
2257         else
2258             currentMoveString[4] = PieceToChar(BlackQueen);
2259       } else if(result == WhiteNonPromotion  || result == BlackNonPromotion)
2260             currentMoveString[4] = '=';
2261       currentMoveString[5] = NULLCHAR;
2262     } else if(appData.testLegality && gameInfo.variant != VariantSChess && // strip off unnecessary and false promo characters
2263        !(result == WhitePromotion  || result == BlackPromotion ||
2264          result == WhiteNonPromotion || result == BlackNonPromotion)) currentMoveString[4] = NULLCHAR;
2265
2266     return (int) result;
2267 }
2268         YY_BREAK
2269 case 3:
2270 YY_RULE_SETUP
2271 #line 340 "parser.l"
2272 {
2273     /*
2274      * Simple algebraic move, in capitals
2275      * [HGM] Some Xiangqi engines use this format ('ICCS notation'). So no promotions!
2276      */
2277     int skip = 0;
2278     ChessMove result;
2279
2280     if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */
2281
2282     /* remove the [xX:-] */
2283     if ((yytext[2] == 'x') || (yytext[2] == 'X') ||
2284         (yytext[2] == '-') || (yytext[2] == ':')) skip = 1;
2285
2286     currentMoveString[0] = yytext[0]+32;
2287     currentMoveString[1] = yytext[1];
2288     currentMoveString[2] = yytext[2+skip]+32;
2289     currentMoveString[3] = yytext[3+skip];
2290     currentMoveString[4] = NULLCHAR;
2291
2292     /* [HGM] do not allow values beyond board size */
2293     if(currentMoveString[1] - ONE >= BOARD_HEIGHT ||
2294        currentMoveString[1] - ONE <  0            ||
2295        currentMoveString[0] - AAA >= BOARD_RGHT   ||
2296        currentMoveString[3] - ONE >= BOARD_HEIGHT ||
2297        currentMoveString[3] - ONE <  0            ||
2298        currentMoveString[2] - AAA >= BOARD_RGHT   ||
2299        currentMoveString[0] - AAA <  BOARD_LEFT   ||
2300        currentMoveString[2] - AAA <  BOARD_LEFT     )
2301       return ImpossibleMove;
2302
2303     result = LegalityTest(boards[yyboardindex],
2304                           PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.!
2305                           currentMoveString[1] - ONE,
2306                           currentMoveString[0] - AAA,
2307                           currentMoveString[3] - ONE,
2308                           currentMoveString[2] - AAA,
2309                           currentMoveString[4]);
2310
2311     return (int) result;
2312 }
2313         YY_BREAK
2314 case 4:
2315 YY_RULE_SETUP
2316 #line 382 "parser.l"
2317 {
2318     /*
2319      * Pawn move, possibly with promotion
2320      */
2321     DisambiguateClosure cl;
2322     int skip = 0;
2323
2324     if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */
2325
2326     /* remove the =() */
2327     if (yytext[2] == '=' && yytext[3] != NULLCHAR) skip++;
2328     if (yytext[2+skip] == '(') skip++;
2329
2330     cl.pieceIn = WhiteOnMove(yyboardindex) ? WhitePawn : BlackPawn;
2331     cl.rfIn = -1;
2332     cl.ffIn = yytext[0] - AAA;
2333     cl.rtIn = yytext[1] - ONE;
2334     cl.ftIn = yytext[0] - AAA;
2335     cl.promoCharIn = ToLower(yytext[2+skip]);
2336     if(cl.promoCharIn == '+' && gameInfo.variant != VariantShogi) cl.promoCharIn = NULLCHAR; // + means check outside Shogi
2337
2338     /* [HGM] do not allow values beyond board size */
2339     if(cl.rtIn >= BOARD_HEIGHT ||
2340        cl.rtIn <  0            ||
2341        cl.ffIn >= BOARD_RGHT   ||
2342        cl.ftIn <  BOARD_LEFT     )
2343       return ImpossibleMove;
2344
2345     Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl);
2346
2347     currentMoveString[0] = cl.ff + AAA;
2348     currentMoveString[1] = cl.rf + ONE;
2349     currentMoveString[2] = cl.ft + AAA;
2350     currentMoveString[3] = cl.rt + ONE;
2351     currentMoveString[4] = cl.promoChar;
2352     currentMoveString[5] = NULLCHAR;
2353
2354     return (int) cl.kind;
2355 }
2356         YY_BREAK
2357 case 5:
2358 YY_RULE_SETUP
2359 #line 423 "parser.l"
2360 {
2361     /*
2362      * Pawn capture, possibly with promotion, possibly ambiguous
2363      */
2364     DisambiguateClosure cl;
2365     int skip1 = 0, skip2 = 0;
2366
2367     if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */
2368
2369     /* remove trailing ep or e.p. (nonstandard PGN) */
2370     if (yytext[yyleng-1] == 'p') {
2371       yyleng -= 2;
2372       yytext[yyleng] = NULLCHAR;
2373     } else if (yytext[yyleng-1] == '.') {
2374       yyleng -= 4;
2375       yytext[yyleng] = NULLCHAR;
2376     }
2377
2378     /* remove the [xX:-] and =() */
2379     if ((yytext[1] == 'x') || (yytext[1] == 'X')
2380         || (yytext[1] == ':') || (yytext[1] == '-')) skip1 = 1;
2381     if (yytext[2+skip1] == '=' && yytext[3+skip1] != NULLCHAR) skip2++;
2382     if (yytext[2+skip1+skip2] == '(') skip2++;
2383
2384     cl.pieceIn = WhiteOnMove(yyboardindex) ? WhitePawn : BlackPawn;
2385     cl.rfIn = -1;
2386     cl.ffIn = yytext[0] - AAA;
2387     cl.rtIn = -1;
2388     cl.ftIn = yytext[1+skip1] - AAA;
2389     cl.promoCharIn = yytext[2+skip1+skip2];
2390     if(cl.promoCharIn == '+' && gameInfo.variant != VariantShogi) cl.promoCharIn = NULLCHAR; // + means check outside Shogi
2391
2392     /* [HGM] do not allow values beyond board size */
2393     if(cl.ffIn >= BOARD_RGHT  ||
2394        cl.ffIn <  BOARD_LEFT  ||
2395        cl.ftIn >= BOARD_RGHT  ||
2396        cl.ftIn <  BOARD_LEFT     )
2397       return ImpossibleMove;
2398
2399     Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl);
2400
2401     currentMoveString[0] = cl.ff + AAA;
2402     currentMoveString[1] = cl.rf + ONE;
2403     currentMoveString[2] = cl.ft + AAA;
2404     currentMoveString[3] = cl.rt + ONE;
2405     currentMoveString[4] = cl.promoChar;
2406     currentMoveString[5] = NULLCHAR;
2407
2408     return (int) cl.kind;
2409 }
2410         YY_BREAK
2411 case 6:
2412 YY_RULE_SETUP
2413 #line 474 "parser.l"
2414 {
2415     /*
2416      * unambiguously abbreviated Pawn capture, possibly with promotion
2417      */
2418     int skip = 0;
2419     ChessMove result; char c;
2420
2421     if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */
2422
2423     /* remove trailing ep or e.p. (nonstandard PGN) */
2424     if (yytext[yyleng-1] == 'p') {
2425       yyleng -= 2;
2426       yytext[yyleng] = NULLCHAR;
2427     } else if (yytext[yyleng-1] == '.') {
2428       yyleng -= 4;
2429       yytext[yyleng] = NULLCHAR;
2430     }
2431
2432     /* remove the [xX:-] */
2433     if ((yytext[1] == 'x') || (yytext[1] == 'X')
2434         || (yytext[1] == ':') || (yytext[1] == '-')) skip = 1;
2435
2436     currentMoveString[0] = yytext[0];
2437     currentMoveString[2] = yytext[1+skip];
2438     currentMoveString[3] = yytext[2+skip];
2439
2440     /* [HGM] do not allow values beyond board size */
2441     if(currentMoveString[0] - AAA >= BOARD_RGHT   ||
2442        currentMoveString[3] - ONE >= BOARD_HEIGHT ||
2443        currentMoveString[3] - ONE <  0            ||
2444        currentMoveString[2] - AAA >= BOARD_RGHT   ||
2445        currentMoveString[0] - AAA <  BOARD_LEFT   ||
2446        currentMoveString[2] - AAA <  BOARD_LEFT     )
2447       return ImpossibleMove;
2448
2449     if (gameInfo.variant == VariantXiangqi && /* [HGM] In Xiangqi rank stays same */
2450          currentMoveString[0] != currentMoveString[2] ) {
2451         currentMoveString[1] = yytext[2+skip];
2452     } else 
2453     if (WhiteOnMove(yyboardindex)) {
2454         if (yytext[2+skip] == ONE) return (int) ImpossibleMove;
2455         currentMoveString[1] = yytext[2+skip] - 1;
2456         if(boards[yyboardindex][currentMoveString[1]-ONE][currentMoveString[0]-AAA] != WhitePawn) 
2457                 return ImpossibleMove;
2458     } else {
2459         currentMoveString[1] = currentMoveString[3] + 1;
2460         if (currentMoveString[3] == ONE+BOARD_HEIGHT-1) return (int) ImpossibleMove;
2461         if(boards[yyboardindex][currentMoveString[1]-ONE][currentMoveString[0]-AAA] != BlackPawn) 
2462                 return ImpossibleMove;
2463     }
2464     if (yyleng-skip > 3) {
2465         if (yytext[yyleng-1] == ')')
2466           c = currentMoveString[4] = ToLower(yytext[yyleng-2]);
2467         else
2468           c = currentMoveString[4] = ToLower(yytext[yyleng-1]);
2469         currentMoveString[5] = NULLCHAR;
2470         if(c == '+' && gameInfo.variant != VariantShogi) c = currentMoveString[4] = NULLCHAR; // + means check outside Shogi
2471     } else {
2472         currentMoveString[4] = NULLCHAR;
2473     }
2474
2475     result = LegalityTest(boards[yyboardindex],
2476                           PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.!
2477                           currentMoveString[1] - ONE,
2478                           currentMoveString[0] - AAA,
2479                           currentMoveString[3] - ONE,
2480                           currentMoveString[2] - AAA,
2481                           currentMoveString[4]);
2482
2483     if (currentMoveString[4] == NULLCHAR) {
2484       if(result == WhitePromotion  || result == BlackPromotion) {
2485         currentMoveString[4] = PieceToChar(BlackQueen);
2486         // [HGM] shatranj: take care of variants without Queen
2487         if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || gameInfo.variant == VariantMakruk)
2488             currentMoveString[4] = PieceToChar(BlackFerz);
2489         if(gameInfo.variant == VariantGreat)
2490             currentMoveString[4] = PieceToChar(BlackMan);
2491         if(gameInfo.variant == VariantShogi)
2492             currentMoveString[4] = '+';
2493       } else if(result == WhiteNonPromotion  || result == BlackNonPromotion)
2494             currentMoveString[4] = '=';
2495       currentMoveString[5] = NULLCHAR;
2496     }
2497
2498     if (result != IllegalMove) return (int) result;
2499
2500     /* Special case: improperly written en passant capture */
2501     if (WhiteOnMove(yyboardindex)) {
2502         if (currentMoveString[3] == '5') {
2503             currentMoveString[1] = '5';
2504             currentMoveString[3] = '6';
2505         } else {
2506             return (int) IllegalMove;
2507         }
2508     } else {
2509         if (currentMoveString[3] == '4') {
2510             currentMoveString[1] = '4';
2511             currentMoveString[3] = '3';
2512         } else {
2513             return (int) IllegalMove;
2514         }
2515     }
2516
2517     result = LegalityTest(boards[yyboardindex],
2518                           PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: might think we can e.p.!
2519                           currentMoveString[1] - ONE,
2520                           currentMoveString[0] - AAA,
2521                           currentMoveString[3] - ONE,
2522                           currentMoveString[2] - AAA,
2523                           currentMoveString[4]);
2524
2525     if (result == WhiteCapturesEnPassant || result == BlackCapturesEnPassant)
2526       return (int) result;
2527     else { // [HGM] all very nice, but this messed up the input move that we might want to accept with legality testing off...
2528       if (WhiteOnMove(yyboardindex)) // undo the damage
2529              currentMoveString[1]--,  currentMoveString[3]--;
2530         else currentMoveString[1]++,  currentMoveString[3]++;
2531       return (int) IllegalMove;
2532     }
2533 }
2534         YY_BREAK
2535 case 7:
2536 YY_RULE_SETUP
2537 #line 595 "parser.l"
2538 {
2539     /*
2540      * piece move, possibly ambiguous
2541      */
2542     DisambiguateClosure cl;
2543     int skip = 0, skip2 = 0, promoted = 0;
2544
2545     if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */
2546
2547     if(yytext[0] == '+') promoted = skip = skip2 = 1;
2548
2549     /* remove the [xX:-] */
2550     if ((yytext[1+skip] == 'x') || (yytext[1+skip] == 'X')
2551         || (yytext[1+skip] == ':') || (yytext[1+skip] == '-')) skip++;
2552
2553     if (WhiteOnMove(yyboardindex)) {
2554         cl.pieceIn = CharToPiece(ToUpper(yytext[skip2]));
2555     } else {
2556         cl.pieceIn = CharToPiece(ToLower(yytext[skip2]));
2557     }
2558     if(promoted) cl.pieceIn = (ChessSquare) (PROMOTED cl.pieceIn);
2559
2560     cl.rfIn = -1;
2561     cl.ffIn = -1;
2562     cl.rtIn = yytext[2+skip] - ONE;
2563     cl.ftIn = yytext[1+skip] - AAA;
2564     cl.promoCharIn = NULLCHAR;
2565
2566     if(yyleng-skip > 3) /* [HGM] in some variants pieces promote */
2567         cl.promoCharIn = yytext[yyleng-1-(yytext[yyleng-1]==')')];
2568     if(cl.promoCharIn == '+' && gameInfo.variant != VariantShogi) cl.promoCharIn = NULLCHAR; // + means check outside Shogi
2569
2570     if (appData.debugMode) {
2571         fprintf(debugFP, "Parser Qa1: yyleng=%d,  %d(%d,%d)-(%d,%d) = %d (%c)\n",
2572         yyleng,
2573         cl.pieceIn,cl.ffIn,cl.rfIn,cl.ftIn,cl.rtIn,cl.promoCharIn,cl.promoCharIn?cl.promoCharIn:' ');
2574     }
2575
2576     /* [HGM] but do not allow values beyond board size */
2577     if(cl.rtIn >= BOARD_HEIGHT ||
2578        cl.rtIn <  0            ||
2579        cl.ftIn >= BOARD_RGHT   ||
2580        cl.ftIn <  BOARD_LEFT     )
2581       return ImpossibleMove;
2582
2583     Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl);
2584
2585     currentMoveString[0] = cl.ff + AAA;
2586     currentMoveString[1] = cl.rf + ONE;
2587     currentMoveString[2] = cl.ft + AAA;
2588     currentMoveString[3] = cl.rt + ONE;
2589     currentMoveString[4] = cl.promoChar;
2590     currentMoveString[5] = NULLCHAR;
2591
2592     return (int) cl.kind;
2593 }
2594         YY_BREAK
2595 case 8:
2596 YY_RULE_SETUP
2597 #line 652 "parser.l"
2598 {
2599     /*
2600      * piece move with rank or file disambiguator
2601      */
2602     DisambiguateClosure cl;
2603     int skip = 0, skip2 = 0; int promoted=0;
2604
2605     if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */
2606
2607     if(yytext[0]=='+') promoted = skip = skip2 = 1;
2608
2609     /* remove the [xX:-] */
2610     if ((yytext[2+skip] == 'x') || (yytext[2+skip] == 'X')
2611         || (yytext[2+skip] == ':') || (yytext[2+skip] == '-')) skip++;
2612
2613     if (WhiteOnMove(yyboardindex)) {
2614         cl.pieceIn = CharToPiece(ToUpper(yytext[skip2]));
2615     } else {
2616         cl.pieceIn = CharToPiece(ToLower(yytext[skip2]));
2617     }
2618     if(promoted) cl.pieceIn = (ChessSquare) (PROMOTED cl.pieceIn);
2619
2620     if (isalpha(yytext[1+skip2])) {
2621         cl.rfIn = -1;
2622         cl.ffIn = yytext[1+skip2] - AAA;
2623        
2624         if(cl.ffIn >= BOARD_RGHT ||
2625            cl.ffIn <  BOARD_LEFT   ) return 0;
2626     } else {
2627         cl.rfIn = yytext[1+skip2] - ONE;
2628         cl.ffIn = -1;
2629         if(cl.rfIn >= BOARD_HEIGHT ||
2630            cl.rfIn <  0) return 0;
2631     }
2632     cl.rtIn = yytext[3+skip] - ONE;
2633     cl.ftIn = yytext[2+skip] - AAA;
2634     cl.promoCharIn = NULLCHAR;
2635
2636     if(yyleng-skip > 4) /* [HGM] in some variants pieces promote */
2637         cl.promoCharIn = yytext[yyleng-1-(yytext[yyleng-1]==')')];
2638     if(cl.promoCharIn == '+' && gameInfo.variant != VariantShogi) cl.promoCharIn = NULLCHAR; // + means check outside Shogi
2639
2640     /* [HGM] do not allow values beyond board size */
2641     if(cl.rtIn >= BOARD_HEIGHT ||
2642        cl.rtIn <  0            ||
2643        cl.ftIn >= BOARD_RGHT   ||
2644        cl.ftIn <  BOARD_LEFT     )
2645       return ImpossibleMove;
2646
2647     Disambiguate(boards[yyboardindex], PosFlags(yyboardindex), &cl);
2648
2649     currentMoveString[0] = cl.ff + AAA;
2650     currentMoveString[1] = cl.rf + ONE;
2651     currentMoveString[2] = cl.ft + AAA;
2652     currentMoveString[3] = cl.rt + ONE;
2653     currentMoveString[4] = cl.promoChar;
2654     currentMoveString[5] = NULLCHAR;
2655
2656     return (int) cl.kind;
2657 }
2658         YY_BREAK
2659 case 9:
2660 YY_RULE_SETUP
2661 #line 713 "parser.l"
2662 {
2663     int rf, ff, rt, ft;
2664
2665     if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */
2666
2667     /* [HGM] all squares referenced to board edges in stead of absolute */
2668     if (WhiteOnMove(yyboardindex)) {
2669         if (boards[yyboardindex][0][(BOARD_WIDTH-1)>>1] == WhiteKing) {
2670             /* ICS wild castling */
2671             rf = 0;
2672             ff = (BOARD_WIDTH-1)>>1;
2673             rt = 0;
2674             ft = BOARD_RGHT-3;
2675         } else {
2676             rf = 0;
2677             ff = BOARD_WIDTH>>1;
2678             rt = 0;
2679             ft = BOARD_LEFT+2;
2680         }
2681     } else{ 
2682         if (boards[yyboardindex][BOARD_HEIGHT-1][(BOARD_WIDTH-1)>>1] == BlackKing) {
2683             /* ICS wild castling */
2684             rf = BOARD_HEIGHT-1;
2685             ff = (BOARD_WIDTH-1)>>1;
2686             rt = BOARD_HEIGHT-1;
2687             ft = BOARD_RGHT-3;
2688         } else {
2689             rf = BOARD_HEIGHT-1;
2690             ff = BOARD_WIDTH>>1;
2691             rt = BOARD_HEIGHT-1;
2692             ft = BOARD_LEFT+2;
2693         }
2694     }
2695     if(PosFlags(0) & F_FRC_TYPE_CASTLING) {
2696
2697         if (WhiteOnMove(yyboardindex)) {
2698             ff = initialRights[2];
2699             ft = initialRights[1];
2700         } else {
2701             ff = initialRights[5];
2702             ft = initialRights[4];
2703         }
2704         if (appData.debugMode) 
2705         {
2706           fprintf(debugFP, "Parser FRC long %d %d\n", ff, ft);
2707         };
2708         if(ff < 0 || ft < 0) return 0;
2709     }
2710     sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE);
2711     if (appData.debugMode) {
2712         fprintf(debugFP, "long castling %d %d\n", ff, ft);
2713     }
2714     return (int) LegalityTest(boards[yyboardindex],
2715                               PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: e.p.!
2716                               rf, ff, rt, ft, NULLCHAR);
2717 }
2718         YY_BREAK
2719 case 10:
2720 YY_RULE_SETUP
2721 #line 770 "parser.l"
2722 {
2723     int rf, ff, rt, ft;
2724
2725     if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */
2726
2727     if (WhiteOnMove(yyboardindex)) {
2728         if (boards[yyboardindex][0][(BOARD_WIDTH-1)>>1] == WhiteKing) {
2729             /* ICS wild castling */
2730             rf = 0;
2731             ff = (BOARD_WIDTH-1)>>1;
2732             rt = 0;
2733             ft = BOARD_LEFT+1;
2734         } else {
2735             rf = 0;
2736             ff = BOARD_WIDTH>>1;
2737             rt = 0;
2738             ft = BOARD_RGHT-2;
2739         }
2740     } else {
2741         if (boards[yyboardindex][BOARD_HEIGHT-1][(BOARD_WIDTH-1)>>1] == BlackKing) {
2742             /* ICS wild castling */
2743             rf = BOARD_HEIGHT-1;
2744             ff = (BOARD_WIDTH-1)>>1;
2745             rt = BOARD_HEIGHT-1;
2746             ft = BOARD_LEFT+1;
2747         } else {
2748             rf = BOARD_HEIGHT-1;
2749             ff = BOARD_WIDTH>>1;
2750             rt = BOARD_HEIGHT-1;
2751             ft = BOARD_RGHT-2;
2752         }
2753     }
2754     if(PosFlags(0) & F_FRC_TYPE_CASTLING) {
2755         if (WhiteOnMove(yyboardindex)) {
2756             ff = initialRights[2];
2757             ft = initialRights[0];
2758         } else {
2759             ff = initialRights[5];
2760             ft = initialRights[3];
2761         }
2762     if (appData.debugMode) {
2763         fprintf(debugFP, "Parser FRC short %d %d\n", ff, ft);
2764     }
2765         if(ff < 0 || ft < 0) return 0;
2766     }
2767     sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE);
2768     if (appData.debugMode) {
2769         fprintf(debugFP, "short castling %d %d\n", ff, ft);
2770     }
2771
2772     return (int) LegalityTest(boards[yyboardindex],
2773                               PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: e.p.!
2774                               rf, ff, rt, ft, NULLCHAR);
2775 }
2776         YY_BREAK
2777 case 11:
2778 YY_RULE_SETUP
2779 #line 825 "parser.l"
2780 {
2781
2782     if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */
2783
2784     /* Bughouse piece drop. */
2785     currentMoveString[1] = '@';
2786     currentMoveString[2] = yytext[2];
2787     currentMoveString[3] = yytext[3];
2788     currentMoveString[4] = NULLCHAR;
2789
2790     if (appData.debugMode) {
2791         fprintf(debugFP, "Drop: %s\n", currentMoveString);
2792     }
2793     /* [HGM] do not allow values beyond board size */
2794     if(currentMoveString[3] - ONE >= BOARD_HEIGHT ||
2795        currentMoveString[2] - AAA >= BOARD_WIDTH     )
2796       return ImpossibleMove;
2797
2798     if (WhiteOnMove(yyboardindex)) {
2799         currentMoveString[0] = ToUpper(yytext[0]);
2800     } else {
2801         currentMoveString[0] = ToLower(yytext[0]);
2802     }
2803     if(CharToPiece(currentMoveString[0]) == EmptySquare) return ImpossibleMove; // Unknown piece;
2804
2805     return LegalityTest(boards[yyboardindex], PosFlags(yyboardindex), DROP_RANK, // [HGM] does drops now too
2806                         CharToPiece(currentMoveString[0]), currentMoveString[3] - ONE, currentMoveString[2] - AAA, NULLCHAR);
2807 }
2808         YY_BREAK
2809 case 12:
2810 YY_RULE_SETUP
2811 #line 854 "parser.l"
2812 {
2813     if (WhiteOnMove(yyboardindex))
2814       return (int) BlackWins;
2815     else
2816       return (int) WhiteWins;
2817 }
2818         YY_BREAK
2819 case 13:
2820 YY_RULE_SETUP
2821 #line 861 "parser.l"
2822 {
2823     return (int) (ToUpper(yytext[0]) == 'W' ? BlackWins : WhiteWins);
2824 }
2825         YY_BREAK
2826 case 14:
2827 YY_RULE_SETUP
2828 #line 865 "parser.l"
2829 {
2830     return (int) GameUnfinished;
2831 }
2832         YY_BREAK
2833 case 15:
2834 YY_RULE_SETUP
2835 #line 869 "parser.l"
2836 {
2837     return (int) GameIsDrawn;
2838 }
2839         YY_BREAK
2840 case 16:
2841 YY_RULE_SETUP
2842 #line 873 "parser.l"
2843 {
2844     return (int) GameIsDrawn;
2845 }
2846         YY_BREAK
2847 case 17:
2848 YY_RULE_SETUP
2849 #line 877 "parser.l"
2850 {
2851     if (WhiteOnMove(yyboardindex))
2852       return (int) BlackWins;
2853     else
2854       return (int) WhiteWins;
2855 }
2856         YY_BREAK
2857 case 18:
2858 YY_RULE_SETUP
2859 #line 884 "parser.l"
2860 {
2861     if (WhiteOnMove(yyboardindex))
2862       return (int) BlackWins;
2863     else
2864       return (int) WhiteWins;
2865 }
2866         YY_BREAK
2867 case 19:
2868 YY_RULE_SETUP
2869 #line 891 "parser.l"
2870 {
2871     return (int) GameIsDrawn;
2872 }
2873         YY_BREAK
2874 case 20:
2875 YY_RULE_SETUP
2876 #line 895 "parser.l"
2877 {
2878     return (int) GameIsDrawn;
2879 }
2880         YY_BREAK
2881 case 21:
2882 YY_RULE_SETUP
2883 #line 899 "parser.l"
2884
2885     return (int) (ToUpper(yytext[0]) == 'W' ? WhiteWins : BlackWins);
2886 }
2887         YY_BREAK
2888 case 22:
2889 YY_RULE_SETUP
2890 #line 903 "parser.l"
2891
2892     return (int) (ToUpper(yytext[0]) == 'W' ? BlackWins : WhiteWins);
2893 }
2894         YY_BREAK
2895 case 23:
2896 /* rule 23 can match eol */
2897 YY_RULE_SETUP
2898 #line 907 "parser.l"
2899
2900     return (int) WhiteWins;
2901 }
2902         YY_BREAK
2903 case 24:
2904 /* rule 24 can match eol */
2905 YY_RULE_SETUP
2906 #line 911 "parser.l"
2907
2908     return (int) BlackWins;
2909 }
2910         YY_BREAK
2911 case 25:
2912 /* rule 25 can match eol */
2913 YY_RULE_SETUP
2914 #line 915 "parser.l"
2915 {
2916     return (int) GameIsDrawn;
2917 }
2918         YY_BREAK
2919 case 26:
2920 /* rule 26 can match eol */
2921 YY_RULE_SETUP
2922 #line 919 "parser.l"
2923 {
2924     return (int) GameUnfinished;
2925 }
2926         YY_BREAK
2927 case 27:
2928 /* rule 27 can match eol */
2929 YY_RULE_SETUP
2930 #line 923 "parser.l"
2931 {
2932     /* move numbers */
2933     if ((yyleng == 1) && (yytext[0] == '1'))
2934       return (int) MoveNumberOne;
2935     else return (int) Nothing; // [HGM] make sure something is returned, for gathering parsed text
2936 }
2937         YY_BREAK
2938 case 28:
2939 YY_RULE_SETUP
2940 #line 930 "parser.l"
2941 {
2942     /* elapsed time indication, e.g. (0:12) or {10:21.071} */ 
2943     return (int) ElapsedTime;
2944 }
2945         YY_BREAK
2946 case 29:
2947 /* rule 29 can match eol */
2948 YY_RULE_SETUP
2949 #line 935 "parser.l"
2950 {
2951     /* position diagram enclosed in [-- --] */
2952     return (int) PositionDiagram;
2953 }
2954         YY_BREAK
2955 case 30:
2956 /* rule 30 can match eol */
2957 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
2958 (yy_c_buf_p) = yy_cp -= 1;
2959 YY_DO_BEFORE_ACTION; /* set up yytext again */
2960 YY_RULE_SETUP
2961 #line 940 "parser.l"
2962 {
2963     /* position diagram enclosed in {-- --} */
2964     return (int) PositionDiagram;
2965 }
2966         YY_BREAK
2967 case 31:
2968 /* rule 31 can match eol */
2969 YY_RULE_SETUP
2970 #line 945 "parser.l"
2971 {
2972     return (int) PGNTag;
2973 }    
2974         YY_BREAK
2975 case 32:
2976 YY_RULE_SETUP
2977 #line 949 "parser.l"
2978 {
2979     return (int) GNUChessGame;
2980 }
2981         YY_BREAK
2982 case 33:
2983 /* rule 33 can match eol */
2984 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
2985 (yy_c_buf_p) = yy_cp -= 1;
2986 YY_DO_BEFORE_ACTION; /* set up yytext again */
2987 YY_RULE_SETUP
2988 #line 953 "parser.l"
2989 {
2990     return (int) XBoardGame;
2991 }
2992         YY_BREAK
2993 case 34:
2994 YY_RULE_SETUP
2995 #line 957 "parser.l"
2996 {                               /* numeric annotation glyph */
2997     return (int) NAG;
2998 }
2999         YY_BREAK
3000 case 35:
3001 /* rule 35 can match eol */
3002 YY_RULE_SETUP
3003 #line 961 "parser.l"
3004 {                               /* anything in {} */
3005     return (int) Comment; 
3006 }
3007         YY_BREAK
3008 case 36:
3009 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
3010 (yy_c_buf_p) = yy_cp -= 1;
3011 YY_DO_BEFORE_ACTION; /* set up yytext again */
3012 YY_RULE_SETUP
3013 #line 965 "parser.l"
3014 {                                          /* ; to end of line */
3015     return (int) Comment;
3016 }
3017         YY_BREAK
3018 case 37:
3019 /* rule 37 can match eol */
3020 YY_RULE_SETUP
3021 #line 969 "parser.l"
3022 {                               /* anything in [] */
3023     return (int) Comment; 
3024 }
3025         YY_BREAK
3026 case 38:
3027 YY_RULE_SETUP
3028 #line 973 "parser.l"
3029 {                               /* Opening parentheses */
3030     return (int) Open; 
3031 }
3032         YY_BREAK
3033 case 39:
3034 YY_RULE_SETUP
3035 #line 977 "parser.l"
3036 {                                     /* closing parentheses */
3037     return (int) Close; 
3038 }       
3039         YY_BREAK
3040 case 40:
3041 /* rule 40 can match eol */
3042 YY_RULE_SETUP
3043 #line 981 "parser.l"
3044 {
3045     return (int) Nothing;                 /* Skip mail headers */
3046 }
3047         YY_BREAK
3048 case 41:
3049 YY_RULE_SETUP
3050 #line 985 "parser.l"
3051 {
3052     return (int) Nothing;                 /* Skip random words */
3053 }
3054         YY_BREAK
3055 case 42:
3056 /* rule 42 can match eol */
3057 YY_RULE_SETUP
3058 #line 989 "parser.l"
3059 {
3060     return (int) Nothing;                 /* Skip everything else */
3061 }
3062         YY_BREAK
3063 case 43:
3064 YY_RULE_SETUP
3065 #line 993 "parser.l"
3066 ECHO;
3067         YY_BREAK
3068 #line 3069 "parser.c"
3069                         case YY_STATE_EOF(INITIAL):
3070                                 yyterminate();
3071
3072         case YY_END_OF_BUFFER:
3073                 {
3074                 /* Amount of text matched not including the EOB char. */
3075                 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
3076
3077                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
3078                 *yy_cp = (yy_hold_char);
3079                 YY_RESTORE_YY_MORE_OFFSET
3080
3081                 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
3082                         {
3083                         /* We're scanning a new file or input source.  It's
3084                          * possible that this happened because the user
3085                          * just pointed yyin at a new source and called
3086                          * yylex().  If so, then we have to assure
3087                          * consistency between YY_CURRENT_BUFFER and our
3088                          * globals.  Here is the right place to do so, because
3089                          * this is the first action (other than possibly a
3090                          * back-up) that will match for the new input source.
3091                          */
3092                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
3093                         YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
3094                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
3095                         }
3096
3097                 /* Note that here we test for yy_c_buf_p "<=" to the position
3098                  * of the first EOB in the buffer, since yy_c_buf_p will
3099                  * already have been incremented past the NUL character
3100                  * (since all states make transitions on EOB to the
3101                  * end-of-buffer state).  Contrast this with the test
3102                  * in input().
3103                  */
3104                 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
3105                         { /* This was really a NUL. */
3106                         yy_state_type yy_next_state;
3107
3108                         (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
3109
3110                         yy_current_state = yy_get_previous_state(  );
3111
3112                         /* Okay, we're now positioned to make the NUL
3113                          * transition.  We couldn't have
3114                          * yy_get_previous_state() go ahead and do it
3115                          * for us because it doesn't know how to deal
3116                          * with the possibility of jamming (and we don't
3117                          * want to build jamming into it because then it
3118                          * will run more slowly).
3119                          */
3120
3121                         yy_next_state = yy_try_NUL_trans( yy_current_state );
3122
3123                         yy_bp = (yytext_ptr) + YY_MORE_ADJ;
3124
3125                         if ( yy_next_state )
3126                                 {
3127                                 /* Consume the NUL. */
3128                                 yy_cp = ++(yy_c_buf_p);
3129                                 yy_current_state = yy_next_state;
3130                                 goto yy_match;
3131                                 }
3132
3133                         else
3134                                 {
3135                                 yy_cp = (yy_c_buf_p);
3136                                 goto yy_find_action;
3137                                 }
3138                         }
3139
3140                 else switch ( yy_get_next_buffer(  ) )
3141                         {
3142                         case EOB_ACT_END_OF_FILE:
3143                                 {
3144                                 (yy_did_buffer_switch_on_eof) = 0;
3145
3146                                 if ( yywrap( ) )
3147                                         {
3148                                         /* Note: because we've taken care in
3149                                          * yy_get_next_buffer() to have set up
3150                                          * yytext, we can now set up
3151                                          * yy_c_buf_p so that if some total
3152                                          * hoser (like flex itself) wants to
3153                                          * call the scanner after we return the
3154                                          * YY_NULL, it'll still work - another
3155                                          * YY_NULL will get returned.
3156                                          */
3157                                         (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
3158
3159                                         yy_act = YY_STATE_EOF(YY_START);
3160                                         goto do_action;
3161                                         }
3162
3163                                 else
3164                                         {
3165                                         if ( ! (yy_did_buffer_switch_on_eof) )
3166                                                 YY_NEW_FILE;
3167                                         }
3168                                 break;
3169                                 }
3170
3171                         case EOB_ACT_CONTINUE_SCAN:
3172                                 (yy_c_buf_p) =
3173                                         (yytext_ptr) + yy_amount_of_matched_text;
3174
3175                                 yy_current_state = yy_get_previous_state(  );
3176
3177                                 yy_cp = (yy_c_buf_p);
3178                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
3179                                 goto yy_match;
3180
3181                         case EOB_ACT_LAST_MATCH:
3182                                 (yy_c_buf_p) =
3183                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
3184
3185                                 yy_current_state = yy_get_previous_state(  );
3186
3187                                 yy_cp = (yy_c_buf_p);
3188                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
3189                                 goto yy_find_action;
3190                         }
3191                 break;
3192                 }
3193
3194         default:
3195                 YY_FATAL_ERROR(
3196                         "fatal flex scanner internal error--no action found" );
3197         } /* end of action switch */
3198                 } /* end of scanning one token */
3199 } /* end of yylex */
3200
3201 /* yy_get_next_buffer - try to read in a new buffer
3202  *
3203  * Returns a code representing an action:
3204  *      EOB_ACT_LAST_MATCH -
3205  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
3206  *      EOB_ACT_END_OF_FILE - end of file
3207  */
3208 static int yy_get_next_buffer (void)
3209 {
3210         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
3211         register char *source = (yytext_ptr);
3212         register int number_to_move, i;
3213         int ret_val;
3214
3215         if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
3216                 YY_FATAL_ERROR(
3217                 "fatal flex scanner internal error--end of buffer missed" );
3218
3219         if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
3220                 { /* Don't try to fill the buffer, so this is an EOF. */
3221                 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
3222                         {
3223                         /* We matched a single character, the EOB, so
3224                          * treat this as a final EOF.
3225                          */
3226                         return EOB_ACT_END_OF_FILE;
3227                         }
3228
3229                 else
3230                         {
3231                         /* We matched some text prior to the EOB, first
3232                          * process it.
3233                          */
3234                         return EOB_ACT_LAST_MATCH;
3235                         }
3236                 }
3237
3238         /* Try to read more data. */
3239
3240         /* First move last chars to start of buffer. */
3241         number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
3242
3243         for ( i = 0; i < number_to_move; ++i )
3244                 *(dest++) = *(source++);
3245
3246         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
3247                 /* don't do the read, it's not guaranteed to return an EOF,
3248                  * just force an EOF
3249                  */
3250                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
3251
3252         else
3253                 {
3254                         int num_to_read =
3255                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
3256
3257                 while ( num_to_read <= 0 )
3258                         { /* Not enough room in the buffer - grow it. */
3259
3260                         YY_FATAL_ERROR(
3261 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
3262
3263                         }
3264
3265                 if ( num_to_read > YY_READ_BUF_SIZE )
3266                         num_to_read = YY_READ_BUF_SIZE;
3267
3268                 /* Read in more data. */
3269                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
3270                         (yy_n_chars), (size_t) num_to_read );
3271
3272                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3273                 }
3274
3275         if ( (yy_n_chars) == 0 )
3276                 {
3277                 if ( number_to_move == YY_MORE_ADJ )
3278                         {
3279                         ret_val = EOB_ACT_END_OF_FILE;
3280                         yyrestart(yyin  );
3281                         }
3282
3283                 else
3284                         {
3285                         ret_val = EOB_ACT_LAST_MATCH;
3286                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
3287                                 YY_BUFFER_EOF_PENDING;
3288                         }
3289                 }
3290
3291         else
3292                 ret_val = EOB_ACT_CONTINUE_SCAN;
3293
3294         if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
3295                 /* Extend the array by 50%, plus the number we really need. */
3296                 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
3297                 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
3298                 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3299                         YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
3300         }
3301
3302         (yy_n_chars) += number_to_move;
3303         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
3304         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
3305
3306         (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
3307
3308         return ret_val;
3309 }
3310
3311 /* yy_get_previous_state - get the state just before the EOB char was reached */
3312
3313     static yy_state_type yy_get_previous_state (void)
3314 {
3315         register yy_state_type yy_current_state;
3316         register char *yy_cp;
3317     
3318         yy_current_state = (yy_start);
3319         yy_current_state += YY_AT_BOL();
3320
3321         (yy_state_ptr) = (yy_state_buf);
3322         *(yy_state_ptr)++ = yy_current_state;
3323
3324         for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
3325                 {
3326                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
3327                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3328                         {
3329                         yy_current_state = (int) yy_def[yy_current_state];
3330                         if ( yy_current_state >= 694 )
3331                                 yy_c = yy_meta[(unsigned int) yy_c];
3332                         }
3333                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3334                 *(yy_state_ptr)++ = yy_current_state;
3335                 }
3336
3337         return yy_current_state;
3338 }
3339
3340 /* yy_try_NUL_trans - try to make a transition on the NUL character
3341  *
3342  * synopsis
3343  *      next_state = yy_try_NUL_trans( current_state );
3344  */
3345     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
3346 {
3347         register int yy_is_jam;
3348     
3349         register YY_CHAR yy_c = 1;
3350         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3351                 {
3352                 yy_current_state = (int) yy_def[yy_current_state];
3353                 if ( yy_current_state >= 694 )
3354                         yy_c = yy_meta[(unsigned int) yy_c];
3355                 }
3356         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3357         yy_is_jam = (yy_current_state == 693);
3358         if ( ! yy_is_jam )
3359                 *(yy_state_ptr)++ = yy_current_state;
3360
3361         return yy_is_jam ? 0 : yy_current_state;
3362 }
3363
3364     static void yyunput (int c, register char * yy_bp )
3365 {
3366         register char *yy_cp;
3367     
3368     yy_cp = (yy_c_buf_p);
3369
3370         /* undo effects of setting up yytext */
3371         *yy_cp = (yy_hold_char);
3372
3373         if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3374                 { /* need to shift things up to make room */
3375                 /* +2 for EOB chars. */
3376                 register int number_to_move = (yy_n_chars) + 2;
3377                 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
3378                                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
3379                 register char *source =
3380                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
3381
3382                 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3383                         *--dest = *--source;
3384
3385                 yy_cp += (int) (dest - source);
3386                 yy_bp += (int) (dest - source);
3387                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
3388                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
3389
3390                 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3391                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
3392                 }
3393
3394         *--yy_cp = (char) c;
3395
3396         (yytext_ptr) = yy_bp;
3397         (yy_hold_char) = *yy_cp;
3398         (yy_c_buf_p) = yy_cp;
3399 }
3400
3401 #ifndef YY_NO_INPUT
3402 #ifdef __cplusplus
3403     static int yyinput (void)
3404 #else
3405     static int input  (void)
3406 #endif
3407
3408 {
3409         int c;
3410     
3411         *(yy_c_buf_p) = (yy_hold_char);
3412
3413         if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
3414                 {
3415                 /* yy_c_buf_p now points to the character we want to return.
3416                  * If this occurs *before* the EOB characters, then it's a
3417                  * valid NUL; if not, then we've hit the end of the buffer.
3418                  */
3419                 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
3420                         /* This was really a NUL. */
3421                         *(yy_c_buf_p) = '\0';
3422
3423                 else
3424                         { /* need more input */
3425                         int offset = (yy_c_buf_p) - (yytext_ptr);
3426                         ++(yy_c_buf_p);
3427
3428                         switch ( yy_get_next_buffer(  ) )
3429                                 {
3430                                 case EOB_ACT_LAST_MATCH:
3431                                         /* This happens because yy_g_n_b()
3432                                          * sees that we've accumulated a
3433                                          * token and flags that we need to
3434                                          * try matching the token before
3435                                          * proceeding.  But for input(),
3436                                          * there's no matching to consider.
3437                                          * So convert the EOB_ACT_LAST_MATCH
3438                                          * to EOB_ACT_END_OF_FILE.
3439                                          */
3440
3441                                         /* Reset buffer status. */
3442                                         yyrestart(yyin );
3443
3444                                         /*FALLTHROUGH*/
3445
3446                                 case EOB_ACT_END_OF_FILE:
3447                                         {
3448                                         if ( yywrap( ) )
3449                                                 return EOF;
3450
3451                                         if ( ! (yy_did_buffer_switch_on_eof) )
3452                                                 YY_NEW_FILE;
3453 #ifdef __cplusplus
3454                                         return yyinput();
3455 #else
3456                                         return input();
3457 #endif
3458                                         }
3459
3460                                 case EOB_ACT_CONTINUE_SCAN:
3461                                         (yy_c_buf_p) = (yytext_ptr) + offset;
3462                                         break;
3463                                 }
3464                         }
3465                 }
3466
3467         c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
3468         *(yy_c_buf_p) = '\0';   /* preserve yytext */
3469         (yy_hold_char) = *++(yy_c_buf_p);
3470
3471         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
3472
3473         return c;
3474 }
3475 #endif  /* ifndef YY_NO_INPUT */
3476
3477 /** Immediately switch to a different input stream.
3478  * @param input_file A readable stream.
3479  * 
3480  * @note This function does not reset the start condition to @c INITIAL .
3481  */
3482     void yyrestart  (FILE * input_file )
3483 {
3484     
3485         if ( ! YY_CURRENT_BUFFER ){
3486         yyensure_buffer_stack ();
3487                 YY_CURRENT_BUFFER_LVALUE =
3488             yy_create_buffer(yyin,YY_BUF_SIZE );
3489         }
3490
3491         yy_init_buffer(YY_CURRENT_BUFFER,input_file );
3492         yy_load_buffer_state( );
3493 }
3494
3495 /** Switch to a different input buffer.
3496  * @param new_buffer The new input buffer.
3497  * 
3498  */
3499     void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
3500 {
3501     
3502         /* TODO. We should be able to replace this entire function body
3503          * with
3504          *              yypop_buffer_state();
3505          *              yypush_buffer_state(new_buffer);
3506      */
3507         yyensure_buffer_stack ();
3508         if ( YY_CURRENT_BUFFER == new_buffer )
3509                 return;
3510
3511         if ( YY_CURRENT_BUFFER )
3512                 {
3513                 /* Flush out information for old buffer. */
3514                 *(yy_c_buf_p) = (yy_hold_char);
3515                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
3516                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3517                 }
3518
3519         YY_CURRENT_BUFFER_LVALUE = new_buffer;
3520         yy_load_buffer_state( );
3521
3522         /* We don't actually know whether we did this switch during
3523          * EOF (yywrap()) processing, but the only time this flag
3524          * is looked at is after yywrap() is called, so it's safe
3525          * to go ahead and always set it.
3526          */
3527         (yy_did_buffer_switch_on_eof) = 1;
3528 }
3529
3530 static void yy_load_buffer_state  (void)
3531 {
3532         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
3533         (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
3534         yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
3535         (yy_hold_char) = *(yy_c_buf_p);
3536 }
3537
3538 /** Allocate and initialize an input buffer state.
3539  * @param file A readable stream.
3540  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
3541  * 
3542  * @return the allocated buffer state.
3543  */
3544     YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
3545 {
3546         YY_BUFFER_STATE b;
3547     
3548         b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
3549         if ( ! b )
3550                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
3551
3552         b->yy_buf_size = size;
3553
3554         /* yy_ch_buf has to be 2 characters longer than the size given because
3555          * we need to put in 2 end-of-buffer characters.
3556          */
3557         b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
3558         if ( ! b->yy_ch_buf )
3559                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
3560
3561         b->yy_is_our_buffer = 1;
3562
3563         yy_init_buffer(b,file );
3564
3565         return b;
3566 }
3567
3568 /** Destroy the buffer.
3569  * @param b a buffer created with yy_create_buffer()
3570  * 
3571  */
3572     void yy_delete_buffer (YY_BUFFER_STATE  b )
3573 {
3574     
3575         if ( ! b )
3576                 return;
3577
3578         if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
3579                 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
3580
3581         if ( b->yy_is_our_buffer )
3582                 yyfree((void *) b->yy_ch_buf  );
3583
3584         yyfree((void *) b  );
3585 }
3586
3587 #ifndef __cplusplus
3588 extern int isatty (int );
3589 #endif /* __cplusplus */
3590     
3591 /* Initializes or reinitializes a buffer.
3592  * This function is sometimes called more than once on the same buffer,
3593  * such as during a yyrestart() or at EOF.
3594  */
3595     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
3596
3597 {
3598         int oerrno = errno;
3599     
3600         yy_flush_buffer(b );
3601
3602         b->yy_input_file = file;
3603         b->yy_fill_buffer = 1;
3604
3605     /* If b is the current buffer, then yy_init_buffer was _probably_
3606      * called from yyrestart() or through yy_get_next_buffer.
3607      * In that case, we don't want to reset the lineno or column.
3608      */
3609     if (b != YY_CURRENT_BUFFER){
3610         b->yy_bs_lineno = 1;
3611         b->yy_bs_column = 0;
3612     }
3613
3614         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
3615     
3616         errno = oerrno;
3617 }
3618
3619 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
3620  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
3621  * 
3622  */
3623     void yy_flush_buffer (YY_BUFFER_STATE  b )
3624 {
3625         if ( ! b )
3626                 return;
3627
3628         b->yy_n_chars = 0;
3629
3630         /* We always need two end-of-buffer characters.  The first causes
3631          * a transition to the end-of-buffer state.  The second causes
3632          * a jam in that state.
3633          */
3634         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
3635         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
3636
3637         b->yy_buf_pos = &b->yy_ch_buf[0];
3638
3639         b->yy_at_bol = 1;
3640         b->yy_buffer_status = YY_BUFFER_NEW;
3641
3642         if ( b == YY_CURRENT_BUFFER )
3643                 yy_load_buffer_state( );
3644 }
3645
3646 /** Pushes the new state onto the stack. The new state becomes
3647  *  the current state. This function will allocate the stack
3648  *  if necessary.
3649  *  @param new_buffer The new state.
3650  *  
3651  */
3652 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
3653 {
3654         if (new_buffer == NULL)
3655                 return;
3656
3657         yyensure_buffer_stack();
3658
3659         /* This block is copied from yy_switch_to_buffer. */
3660         if ( YY_CURRENT_BUFFER )
3661                 {
3662                 /* Flush out information for old buffer. */
3663                 *(yy_c_buf_p) = (yy_hold_char);
3664                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
3665                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3666                 }
3667
3668         /* Only push if top exists. Otherwise, replace top. */
3669         if (YY_CURRENT_BUFFER)
3670                 (yy_buffer_stack_top)++;
3671         YY_CURRENT_BUFFER_LVALUE = new_buffer;
3672
3673         /* copied from yy_switch_to_buffer. */
3674         yy_load_buffer_state( );
3675         (yy_did_buffer_switch_on_eof) = 1;
3676 }
3677
3678 /** Removes and deletes the top of the stack, if present.
3679  *  The next element becomes the new top.
3680  *  
3681  */
3682 void yypop_buffer_state (void)
3683 {
3684         if (!YY_CURRENT_BUFFER)
3685                 return;
3686
3687         yy_delete_buffer(YY_CURRENT_BUFFER );
3688         YY_CURRENT_BUFFER_LVALUE = NULL;
3689         if ((yy_buffer_stack_top) > 0)
3690                 --(yy_buffer_stack_top);
3691
3692         if (YY_CURRENT_BUFFER) {
3693                 yy_load_buffer_state( );
3694                 (yy_did_buffer_switch_on_eof) = 1;
3695         }
3696 }
3697
3698 /* Allocates the stack if it does not exist.
3699  *  Guarantees space for at least one push.
3700  */
3701 static void yyensure_buffer_stack (void)
3702 {
3703         int num_to_alloc;
3704     
3705         if (!(yy_buffer_stack)) {
3706
3707                 /* First allocation is just for 2 elements, since we don't know if this
3708                  * scanner will even need a stack. We use 2 instead of 1 to avoid an
3709                  * immediate realloc on the next call.
3710          */
3711                 num_to_alloc = 1;
3712                 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
3713                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
3714                                                                 );
3715                 if ( ! (yy_buffer_stack) )
3716                         YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
3717                                                                   
3718                 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
3719                                 
3720                 (yy_buffer_stack_max) = num_to_alloc;
3721                 (yy_buffer_stack_top) = 0;
3722                 return;
3723         }
3724
3725         if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
3726
3727                 /* Increase the buffer to prepare for a possible push. */
3728                 int grow_size = 8 /* arbitrary grow size */;
3729
3730                 num_to_alloc = (yy_buffer_stack_max) + grow_size;
3731                 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
3732                                                                 ((yy_buffer_stack),
3733                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
3734                                                                 );
3735                 if ( ! (yy_buffer_stack) )
3736                         YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
3737
3738                 /* zero only the new slots.*/
3739                 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
3740                 (yy_buffer_stack_max) = num_to_alloc;
3741         }
3742 }
3743
3744 /** Setup the input buffer state to scan directly from a user-specified character buffer.
3745  * @param base the character buffer
3746  * @param size the size in bytes of the character buffer
3747  * 
3748  * @return the newly allocated buffer state object. 
3749  */
3750 YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
3751 {
3752         YY_BUFFER_STATE b;
3753     
3754         if ( size < 2 ||
3755              base[size-2] != YY_END_OF_BUFFER_CHAR ||
3756              base[size-1] != YY_END_OF_BUFFER_CHAR )
3757                 /* They forgot to leave room for the EOB's. */
3758                 return 0;
3759
3760         b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
3761         if ( ! b )
3762                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
3763
3764         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
3765         b->yy_buf_pos = b->yy_ch_buf = base;
3766         b->yy_is_our_buffer = 0;
3767         b->yy_input_file = 0;
3768         b->yy_n_chars = b->yy_buf_size;
3769         b->yy_is_interactive = 0;
3770         b->yy_at_bol = 1;
3771         b->yy_fill_buffer = 0;
3772         b->yy_buffer_status = YY_BUFFER_NEW;
3773
3774         yy_switch_to_buffer(b  );
3775
3776         return b;
3777 }
3778
3779 /** Setup the input buffer state to scan a string. The next call to yylex() will
3780  * scan from a @e copy of @a str.
3781  * @param yystr a NUL-terminated string to scan
3782  * 
3783  * @return the newly allocated buffer state object.
3784  * @note If you want to scan bytes that may contain NUL values, then use
3785  *       yy_scan_bytes() instead.
3786  */
3787 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
3788 {
3789     
3790         return yy_scan_bytes(yystr,strlen(yystr) );
3791 }
3792
3793 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
3794  * scan from a @e copy of @a bytes.
3795  * @param bytes the byte buffer to scan
3796  * @param len the number of bytes in the buffer pointed to by @a bytes.
3797  * 
3798  * @return the newly allocated buffer state object.
3799  */
3800 YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
3801 {
3802         YY_BUFFER_STATE b;
3803         char *buf;
3804         yy_size_t n;
3805         int i;
3806     
3807         /* Get memory for full buffer, including space for trailing EOB's. */
3808         n = _yybytes_len + 2;
3809         buf = (char *) yyalloc(n  );
3810         if ( ! buf )
3811                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
3812
3813         for ( i = 0; i < _yybytes_len; ++i )
3814                 buf[i] = yybytes[i];
3815
3816         buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
3817
3818         b = yy_scan_buffer(buf,n );
3819         if ( ! b )
3820                 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
3821
3822         /* It's okay to grow etc. this buffer, and we should throw it
3823          * away when we're done.
3824          */
3825         b->yy_is_our_buffer = 1;
3826
3827         return b;
3828 }
3829
3830 #ifndef YY_EXIT_FAILURE
3831 #define YY_EXIT_FAILURE 2
3832 #endif
3833
3834 static void yy_fatal_error (yyconst char* msg )
3835 {
3836         (void) fprintf( stderr, "%s\n", msg );
3837         exit( YY_EXIT_FAILURE );
3838 }
3839
3840 /* Redefine yyless() so it works in section 3 code. */
3841
3842 #undef yyless
3843 #define yyless(n) \
3844         do \
3845                 { \
3846                 /* Undo effects of setting up yytext. */ \
3847         int yyless_macro_arg = (n); \
3848         YY_LESS_LINENO(yyless_macro_arg);\
3849                 yytext[yyleng] = (yy_hold_char); \
3850                 (yy_c_buf_p) = yytext + yyless_macro_arg; \
3851                 (yy_hold_char) = *(yy_c_buf_p); \
3852                 *(yy_c_buf_p) = '\0'; \
3853                 yyleng = yyless_macro_arg; \
3854                 } \
3855         while ( 0 )
3856
3857 /* Accessor  methods (get/set functions) to struct members. */
3858
3859 /** Get the current line number.
3860  * 
3861  */
3862 int yyget_lineno  (void)
3863 {
3864         
3865     return yylineno;
3866 }
3867
3868 /** Get the input stream.
3869  * 
3870  */
3871 FILE *yyget_in  (void)
3872 {
3873         return yyin;
3874 }
3875
3876 /** Get the output stream.
3877  * 
3878  */
3879 FILE *yyget_out  (void)
3880 {
3881         return yyout;
3882 }
3883
3884 /** Get the length of the current token.
3885  * 
3886  */
3887 int yyget_leng  (void)
3888 {
3889         return yyleng;
3890 }
3891
3892 /** Get the current token.
3893  * 
3894  */
3895
3896 char *yyget_text  (void)
3897 {
3898         return yytext;
3899 }
3900
3901 /** Set the current line number.
3902  * @param line_number
3903  * 
3904  */
3905 void yyset_lineno (int  line_number )
3906 {
3907     
3908     yylineno = line_number;
3909 }
3910
3911 /** Set the input stream. This does not discard the current
3912  * input buffer.
3913  * @param in_str A readable stream.
3914  * 
3915  * @see yy_switch_to_buffer
3916  */
3917 void yyset_in (FILE *  in_str )
3918 {
3919         yyin = in_str ;
3920 }
3921
3922 void yyset_out (FILE *  out_str )
3923 {
3924         yyout = out_str ;
3925 }
3926
3927 int yyget_debug  (void)
3928 {
3929         return yy_flex_debug;
3930 }
3931
3932 void yyset_debug (int  bdebug )
3933 {
3934         yy_flex_debug = bdebug ;
3935 }
3936
3937 static int yy_init_globals (void)
3938 {
3939         /* Initialization is the same as for the non-reentrant scanner.
3940      * This function is called from yylex_destroy(), so don't allocate here.
3941      */
3942
3943     (yy_buffer_stack) = 0;
3944     (yy_buffer_stack_top) = 0;
3945     (yy_buffer_stack_max) = 0;
3946     (yy_c_buf_p) = (char *) 0;
3947     (yy_init) = 0;
3948     (yy_start) = 0;
3949
3950     (yy_state_buf) = 0;
3951     (yy_state_ptr) = 0;
3952     (yy_full_match) = 0;
3953     (yy_lp) = 0;
3954
3955 /* Defined in main.c */
3956 #ifdef YY_STDINIT
3957     yyin = stdin;
3958     yyout = stdout;
3959 #else
3960     yyin = (FILE *) 0;
3961     yyout = (FILE *) 0;
3962 #endif
3963
3964     /* For future reference: Set errno on error, since we are called by
3965      * yylex_init()
3966      */
3967     return 0;
3968 }
3969
3970 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
3971 int yylex_destroy  (void)
3972 {
3973     
3974     /* Pop the buffer stack, destroying each element. */
3975         while(YY_CURRENT_BUFFER){
3976                 yy_delete_buffer(YY_CURRENT_BUFFER  );
3977                 YY_CURRENT_BUFFER_LVALUE = NULL;
3978                 yypop_buffer_state();
3979         }
3980
3981         /* Destroy the stack itself. */
3982         yyfree((yy_buffer_stack) );
3983         (yy_buffer_stack) = NULL;
3984
3985     yyfree ( (yy_state_buf) );
3986     (yy_state_buf)  = NULL;
3987
3988     /* Reset the globals. This is important in a non-reentrant scanner so the next time
3989      * yylex() is called, initialization will occur. */
3990     yy_init_globals( );
3991
3992     return 0;
3993 }
3994
3995 /*
3996  * Internal utility routines.
3997  */
3998
3999 #ifndef yytext_ptr
4000 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
4001 {
4002         register int i;
4003         for ( i = 0; i < n; ++i )
4004                 s1[i] = s2[i];
4005 }
4006 #endif
4007
4008 #ifdef YY_NEED_STRLEN
4009 static int yy_flex_strlen (yyconst char * s )
4010 {
4011         register int n;
4012         for ( n = 0; s[n]; ++n )
4013                 ;
4014
4015         return n;
4016 }
4017 #endif
4018
4019 void *yyalloc (yy_size_t  size )
4020 {
4021         return (void *) malloc( size );
4022 }
4023
4024 void *yyrealloc  (void * ptr, yy_size_t  size )
4025 {
4026         /* The cast to (char *) in the following accommodates both
4027          * implementations that use char* generic pointers, and those
4028          * that use void* generic pointers.  It works with the latter
4029          * because both ANSI C and C++ allow castless assignment from
4030          * any pointer type to void*, and deal with argument conversions
4031          * as though doing an assignment.
4032          */
4033         return (void *) realloc( (char *) ptr, size );
4034 }
4035
4036 void yyfree (void * ptr )
4037 {
4038         free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
4039 }
4040
4041 #define YYTABLES_NAME "yytables"
4042
4043 #line 993 "parser.l"
4044
4045
4046
4047
4048 static char *StringToLex;
4049
4050 #ifndef FLEX_SCANNER
4051 static FILE *lexFP;
4052
4053 static int input()
4054 {
4055     int ret;
4056     
4057     if (StringToLex != NULL) {
4058         ret = *StringToLex;
4059         if (ret == NULLCHAR)
4060           ret = EOF;
4061         else
4062           StringToLex++;
4063     } else if (unputCount > 0) {
4064         ret = unputBuffer[--unputCount];
4065     } else {
4066         ret = fgetc(lexFP);
4067     }    
4068
4069     if (ret == EOF) 
4070       return 0;
4071     else
4072       return ret;
4073 }
4074
4075 /*
4076  * Return offset of next pattern within current file
4077  */
4078 int yyoffset()
4079 {
4080     int offset = ftell(lexFP) - unputCount;
4081
4082     if (offset < 0) {
4083         offset = 0;
4084     }
4085     return(offset);
4086 }
4087  
4088 static void output(ch)
4089      int ch;
4090 {
4091     if(appData.debugMode) fprintf(debugFP, "PARSER BUG: unmatched character '%c' (0%o)\n",
4092             ch, ch);
4093 }
4094
4095 static void unput(ch)
4096      int ch;
4097 {
4098     if (ch == 0) return;
4099     if (StringToLex != NULL) {
4100         StringToLex--;
4101     } else {
4102         if (unputCount >= UNPUT_BUF_SIZE)
4103           if(appData.debugMode) fprintf(debugFP, "PARSER BUG: unput buffer overflow '%c' (0%o)\n",
4104                   ch, ch);
4105         unputBuffer[unputCount++] = ch;
4106     }
4107 }
4108
4109 /* Get ready to lex from a new file.  Kludge below sticks
4110    an artificial newline at the front of the file, which the
4111    above grammar ignores, but which makes ^ at start of pattern
4112    match at the real start of the file.
4113 */
4114 void yynewfile(f)
4115      FILE *f;
4116 {
4117     lexFP = f;
4118     StringToLex = NULL;
4119     unputCount = 0;
4120     unput('\n'); /* kludge */
4121 }
4122
4123 /* Get ready to lex from a string.  ^ at start of pattern WON'T
4124    match at the start of the string!
4125 */
4126 void yynewstr(s)
4127      char *s;
4128 {
4129     lexFP = NULL;
4130     StringToLex = s;
4131     unputCount = 0;
4132 }
4133 #endif /*!FLEX_SCANNER*/
4134
4135 #ifdef FLEX_SCANNER
4136 void my_yy_input(buf, result, max_size)
4137      char *buf;
4138      int *result;
4139      int max_size;
4140 {
4141     int count;
4142
4143     if (StringToLex != NULL) {
4144         count = 0;
4145         while (*StringToLex != NULLCHAR) {
4146             *buf++ = *StringToLex++;
4147             count++;
4148         }
4149         *result = count;
4150         return;
4151     } else {
4152         count = fread(buf, 1, max_size, yyin);
4153         if (count == 0) {
4154             *result = YY_NULL;
4155         } else {
4156             *result = count;
4157         }
4158         return;
4159     }    
4160 }
4161
4162 static YY_BUFFER_STATE my_file_buffer = NULL;
4163
4164 /*
4165     Return offset of next pattern in the current file.
4166 */
4167 int yyoffset()
4168 {
4169     int pos = yy_c_buf_p - YY_CURRENT_BUFFER->yy_ch_buf;
4170
4171     return(ftell(YY_CURRENT_BUFFER->yy_input_file) -
4172          yy_n_chars + pos);
4173 }
4174
4175
4176 void yynewstr(s)
4177      char *s;
4178 {
4179     if (my_file_buffer != NULL)
4180       yy_delete_buffer(my_file_buffer);
4181     StringToLex = s;
4182     my_file_buffer = yy_create_buffer(stdin,YY_BUF_SIZE);
4183     yy_switch_to_buffer(my_file_buffer);
4184 }
4185
4186 void yynewfile(f)
4187      FILE *f;
4188 {
4189     if (my_file_buffer != NULL)
4190       yy_delete_buffer(my_file_buffer);
4191     StringToLex = NULL;
4192     my_file_buffer = yy_create_buffer(f,YY_BUF_SIZE);
4193     yy_switch_to_buffer(my_file_buffer);
4194 }
4195 #endif /*FLEX_SCANNER*/
4196
4197 int yywrap()
4198 {
4199     return TRUE;
4200 }
4201
4202 /* Parse a move from the given string s */
4203 /* ^ at start of pattern WON'T work here unless using flex */
4204 ChessMove yylexstr(boardIndex, s, text, len)
4205      int boardIndex, len;
4206      char *s, *text;
4207 {
4208     ChessMove ret;
4209     char *oldStringToLex;
4210 #ifdef FLEX_SCANNER
4211     YY_BUFFER_STATE buffer, oldBuffer;
4212 #endif
4213     
4214     yyboardindex = boardIndex;
4215     oldStringToLex = StringToLex;
4216     StringToLex = s;
4217 #ifdef FLEX_SCANNER
4218     buffer = yy_create_buffer(stdin,YY_BUF_SIZE);
4219     oldBuffer = YY_CURRENT_BUFFER;
4220     yy_switch_to_buffer(buffer);
4221 #endif /*FLEX_SCANNER*/
4222
4223     ret = (ChessMove) Myylex();
4224      strncpy(text, yy_text, len-1); // [HGM] vari: yy_text is not available to caller after buffer switch ?!?
4225      text[len-1] = NULLCHAR;
4226
4227 #ifdef FLEX_SCANNER
4228     if (oldBuffer != NULL) 
4229       yy_switch_to_buffer(oldBuffer);
4230     yy_delete_buffer(buffer);
4231 #endif /*FLEX_SCANNER*/
4232     StringToLex = oldStringToLex;
4233
4234     return ret;
4235 }
4236
4237 int Myylex()
4238 {   // [HGM] wrapper for yylex, which treats nesting of parentheses
4239     int symbol, nestingLevel = 0, i=0;
4240     char *p;
4241     static char buf[256*MSG_SIZ];
4242     buf[0] = NULLCHAR;
4243     do { // eat away anything not at level 0
4244         symbol = yylex();
4245         if(symbol == Open) nestingLevel++;
4246         if(nestingLevel) { // save all parsed text between (and including) the ()
4247             for(p=yytext; *p && i<256*MSG_SIZ-2;) buf[i++] = *p++;
4248             buf[i] = NULLCHAR;
4249         }
4250         if(symbol == 0) break; // ran into EOF
4251         if(symbol == Close) symbol = Comment, nestingLevel--;
4252     } while(nestingLevel || symbol == Nothing);
4253     yy_text = buf[0] ? buf : (char*)yytext;
4254     return symbol;
4255 }
4256