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