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