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