1 /*
2  * $Id: yorick.c,v 1.2 2007-07-28 02:15:26 dhmunro Exp $
3  *
4  * Based on Berkeley Yacc (byacc) parser generated from yorick.y.
5  * Modified to handle parser stack overflow gracefully.
6  * Modified parser to take single step.
7  */
8 /* Copyright (c) 2005, The Regents of the University of California.
9  * All rights reserved.
10  * This file is part of yorick (http://yorick.sourceforge.net).
11  * Read the accompanying LICENSE file for details.
12  */
13 
14 #include "parse.h"
15 #include "pstdlib.h"
16 #include "play.h"
17 #include <string.h>
18 #include <errno.h>
19 
20 /* Sun Fortran formatted I/O stupidly uses a yacc parser which uses
21  * the names yyparse and yylex.  Sheesh.  */
22 static int yylex(void);
23 static int yyparse_step(int last_state);
24 static void yyerror(char *msg);
25 
26 #ifdef DO_DEBUG
27 #include <stdio.h>
28 #define YYDEBUG 1
29 /* must also set yydebug non-0 */
30 #endif
31 
32 /* The Yorick grammar requires two "lexical tie-ins"-- both alter the
33    token returned by yylex when an end-of-line (EOL) is encountered:
34    (1) If parentheses () and square brackets [] are balanced, then
35        EOL returns a ';' token, unless the previous token was ';'.
36        If the token immediately before EOL was an operator which needs
37        a right operand, yylex treats it as if there were an open
38        parenthesis-- no ';' token is generated.
39    (2) If there are no open control structures (func or struct definitions,
40        if, while, do, for or compound statements), then EOL returns the
41        YACC end-of-file (EOF) token.  This is applied after rule (1).
42  */
43 static int nOpenCS;     /* The openCS rule increments nOpenCS, while the
44                            action when the control structure is complete
45                            decrements it.  */
46 static int parenDepth;  /* The openP rule increments parenDepth; the
47                            closeP rule decrements it.  */
48 static int braceDepth;  /* The openC rule increments braceDepth; the
49                            closeC rule decrements it.  */
50 static int needOperand; /* set if previous token needs right operand */
51 static int supressSemi; /* set to prevent yylex from returning ';' at EOL
52                            -- used for if, while, do, and for */
53 static int needBody;    /* set if looking for open curly brace */
54 static int keyCount;    /* key_expr state information */
55 
56 /* A bizzare lexical tie-in is required for graphics routines which
57    need the textual form of their arguments to generate default
58    legend strings...  */
59 static int nQuines, quining;
60 static void BeginQuine(void);
61 static void GrabQuine(char *stop);
62 static int DoQuine(void);
63 
64 static int EndOfLine(void);
65 
66 typedef union {
67   long l;
68   double d;
69   Quote q;
70   int i;            /* counter or index */
71   CodeBlock cb;     /* code block index (see parse.c) */
72   Literal lit;      /* literal table index (see parse.c) */
73   CBorLit def;      /* CodeBlock or Literal for assign_predicate */
74 } YYSTYPE;
75 #define CHAR 257
76 #define SHORT 258
77 #define INT 259
78 #define LONG 260
79 #define CHAR_ERR 261
80 #define FLOAT 262
81 #define DOUBLE 263
82 #define IMAGINARY 264
83 #define STRING 265
84 #define STRING_ERR 266
85 #define SYSCALL 267
86 #define NAME 268
87 #define RFNAME 269
88 #define FUNC 270
89 #define STRUCT 271
90 #define IF 272
91 #define ELSE 273
92 #define WHILE 274
93 #define DO 275
94 #define FOR 276
95 #define GOTO 277
96 #define CONTINUE 278
97 #define BREAK 279
98 #define RETURN 280
99 #define EXTERN 281
100 #define LOCAL 282
101 #define DOTDOT 283
102 #define NEXT_ARG 284
103 #define MORE_ARGS 285
104 #define PEQ 286
105 #define MEQ 287
106 #define TMSEQ 288
107 #define DIVEQ 289
108 #define MODEQ 290
109 #define SHLEQ 291
110 #define SHREQ 292
111 #define ANDEQ 293
112 #define XOREQ 294
113 #define OREQ 295
114 #define OR 296
115 #define AND 297
116 #define EQ 298
117 #define NE 299
118 #define LE 300
119 #define GE 301
120 #define SHL 302
121 #define SHR 303
122 #define UNARY 304
123 #define ARROW 305
124 #define PLUSPLUS 306
125 #define MINUSMINUS 307
126 #define NOINPUT 308
127 #define YYERRCODE 256
128 static short yylhs[] = {                                        -1,
129     0,    0,    0,    0,    0,    0,    0,    0,    0,   33,
130    33,   33,   33,   34,   36,   42,   43,   44,   39,   41,
131    45,   45,   12,   12,   12,   12,   12,   49,   12,   12,
132    54,   12,   12,   12,   12,   12,   12,   12,   12,   12,
133    12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
134    12,   12,   13,   13,   10,   10,   10,   10,   11,   11,
135    53,   51,   60,   61,   62,   38,   50,   52,   55,   56,
136    57,   63,   59,   40,   40,   64,   65,   65,   66,   66,
137    66,    2,    2,    8,    8,    8,   29,   35,   67,   28,
138    37,   37,   37,   37,   37,   37,   37,   68,   68,   68,
139    68,   69,   69,   70,   71,    4,   72,   48,    5,    5,
140     5,    6,    6,    7,    7,   73,   73,   32,   32,   32,
141    32,   31,   31,   16,   16,   16,   16,   17,   17,    3,
142     3,    3,   46,   46,   47,   47,   15,   15,   15,   15,
143     9,    1,    1,    1,    1,    1,    1,    1,    1,    1,
144     1,   18,   18,   18,   19,   19,   19,   19,   19,   19,
145    19,   19,   19,   19,   19,   19,   19,   19,   19,   19,
146    19,   19,   19,   24,   24,   24,   23,   23,   22,   22,
147    22,   22,   22,   22,   22,   25,   25,   74,   25,   25,
148    25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
149    25,   25,   25,   14,   20,   20,   58,   75,   58,   21,
150    21,   27,   30,   26,   26,   26,   26,   26,   26,   26,
151    26,
152 };
153 static short yylen[] = {                                         2,
154     1,    1,    4,    7,    6,    7,    4,    6,    3,    1,
155     3,    2,    2,    0,    1,    1,    1,    1,    2,    2,
156     0,    1,    3,    3,    2,    1,    2,    0,    5,    8,
157     0,   12,    7,    8,   11,    9,    2,    2,    2,    3,
158     3,    3,    2,    5,    3,    5,    3,    7,    5,    4,
159     5,    3,    1,    1,    2,    3,    3,    4,    1,    2,
160     0,    0,    0,    0,    0,    2,    0,    0,    0,    0,
161     0,    0,    2,    3,    4,    1,    1,    3,    2,    5,
162     5,    0,    2,    1,    1,    3,    1,    1,    0,    2,
163     1,    3,    1,    1,    3,    5,    3,    1,    3,    2,
164     4,    2,    4,    1,    0,    2,    0,    2,    1,    1,
165     3,    1,    3,    1,    3,    1,    1,    1,    1,    3,
166     3,    0,    1,    1,    1,    2,    3,    3,    5,    1,
167     1,    1,    1,    3,    1,    3,    1,    2,    2,    3,
168     2,    1,    1,    1,    1,    1,    1,    1,    1,    1,
169     1,    1,    8,    4,    1,    3,    3,    3,    3,    3,
170     3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
171     3,    4,    4,    1,    2,    2,    1,    3,    1,    2,
172     2,    2,    2,    2,    2,    1,    1,    0,    5,    4,
173     3,    3,    4,    2,    3,    3,    2,    2,    3,    4,
174     4,    3,    3,    0,    0,    1,    0,    0,    2,    1,
175     3,    1,    1,    1,    1,    1,    1,    1,    1,    1,
176     1,
177 };
178 static short yydefred[] = {                                      0,
179     0,  214,  215,  216,  217,  218,  219,  221,  220,    0,
180     0,  213,    0,    0,    0,    0,    0,    0,    0,    0,
181     0,    0,    0,    0,    0,    0,    0,    0,    1,   15,
182    17,    0,    0,    0,   26,   10,    0,  137,    0,    0,
183   174,  155,    0,  186,    0,    0,    0,    0,    0,    0,
184     0,    0,    0,    0,    0,   13,   25,   43,    0,    0,
185    37,   38,  212,    0,    0,    0,   39,    0,    0,    0,
186   124,    0,  187,    0,  133,    0,    0,  135,    0,    0,
187     0,    0,    0,    0,  175,  176,  180,    0,    0,    0,
188    22,   19,  138,  139,   27,   63,   62,    0,    0,    0,
189     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
190     0,    0,    0,    0,  141,  142,  143,  144,  145,  146,
191   147,  148,  149,  150,  151,    0,    0,    0,    0,  197,
192   198,    0,  107,    0,    0,   12,    0,    0,    0,    0,
193     0,    0,    0,   59,   55,    0,   18,    0,  194,    0,
194     0,    0,    0,   73,   42,    0,   40,   41,    0,   11,
195    23,    0,   24,    0,   16,  191,  192,    0,    0,    0,
196     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
197     0,    0,  156,  157,  158,    0,  178,  140,  195,  196,
198     0,  105,    0,    0,    0,    0,    0,   88,    0,    9,
199     0,    0,  203,  199,    0,   57,   20,   60,   56,  202,
200     0,   85,    0,   45,    0,   47,    0,    0,    0,   52,
201     0,  127,    0,    0,  134,  136,    0,    0,  154,    0,
202   200,    0,    0,    0,  119,    0,  112,  108,  201,  190,
203   116,    0,  106,    0,  110,    0,    7,    3,    0,    0,
204    90,   58,    0,  193,    0,   62,    0,   62,   50,    0,
205     0,  210,    0,    0,    0,    0,  189,    0,   29,    0,
206     0,    0,    0,    0,  104,    0,   65,    0,    0,    0,
207     0,   76,    0,   82,    0,   44,   65,   46,   65,   49,
208     0,   51,    0,    0,  129,   64,  121,    0,  113,  111,
209     0,    0,  102,  100,    0,    0,    0,    0,    0,    8,
210     5,   82,    0,    0,   77,    0,    0,    0,    0,    0,
211    62,  211,    0,    6,    4,   66,    0,    0,    0,    0,
212     0,    0,    0,    0,   87,   83,    0,   74,   82,   68,
213    53,   54,   33,   48,    0,   65,    0,    0,  153,  101,
214     0,  103,   75,    0,   78,    0,   34,    0,    0,    0,
215     0,    0,    0,   31,   36,   65,   81,   80,   61,    0,
216     0,   35,   32,
217 };
218 static short yydgoto[] = {                                      33,
219   127,  313,   68,  196,  243,  234,  245,  211,   34,   35,
220   143,  342,  343,  148,   37,  235,   71,   38,   39,  263,
221   264,   84,   41,   42,   43,   44,   73,  201,  337,   46,
222    74,  237,   47,  114,  199,   49,  277,  305,   50,  283,
223   145,  166,   51,  149,   92,   77,   79,  270,  133,   52,
224   169,  356,  371,  369,   53,   54,   55,  346,   58,  168,
225   323,  306,   59,  284,  314,  315,  202,  278,  279,  280,
226   197,  194,  246,  192,  347,
227 };
228 static short yysindex[] = {                                    294,
229   -34,    0,    0,    0,    0,    0,    0,    0,    0,  -21,
230     0,    0, -219,   -1,   53, 1000, -238, -215,   36,   36,
231  2670, 2670, 1613, 1613, 1613, 2670, 2670, 2670,    0,    0,
232     0,   55,    0,   93,    0,    0,   59,    0, 2431,  249,
233     0,    0,  -36,    0,    0,   36,  743, -185, 1030,  486,
234   -86, -205, -154, -150, -139,    0,    0,    0,   81,   88,
235     0,    0,    0,    0, 1613, 1613,    0,   91,  132,  156,
236     0, 2431,    0,  159,    0,  162,   10,    0,  116,  199,
237   199,  -36,  -36,  152,    0,    0,    0,  -36,  -36,  -36,
238     0,    0,    0,    0,    0,    0,    0, 1438, 1438, 1438,
239  1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438,
240  1438, 1438, 1438,  216,    0,    0,    0,    0,    0,    0,
241     0,    0,    0,    0,    0, 1438, 1438,   25,   32,    0,
242     0,   29,    0,   56,   51,    0,   52,   70,  199,  199,
243   580,   55,  580,    0,    0,  235,    0, 1438,    0,  -25,
244   -20,  646,  -19,    0,    0, 1438,    0,    0, 1438,    0,
245     0,   74,    0,   86,    0,    0,    0, 1438, 1438, 1914,
246  2272,  523,  202,  202,  214,  214,  214,  214,  550,  550,
247   293,  293,    0,    0,    0,  104,    0,    0,    0,    0,
248   199,    0, 1492,  321,  199,  199, 1063,    0,   17,    0,
249   261,  102,    0,    0,  580,    0,    0,    0,    0,    0,
250   -30,    0, 2431,    0, 1117,    0, 1135,  331,  121,    0,
251  1190,    0, 2431,  354,    0,    0, 2481,  753,    0, 1438,
252     0,  199,  357,  373,    0,  159,    0,    0,    0,    0,
253     0, 1613,    0,    0,    0,  390,    0,    0,  -15, -228,
254     0,    0, 1438,    0,  199,    0,  199,    0,    0,   -6,
255   199,    0,  378,  394, 1438, 2368,    0,   93,    0, 1492,
256  1063, 1492,  199,  382,    0,  176,    0,  402,  407,  412,
257   336,    0, -123,    0, 2431,    0,    0,    0,    0,    0,
258  1317,    0, 1372, 1438,    0,    0,    0,  159,    0,    0,
259     0,  261,    0,    0,  261,  199,   22,  195,  210,    0,
260     0,    0,  -39,  122,    0,  743,  682,  199,  199,    0,
261     0,    0, 1438,    0,    0,    0,  382,  219,  407,  438,
262   427,  382,  407,  124,    0,    0,   36,    0,    0,    0,
263     0,    0,    0,    0,  433,    0, 1438,  434,    0,    0,
264   210,    0,    0, 1424,    0,  227,    0,  682,  394,    0,
265   407,  199,  115,    0,    0,    0,    0,    0,    0,  682,
266   743,    0,    0,
267 };
268 static short yyrindex[] = {                                    426,
269     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
270  1728,    0,    0,    0,    0,  449,    0,    0,    0,    0,
271     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
272     0,  388,    0,  449,    0,    0,    0,    0,  270, 2340,
273     0,    0, 1884,    0, 1786,    0,    8,    0,    0,  -63,
274  1478,    0,    0,    0,    0,    0,    0,    0,    0,    0,
275     0,    0,    0,  540,  381,  436,    0,   24,    0,    0,
276     0,  135,    0,    0,    0,    0,    0,    0,    0,    0,
277     0, 1943, 2001, 2283,    0,    0,    0, 2070, 2160, 2214,
278     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
279     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
280     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
281     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
282     0,  830,    0,  935,    0,    0,    0,  241,    0,    0,
283   -63,  129,  -63,    0,    0,    0,    0,  449,    0,    0,
284     0,  -63,    0,    0,    0,  573,    0,    0,  432,    0,
285     0,    0,    0,    0,    0,    0,    0,    0,    0, 1143,
286   955, 2860, 2773, 2782, 2644, 2681, 2713, 2750, 2560, 2588,
287  2501, 2552,    0,    0,    0, 1551,    0,    0,    0,    0,
288     0,    0,   31,    0,    0,    0,   83,    0,    0,    0,
289     0,    0,    0,    0,  -63,    0,    0,    0,    0,    0,
290     0,    0,   20,    0,    0,    0,    0,    0,    0,    0,
291   451,    0,  440,  141,    0,    0,  -22,  145,    0,    0,
292     0,    0, 1846,  464,    0,  114,    0,    0,    0,    0,
293     0,  245,    0,  297,    0,  471,    0,    0,    0,    0,
294     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
295     0,    0,    0,  456,  183,    0,    0,  575,    0,  575,
296    83,   83,    0,  303,    0,    0,    0,  477,  479,  481,
297     0,    0,    0,    0,   -2,    0,    0,    0,    0,    0,
298     0,    0,    0,    0,    0,    0,    0,  247,    0,    0,
299   325,    0,    0,    0,    0,    0,    0,    0,    0,    0,
300     0,    0,    0,    0,    0,  -63,  -63,    0,    0,   39,
301     0,    0,    0,    0,    0,    0,  338,    0,  489,  491,
302     0,    0,  504,    0,    0,    0,  143,    0,    0,    0,
303     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
304     0,    0,    0,  449,    0,  190,    0,  -63,  507,   39,
305   508,    0,    0,    0,    0,    0,    0,    0,    0,  -63,
306   -63,    0,    0,
307 };
308 static short yygindex[] = {                                      0,
309     0,    0,    0,  335,    0, -184,  284,  213,    0, -183,
310   423,    9, -326,    0,  -16,  -10,  -82,  259,   -5,    0,
311   239,    1,  350,    0,  614,    0,    5,    0,    0,    0,
312   410,  -75,    0,  588,    0,   27,    0,  140,  393,    0,
313   240,  228,    0, -119,  447,    0,    0, -121,    0,    0,
314  -124,    0,    0,    0,    0,    0,    0,  236,    0,    0,
315     0,    0,    0,  322,  292,  267,    0,    0, -264,  301,
316     0,    0,    0,    0,    0,
317 };
318 #define YYTABLESIZE 3157
319 static short yytable[] = {                                      69,
320    40,  142,  336,   30,   45,   70,  147,    2,   36,  128,
321    72,  193,  244,  253,   30,  248,   40,   93,  173,   30,
322    30,  173,  276,   94,   56,   87,  210,  281,   72,   75,
323    76,  365,  140,   30,   40,  173,  173,   57,   86,  282,
324   173,   86,  329,  372,  333,   80,   81,   40,   60,   40,
325    40,   45,   78,  162,   45,  136,   30,   61,  144,  328,
326    84,  230,  147,   84,  125,  212,  150,  125,  161,  132,
327   173,  208,  134,  222,  122,   30,  208,  123,  208,  207,
328   208,  208,  125,  208,  137,  138,  361,  301,  122,  122,
329    86,  254,  170,  171,  172,  173,  174,  175,  176,  177,
330   178,  179,  180,  181,  182,  183,  184,  185,  132,  132,
331   188,   62,   84,   91,  132,  132,  132,   95,  324,  151,
332   187,  325,  271,  122,  152,   26,  122,   40,   21,  208,
333    22,  287,   30,  289,   25,   65,  153,   66,  154,   32,
334   122,   40,  213,   40,  282,   45,  155,   45,  156,  144,
335   223,  208,   40,  223,  118,  165,   45,  118,  253,  164,
336   219,   21,  227,  228,  208,  339,   21,  339,   21,  146,
337    21,   21,  118,   21,  163,  152,  215,  217,  152,  221,
338   338,  128,  353,   31,  128,  172,   79,  223,  172,   30,
339   157,  223,  123,  152,  299,  299,  348,   14,  256,  128,
340   258,   79,  172,  172,  262,   40,  251,  172,   67,   45,
341    69,   70,   71,  208,  158,   40,  159,   40,   21,   21,
342   160,   40,   30,  122,  266,  249,  122,   30,  335,   30,
343   214,   30,   30,  128,   30,  216,  220,  172,  113,  165,
344   273,  122,   87,  111,  109,  126,  110,  285,  112,  290,
345   113,   21,  274,   21,   21,  111,  109,  297,  110,  223,
346   112,  103,  223,  104,  223,  223,  223,  275,  129,  130,
347   131,  212,  247,  173,  319,  122,  321,  322,  186,   67,
348    30,   69,   70,   71,  191,  117,  291,  120,  117,  327,
349   120,   40,  189,   40,   40,  208,  208,  208,  208,  190,
350   208,  208,  208,  208,  275,  120,  208,  208,  167,  115,
351   152,  195,   30,  152,   30,   30,   40,   40,   75,  198,
352    45,   45,  208,  208,  340,  200,   26,  147,  152,  113,
353   262,   22,   14,   30,  111,   25,   23,  109,   24,  112,
354   107,  225,  126,   98,  208,  208,   98,   40,  213,    2,
355     3,    4,    5,  226,    6,    7,    8,    9,   40,  229,
356    63,   64,   45,  354,  238,  115,  203,  204,  107,   63,
357    40,   40,   85,   86,   45,   45,   19,   20,   99,  373,
358   206,   99,  209,   32,   31,   21,   21,   21,   21,  259,
359    21,   21,   21,   21,  260,   21,   21,   21,   27,   28,
360    21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
361    21,  265,   21,   21,   85,   86,   32,  268,  231,   21,
362    21,  131,  239,  240,  131,   21,  316,   21,  317,   21,
363    21,  269,   21,  272,   21,   21,  293,  294,  131,  131,
364   172,  172,  303,  304,  252,  307,   30,   30,   30,   30,
365   308,   30,   30,   30,   30,  309,   30,   30,   30,  267,
366   142,   30,  331,   30,   30,   30,   30,   30,   30,   30,
367    30,   30,  122,   30,   30,  122,  132,  332,   21,  132,
368   123,  351,  286,  123,  288,  358,  350,  352,  292,  122,
369   122,  357,  360,  132,  132,   30,   30,  123,  123,  364,
370   302,  105,  106,  107,  108,  370,  122,  107,   89,  205,
371    21,  114,   21,   21,  206,  107,  108,   91,   26,   93,
372   310,   94,  311,   22,  122,   30,  232,   25,   23,   92,
373    24,   95,  123,  326,  116,  117,  118,  119,  120,  121,
374   122,  123,  124,  125,   97,  344,  345,  209,   96,    1,
375     2,    3,    4,    5,  300,    6,    7,    8,    9,  113,
376    10,   11,   12,  205,  111,  109,  363,  110,  224,  112,
377    13,   14,   15,   16,   17,   18,   31,   19,   20,  213,
378   130,  349,  103,  130,  104,  359,  113,   48,  207,  367,
379   368,  111,  109,  250,  110,  366,  112,  130,  130,   27,
380    28,   29,  236,  334,  312,  355,  236,  330,   32,    0,
381   142,   21,   26,  126,    0,  122,  126,   22,  122,   30,
382     0,   25,   23,    0,   24,    0,    0,    0,    0,    0,
383   122,  126,  122,  122,   82,   83,    0,    0,    0,   88,
384    89,   90,    0,   21,   21,   21,   21,   21,    0,   21,
385    21,   21,   21,    0,   21,   21,   21,    0,    0,   21,
386     0,   21,   21,   21,   21,   21,   21,   21,   21,   21,
387    31,   21,   21,    0,  295,    0,    0,  298,   26,  236,
388   236,  236,    0,   22,    0,   30,    0,   25,   23,    0,
389    24,    0,    0,   21,   21,   14,   14,   67,    0,   69,
390    70,   71,   32,    0,  142,   21,    0,    0,    0,    0,
391     0,    0,    0,    0,   26,    0,    0,    0,    0,   22,
392     0,   30,    0,   25,   23,    0,   24,    0,    0,    0,
393     0,    0,    0,    0,    0,    0,   31,    0,    0,    0,
394   341,  141,    2,    3,    4,    5,    0,    6,    7,    8,
395     9,    0,   10,   11,   12,    0,    0,    0,    0,    0,
396     0,    0,   13,   14,   15,   16,  135,   18,   32,   19,
397    20,   21,   31,    0,    0,   26,    0,    0,    0,    0,
398    22,    0,   30,    0,   25,   23,    0,   24,    0,  113,
399   100,   27,   28,    0,  111,  109,    0,  110,    0,  112,
400     0,    0,    0,    0,   32,    0,    0,   21,    0,    0,
401     0,    0,  103,    0,  104,    0,    0,    0,    0,    0,
402   101,  102,  105,  106,  107,  108,    0,    0,    0,    0,
403     0,    0,    0,   31,    0,    0,    2,    3,    4,    5,
404     0,    6,    7,    8,    9,    0,   10,   11,   12,    0,
405     0,    0,    0,    0,    0,    0,   13,   14,   15,   16,
406   135,   18,  188,   19,   20,   32,    0,  188,   21,  188,
407   188,  188,  188,  188,  188,    0,   98,    0,   99,    0,
408     0,    0,    0,    0,    0,   27,   28,  188,    0,    0,
409     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
410     0,  218,    2,    3,    4,    5,    0,    6,    7,    8,
411     9,    0,   10,   11,   12,    0,    0,    0,    0,    0,
412   188,    0,   13,   14,   15,   16,  135,   18,    0,   19,
413    20,    0,    0,    0,    0,    0,    0,    0,    2,    3,
414     4,    5,    0,    6,    7,    8,    9,    0,   10,   11,
415    12,   27,   28,    0,    0,  188,    0,    0,   13,   14,
416    15,   16,  135,   18,    0,   19,   20,  105,    0,    0,
417     0,    0,  105,    0,  105,  105,  105,  105,  105,  105,
418     0,    0,    0,    0,    0,    0,    0,   27,   28,    0,
419     0,    0,  105,    0,    0,  170,    0,    0,  170,    2,
420     3,    4,    5,    0,    6,    7,    8,    9,    0,   10,
421    11,   12,  170,  170,    0,    0,    0,  170,    0,   13,
422    14,   15,   16,  135,   18,  105,   19,   20,    0,    0,
423     0,    0,   26,    0,    0,    0,    0,   22,    0,   30,
424     0,   25,   65,    0,   66,    0,    0,  170,   27,   28,
425   101,  102,  105,  106,  107,  108,    0,    0,   67,    0,
426   105,    0,   26,    0,    0,    0,    0,   22,    0,   30,
427     0,   25,   23,    0,   24,    0,    0,    0,  170,    0,
428   170,    0,    0,    0,    0,    0,  188,  188,  188,  188,
429    31,  188,  188,  188,  188,   26,    0,  188,  188,    0,
430    22,    0,   30,    0,  242,   65,    0,   66,    0,    0,
431     0,    0,  188,  188,  188,    0,    0,    0,    0,    0,
432    31,    0,    0,    0,    0,   21,    0,    0,    0,    0,
433     0,    0,    0,    0,    0,  188,  188,    0,    0,    0,
434     0,    0,    0,    0,    0,    0,    0,    0,    0,   26,
435     0,    0,    0,   31,   22,   21,   30,    0,   25,   23,
436     0,   24,    0,    0,    0,    0,    0,   26,    0,    0,
437     0,    0,   22,    0,   30,    0,   25,   23,    0,   24,
438     0,    0,    0,  171,    0,    0,  171,    0,   21,    0,
439     0,  105,  105,  105,  105,    0,  105,  105,  105,  105,
440   171,  171,  105,  105,    0,  171,    0,   31,    0,    0,
441     0,    0,    0,    0,    0,    0,    0,  105,  105,  105,
442     0,    0,   26,    0,    0,   31,    0,   22,    0,   30,
443     0,   25,   23,    0,   24,  171,    0,    0,    0,    0,
444   105,  105,   21,    0,    0,    0,    0,    0,    0,    0,
445   170,  170,    0,    0,    0,    0,    2,    3,    4,    5,
446    21,    6,    7,    8,    9,    0,  171,   63,   64,    0,
447     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
448    31,    0,    0,   19,   20,  139,    2,    3,    4,    5,
449     0,    6,    7,    8,    9,    0,    0,   63,   12,    0,
450     0,    0,    0,    0,    0,   27,   28,    0,    0,    0,
451     0,    0,    0,   19,   20,   21,    0,    0,    0,    2,
452     3,    4,    5,    0,    6,    7,    8,    9,    0,    0,
453   233,   64,    0,    0,    0,   27,   28,    0,    0,    0,
454     0,    0,    0,    0,    0,  241,   19,   20,    0,   26,
455     0,    0,    0,    0,   22,    0,   30,    0,   25,   23,
456     0,   24,    0,    0,    0,    0,    0,    0,   27,   28,
457     0,    0,  255,    2,    3,    4,    5,    0,    6,    7,
458     8,    9,    0,    0,   63,   12,    0,    0,    0,    0,
459   257,    2,    3,    4,    5,    0,    6,    7,    8,    9,
460    19,   20,   63,   12,   26,    0,    0,   31,    0,   22,
461     0,   30,    0,   25,   23,    0,   24,    0,   19,   20,
462     0,    0,   27,   28,    0,    0,    0,    0,    0,    0,
463   320,    0,    0,    0,    0,    0,    0,    0,  171,  171,
464    27,   28,   21,    0,    0,  261,    2,    3,    4,    5,
465     0,    6,    7,    8,    9,    0,   26,   63,   12,    0,
466     0,   22,   31,   30,    0,   25,   23,    0,   24,    0,
467    26,    0,    0,   19,   20,   22,    0,   30,    0,   25,
468    23,    0,   24,    0,    0,    0,    0,    0,    0,    0,
469     0,    0,    0,    0,    0,   27,   28,   21,    0,    0,
470     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
471   204,    0,    0,    0,   31,  204,    0,  204,    0,  204,
472   204,    0,  204,    0,   26,    0,    0,    0,   31,   22,
473     0,   30,    0,   25,   65,  204,   66,    0,    0,    0,
474     0,    0,    0,    0,    0,    0,    0,    0,    0,   21,
475     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
476     0,    0,    0,   21,    0,    0,    0,    0,  204,    0,
477     0,    0,  318,    2,    3,    4,    5,    0,    6,    7,
478     8,    9,   31,   62,   63,   12,    0,    0,   62,    0,
479    62,    0,   62,   62,    0,   62,    0,    0,    0,    0,
480    19,   20,    0,  204,    0,    0,    0,    0,    0,    0,
481     0,    0,    0,    0,    0,    0,    0,   21,    0,    0,
482     0,    0,   27,   28,    0,    0,    0,    0,    2,    3,
483     4,    5,    0,    6,    7,    8,    9,    0,    0,   63,
484    12,   62,    0,    0,    0,   26,    0,    0,    0,    0,
485    22,    0,   30,    0,   25,   19,   20,    0,    0,    0,
486     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
487     0,    0,    0,    0,    0,    0,   62,   27,   28,  362,
488     2,    3,    4,    5,    0,    6,    7,    8,    9,    0,
489     0,   63,   12,    0,    2,    3,    4,    5,    0,    6,
490     7,    8,    9,   31,    0,   63,   12,   19,   20,    0,
491     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
492     0,   19,   20,    0,    0,    0,    0,    0,    0,   27,
493    28,    0,    0,    0,  204,  204,  204,  204,   21,  204,
494   204,  204,  204,   27,   28,  204,  204,    0,    2,    3,
495     4,    5,    0,    6,    7,    8,    9,    0,    0,  233,
496    64,  204,  204,    0,  212,  212,    0,  212,    0,  212,
497   212,  212,  212,  212,  212,   19,   20,    0,    0,    0,
498     0,    0,    0,  204,  204,   72,  212,  212,  212,  212,
499   212,    0,    0,    0,    0,    0,    0,   27,   28,    0,
500     0,    0,    0,    0,    0,    0,    0,   62,   62,   62,
501    62,    0,   62,   62,   62,   62,    0,    0,   62,   62,
502     0,  212,  187,  187,    0,  187,    0,  187,  187,   28,
503   187,  187,  187,    0,   62,   62,    0,    0,    0,    0,
504     0,    0,    0,    0,  187,  187,  187,  187,  187,    0,
505     0,  212,    0,  212,    0,    0,   62,   62,    0,    0,
506     0,    0,    0,    0,    0,    0,    0,    0,    0,    2,
507     3,    4,    5,    0,    6,    7,    8,    9,    0,  187,
508    63,   12,  212,  212,    0,  212,  212,  212,  212,  212,
509   212,  212,  212,    0,    0,    0,   19,   20,    0,    0,
510     0,    0,    0,  212,  212,  212,    0,  212,    0,  187,
511     0,  187,    0,    0,    0,    0,    0,    0,   27,   28,
512   179,  179,    0,    0,  179,  179,  179,  179,  179,    0,
513   179,    0,    0,    0,    0,    0,    0,    0,    0,  212,
514     0,  179,  179,  179,  179,  179,  179,    0,    0,    0,
515   113,  100,    0,    0,    0,  111,  109,    0,  110,    0,
516   112,    0,    0,    0,    0,    0,    0,    0,    0,  212,
517     0,  212,    0,  103,    0,  104,  179,  179,    0,  182,
518   182,    0,    0,  182,  182,  182,  182,  182,    0,  182,
519     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
520   182,  182,  182,  182,  182,  182,    0,  179,    0,  179,
521     0,    0,    0,  212,  212,  212,  212,  212,  212,  212,
522   212,  212,  212,  212,  212,  212,  212,  212,  212,  212,
523   212,    0,  212,  212,  212,  182,  182,  181,  181,   99,
524     0,  181,  181,  181,  181,  181,    0,  181,    0,    0,
525     0,    0,    0,    0,    0,    0,    0,    0,  181,  181,
526   181,  181,  181,  181,    0,    0,  182,    0,  182,    0,
527     0,  187,  187,  187,  187,  187,  187,  187,  187,  187,
528   187,  187,  187,  187,  187,  187,  187,  187,  187,    0,
529   187,  187,  187,  181,  181,    0,    0,    0,    0,    0,
530     0,    0,    0,    0,    0,    0,  183,  183,    0,    0,
531   183,  183,  183,  183,  183,    0,  183,    0,    0,    0,
532     0,    0,    0,    0,  181,    0,  181,  183,  183,  183,
533   183,  183,  183,    0,    0,    0,    0,    0,    0,    0,
534     0,  212,  212,  212,  212,  212,  212,  212,  212,    0,
535   212,  212,  212,    0,    0,    0,    0,    0,    0,    0,
536     0,    0,  183,  183,    0,    0,    0,    0,    0,  179,
537   179,  179,  179,  179,  179,  179,  179,  179,  179,  179,
538   179,  179,  179,  179,  179,  179,  179,    0,    0,    0,
539     0,    0,    0,  183,    0,  183,  184,  184,    0,    0,
540   184,  184,  184,  184,  184,    0,  184,    0,    0,    0,
541     0,  101,  102,  105,  106,  107,  108,  184,  184,  184,
542   184,  184,  184,    0,    0,    0,    0,    0,  182,  182,
543   182,  182,  182,  182,  182,  182,  182,  182,  182,  182,
544   182,  182,  182,  182,  182,  182,    0,    0,    0,    0,
545   185,  185,  184,  184,  185,  185,  185,  185,  185,    0,
546   185,    0,    0,    0,    0,    0,    0,    0,    0,    0,
547     0,  185,  185,  185,  185,  185,  185,    0,    0,    0,
548     0,    0,    0,  184,    0,  184,  181,  181,  181,  181,
549   181,  181,  181,  181,  181,  181,  181,  181,  181,  181,
550   181,  181,  181,  181,    0,    0,  185,  185,  113,  100,
551     0,    0,    0,  111,  109,    0,  110,    0,  112,  177,
552   177,    0,    0,  177,  177,  177,  177,  177,    0,  177,
553     0,  103,    0,  104,    0,    0,    0,  185,    0,  185,
554   177,  177,  177,    0,  177,  177,    0,    0,    0,    0,
555     0,    0,    0,    0,    0,  183,  183,  183,  183,  183,
556   183,  183,  183,  183,  183,  183,  183,  183,  183,  183,
557   183,  183,  183,    0,    0,  177,  177,  177,    0,    0,
558   177,  177,  177,  177,  177,    0,  177,    0,    0,    0,
559     0,    0,    0,    0,    0,    0,    0,  177,  177,  177,
560     0,  177,  177,    0,  113,  100,  177,    0,  177,  111,
561   109,    0,  110,    0,  112,    0,    0,    0,    0,    0,
562     0,    0,    0,    0,    0,  296,    0,  103,    0,  104,
563     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
564     0,    0,    0,    0,    0,  184,  184,  184,  184,  184,
565   184,  184,  184,  184,  184,  184,  184,  184,  184,  184,
566   184,  184,  184,  177,    0,  177,    0,  113,  100,    0,
567     0,    0,  111,  109,    0,  110,    0,  112,    0,    0,
568     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
569   103,   98,  104,   99,    0,    0,    0,    0,    0,  185,
570   185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
571   185,  185,  185,  185,  185,  185,  185,  113,  100,    0,
572     0,    0,  111,  109,    0,  110,    0,  112,    0,    0,
573     0,    0,    0,    0,    0,    0,    0,    0,  159,    0,
574   103,  159,  104,  159,  159,  159,    0,    0,    0,    0,
575     0,    0,    0,    0,   98,    0,   99,    0,  159,  159,
576   159,    0,  159,  159,    0,    0,    0,    0,    0,  101,
577   102,  105,  106,  107,  108,    0,    0,    0,  177,  177,
578   177,  177,  177,  177,  177,  177,    0,    0,    0,  160,
579     0,    0,  160,  159,  160,  160,  160,  161,    0,    0,
580   161,    0,    0,  161,   98,    0,   99,    0,    0,  160,
581   160,  160,    0,  160,  160,    0,    0,  161,  161,  161,
582     0,  161,  161,    0,  159,  162,  159,    0,  162,    0,
583     0,  162,    0,    0,    0,  177,  177,  177,  177,  177,
584   177,  177,  177,    0,  160,  162,  162,  162,    0,  162,
585   162,    0,  161,    0,    0,    0,    0,    0,    0,    0,
586     0,    0,    0,   96,   97,  101,  102,  105,  106,  107,
587   108,    0,    0,    0,    0,  160,    0,  160,    0,    0,
588   162,  163,    0,  161,  163,  161,    0,  163,    0,    0,
589     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
590     0,  163,  163,  163,    0,  163,  163,    0,    0,   30,
591     0,  162,    0,  162,    0,    0,    0,    0,  164,    0,
592     0,  164,    0,    0,  164,    0,   96,   97,  101,  102,
593   105,  106,  107,  108,    0,    0,  163,    0,  164,  164,
594   164,    0,  164,  164,    0,    0,    0,    0,    0,    0,
595   165,    0,    0,  165,    0,    0,  165,    0,    0,    0,
596    31,    0,    0,    0,    0,    0,    0,  163,    0,  163,
597   165,  165,  165,  164,  165,  165,    0,   97,  101,  102,
598   105,  106,  107,  108,    0,    0,    0,  166,    0,    0,
599   166,    0,    0,  166,    0,    0,  159,  159,  159,  159,
600   159,  159,  159,  159,  164,  165,  164,  166,  166,  166,
601   167,  166,  166,  167,    0,    0,  167,    0,    0,  168,
602     0,    0,  168,    0,    0,  168,    0,    0,    0,    0,
603   167,  167,    0,    0,    0,  167,  165,    0,  165,  168,
604   168,    0,  166,    0,  168,    0,    0,  160,  160,  160,
605   160,  160,  160,  160,  160,  161,  161,  161,  161,  161,
606   161,  161,  161,    0,    0,  167,    0,    0,    0,    0,
607     0,    0,    0,  166,  168,  166,    0,    0,    0,    0,
608     0,    0,    0,  162,  162,  162,  162,  162,  162,  162,
609   162,    0,    0,    0,    0,    0,  167,  169,  167,    0,
610   169,    0,    0,  169,    0,  168,    0,  168,    0,    0,
611     0,    0,    0,    0,    0,    0,    0,  169,  169,    0,
612     0,    0,  169,    0,    0,    0,    2,    3,    4,    5,
613     0,    6,    7,    8,    9,    0,    0,   63,   12,  163,
614   163,  163,  163,  163,  163,    0,    0,    0,    0,    0,
615     0,    0,  169,   19,   20,    0,    0,    0,    0,    0,
616     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
617     0,    0,    0,    0,    0,    0,  164,  164,  164,  164,
618   164,  164,    0,  169,    0,  169,    0,    0,    0,    0,
619     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
620     0,    0,    0,    0,    0,    0,    0,    0,  165,  165,
621   165,  165,  165,  165,    0,    0,    0,    0,    0,    0,
622     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
623     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
624     0,    0,    0,    0,    0,  166,  166,  166,  166,  166,
625   166,    0,    0,    0,    0,    0,    0,    0,    0,    0,
626     0,    0,    0,    0,    0,    0,    0,    0,  167,  167,
627   167,  167,    0,    0,    0,    0,    0,  168,  168,  168,
628   168,    0,    0,    0,    0,    0,    0,    0,    0,    0,
629     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
630     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
631     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
632     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
633     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
634     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
635     0,    0,    0,    0,    0,  169,  169,
636 };
637 static short yycheck[] = {                                      16,
638     0,  125,   42,   40,    0,   16,   93,    0,    0,   46,
639    16,  133,  197,   44,   40,  199,   16,   34,   41,   40,
640    40,   44,   38,   34,   59,   25,  146,  256,   34,  268,
641   269,  358,   49,   40,   34,   58,   59,   59,   41,  268,
642    63,   44,  307,  370,  309,   19,   20,   47,  268,   49,
643    50,   47,  268,   44,   50,   47,   40,   59,   50,   38,
644    41,  186,   93,   44,   41,  148,  272,   44,   59,   43,
645    93,   33,   46,  156,   44,   40,   38,   58,   40,   41,
646    42,   43,   59,   45,  270,  271,  351,  272,   58,   59,
647    93,  211,   98,   99,  100,  101,  102,  103,  104,  105,
648   106,  107,  108,  109,  110,  111,  112,  113,   82,   83,
649   127,   59,   93,   59,   88,   89,   90,   59,  302,  274,
650   126,  305,  244,   41,  275,   33,   44,  127,    0,   91,
651    38,  256,   40,  258,   42,   43,  276,   45,   58,  123,
652    58,  141,  148,  143,  268,  141,   59,  143,   58,  141,
653   156,  143,  152,  159,   41,   41,  152,   44,   44,   44,
654   152,   33,  168,  169,  126,   44,   38,   44,   40,  256,
655    42,   43,   59,   45,   59,   41,  150,  151,   44,  153,
656    59,   41,   59,   91,   44,   41,   44,  193,   44,    0,
657    59,  197,   58,   59,  270,  271,  321,   63,  215,   59,
658   217,   59,   58,   59,  221,  205,  202,   63,  272,  205,
659   274,  275,  276,  205,   59,  215,   58,  217,  126,   91,
660    59,  221,   33,   41,  230,  199,   44,   38,  268,   40,
661   256,   42,   43,   93,   45,  256,  256,   93,   37,   41,
662   256,   59,  242,   42,   43,   94,   45,  253,   47,  256,
663    37,  123,  268,  125,  126,   42,   43,  268,   45,  265,
664    47,   60,  268,   62,  270,  271,  272,  283,  305,  306,
665   307,  354,  256,  296,  291,   93,  293,  294,   63,  272,
666    91,  274,  275,  276,  256,   41,  260,   41,   44,  268,
667    44,  291,  268,  293,  294,  257,  258,  259,  260,  268,
668   262,  263,  264,  265,  283,   59,  268,  269,   81,   61,
669    41,  256,  123,   44,  125,  126,  316,  317,  268,  268,
670   316,  317,  284,  285,  316,  256,   33,   93,   59,   37,
671   347,   38,   63,   40,   42,   42,   43,   41,   45,   47,
672    44,  268,   94,   41,  306,  307,   44,  347,  354,  257,
673   258,  259,  260,  268,  262,  263,  264,  265,  358,  256,
674   268,  269,  358,  337,   44,   41,  139,  140,   44,  268,
675   370,  371,   23,   24,  370,  371,  284,  285,   41,  371,
676   141,   44,  143,  123,   91,  257,  258,  259,  260,   59,
677   262,  263,  264,  265,  274,  267,  268,  269,  306,  307,
678   272,  273,  274,  275,  276,  277,  278,  279,  280,  281,
679   282,   58,  284,  285,   65,   66,  123,   61,  191,  126,
680    33,   41,  195,  196,   44,   38,  287,   40,  289,   42,
681    43,   59,   45,   44,  306,  307,   59,   44,   58,   59,
682   296,  297,   61,  268,  205,   44,  257,  258,  259,  260,
683    44,  262,  263,  264,  265,   44,  267,  268,  269,  232,
684   125,  272,  268,  274,  275,  276,  277,  278,  279,  280,
685   281,  282,   41,  284,  285,   44,   41,  268,   91,   44,
686    41,   44,  255,   44,  257,  346,  268,   61,  261,   58,
687    59,   59,   59,   58,   59,  306,  307,   58,   59,  273,
688   273,  300,  301,  302,  303,  366,   58,   44,  268,   59,
689   123,   41,  125,  126,   59,  302,  303,   41,   33,   41,
690   281,   41,  283,   38,   93,   40,  192,   42,   43,   41,
691    45,   41,   93,  306,  286,  287,  288,  289,  290,  291,
692   292,  293,  294,  295,   41,  318,  319,   41,   41,  256,
693   257,  258,  259,  260,  271,  262,  263,  264,  265,   37,
694   267,  268,  269,  141,   42,   43,  354,   45,  159,   47,
695   277,  278,  279,  280,  281,  282,   91,  284,  285,   40,
696    41,  323,   60,   44,   62,  347,   37,    0,  142,  362,
697   363,   42,   43,  201,   45,  360,   47,   58,   59,  306,
698   307,  308,  193,  312,  283,  339,  197,  307,  123,   -1,
699   125,  126,   33,   41,   -1,   41,   44,   38,   44,   40,
700    -1,   42,   43,   -1,   45,   -1,   -1,   -1,   -1,   -1,
701    58,   59,   58,   59,   21,   22,   -1,   -1,   -1,   26,
702    27,   28,   -1,  256,  257,  258,  259,  260,   -1,  262,
703   263,  264,  265,   -1,  267,  268,  269,   -1,   -1,  272,
704    -1,  274,  275,  276,  277,  278,  279,  280,  281,  282,
705    91,  284,  285,   -1,  265,   -1,   -1,  268,   33,  270,
706   271,  272,   -1,   38,   -1,   40,   -1,   42,   43,   -1,
707    45,   -1,   -1,  306,  307,  270,  271,  272,   -1,  274,
708   275,  276,  123,   -1,  125,  126,   -1,   -1,   -1,   -1,
709    -1,   -1,   -1,   -1,   33,   -1,   -1,   -1,   -1,   38,
710    -1,   40,   -1,   42,   43,   -1,   45,   -1,   -1,   -1,
711    -1,   -1,   -1,   -1,   -1,   -1,   91,   -1,   -1,   -1,
712    59,  256,  257,  258,  259,  260,   -1,  262,  263,  264,
713   265,   -1,  267,  268,  269,   -1,   -1,   -1,   -1,   -1,
714    -1,   -1,  277,  278,  279,  280,  281,  282,  123,  284,
715   285,  126,   91,   -1,   -1,   33,   -1,   -1,   -1,   -1,
716    38,   -1,   40,   -1,   42,   43,   -1,   45,   -1,   37,
717    38,  306,  307,   -1,   42,   43,   -1,   45,   -1,   47,
718    -1,   -1,   -1,   -1,  123,   -1,   -1,  126,   -1,   -1,
719    -1,   -1,   60,   -1,   62,   -1,   -1,   -1,   -1,   -1,
720   298,  299,  300,  301,  302,  303,   -1,   -1,   -1,   -1,
721    -1,   -1,   -1,   91,   -1,   -1,  257,  258,  259,  260,
722    -1,  262,  263,  264,  265,   -1,  267,  268,  269,   -1,
723    -1,   -1,   -1,   -1,   -1,   -1,  277,  278,  279,  280,
724   281,  282,   33,  284,  285,  123,   -1,   38,  126,   40,
725    41,   42,   43,   44,   45,   -1,  124,   -1,  126,   -1,
726    -1,   -1,   -1,   -1,   -1,  306,  307,   58,   -1,   -1,
727    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
728    -1,  256,  257,  258,  259,  260,   -1,  262,  263,  264,
729   265,   -1,  267,  268,  269,   -1,   -1,   -1,   -1,   -1,
730    91,   -1,  277,  278,  279,  280,  281,  282,   -1,  284,
731   285,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  257,  258,
732   259,  260,   -1,  262,  263,  264,  265,   -1,  267,  268,
733   269,  306,  307,   -1,   -1,  126,   -1,   -1,  277,  278,
734   279,  280,  281,  282,   -1,  284,  285,   33,   -1,   -1,
735    -1,   -1,   38,   -1,   40,   41,   42,   43,   44,   45,
736    -1,   -1,   -1,   -1,   -1,   -1,   -1,  306,  307,   -1,
737    -1,   -1,   58,   -1,   -1,   41,   -1,   -1,   44,  257,
738   258,  259,  260,   -1,  262,  263,  264,  265,   -1,  267,
739   268,  269,   58,   59,   -1,   -1,   -1,   63,   -1,  277,
740   278,  279,  280,  281,  282,   91,  284,  285,   -1,   -1,
741    -1,   -1,   33,   -1,   -1,   -1,   -1,   38,   -1,   40,
742    -1,   42,   43,   -1,   45,   -1,   -1,   93,  306,  307,
743   298,  299,  300,  301,  302,  303,   -1,   -1,   59,   -1,
744   126,   -1,   33,   -1,   -1,   -1,   -1,   38,   -1,   40,
745    -1,   42,   43,   -1,   45,   -1,   -1,   -1,  124,   -1,
746   126,   -1,   -1,   -1,   -1,   -1,  257,  258,  259,  260,
747    91,  262,  263,  264,  265,   33,   -1,  268,  269,   -1,
748    38,   -1,   40,   -1,   42,   43,   -1,   45,   -1,   -1,
749    -1,   -1,  283,  284,  285,   -1,   -1,   -1,   -1,   -1,
750    91,   -1,   -1,   -1,   -1,  126,   -1,   -1,   -1,   -1,
751    -1,   -1,   -1,   -1,   -1,  306,  307,   -1,   -1,   -1,
752    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   33,
753    -1,   -1,   -1,   91,   38,  126,   40,   -1,   42,   43,
754    -1,   45,   -1,   -1,   -1,   -1,   -1,   33,   -1,   -1,
755    -1,   -1,   38,   -1,   40,   -1,   42,   43,   -1,   45,
756    -1,   -1,   -1,   41,   -1,   -1,   44,   -1,  126,   -1,
757    -1,  257,  258,  259,  260,   -1,  262,  263,  264,  265,
758    58,   59,  268,  269,   -1,   63,   -1,   91,   -1,   -1,
759    -1,   -1,   -1,   -1,   -1,   -1,   -1,  283,  284,  285,
760    -1,   -1,   33,   -1,   -1,   91,   -1,   38,   -1,   40,
761    -1,   42,   43,   -1,   45,   93,   -1,   -1,   -1,   -1,
762   306,  307,  126,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
763   296,  297,   -1,   -1,   -1,   -1,  257,  258,  259,  260,
764   126,  262,  263,  264,  265,   -1,  124,  268,  269,   -1,
765    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
766    91,   -1,   -1,  284,  285,  256,  257,  258,  259,  260,
767    -1,  262,  263,  264,  265,   -1,   -1,  268,  269,   -1,
768    -1,   -1,   -1,   -1,   -1,  306,  307,   -1,   -1,   -1,
769    -1,   -1,   -1,  284,  285,  126,   -1,   -1,   -1,  257,
770   258,  259,  260,   -1,  262,  263,  264,  265,   -1,   -1,
771   268,  269,   -1,   -1,   -1,  306,  307,   -1,   -1,   -1,
772    -1,   -1,   -1,   -1,   -1,  283,  284,  285,   -1,   33,
773    -1,   -1,   -1,   -1,   38,   -1,   40,   -1,   42,   43,
774    -1,   45,   -1,   -1,   -1,   -1,   -1,   -1,  306,  307,
775    -1,   -1,  256,  257,  258,  259,  260,   -1,  262,  263,
776   264,  265,   -1,   -1,  268,  269,   -1,   -1,   -1,   -1,
777   256,  257,  258,  259,  260,   -1,  262,  263,  264,  265,
778   284,  285,  268,  269,   33,   -1,   -1,   91,   -1,   38,
779    -1,   40,   -1,   42,   43,   -1,   45,   -1,  284,  285,
780    -1,   -1,  306,  307,   -1,   -1,   -1,   -1,   -1,   -1,
781    59,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  296,  297,
782   306,  307,  126,   -1,   -1,  256,  257,  258,  259,  260,
783    -1,  262,  263,  264,  265,   -1,   33,  268,  269,   -1,
784    -1,   38,   91,   40,   -1,   42,   43,   -1,   45,   -1,
785    33,   -1,   -1,  284,  285,   38,   -1,   40,   -1,   42,
786    43,   -1,   45,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
787    -1,   -1,   -1,   -1,   -1,  306,  307,  126,   -1,   -1,
788    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
789    33,   -1,   -1,   -1,   91,   38,   -1,   40,   -1,   42,
790    43,   -1,   45,   -1,   33,   -1,   -1,   -1,   91,   38,
791    -1,   40,   -1,   42,   43,   58,   45,   -1,   -1,   -1,
792    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  126,
793    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
794    -1,   -1,   -1,  126,   -1,   -1,   -1,   -1,   91,   -1,
795    -1,   -1,  256,  257,  258,  259,  260,   -1,  262,  263,
796   264,  265,   91,   33,  268,  269,   -1,   -1,   38,   -1,
797    40,   -1,   42,   43,   -1,   45,   -1,   -1,   -1,   -1,
798   284,  285,   -1,  126,   -1,   -1,   -1,   -1,   -1,   -1,
799    -1,   -1,   -1,   -1,   -1,   -1,   -1,  126,   -1,   -1,
800    -1,   -1,  306,  307,   -1,   -1,   -1,   -1,  257,  258,
801   259,  260,   -1,  262,  263,  264,  265,   -1,   -1,  268,
802   269,   91,   -1,   -1,   -1,   33,   -1,   -1,   -1,   -1,
803    38,   -1,   40,   -1,   42,  284,  285,   -1,   -1,   -1,
804    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
805    -1,   -1,   -1,   -1,   -1,   -1,  126,  306,  307,  256,
806   257,  258,  259,  260,   -1,  262,  263,  264,  265,   -1,
807    -1,  268,  269,   -1,  257,  258,  259,  260,   -1,  262,
808   263,  264,  265,   91,   -1,  268,  269,  284,  285,   -1,
809    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
810    -1,  284,  285,   -1,   -1,   -1,   -1,   -1,   -1,  306,
811   307,   -1,   -1,   -1,  257,  258,  259,  260,  126,  262,
812   263,  264,  265,  306,  307,  268,  269,   -1,  257,  258,
813   259,  260,   -1,  262,  263,  264,  265,   -1,   -1,  268,
814   269,  284,  285,   -1,   37,   38,   -1,   40,   -1,   42,
815    43,   44,   45,   46,   47,  284,  285,   -1,   -1,   -1,
816    -1,   -1,   -1,  306,  307,   58,   59,   60,   61,   62,
817    63,   -1,   -1,   -1,   -1,   -1,   -1,  306,  307,   -1,
818    -1,   -1,   -1,   -1,   -1,   -1,   -1,  257,  258,  259,
819   260,   -1,  262,  263,  264,  265,   -1,   -1,  268,  269,
820    -1,   94,   37,   38,   -1,   40,   -1,   42,   43,   44,
821    45,   46,   47,   -1,  284,  285,   -1,   -1,   -1,   -1,
822    -1,   -1,   -1,   -1,   59,   60,   61,   62,   63,   -1,
823    -1,  124,   -1,  126,   -1,   -1,  306,  307,   -1,   -1,
824    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  257,
825   258,  259,  260,   -1,  262,  263,  264,  265,   -1,   94,
826   268,  269,   37,   38,   -1,   40,   41,   42,   43,   44,
827    45,   46,   47,   -1,   -1,   -1,  284,  285,   -1,   -1,
828    -1,   -1,   -1,   58,   59,   60,   -1,   62,   -1,  124,
829    -1,  126,   -1,   -1,   -1,   -1,   -1,   -1,  306,  307,
830    37,   38,   -1,   -1,   41,   42,   43,   44,   45,   -1,
831    47,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   94,
832    -1,   58,   59,   60,   61,   62,   63,   -1,   -1,   -1,
833    37,   38,   -1,   -1,   -1,   42,   43,   -1,   45,   -1,
834    47,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  124,
835    -1,  126,   -1,   60,   -1,   62,   93,   94,   -1,   37,
836    38,   -1,   -1,   41,   42,   43,   44,   45,   -1,   47,
837    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
838    58,   59,   60,   61,   62,   63,   -1,  124,   -1,  126,
839    -1,   -1,   -1,  286,  287,  288,  289,  290,  291,  292,
840   293,  294,  295,  296,  297,  298,  299,  300,  301,  302,
841   303,   -1,  305,  306,  307,   93,   94,   37,   38,  126,
842    -1,   41,   42,   43,   44,   45,   -1,   47,   -1,   -1,
843    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   58,   59,
844    60,   61,   62,   63,   -1,   -1,  124,   -1,  126,   -1,
845    -1,  286,  287,  288,  289,  290,  291,  292,  293,  294,
846   295,  296,  297,  298,  299,  300,  301,  302,  303,   -1,
847   305,  306,  307,   93,   94,   -1,   -1,   -1,   -1,   -1,
848    -1,   -1,   -1,   -1,   -1,   -1,   37,   38,   -1,   -1,
849    41,   42,   43,   44,   45,   -1,   47,   -1,   -1,   -1,
850    -1,   -1,   -1,   -1,  124,   -1,  126,   58,   59,   60,
851    61,   62,   63,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
852    -1,  296,  297,  298,  299,  300,  301,  302,  303,   -1,
853   305,  306,  307,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
854    -1,   -1,   93,   94,   -1,   -1,   -1,   -1,   -1,  286,
855   287,  288,  289,  290,  291,  292,  293,  294,  295,  296,
856   297,  298,  299,  300,  301,  302,  303,   -1,   -1,   -1,
857    -1,   -1,   -1,  124,   -1,  126,   37,   38,   -1,   -1,
858    41,   42,   43,   44,   45,   -1,   47,   -1,   -1,   -1,
859    -1,  298,  299,  300,  301,  302,  303,   58,   59,   60,
860    61,   62,   63,   -1,   -1,   -1,   -1,   -1,  286,  287,
861   288,  289,  290,  291,  292,  293,  294,  295,  296,  297,
862   298,  299,  300,  301,  302,  303,   -1,   -1,   -1,   -1,
863    37,   38,   93,   94,   41,   42,   43,   44,   45,   -1,
864    47,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
865    -1,   58,   59,   60,   61,   62,   63,   -1,   -1,   -1,
866    -1,   -1,   -1,  124,   -1,  126,  286,  287,  288,  289,
867   290,  291,  292,  293,  294,  295,  296,  297,  298,  299,
868   300,  301,  302,  303,   -1,   -1,   93,   94,   37,   38,
869    -1,   -1,   -1,   42,   43,   -1,   45,   -1,   47,   37,
870    38,   -1,   -1,   41,   42,   43,   44,   45,   -1,   47,
871    -1,   60,   -1,   62,   -1,   -1,   -1,  124,   -1,  126,
872    58,   59,   60,   -1,   62,   63,   -1,   -1,   -1,   -1,
873    -1,   -1,   -1,   -1,   -1,  286,  287,  288,  289,  290,
874   291,  292,  293,  294,  295,  296,  297,  298,  299,  300,
875   301,  302,  303,   -1,   -1,   93,   37,   38,   -1,   -1,
876    41,   42,   43,   44,   45,   -1,   47,   -1,   -1,   -1,
877    -1,   -1,   -1,   -1,   -1,   -1,   -1,   58,   59,   60,
878    -1,   62,   63,   -1,   37,   38,  124,   -1,  126,   42,
879    43,   -1,   45,   -1,   47,   -1,   -1,   -1,   -1,   -1,
880    -1,   -1,   -1,   -1,   -1,   58,   -1,   60,   -1,   62,
881    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
882    -1,   -1,   -1,   -1,   -1,  286,  287,  288,  289,  290,
883   291,  292,  293,  294,  295,  296,  297,  298,  299,  300,
884   301,  302,  303,  124,   -1,  126,   -1,   37,   38,   -1,
885    -1,   -1,   42,   43,   -1,   45,   -1,   47,   -1,   -1,
886    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
887    60,  124,   62,  126,   -1,   -1,   -1,   -1,   -1,  286,
888   287,  288,  289,  290,  291,  292,  293,  294,  295,  296,
889   297,  298,  299,  300,  301,  302,  303,   37,   38,   -1,
890    -1,   -1,   42,   43,   -1,   45,   -1,   47,   -1,   -1,
891    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   38,   -1,
892    60,   41,   62,   43,   44,   45,   -1,   -1,   -1,   -1,
893    -1,   -1,   -1,   -1,  124,   -1,  126,   -1,   58,   59,
894    60,   -1,   62,   63,   -1,   -1,   -1,   -1,   -1,  298,
895   299,  300,  301,  302,  303,   -1,   -1,   -1,  296,  297,
896   298,  299,  300,  301,  302,  303,   -1,   -1,   -1,   38,
897    -1,   -1,   41,   93,   43,   44,   45,   38,   -1,   -1,
898    41,   -1,   -1,   44,  124,   -1,  126,   -1,   -1,   58,
899    59,   60,   -1,   62,   63,   -1,   -1,   58,   59,   60,
900    -1,   62,   63,   -1,  124,   38,  126,   -1,   41,   -1,
901    -1,   44,   -1,   -1,   -1,  296,  297,  298,  299,  300,
902   301,  302,  303,   -1,   93,   58,   59,   60,   -1,   62,
903    63,   -1,   93,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
904    -1,   -1,   -1,  296,  297,  298,  299,  300,  301,  302,
905   303,   -1,   -1,   -1,   -1,  124,   -1,  126,   -1,   -1,
906    93,   38,   -1,  124,   41,  126,   -1,   44,   -1,   -1,
907    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
908    -1,   58,   59,   60,   -1,   62,   63,   -1,   -1,   40,
909    -1,  124,   -1,  126,   -1,   -1,   -1,   -1,   38,   -1,
910    -1,   41,   -1,   -1,   44,   -1,  296,  297,  298,  299,
911   300,  301,  302,  303,   -1,   -1,   93,   -1,   58,   59,
912    60,   -1,   62,   63,   -1,   -1,   -1,   -1,   -1,   -1,
913    38,   -1,   -1,   41,   -1,   -1,   44,   -1,   -1,   -1,
914    91,   -1,   -1,   -1,   -1,   -1,   -1,  124,   -1,  126,
915    58,   59,   60,   93,   62,   63,   -1,  297,  298,  299,
916   300,  301,  302,  303,   -1,   -1,   -1,   38,   -1,   -1,
917    41,   -1,   -1,   44,   -1,   -1,  296,  297,  298,  299,
918   300,  301,  302,  303,  124,   93,  126,   58,   59,   60,
919    38,   62,   63,   41,   -1,   -1,   44,   -1,   -1,   38,
920    -1,   -1,   41,   -1,   -1,   44,   -1,   -1,   -1,   -1,
921    58,   59,   -1,   -1,   -1,   63,  124,   -1,  126,   58,
922    59,   -1,   93,   -1,   63,   -1,   -1,  296,  297,  298,
923   299,  300,  301,  302,  303,  296,  297,  298,  299,  300,
924   301,  302,  303,   -1,   -1,   93,   -1,   -1,   -1,   -1,
925    -1,   -1,   -1,  124,   93,  126,   -1,   -1,   -1,   -1,
926    -1,   -1,   -1,  296,  297,  298,  299,  300,  301,  302,
927   303,   -1,   -1,   -1,   -1,   -1,  124,   38,  126,   -1,
928    41,   -1,   -1,   44,   -1,  124,   -1,  126,   -1,   -1,
929    -1,   -1,   -1,   -1,   -1,   -1,   -1,   58,   59,   -1,
930    -1,   -1,   63,   -1,   -1,   -1,  257,  258,  259,  260,
931    -1,  262,  263,  264,  265,   -1,   -1,  268,  269,  296,
932   297,  298,  299,  300,  301,   -1,   -1,   -1,   -1,   -1,
933    -1,   -1,   93,  284,  285,   -1,   -1,   -1,   -1,   -1,
934    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
935    -1,   -1,   -1,   -1,   -1,   -1,  296,  297,  298,  299,
936   300,  301,   -1,  124,   -1,  126,   -1,   -1,   -1,   -1,
937    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
938    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  296,  297,
939   298,  299,  300,  301,   -1,   -1,   -1,   -1,   -1,   -1,
940    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
941    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
942    -1,   -1,   -1,   -1,   -1,  296,  297,  298,  299,  300,
943   301,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
944    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  296,  297,
945   298,  299,   -1,   -1,   -1,   -1,   -1,  296,  297,  298,
946   299,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
947    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
948    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
949    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
950    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
951    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
952    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
953    -1,   -1,   -1,   -1,   -1,  296,  297,
954 };
955 #define YYFINAL 33
956 #ifndef YYDEBUG
957 #define YYDEBUG 0
958 #endif
959 #define YYMAXTOKEN 308
960 #if YYDEBUG
961 static char *yyname[] = {
962 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
963 "'!'",0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0,0,
964 0,0,0,0,0,0,0,"':'","';'","'<'","'='","'>'","'?'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
965 0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,"']'","'^'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
966 0,0,0,0,0,0,0,0,0,0,"'{'","'|'","'}'","'~'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
967 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
968 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
969 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"CHAR","SHORT",
970 "INT","LONG","CHAR_ERR","FLOAT","DOUBLE","IMAGINARY","STRING","STRING_ERR",
971 "SYSCALL","NAME","RFNAME","FUNC","STRUCT","IF","ELSE","WHILE","DO","FOR","GOTO",
972 "CONTINUE","BREAK","RETURN","EXTERN","LOCAL","DOTDOT","NEXT_ARG","MORE_ARGS",
973 "PEQ","MEQ","TMSEQ","DIVEQ","MODEQ","SHLEQ","SHREQ","ANDEQ","XOREQ","OREQ","OR",
974 "AND","EQ","NE","LE","GE","SHL","SHR","UNARY","ARROW","PLUSPLUS","MINUSMINUS",
975 "NOINPUT",
976 };
977 static char *yyrule[] = {
978 "$accept : program_unit",
979 "program_unit : NOINPUT",
980 "program_unit : main_program",
981 "program_unit : openCS FUNC func_name compound",
982 "program_unit : openCS FUNC func_name openP param_list closeP_wait compound",
983 "program_unit : openCS STRUCT struct_name openC declar_list closeC",
984 "program_unit : openCS FUNC func_name openP error closeP compound",
985 "program_unit : openCS FUNC func_name error",
986 "program_unit : openCS STRUCT struct_name openC error closeC",
987 "program_unit : openCS STRUCT error",
988 "main_program : statement",
989 "main_program : EXTERN RFNAME ';'",
990 "main_program : main_program statement",
991 "main_program : error ';'",
992 "openCS :",
993 "openP : '('",
994 "closeP : ')'",
995 "openB : '['",
996 "closeB : ']'",
997 "openC : '{' optional_semi",
998 "closeC : '}' optional_semi",
999 "optional_semi :",
1000 "optional_semi : ';'",
1001 "statement : EXTERN extern_vars ';'",
1002 "statement : LOCAL local_vars ';'",
1003 "statement : SYSCALL ';'",
1004 "statement : compound",
1005 "statement : assign_expr ';'",
1006 "$$1 :",
1007 "statement : variable $$1 arg_sep lj_arg_list ';'",
1008 "statement : if_test IF openP assign_expr brfalse closeP_wait statement if_done",
1009 "$$2 :",
1010 "statement : if_test IF openP assign_expr brfalse closeP_wait statement if_done ELSE $$2 branch statement",
1011 "statement : wloop WHILE openP assign_expr brfalse closeP_wait nil_statement",
1012 "statement : dloop DO statement WHILE openP assign_expr closeP ';'",
1013 "statement : floop FOR openP for_expr ';' assign_expr brfalse ';' inc_expr closeP_wait nil_statement",
1014 "statement : floop FOR openP for_expr ';' ';' inc_expr closeP_wait nil_statement",
1015 "statement : CONTINUE ';'",
1016 "statement : BREAK ';'",
1017 "statement : RETURN ';'",
1018 "statement : RETURN assign_expr ';'",
1019 "statement : RETURN range_expr ';'",
1020 "statement : GOTO NAME ';'",
1021 "statement : NAME lab_delim",
1022 "statement : if_test IF openP error closeP",
1023 "statement : if_test IF error",
1024 "statement : wloop WHILE openP error closeP",
1025 "statement : wloop WHILE error",
1026 "statement : dloop DO statement WHILE openP error closeP",
1027 "statement : dloop DO statement WHILE error",
1028 "statement : dloop DO error ';'",
1029 "statement : floop FOR openP error closeP",
1030 "statement : floop FOR error",
1031 "nil_statement : ';'",
1032 "nil_statement : statement",
1033 "compound : openC closeC",
1034 "compound : openC statement_list closeC",
1035 "compound : openC error closeC",
1036 "compound : openC error statement_list closeC",
1037 "statement_list : statement",
1038 "statement_list : statement_list statement",
1039 "branch :",
1040 "brfalse :",
1041 "brtrue :",
1042 "branch_pop :",
1043 "$$3 :",
1044 "closeP_wait : $$3 closeP",
1045 "if_test :",
1046 "if_done :",
1047 "wloop :",
1048 "dloop :",
1049 "floop :",
1050 "$$4 :",
1051 "lab_delim : $$4 ':'",
1052 "declar_list : data_type declarators ';'",
1053 "declar_list : declar_list data_type declarators ';'",
1054 "data_type : NAME",
1055 "declarators : declarator",
1056 "declarators : declarators ',' declarator",
1057 "declarator : pointer member",
1058 "declarator : pointer member openP expr_list closeP",
1059 "declarator : pointer member openP error closeP",
1060 "pointer :",
1061 "pointer : pointer '*'",
1062 "expr_list : expr",
1063 "expr_list : simple_range",
1064 "expr_list : expr_list ',' expr",
1065 "member : NAME",
1066 "func_name : NAME",
1067 "$$5 :",
1068 "struct_name : $$5 variable",
1069 "param_list : positionals",
1070 "param_list : positionals ',' keywords",
1071 "param_list : keywords",
1072 "param_list : dot_dot",
1073 "param_list : positionals ',' dot_dot",
1074 "param_list : positionals ',' dot_dot ',' keywords",
1075 "param_list : dot_dot ',' keywords",
1076 "positionals : NAME",
1077 "positionals : positionals ',' NAME",
1078 "positionals : '&' NAME",
1079 "positionals : positionals ',' '&' NAME",
1080 "keywords : NAME '='",
1081 "keywords : keywords ',' NAME '='",
1082 "dot_dot : DOTDOT",
1083 "$$6 :",
1084 "arg_list : $$6 func_arg_list",
1085 "$$7 :",
1086 "arg_sep : $$7 ','",
1087 "func_arg_list : lj_arg_list",
1088 "func_arg_list : rj_arg_list",
1089 "func_arg_list : lj_arg_list arg_sep rj_arg_list",
1090 "lj_arg_list : key_expr",
1091 "lj_arg_list : lj_arg_list arg_sep key_expr",
1092 "rj_arg_list : dotdot",
1093 "rj_arg_list : dotdot ',' lj_arg_list",
1094 "dotdot : DOTDOT",
1095 "dotdot : '*'",
1096 "key_expr : nil_expr",
1097 "key_expr : range_expr",
1098 "key_expr : NAME '=' nil_expr",
1099 "key_expr : NAME '=' range_expr",
1100 "nil_expr :",
1101 "nil_expr : expr",
1102 "range_expr : simple_range",
1103 "range_expr : range_func",
1104 "range_expr : range_func ':'",
1105 "range_expr : range_func ':' simple_range",
1106 "simple_range : nil_expr ':' nil_expr",
1107 "simple_range : nil_expr ':' nil_expr ':' nil_expr",
1108 "range_func : RFNAME",
1109 "range_func : '+'",
1110 "range_func : '-'",
1111 "extern_vars : NAME",
1112 "extern_vars : extern_vars ',' NAME",
1113 "local_vars : NAME",
1114 "local_vars : local_vars ',' NAME",
1115 "assign_expr : cond_expr",
1116 "assign_expr : assign_predicate assign_expr",
1117 "assign_expr : assign_predicate range_expr",
1118 "assign_expr : unary_expr assign_op assign_expr",
1119 "assign_predicate : unary_expr '='",
1120 "assign_op : PEQ",
1121 "assign_op : MEQ",
1122 "assign_op : TMSEQ",
1123 "assign_op : DIVEQ",
1124 "assign_op : MODEQ",
1125 "assign_op : SHLEQ",
1126 "assign_op : SHREQ",
1127 "assign_op : ANDEQ",
1128 "assign_op : XOREQ",
1129 "assign_op : OREQ",
1130 "cond_expr : expr",
1131 "cond_expr : expr openCS '?' brfalse expr ':' branch_pop cond_expr",
1132 "cond_expr : expr openCS '?' error",
1133 "expr : pm_expr",
1134 "expr : expr '*' expr",
1135 "expr : expr '/' expr",
1136 "expr : expr '%' expr",
1137 "expr : expr '+' expr",
1138 "expr : expr '-' expr",
1139 "expr : expr SHL expr",
1140 "expr : expr SHR expr",
1141 "expr : expr '<' expr",
1142 "expr : expr '>' expr",
1143 "expr : expr LE expr",
1144 "expr : expr GE expr",
1145 "expr : expr EQ expr",
1146 "expr : expr NE expr",
1147 "expr : expr '&' expr",
1148 "expr : expr '~' expr",
1149 "expr : expr '|' expr",
1150 "expr : expr AND brfalse expr",
1151 "expr : expr OR brtrue expr",
1152 "pm_expr : term",
1153 "pm_expr : '+' term",
1154 "pm_expr : '-' term",
1155 "term : unary_expr",
1156 "term : unary_expr '^' expr",
1157 "unary_expr : basic_expr",
1158 "unary_expr : '*' unary_expr",
1159 "unary_expr : '&' basic_expr",
1160 "unary_expr : '~' basic_expr",
1161 "unary_expr : '!' basic_expr",
1162 "unary_expr : PLUSPLUS basic_expr",
1163 "unary_expr : MINUSMINUS basic_expr",
1164 "basic_expr : constant",
1165 "basic_expr : variable",
1166 "$$8 :",
1167 "basic_expr : basic_expr openP $$8 arg_list closeP",
1168 "basic_expr : rfname openP arg_list closeP",
1169 "basic_expr : NEXT_ARG openP closeP",
1170 "basic_expr : MORE_ARGS openP closeP",
1171 "basic_expr : openB get_pc expr_list closeB",
1172 "basic_expr : openB closeB",
1173 "basic_expr : basic_expr '.' NAME",
1174 "basic_expr : basic_expr ARROW NAME",
1175 "basic_expr : basic_expr PLUSPLUS",
1176 "basic_expr : basic_expr MINUSMINUS",
1177 "basic_expr : openP assign_expr closeP",
1178 "basic_expr : basic_expr openP error closeP",
1179 "basic_expr : rfname openP error closeP",
1180 "basic_expr : openB error closeB",
1181 "basic_expr : openP error closeP",
1182 "get_pc :",
1183 "for_expr :",
1184 "for_expr : assign_expr_list",
1185 "inc_expr :",
1186 "$$9 :",
1187 "inc_expr : $$9 assign_expr_list",
1188 "assign_expr_list : assign_expr",
1189 "assign_expr_list : assign_expr_list ',' assign_expr",
1190 "variable : NAME",
1191 "rfname : RFNAME",
1192 "constant : CHAR",
1193 "constant : SHORT",
1194 "constant : INT",
1195 "constant : LONG",
1196 "constant : FLOAT",
1197 "constant : DOUBLE",
1198 "constant : STRING",
1199 "constant : IMAGINARY",
1200 };
1201 #endif
1202 #define yyclearin (yychar=(-1))
1203 #define yyerrok (yyerrflag=0)
1204 #ifdef YYSTACKSIZE
1205 #ifndef YYMAXDEPTH
1206 #define YYMAXDEPTH YYSTACKSIZE
1207 #endif
1208 #else
1209 #ifdef YYMAXDEPTH
1210 #define YYSTACKSIZE YYMAXDEPTH
1211 #else
1212 #define YYSTACKSIZE 200
1213 #define YYMAXDEPTH 200
1214 #endif
1215 #endif
1216 #ifndef YYOVERFLOW
1217 #define YYOVERFLOW 10000
1218 #endif
1219 #if YYDEBUG
1220 static int yydebug;
1221 #endif
1222 static int yynerrs;
1223 static int yyerrflag;
1224 static int yychar;
1225 static short *yyssp;
1226 static YYSTYPE *yyvsp;
1227 static YYSTYPE yyval, yy_zero;
1228 static YYSTYPE yylval;
1229 static short *yyss= 0;
1230 static YYSTYPE *yyvs= 0;
1231 /* #define yystacksize YYSTACKSIZE */
1232 static long yystacksize= 0;
1233 /* End YACC grammar rules */
1234 /*--------------------------------------------------------------------------*/
1235 
1236 
1237 
1238 /*--------------------------------------------------------------------------*/
1239 /* Begin C code */
1240 
1241 static char *curLine, *nextChar= 0;
1242 static int curChar;
1243 static char *prevToken;
1244 
1245 static int prevWasSemi, prevWasComma, noInputYet;
1246 static char *quineBegin, *quineEnd, *quineText;
1247 
1248 static int EndOfLine(void);
1249 
1250 /* CheckMulti checks for multi-character special symbols.
1251    In the "multis" list, CheckMulti assumes that any 3 character
1252    symbol comes immediately after a matching 2 character symbol, AND
1253    no other symbols with the same FIRST character follow.
1254    More than one 3-symbol may not match a 2-symbol, and symbols of
1255    more than 3 characters are not allowed.  */
1256 static int CheckMulti(void);
1257 
1258 /* CheckName checks for reserved words and range function names.
1259    The "reserved" list must be alphabetized.  */
1260 static int CheckName(char *name);
1261 
1262 static char *AppendString(char *s, long ns, char *t, long nt);
1263 static int StringValue(int resuming);
1264 static int CharValue(void);
1265 static int NumberValue(void);
1266 
1267 /* CheckSyscall checks for $ system escape sequence */
1268 static int CheckSyscall(int resuming);
1269 
1270 /* ------------------------------ */
1271 
1272 static int yp_prev_state= 0;
1273 static int yp_keybd_input= 0;
1274 #define YP_KEYBD_INPUT 0x4000
1275 #define YP_EOL_EXPR 1
1276 #define YP_EOL_COMMENT 2
1277 #define YP_EOL_STRING 4
1278 #define YP_EOL_SYSCALL 8
1279 
1280 /* The context argument to YpNextLine determines how that routine will
1281  * prompt for input, if input is from a terminal.
1282  * NL_MAIN      -- read first line for parse
1283  * NL_NOINPUT   -- no non-comment input yet,
1284  *                   read next line (if file) or return EOF (if terminal)
1285  * NL_CONTINUE  -- need more input to complete program unit (cont>)
1286  * NL_QUOTE     -- inside multi-line quoted string (quot>)
1287  * NL_COMMENT   -- inside multi-line comment (comm>)
1288  */
1289 /* Since NL_NOINPUT cannot result in a prompt being issued, its "spot"
1290  * is used for the debugging mode prompt.  */
1291 static char *yp_prompts[]= { "> ", "dbug> ", "cont> ", "quot> ", "comm> " };
1292 
1293 extern void y_do_prompt(void);
1294 extern int ym_dbenter;
1295 
1296 void
y_do_prompt(void)1297 y_do_prompt(void)
1298 {
1299   extern int yDebugLevel;        /* declared in ydata.h */
1300   int i;
1301   if (yp_keybd_input & YP_EOL_COMMENT) i = NL_COMMENT;
1302   else if (yp_keybd_input & YP_EOL_STRING) i = NL_QUOTE;
1303   else if (yp_keybd_input & YP_EOL_SYSCALL) i = NL_QUOTE;
1304   else if (yp_keybd_input & YP_EOL_EXPR) i = NL_CONTINUE;
1305   else i = (yDebugLevel &&
1306             (!ym_dbenter || yDebugLevel>1))? NL_NOINPUT : NL_MAIN;
1307   p_stdout(yp_prompts[i]);
1308 }
1309 
1310 int
YpParse(void * func)1311 YpParse(void *func)
1312 {
1313   YpParseInit(func);
1314   nOpenCS= 0;    /* initialize number of open control structures */
1315   parenDepth= 0; /* initialize number of open parentheses/square brackets */
1316   braceDepth= 0; /* initialize number of open curly braces */
1317   needOperand= prevWasSemi= prevWasComma= supressSemi= 0; /* more EOL flags */
1318   nQuines= quining= 0;
1319   ypSkipIncludes= 0;  /* see ScanForFunc */
1320   curLine= nextChar= YpNextLine(NL_MAIN);
1321   prevToken= 0;
1322   if (!nextChar) return 0;
1323   noInputYet= 1;
1324 
1325   yp_keybd_input= 0;  /* YpParse no longer used to parse keyboard input */
1326   return yyparse_step(0);
1327 }
1328 
1329 int
yp_parse_keybd(char * line,int first)1330 yp_parse_keybd(char *line, int first)
1331 {
1332   if (first) {
1333     YpParseInit(0);
1334     nOpenCS= 0;    /* initialize number of open control structures */
1335     parenDepth= 0; /* initialize number of open parentheses/square brackets */
1336     braceDepth= 0; /* initialize number of open curly braces */
1337     needOperand= prevWasSemi= prevWasComma= supressSemi= 0; /* EOL flags */
1338     nQuines= quining= 0;
1339     ypSkipIncludes= 0;  /* see ScanForFunc */
1340     prevToken= 0;
1341     if (!line) return 0;
1342     noInputYet= 1;
1343     yp_prev_state= 0;
1344     yp_keybd_input= YP_KEYBD_INPUT;
1345   }
1346   curLine= nextChar= line;
1347   yp_prev_state= yyparse_step(yp_prev_state);
1348   if (noInputYet && yp_prev_state==0x2000 && !ypErrors &&
1349       !(yp_keybd_input&YP_EOL_COMMENT))
1350     yp_prev_state = 0;
1351   if (ypErrors) {
1352     curLine= nextChar= 0;
1353     yyparse_step(yp_prev_state);
1354     yp_prev_state= 1;
1355   }
1356   if (!(yp_prev_state & 0x6000)) yp_keybd_input= 0;
1357   return yp_prev_state;          /* 0 success, 1 error, else unfinished */
1358 }
1359 
1360 /* ------------------------------ */
1361 
1362 static char *multis[]= { "!=", "%=", "&&", "&=", "*=", "++", "+=",
1363   "--", "-=", "->", "..", "/=", "<<", "<<=", "<=", "==", ">=", ">>", ">>=",
1364   "|=", "||", "~=", "" };
1365 
1366 static int multiTypes[]= { NE, MODEQ, AND, ANDEQ, TMSEQ, PLUSPLUS, PEQ,
1367   MINUSMINUS, MEQ, ARROW, DOTDOT, DIVEQ, SHL, SHLEQ, LE, EQ, GE, SHR, SHREQ,
1368   OREQ, OR, XOREQ };
1369 
1370 static char *reserved[]= { "avg", "break", "continue", "cum", "dif", "do",
1371   "else", "extern", "for", "func", "goto", "if", "local", "max", "min", "mnx",
1372   "more_args", "mxx", "next_arg", "pcen", "psum", "ptp", "return", "rms",
1373   "struct", "sum", "uncp", "while", "zcen", "" };
1374 
1375 static int reservedTypes[]= { RFNAME, BREAK, CONTINUE, RFNAME, RFNAME, DO,
1376   ELSE, EXTERN, FOR, FUNC, GOTO, IF, LOCAL, RFNAME, RFNAME, RFNAME,
1377   MORE_ARGS, RFNAME, NEXT_ARG, RFNAME, RFNAME, RFNAME, RETURN, RFNAME,
1378   STRUCT, RFNAME, RFNAME, WHILE, RFNAME };
1379 
1380 static int reservedRFs[]= { 0, -1, -1, 1, 2, -1,
1381   -1, -1, -1, -1, -1, -1, -1, 3, 4, 5,
1382   -1, 6, -1, 7, 8, 9, -1, 10, -1, 11,
1383   12, -1, 13 };
1384 
1385 /* ------------------------------ */
1386 
EndOfLine(void)1387 static int EndOfLine(void)
1388 {
1389   if (!nextChar) return 1;
1390   while ((curChar= *nextChar) && (curChar==' ' || curChar=='\t'))
1391     nextChar++;        /* skip over tabs and blanks */
1392   return !curChar;
1393 }
1394 
CheckMulti(void)1395 static int CheckMulti(void)
1396 {
1397   char **now= multis;
1398   char *cur= *now;
1399   int token;
1400 
1401   token= curChar;
1402   nextChar++;
1403   while (cur[0] && curChar!=cur[0]) cur= *(++now);
1404 
1405   if (*cur++) {
1406     /* first character of symbol matches at least one multi-symbol */
1407     int second= *nextChar;
1408 
1409     do {
1410       if (second == *cur) {
1411         /* second character of symbol matches at least one multi-symbol */
1412         nextChar++;
1413         now++;
1414         if (curChar==(*now)[0] && *nextChar && *nextChar==(*now)[2]) {
1415           nextChar++;        /* found 3 character multi-symbol */
1416         } else {
1417           now--;             /* found 2 character multi-symbol */
1418         }
1419         token= multiTypes[now-multis];
1420         break;
1421       }
1422       cur= *(++now);
1423     } while (curChar == (cur++)[0]);
1424 
1425     if (token!=DOTDOT && token!=PLUSPLUS && token!=MINUSMINUS)
1426       needOperand= 1;
1427 
1428   } else if (curChar=='^') {
1429     /* Caret is the only operator which is NOT the first character of
1430        at least one multi-symbol.  */
1431     needOperand= 1;
1432 
1433   } else if (curChar==',') {
1434     if (quining==1) quineEnd= nextChar-1;
1435     prevWasComma= 1;
1436   } else if (needBody && curChar=='{') {
1437     needBody= 0;  /* no need to supress semicolon on EOL any more */
1438   }
1439 
1440   return token;
1441 }
1442 
CheckName(char * name)1443 static int CheckName(char *name)
1444 {
1445   char *now= name;
1446   int c= *now++;
1447 
1448   if (c>='a' && c<='z') { /* from "avg" to "zcen" NOT a to z! */
1449     char *match, **lst, **fst= reserved;
1450     int i= 1;
1451 
1452     /* find position of 1st character of name in reserved list */
1453     while (**fst<c) fst++;
1454     lst= fst;
1455     while (**lst==c) lst++;
1456     lst--;
1457 
1458     /* if first character matches, procede with following characters */
1459     while (fst <= lst) {
1460       if (fst==lst) {
1461         match= &(*fst)[i];   /* only one possible match */
1462         while (now<nextChar && match[0]==now[0]) { match++; now++; }
1463         if (*match || now!=nextChar) break;
1464 
1465         yylval.i= reservedRFs[fst-reserved];
1466         if (reservedTypes[fst-reserved]==ELSE) supressSemi= 1;
1467         return reservedTypes[fst-reserved];     /* found a reserved word */
1468 
1469       }
1470       c= *now++;
1471       while (fst<=lst && (*fst)[i]<c) fst++;
1472       while (fst<=lst && (*lst)[i]>c) lst--;
1473       i++;
1474     }
1475   }
1476 
1477   yylval.lit= YpName(name, nextChar-name);
1478   return NAME;             /* NOT a reserved word, just an ordinary name */
1479 }
1480 
1481 /* ------------------------------ */
1482 
AppendString(char * s,long ns,char * t,long nt)1483 static char *AppendString(char *s, long ns, char *t, long nt)
1484 {
1485   char *n_w= p_malloc(ns+nt+1);
1486   if (ns) strcpy(n_w, s);
1487   p_free(s);
1488   if (nt) strncpy(n_w+ns, t, nt);
1489   n_w[ns+nt]= '\0';
1490   return n_w;
1491 }
1492 
1493 static char *quote= 0;  /* for StringValue and CheckSyscall */
1494 
1495 static int
StringValue(int resuming)1496 StringValue(int resuming)
1497 {
1498   char c, *begin, *next;
1499   long n, len= 0;
1500 
1501   if (!resuming) {
1502     begin= quote;
1503     quote= 0;
1504     p_free(begin);
1505     begin= ++nextChar;  /* skip open quote */
1506   } else {
1507     len= quote? strlen(quote) : 0;
1508     begin= prevToken= curLine;
1509     if (quining==1) quineBegin= quineEnd= nextChar;
1510     if (!curLine) {
1511       if (len) p_free(quote);
1512       YpError("open \" at end-of-file");
1513       return 0;                    /* EOF reached (inside string) */
1514     }
1515   }
1516 
1517   while ((c=*nextChar++)) {
1518     if (c=='\\') {
1519       if (*nextChar) {
1520         nextChar[-1]= YpEscapeSeq(nextChar, &next);
1521         quote= AppendString(quote, len, begin, nextChar-begin);
1522         len+= nextChar-begin;
1523         begin= nextChar= next;
1524 
1525       } else {
1526         /* escaped newline */
1527         n= nextChar-begin-1;
1528         quote= AppendString(quote, len, begin, n);
1529         len+= n;
1530         if (quining==1) GrabQuine(nextChar-1);
1531         return -1;  /* signal NL_QUOTE next line required */
1532       }
1533 
1534     } else if (c=='\"') {
1535       /* only legitimate way out is close quote */
1536       quote= AppendString(quote, len, begin, nextChar-begin-1);
1537       yylval.q= YpQuoteConst(quote);
1538       return STRING;
1539     }
1540   }
1541 
1542   if (len) {
1543     begin= quote;
1544     quote= 0;
1545     p_free(begin);
1546   }
1547   YpError("missing close \"");
1548   yylval.q= 0;
1549   return STRING_ERR;  /* unmatched open quote */
1550 }
1551 
CharValue(void)1552 static int CharValue(void)
1553 {
1554   int c= *(++nextChar);
1555   if (*nextChar) nextChar++;
1556   if (c=='\\') c= YpEscapeSeq(nextChar, &nextChar);
1557   if (*nextChar && (*nextChar++ != '\'')) {
1558     /* skip past matching close quote, if one on current line */
1559     while (*nextChar && (*nextChar++ != '\''));
1560     YpError("missing close \'");
1561     yylval.l= 0;
1562     return CHAR_ERR;
1563   }
1564   yylval.l= c;
1565   return CHAR;
1566 }
1567 
NumberValue(void)1568 static int NumberValue(void)
1569 {
1570   char *begin= nextChar;
1571   int isReal= (curChar=='.');
1572   long trialValue= 0;
1573   char testc;
1574 
1575   if (!isReal) {
1576     /* strtoul does not exist on Suns, but the Sun strtol works
1577        properly there, hence this switch */
1578 #ifndef NO_STRTOUL
1579     trialValue= strtoul(begin, &nextChar, 0);
1580 #else
1581     trialValue= strtol(begin, &nextChar, 0);
1582 #endif
1583     testc= nextChar[0];
1584 
1585     /* Mac MetroWerks C library strtoul does not advance nextChar
1586        past all digits if there are too many to represent a number;
1587        instead, it leaves nextChar==begin, which is a disaster.  Try
1588        to avert the disaster here. */
1589     if (begin[0]=='0') {
1590       if (begin[1]=='x') {
1591         while ((testc>='0' && testc<='9') ||
1592                (testc>='A' && testc<='F') ||
1593                (testc>='a' && testc<='f')) testc= *(++nextChar);
1594       } else {
1595         while (testc>='0' && testc<='7') testc= *(++nextChar);
1596       }
1597     } else {
1598       while (testc>='0' && testc<='9') testc= *(++nextChar);
1599     }
1600 
1601     if (testc=='.') {
1602       isReal= 1;
1603     } else if (testc=='e' || testc=='E') {
1604       int i= 1;
1605       if (nextChar[1]=='+' || nextChar[1]=='-') i= 2;
1606       if (nextChar[i]>='0' && nextChar[i]<='9') isReal= 1;
1607     }
1608   }
1609 
1610   if (isReal) {
1611     errno = 0;
1612     yylval.d = strtod(begin, &nextChar);
1613 
1614     if (nextChar==begin) {
1615       /* avert MetroWerks disaster described above */
1616       if (begin[0]=='.') nextChar++;
1617       testc= nextChar[0];
1618       while (testc>='0' && testc<='9') testc= *(++nextChar);
1619     }
1620 
1621     if (*nextChar=='f' || *nextChar=='F') {
1622       nextChar++;
1623       if (!errno) return FLOAT;
1624     } else if (*nextChar=='i' || *nextChar=='I') {
1625       /* alternative suggestion: 1j for imaginary, 1i for int */
1626       nextChar++;
1627       if (!errno) return IMAGINARY;
1628     } else if (!errno) {
1629       if (!errno) return DOUBLE;
1630     }
1631     yylval.d = 0.;
1632     return '0';   /* treat Inf like illegal token (0 only legal in number) */
1633 
1634   } else {
1635     yylval.l= trialValue;
1636     if (*nextChar=='l' || *nextChar=='L') {
1637       nextChar++;
1638       return LONG;
1639     } else if (*nextChar=='i' || *nextChar=='I') {
1640       nextChar++;
1641       yylval.d= (double)trialValue;
1642       return IMAGINARY;
1643     } else if (*nextChar=='s' || *nextChar=='S') {
1644       nextChar++;
1645       return SHORT;
1646     } else if (*nextChar=='n' || *nextChar=='N') {
1647       /* alternative suggestion: 1j for imaginary, 1i for int */
1648       nextChar++;
1649       return INT;
1650     } else {
1651       return LONG;
1652     }
1653   }
1654 }
1655 
1656 /* ------------------------------ */
1657 
1658 static int
CheckSyscall(int resuming)1659 CheckSyscall(int resuming)
1660 {
1661   long n, len;
1662   int more;
1663 
1664   if (!resuming) {
1665     if (EndOfLine() || curChar!='$') return 0;
1666     nextChar++;
1667     for (n=0 ; nextChar[n] ; n++)
1668       if (nextChar[n]!=' ' && nextChar[n]!='\t') break;
1669     if (!nextChar[n]) return 0;
1670 
1671     nextChar+= n;               /* skip past leading whitespace */
1672     len= 0;
1673 
1674     if (quote) {
1675       char *prev= quote;
1676       quote= 0;
1677       p_free(prev);
1678     }
1679   } else {
1680     len= quote? strlen(quote) : 0;
1681     prevToken= curLine;
1682     if (curLine) resuming= 0;
1683   }
1684   if (!resuming) {
1685     n= strlen(nextChar);
1686     more= (n && nextChar[n-1]=='\\');
1687     if (more) n--;
1688 
1689     quote= AppendString(quote, len, nextChar, n);
1690     len+= n;
1691     nextChar+= n;
1692 
1693     if (more) return -1;   /* signal NL_QUOTE next line required */
1694   }
1695 
1696   yylval.q= YpQuoteConst(quote);
1697   return 1;
1698 }
1699 
1700 /* ------------------------------ */
1701 
BeginQuine(void)1702 static void BeginQuine(void)
1703 {
1704   /* nextChar is just past comma for argument to be quined */
1705   EndOfLine();   /* skip whitespace */
1706   if (quineText) p_free(quineText);
1707   quineText= 0;
1708   quineBegin= quineEnd= nextChar;
1709   if (curChar=='\\' && !nextChar[1]) quineBegin++;
1710 }
1711 
GrabQuine(char * stop)1712 static void GrabQuine(char *stop)
1713 {
1714   long n= stop>quineBegin? stop-quineBegin : 0;
1715   char *text= p_strncat(quineText, quineBegin, n);
1716   p_free(quineText);
1717   quineText= text;
1718 }
1719 
DoQuine(void)1720 static int DoQuine(void)
1721 {
1722   if (quining!=1) return 0;
1723   while (quineEnd>curLine && (quineEnd[-1]==' ' || quineEnd[-1]=='\t'))
1724     quineEnd--;
1725   GrabQuine(quineEnd);
1726   YpString(YpQuoteConst(quineText));
1727   p_free(quineText);
1728   quineText= quineBegin= quineEnd= 0;
1729   nQuines--;
1730   if (nQuines==0) quining= 0;
1731   return 1;
1732 }
1733 
1734 /* ------------------------------ */
1735 
yylex(void)1736 static int yylex(void)
1737 {
1738   int eol, continuation, bol;
1739   int supress= parenDepth || needOperand || supressSemi;
1740 
1741   if (yp_keybd_input&YP_EOL_STRING) {          /* NL_QUOTE (string case) */
1742     /* resume quoted string */
1743     int tok= StringValue(1);
1744     if (tok == -1) return yp_keybd_input;
1745     yp_keybd_input &= ~YP_EOL_STRING;
1746     return tok;
1747   } else if (yp_keybd_input&YP_EOL_SYSCALL) {  /* NL_QUOTE (syscall case) */
1748     int tok= CheckSyscall(1);
1749     if (tok == -1) return yp_keybd_input;
1750     yp_keybd_input &= ~YP_EOL_SYSCALL;
1751     return SYSCALL;
1752   } else if (yp_keybd_input&YP_EOL_COMMENT) {  /* NL_COMMENT */
1753     yp_keybd_input &= ~YP_EOL_COMMENT;
1754     goto comment;  /* yuck */
1755   } else if (yp_keybd_input&YP_EOL_EXPR) {     /* NL_NOINPUT or NL_CONTINUE */
1756     yp_keybd_input &= ~YP_EOL_EXPR;
1757     goto cntinue;  /* yuck */
1758   } else if (noInputYet==2) {
1759     return 0;
1760   }
1761 
1762   for (;;) { /* loop past all whitespace, comments, and escaped newlines */
1763 
1764     for (;;) {  /* loop past blank lines */
1765       bol= (nextChar && nextChar==curLine);
1766       eol= EndOfLine();
1767       continuation= (nextChar && curChar=='\\' && !nextChar[1]);
1768       bol= (bol && !continuation && !supress);
1769       if (!eol && !continuation) break;
1770 
1771       if (!continuation && !supress && !noInputYet &&
1772           !prevWasComma && !needBody) {
1773         if (!prevWasSemi) {
1774           /* if there are no open parentheses or operators, and the
1775              previous token was NOT ';', EOL is same as ';' */
1776           if (quining==1) quineEnd= nextChar;
1777           prevWasSemi= 1;
1778           return ';';
1779         }
1780         /* EOL (after ';') is same as EOF if no reason to continue */
1781         if (!nOpenCS && !braceDepth) return 0;
1782       }
1783 
1784       if (quining==1) GrabQuine(nextChar);
1785       if (yp_keybd_input) return (yp_keybd_input|= YP_EOL_EXPR);
1786       else curLine= nextChar= YpNextLine(noInputYet?NL_NOINPUT:NL_CONTINUE);
1787     cntinue:
1788       prevToken= curLine;
1789       if (quining==1) quineBegin= quineEnd= nextChar;
1790 
1791       if (!curLine) {                        /* hit EOF */
1792         if (noInputYet) {
1793           noInputYet= 2;
1794           return NOINPUT;
1795         } else {
1796           return 0;
1797         }
1798       }
1799     }
1800 
1801     if (curChar=='/' && nextChar[1]=='/') {
1802       while (*nextChar) nextChar++;
1803       continue;
1804     }
1805 
1806     if (curChar!='/' || nextChar[1]!='*') break;
1807 
1808     nextChar+= 2;                        /* skip past open comment */
1809     curChar= *nextChar++;
1810 
1811     while (curChar!='*' || *nextChar!='/') {  /* skip comment body */
1812       if (!curChar) {
1813         if (quining==1) GrabQuine(nextChar-1);
1814         if (yp_keybd_input) return (yp_keybd_input|= YP_EOL_COMMENT);
1815         else curLine= nextChar= YpNextLine(NL_COMMENT);
1816       comment:
1817         prevToken= curLine;
1818         if (quining==1) quineBegin= quineEnd= nextChar;
1819         if (!curLine) {
1820           YpError("open comment at end-of-file");
1821           return 0;           /* EOF reached (in comment) */
1822         }
1823       }
1824       curChar= *nextChar++;
1825     }
1826     nextChar++;
1827   }
1828 
1829   /* At last!  A real token has arrived! */
1830 
1831   needOperand= supressSemi= prevWasSemi= prevWasComma= 0;
1832 
1833   prevToken= nextChar;
1834   noInputYet= 0;
1835 
1836   if (curChar=='\"') {
1837     /* token is quoted string */
1838     int tok= StringValue(0);
1839     if (tok == -1) {
1840       if (yp_keybd_input) {
1841         return (yp_keybd_input|= YP_EOL_STRING);
1842       } else do {
1843         curLine= nextChar= YpNextLine(NL_QUOTE);
1844         tok= StringValue(1);
1845       } while (tok == -1);
1846     }
1847     return tok;         /* may include escaped newlines */
1848 
1849   } else if (curChar=='\'') {
1850     /* token is character constant */
1851     return CharValue();
1852 
1853   } else if ((curChar>='0' && curChar<='9') ||
1854              (curChar=='.' && nextChar[1]>='0' && nextChar[1]<='9')) {
1855     /* token is some sort of number */
1856     return NumberValue();
1857 
1858   } else {
1859     /* token is not a number, check for a variable name */
1860     while ((curChar>='a'&&curChar<='z') || (curChar>='A'&&curChar<='Z') ||
1861            (curChar>='0'&&curChar<='9') || curChar=='_')
1862       curChar= *(++nextChar);
1863 
1864     if (nextChar > prevToken) {
1865       /* token is a name */
1866       int nmtk = CheckName(prevToken);
1867       return nmtk;
1868 
1869     } else if (curChar!=';') {
1870       /* token must be a symbol */
1871       if (bol) {
1872         int tok= CheckSyscall(0);
1873         if (tok == -1) {
1874           if (yp_keybd_input) {
1875             return (yp_keybd_input|= YP_EOL_SYSCALL);
1876           } else do {
1877             curLine= nextChar= YpNextLine(NL_QUOTE);
1878             tok= CheckSyscall(1);
1879           } while (tok == -1);
1880         } else if (tok) {
1881           return SYSCALL;
1882         }
1883       }
1884       return CheckMulti();
1885     } else {
1886       if (quining==1) quineEnd= nextChar;
1887       prevWasSemi= 1;
1888       nextChar++;
1889       return ';';
1890     }
1891   }
1892 }
1893 
1894 /* ------------------------------ */
1895 
yyerror(char * msg)1896 static void yyerror(char *msg)
1897 {
1898   char errorMsg[81];
1899   long n;
1900 
1901   if (yychar==CHAR_ERR || yychar==STRING_ERR) return;
1902 
1903   n= strlen(msg);
1904   strncpy(errorMsg, msg, 80);
1905   if (n>=80) {
1906     errorMsg[80]= '\0';
1907   } else if (n>=70) {
1908     errorMsg[n]= '\0';
1909   } else {
1910     msg= errorMsg+n;
1911     strcpy(msg, " near ");
1912     msg+= 6;
1913     n= 80-n;
1914     if (n>16) n= 16;
1915     if (yychar==0) {
1916       strcpy(msg, "<EOF>");
1917     } else if (!prevToken || *prevToken==0) {
1918       strcpy(msg, "<EOL>");
1919     } else if (yychar==STRING && *prevToken!='\"') {
1920       strcpy(msg, "\"...\"");
1921     } else {
1922       strncpy(msg, prevToken, n);
1923       msg[n]= '\0';
1924     }
1925   }
1926 
1927   YpError(errorMsg);
1928 }
1929 
1930 /* ------------------------------ */
1931 
1932 /* ScanForFunc is a "pseudo-parser" which merely calls yylex until
1933    it finds a func, struct, or extern definition for fname.  It returns
1934    the location of the line on which the definition began, suitable
1935    for use with fseek.  */
ScanForFunc(const char * fname,int notExtern)1936 long ScanForFunc(const char *fname, int notExtern)
1937 {
1938   int type, counter= 0;
1939   long position= -1;
1940   int token;
1941   YpParseInit((void *)0); /* necessary to receive literals and quotes */
1942   nOpenCS= 0;    /* initialize number of open control structures */
1943   parenDepth= 0; /* initialize number of open parentheses/square brackets */
1944   braceDepth= 0; /* initialize number of open curly braces */
1945   needOperand= prevWasSemi= prevWasComma= supressSemi= 0; /* more EOL flags */
1946   nQuines= quining= 0;
1947   /* this time, want to skip any include files and remember address of
1948      each line before it is read */
1949   ypSkipIncludes= 1;
1950   /* Get 1st line in NL_NOINPUT mode.  This is not really too important
1951    * here, but if input were from keyboard, this would force YpNextLine
1952    * to wait for input instead of possibly returning eof to handle
1953    * input from another source.
1954    * -- input cannot be from keyboard now */
1955   yp_keybd_input= 0;
1956   curLine= nextChar= YpNextLine(NL_NOINPUT);
1957   prevToken= 0;
1958   if (!nextChar) return 0;
1959 
1960   for (;;) {
1961     noInputYet= 1;     /* keep calling YpNextLine(NL_NOINPUT) --
1962                         * assures that YpNextLine will keep track of
1963                         * beginning line number */
1964     token= yylex();
1965     if (!token || token==NOINPUT) break;
1966     if (token=='{') braceDepth++;
1967     else if (token=='}') braceDepth--;
1968     else if (!braceDepth) {
1969       if (token==FUNC) type= 1;
1970       else if (token==STRUCT) type= 2;
1971       else if (!notExtern && (token==EXTERN||token==LOCAL)) type= 3;
1972       else type= 0;
1973       if (type) {
1974         position= YpStandby();
1975         noInputYet= 0;     /* if necessary, YpNextLine(NL_CONTINUE) */
1976         supressSemi= 1;    /* dont get confused by newline */
1977         token= yylex();
1978         supressSemi= 0;
1979         if (token==NAME && strcmp(fname, YpLitName(yylval.lit))==0) break;
1980         if (type==3) {
1981           while ((token= yylex())==',') {
1982             token= yylex();
1983             if (token==NAME && strcmp(fname, YpLitName(yylval.lit))==0)
1984               goto found;
1985           }
1986         }
1987         position= -1;
1988         if (!token || token==NOINPUT) break;
1989       }
1990     } else if (token==NAME || token==STRING || token==SYSCALL) {
1991       /* try to keep the literal and constant tables reasonably small */
1992       counter++;
1993       if (counter>=32) { YpParseInit((void *)0); counter= 0; }
1994     }
1995   }
1996  found:
1997 
1998   return position;
1999 }
2000 
2001 /* End C code */
2002 /*--------------------------------------------------------------------------*/
2003 #define YYABORT goto yyabort
2004 #define YYACCEPT goto yyaccept
2005 
2006 /* modifed byacc parser
2007  * -- return value will be 0 if parse finishes, 1 on error,
2008  *    >= 0x2000 if another token is required
2009  * -- in latter case, pass return value in subsequent call */
2010 
2011 static int
yyparse_step(int last_state)2012 yyparse_step(int last_state)
2013 {
2014     register int yym, yyn, yystate;
2015 #if YYDEBUG
2016     register char *yys;
2017     extern char *getenv();
2018 
2019     if (!(last_state&0x6000) && (yys = getenv("YYDEBUG")))
2020     {
2021         yyn = *yys;
2022         if (yyn >= '0' && yyn <= '9')
2023             yydebug = yyn - '0';
2024     }
2025 #endif
2026 
2027     /* recover from previous call */
2028     if (last_state&0x2000) {
2029       yystate= last_state&0x1fff;
2030       goto yytop;
2031     } else if (last_state&0x4000) {
2032       yystate= last_state&0x1fff;
2033       goto yybot;
2034     }
2035 
2036     yynerrs = 0;
2037     yyerrflag = 0;
2038     yychar = (-1);
2039 
2040     if (yystacksize!=YYSTACKSIZE) {
2041       yyss= p_realloc(yyss, YYSTACKSIZE*sizeof(short));
2042       yyvs= p_realloc(yyvs, YYSTACKSIZE*sizeof(YYSTYPE));
2043       yystacksize= YYSTACKSIZE;
2044     }
2045     yyssp = yyss;
2046     yyvsp = yyvs;
2047     *yyssp = yystate = 0;
2048 
2049 yyloop:
2050     if ((yyn = yydefred[yystate])) goto yyreduce;
2051     if (yychar < 0)
2052     {
2053       yytop:
2054         yychar= yylex();
2055         if (yychar & YP_KEYBD_INPUT) return 0x2000 | yystate;
2056         if (yychar < 0) yychar = 0;
2057 #if YYDEBUG
2058         if (yydebug)
2059         {
2060             yys = 0;
2061             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
2062             if (!yys) yys = "illegal-symbol";
2063             printf("yydebug: state %d, reading %d (%s)\n", yystate,
2064                     yychar, yys);
2065         }
2066 #endif
2067     }
2068     if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
2069             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
2070     {
2071 #if YYDEBUG
2072         if (yydebug)
2073             printf("yydebug: state %d, shifting to state %d\n",
2074                     yystate, yytable[yyn]);
2075 #endif
2076         if (yyssp >= yyss + yystacksize - 1)
2077         {
2078           long iyyssp= yyssp-yyss;
2079           long iyyvsp= yyvsp-yyvs;
2080           yystacksize*= 2;
2081           if (yystacksize>YYOVERFLOW) goto yyoverflow;
2082           yyss= p_realloc(yyss, yystacksize*sizeof(short));
2083           yyvs= p_realloc(yyvs, yystacksize*sizeof(YYSTYPE));
2084           yyssp= yyss+iyyssp;
2085           yyvsp= yyvs+iyyvsp;
2086         }
2087         *++yyssp = yystate = yytable[yyn];
2088         *++yyvsp = yylval;
2089         yychar = (-1);
2090         if (yyerrflag > 0)  --yyerrflag;
2091         goto yyloop;
2092     }
2093     if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
2094             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
2095     {
2096         yyn = yytable[yyn];
2097         goto yyreduce;
2098     }
2099     if (yyerrflag) goto yyinrecovery;
2100     yyerror("syntax error");
2101     ++yynerrs;
2102 yyinrecovery:
2103     if (yyerrflag < 3)
2104     {
2105         yyerrflag = 3;
2106         for (;;)
2107         {
2108             if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
2109                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
2110             {
2111 #if YYDEBUG
2112                 if (yydebug)
2113                     printf("yydebug: state %d, error recovery shifting\
2114  to state %d\n", *yyssp, yytable[yyn]);
2115 #endif
2116                 if (yyssp >= yyss + yystacksize - 1)
2117                 {
2118                   long iyyssp= yyssp-yyss;
2119                   long iyyvsp= yyvsp-yyvs;
2120                   yystacksize*= 2;
2121                   if (yystacksize>YYOVERFLOW) goto yyoverflow;
2122                   yyss= p_realloc(yyss, yystacksize*sizeof(short));
2123                   yyvs= p_realloc(yyvs, yystacksize*sizeof(YYSTYPE));
2124                   yyssp= yyss+iyyssp;
2125                   yyvsp= yyvs+iyyvsp;
2126                 }
2127                 *++yyssp = yystate = yytable[yyn];
2128                 *++yyvsp = yylval;
2129                 goto yyloop;
2130             }
2131             else
2132             {
2133 #if YYDEBUG
2134                 if (yydebug)
2135                     printf("yydebug: error recovery discarding state %d\n",
2136                             *yyssp);
2137 #endif
2138                 if (yyssp <= yyss) goto yyabort;
2139                 --yyssp;
2140                 --yyvsp;
2141             }
2142         }
2143     }
2144     else
2145     {
2146         if (yychar == 0) goto yyabort;
2147 #if YYDEBUG
2148         if (yydebug)
2149         {
2150             yys = 0;
2151             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
2152             if (!yys) yys = "illegal-symbol";
2153             printf("yydebug: state %d, error recovery discards token %d (%s)\n",
2154                     yystate, yychar, yys);
2155         }
2156 #endif
2157         yychar = (-1);
2158         goto yyloop;
2159     }
2160 yyreduce:
2161 #if YYDEBUG
2162     if (yydebug)
2163         printf("yydebug: state %d, reducing by rule %d (%s)\n",
2164                 yystate, yyn, yyrule[yyn]);
2165 #endif
2166     yym = yylen[yyn];
2167     /* yyvsp[1] can be beyond end of yyval stack -- do not access */
2168     yyval = yym? yyvsp[1-yym] : yy_zero;
2169     switch (yyn)
2170     {
2171 case 2:
2172 { YpFunc(1, 1); }
2173 break;
2174 case 3:
2175 { nOpenCS--; YpFunc(0, EndOfLine()); }
2176 break;
2177 case 4:
2178 { nOpenCS--; YpFunc(0, EndOfLine()); }
2179 break;
2180 case 5:
2181 { nOpenCS--; YpStruct(yyvsp[-3].cb, EndOfLine()); }
2182 break;
2183 case 6:
2184 { nOpenCS--; YpFunc(0, EndOfLine()); }
2185 break;
2186 case 7:
2187 { nOpenCS--; needBody=0; YpFunc(0, EndOfLine()); }
2188 break;
2189 case 8:
2190 { nOpenCS--; YpStruct(yyvsp[-3].cb, EndOfLine()); }
2191 break;
2192 case 9:
2193 { nOpenCS--; needBody=0; YpStruct(NONE, EndOfLine()); }
2194 break;
2195 case 11:
2196 { YpSpecial(yyvsp[-1].i); }
2197 break;
2198 case 14:
2199 { nOpenCS++; }
2200 break;
2201 case 15:
2202 { parenDepth++; }
2203 break;
2204 case 16:
2205 { parenDepth--; }
2206 break;
2207 case 17:
2208 { parenDepth++; }
2209 break;
2210 case 18:
2211 { parenDepth--; }
2212 break;
2213 case 19:
2214 { braceDepth++; }
2215 break;
2216 case 20:
2217 { braceDepth--; }
2218 break;
2219 case 23:
2220 { yyval.cb= YpNoop(); }
2221 break;
2222 case 24:
2223 { yyval.cb= YpNoop(); }
2224 break;
2225 case 25:
2226 { yyval.cb= YpSyscall(yyvsp[-1].q); }
2227 break;
2228 case 27:
2229 { yyval.cb= YpAssignOrPrint(yyvsp[-1].cb); }
2230 break;
2231 case 28:
2232 { if ((nQuines= YpCallInit(yyvsp[0].cb))) quining= 1; }
2233 break;
2234 case 29:
2235 { nQuines= quining= 0; yyval.cb= YpCall(yyvsp[-4].cb, yyvsp[-1].i); }
2236 break;
2237 case 30:
2238 { yyval.cb= YpIfElse(yyvsp[-4].cb, yyvsp[-1].cb, NONE); }
2239 break;
2240 case 31:
2241 { nOpenCS++; }
2242 break;
2243 case 32:
2244 { nOpenCS--; yyval.cb= YpIfElse(yyvsp[-8].cb, yyvsp[-5].cb, yyvsp[0].cb); }
2245 break;
2246 case 33:
2247 { nOpenCS--; yyval.cb= YpWhile(yyvsp[-3].cb, yyvsp[0].cb); }
2248 break;
2249 case 34:
2250 { nOpenCS--; yyval.cb= YpDo(yyvsp[-5].cb, yyvsp[-2].cb); }
2251 break;
2252 case 35:
2253 { nOpenCS--; yyval.cb= YpFor(yyvsp[-7].cb, yyvsp[-5].cb, yyvsp[0].cb); }
2254 break;
2255 case 36:
2256 { nOpenCS--; yyval.cb= YpFor(yyvsp[-5].cb, NONE, yyvsp[0].cb); }
2257 break;
2258 case 37:
2259 { yyval.cb= YpContinue(); }
2260 break;
2261 case 38:
2262 { yyval.cb= YpBreak(); }
2263 break;
2264 case 39:
2265 { yyval.cb= YpReturn(NONE); }
2266 break;
2267 case 40:
2268 { yyval.cb= YpReturn(yyvsp[-1].cb); }
2269 break;
2270 case 41:
2271 { yyval.cb= YpReturn(yyvsp[-1].cb); }
2272 break;
2273 case 42:
2274 { yyval.cb= YpGoto(yyvsp[-1].lit); }
2275 break;
2276 case 43:
2277 { yyval.cb= YpLabel(yyvsp[-1].lit); }
2278 break;
2279 case 44:
2280 { nOpenCS--; yyval.cb= YpReset(); }
2281 break;
2282 case 45:
2283 { nOpenCS--; yyval.cb= YpReset(); }
2284 break;
2285 case 46:
2286 { nOpenCS--; yyval.cb= YpReset(); }
2287 break;
2288 case 47:
2289 { nOpenCS--; yyval.cb= YpReset(); }
2290 break;
2291 case 48:
2292 { nOpenCS--; yyval.cb= YpReset(); }
2293 break;
2294 case 49:
2295 { nOpenCS--; yyval.cb= YpReset(); }
2296 break;
2297 case 50:
2298 { nOpenCS--; yyval.cb= YpReset(); }
2299 break;
2300 case 51:
2301 { nOpenCS--; yyval.cb= YpReset(); }
2302 break;
2303 case 52:
2304 { nOpenCS--; yyval.cb= YpReset(); }
2305 break;
2306 case 53:
2307 { yyval.cb= YpNoop(); }
2308 break;
2309 case 55:
2310 { yyval.cb= YpNoop(); }
2311 break;
2312 case 56:
2313 { yyval.cb= yyvsp[-1].cb; }
2314 break;
2315 case 57:
2316 { yyval.cb= YpReset(); }
2317 break;
2318 case 58:
2319 { yyval.cb= YpReset(); }
2320 break;
2321 case 61:
2322 { YpBranch(0); }
2323 break;
2324 case 62:
2325 { YpBranch(1); }
2326 break;
2327 case 63:
2328 { YpBranch(2); }
2329 break;
2330 case 64:
2331 { YpBranch(3); }
2332 break;
2333 case 65:
2334 { supressSemi= 1; }
2335 break;
2336 case 67:
2337 { supressSemi= 1; nOpenCS++; }
2338 break;
2339 case 68:
2340 { nOpenCS--; }
2341 break;
2342 case 69:
2343 { supressSemi= 1; nOpenCS++; YpLoop(0); }
2344 break;
2345 case 70:
2346 { supressSemi= 1; nOpenCS++; YpLoop(1); }
2347 break;
2348 case 71:
2349 { supressSemi= 1; nOpenCS++; YpLoop(2); }
2350 break;
2351 case 72:
2352 { supressSemi= 1; }
2353 break;
2354 case 76:
2355 { YpDataType(yyvsp[0].lit); }
2356 break;
2357 case 79:
2358 { YpDeclarator(yyvsp[-1].i, yyvsp[0].cb, 0); }
2359 break;
2360 case 80:
2361 { YpDeclarator(yyvsp[-4].i, yyvsp[-3].cb, yyvsp[-1].i); }
2362 break;
2363 case 81:
2364 { YpReset(); }
2365 break;
2366 case 82:
2367 { yyval.i= 0; }
2368 break;
2369 case 83:
2370 { yyval.i= yyvsp[-1].i+1; }
2371 break;
2372 case 84:
2373 { yyval.i= 1; }
2374 break;
2375 case 85:
2376 { yyval.i= 1; }
2377 break;
2378 case 86:
2379 { yyval.i= yyvsp[-2].i + 1; }
2380 break;
2381 case 87:
2382 { yyval.cb= YpQuoted(yyvsp[0].lit); }
2383 break;
2384 case 88:
2385 { needBody= 1; YpInitFunc(yyvsp[0].lit); }
2386 break;
2387 case 89:
2388 { needBody= 1; }
2389 break;
2390 case 90:
2391 { yyval.cb= yyvsp[0].cb; }
2392 break;
2393 case 98:
2394 { YpPosParam(yyvsp[0].lit, 0); }
2395 break;
2396 case 99:
2397 { YpPosParam(yyvsp[0].lit, 0); }
2398 break;
2399 case 100:
2400 { YpPosParam(yyvsp[0].lit, 1); }
2401 break;
2402 case 101:
2403 { YpPosParam(yyvsp[0].lit, 1); }
2404 break;
2405 case 102:
2406 { YpKeyParam(yyvsp[-1].lit); }
2407 break;
2408 case 103:
2409 { YpKeyParam(yyvsp[-1].lit); }
2410 break;
2411 case 104:
2412 { YpHasPosList(); }
2413 break;
2414 case 105:
2415 { if (nQuines) quining++; }
2416 break;
2417 case 106:
2418 { yyval.i= yyvsp[0].i; if (nQuines) quining--; }
2419 break;
2420 case 107:
2421 { if (quining==1) BeginQuine(); }
2422 break;
2423 case 111:
2424 { yyval.i= yyvsp[-2].i + yyvsp[0].i; }
2425 break;
2426 case 112:
2427 { yyval.i= keyCount; YpCheckRef(yyvsp[0].cb); }
2428 break;
2429 case 113:
2430 { yyval.i= yyvsp[-2].i + keyCount; YpCheckRef(yyvsp[0].cb); }
2431 break;
2432 case 114:
2433 { yyval.i= 1; }
2434 break;
2435 case 115:
2436 { yyval.i= 1 + yyvsp[0].i; }
2437 break;
2438 case 116:
2439 { YpDotDot(0); }
2440 break;
2441 case 117:
2442 { YpDotDot(1); }
2443 break;
2444 case 118:
2445 { yyval.cb= yyvsp[0].cb; keyCount= 1 + DoQuine(); }
2446 break;
2447 case 119:
2448 { yyval.cb= yyvsp[0].cb; keyCount= 1 + DoQuine(); }
2449 break;
2450 case 120:
2451 { yyval.cb= yyvsp[0].cb; keyCount= 2; YpKeyword(yyvsp[-2].lit, yyvsp[0].cb); }
2452 break;
2453 case 121:
2454 { yyval.cb= yyvsp[0].cb; keyCount= 2; YpKeyword(yyvsp[-2].lit, yyvsp[0].cb); }
2455 break;
2456 case 122:
2457 { yyval.cb= YpNil(); }
2458 break;
2459 case 125:
2460 { yyval.cb= YpRangeFunc(yyvsp[0].i, NONE); }
2461 break;
2462 case 126:
2463 { yyval.cb= YpRangeFunc(yyvsp[-1].i, NONE); }
2464 break;
2465 case 127:
2466 { yyval.cb= YpRangeFunc(yyvsp[-2].i, yyvsp[0].cb); }
2467 break;
2468 case 128:
2469 { yyval.cb= YpRange(yyvsp[-2].cb, 0); }
2470 break;
2471 case 129:
2472 { yyval.cb= YpRange(yyvsp[-4].cb, 1); }
2473 break;
2474 case 131:
2475 { yyval.i= 14; }
2476 break;
2477 case 132:
2478 { yyval.i= 15; }
2479 break;
2480 case 133:
2481 { YpExtern(yyvsp[0].lit); }
2482 break;
2483 case 134:
2484 { YpExtern(yyvsp[0].lit); }
2485 break;
2486 case 135:
2487 { YpLocal(yyvsp[0].lit); }
2488 break;
2489 case 136:
2490 { YpLocal(yyvsp[0].lit); }
2491 break;
2492 case 138:
2493 { yyval.cb= YpAssign(yyvsp[-1].def, yyvsp[0].cb); }
2494 break;
2495 case 139:
2496 { yyval.cb= YpAssign(yyvsp[-1].def, yyvsp[0].cb); }
2497 break;
2498 case 140:
2499 { yyval.cb= YpIncrement(yyvsp[-2].cb, yyvsp[-1].i, yyvsp[0].cb); }
2500 break;
2501 case 141:
2502 { yyval.def= YpCheckDefine(yyvsp[-1].cb); }
2503 break;
2504 case 142:
2505 { yyval.i= 0; }
2506 break;
2507 case 143:
2508 { yyval.i= 1; }
2509 break;
2510 case 144:
2511 { yyval.i= 2; }
2512 break;
2513 case 145:
2514 { yyval.i= 3; }
2515 break;
2516 case 146:
2517 { yyval.i= 4; }
2518 break;
2519 case 147:
2520 { yyval.i= 5; }
2521 break;
2522 case 148:
2523 { yyval.i= 6; }
2524 break;
2525 case 149:
2526 { yyval.i= 7; }
2527 break;
2528 case 150:
2529 { yyval.i= 8; }
2530 break;
2531 case 151:
2532 { yyval.i= 9; }
2533 break;
2534 case 153:
2535 { nOpenCS--; yyval.cb= YpTernop(yyvsp[-7].cb, yyvsp[-3].cb, yyvsp[0].cb); }
2536 break;
2537 case 154:
2538 { nOpenCS--; yyval.cb= YpReset(); }
2539 break;
2540 case 156:
2541 { yyval.cb= YpMultop(yyvsp[-2].cb); }
2542 break;
2543 case 157:
2544 { yyval.cb= YpBinop(yyvsp[-2].cb, 2); }
2545 break;
2546 case 158:
2547 { yyval.cb= YpBinop(yyvsp[-2].cb, 3); }
2548 break;
2549 case 159:
2550 { yyval.cb= YpBinop(yyvsp[-2].cb, 4); }
2551 break;
2552 case 160:
2553 { yyval.cb= YpBinop(yyvsp[-2].cb, 5); }
2554 break;
2555 case 161:
2556 { yyval.cb= YpBinop(yyvsp[-2].cb, 6); }
2557 break;
2558 case 162:
2559 { yyval.cb= YpBinop(yyvsp[-2].cb, 7); }
2560 break;
2561 case 163:
2562 { yyval.cb= YpBinop(yyvsp[-2].cb, 8); }
2563 break;
2564 case 164:
2565 { yyval.cb= YpBinop(yyvsp[-2].cb, 9); }
2566 break;
2567 case 165:
2568 { yyval.cb= YpBinop(yyvsp[-2].cb, 10); }
2569 break;
2570 case 166:
2571 { yyval.cb= YpBinop(yyvsp[-2].cb, 11); }
2572 break;
2573 case 167:
2574 { yyval.cb= YpBinop(yyvsp[-2].cb, 12); }
2575 break;
2576 case 168:
2577 { yyval.cb= YpBinop(yyvsp[-2].cb, 13); }
2578 break;
2579 case 169:
2580 { yyval.cb= YpBinop(yyvsp[-2].cb, 14); }
2581 break;
2582 case 170:
2583 { yyval.cb= YpBinop(yyvsp[-2].cb, 15); }
2584 break;
2585 case 171:
2586 { yyval.cb= YpBinop(yyvsp[-2].cb, 16); }
2587 break;
2588 case 172:
2589 { yyval.cb= YpLogop(yyvsp[-3].cb, 0, yyvsp[0].cb); }
2590 break;
2591 case 173:
2592 { yyval.cb= YpLogop(yyvsp[-3].cb, 1, yyvsp[0].cb); }
2593 break;
2594 case 175:
2595 { yyval.cb= YpUnop(2, yyvsp[0].cb); }
2596 break;
2597 case 176:
2598 { yyval.cb= YpUnop(3, yyvsp[0].cb); }
2599 break;
2600 case 178:
2601 { yyval.cb= YpBinop(yyvsp[-2].cb, 0); }
2602 break;
2603 case 180:
2604 { yyval.cb= YpUnop(0, yyvsp[0].cb); }
2605 break;
2606 case 181:
2607 { YpCheckRef(yyvsp[0].cb); yyval.cb= YpUnop(1, yyvsp[0].cb); }
2608 break;
2609 case 182:
2610 { yyval.cb= YpUnop(4, yyvsp[0].cb); }
2611 break;
2612 case 183:
2613 { yyval.cb= YpUnop(5, yyvsp[0].cb); }
2614 break;
2615 case 184:
2616 { yyval.cb= YpUnop(6, YpCheckDefine(yyvsp[0].cb)); }
2617 break;
2618 case 185:
2619 { yyval.cb= YpUnop(7, YpCheckDefine(yyvsp[0].cb)); }
2620 break;
2621 case 188:
2622 { YpEvalInit(yyvsp[-1].cb); }
2623 break;
2624 case 189:
2625 { yyval.cb= YpEval(yyvsp[-4].cb, yyvsp[-1].i); }
2626 break;
2627 case 190:
2628 { yyval.cb= YpEval(yyvsp[-3].cb, yyvsp[-1].i); }
2629 break;
2630 case 191:
2631 { yyval.cb= YpNextArg(0); }
2632 break;
2633 case 192:
2634 { yyval.cb= YpNextArg(1); }
2635 break;
2636 case 193:
2637 { yyval.cb= YpBuild(yyvsp[-2].cb, yyvsp[-1].i); }
2638 break;
2639 case 194:
2640 { yyval.cb= YpNil(); }
2641 break;
2642 case 195:
2643 { yyval.cb= YpMember(yyvsp[-2].cb, 0, yyvsp[0].lit); }
2644 break;
2645 case 196:
2646 { yyval.cb= YpMember(yyvsp[-2].cb, 1, yyvsp[0].lit); }
2647 break;
2648 case 197:
2649 { yyval.cb= YpPostfix(YpCheckDefine(yyvsp[-1].cb), 0); }
2650 break;
2651 case 198:
2652 { yyval.cb= YpPostfix(YpCheckDefine(yyvsp[-1].cb), 1); }
2653 break;
2654 case 199:
2655 { yyval.cb= yyvsp[-1].cb; }
2656 break;
2657 case 200:
2658 { yyval.cb= YpReset(); }
2659 break;
2660 case 201:
2661 { yyval.cb= YpReset(); }
2662 break;
2663 case 202:
2664 { yyval.cb= YpReset(); }
2665 break;
2666 case 203:
2667 { yyval.cb= YpReset(); }
2668 break;
2669 case 204:
2670 { yyval.cb= YpNoop(); }
2671 break;
2672 case 205:
2673 { yyval.cb= YpNoop(); }
2674 break;
2675 case 208:
2676 { YpBeginInc(); }
2677 break;
2678 case 209:
2679 { YpEndInc(yyvsp[0].cb); }
2680 break;
2681 case 210:
2682 { yyval.cb= yyvsp[0].cb; YpDrop(); }
2683 break;
2684 case 211:
2685 { yyval.cb= yyvsp[-2].cb; YpDrop(); }
2686 break;
2687 case 212:
2688 { yyval.cb= YpVariable(yyvsp[0].lit); }
2689 break;
2690 case 213:
2691 { yyval.cb= YpPushRF(yyvsp[0].i); }
2692 break;
2693 case 214:
2694 { yyval.cb= YpChar(yyvsp[0].l); }
2695 break;
2696 case 215:
2697 { yyval.cb= YpShort(yyvsp[0].l); }
2698 break;
2699 case 216:
2700 { yyval.cb= YpInt(yyvsp[0].l); }
2701 break;
2702 case 217:
2703 { yyval.cb= YpLong(yyvsp[0].l); }
2704 break;
2705 case 218:
2706 { yyval.cb= YpFloat(yyvsp[0].d); }
2707 break;
2708 case 219:
2709 { yyval.cb= YpDouble(yyvsp[0].d); }
2710 break;
2711 case 220:
2712 { yyval.cb= YpString(yyvsp[0].q); }
2713 break;
2714 case 221:
2715 { yyval.cb= YpImaginary(yyvsp[0].d); }
2716 break;
2717     }
2718     yyssp -= yym;
2719     yystate = *yyssp;
2720     yyvsp -= yym;
2721     yym = yylhs[yyn];
2722     if (yystate == 0 && yym == 0)
2723     {
2724 #if YYDEBUG
2725         if (yydebug)
2726             printf("yydebug: after reduction, shifting from state 0 to\
2727  state %d\n", YYFINAL);
2728 #endif
2729         yystate = YYFINAL;
2730         *++yyssp = YYFINAL;
2731         *++yyvsp = yyval;
2732         if (yychar < 0)
2733         {
2734           yybot:
2735             yychar= yylex();
2736             if (yychar & YP_KEYBD_INPUT) return 0x4000 | yystate;
2737             if (yychar < 0) yychar = 0;
2738 #if YYDEBUG
2739             if (yydebug)
2740             {
2741                 yys = 0;
2742                 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
2743                 if (!yys) yys = "illegal-symbol";
2744                 printf("yydebug: state %d, reading %d (%s)\n",
2745                         YYFINAL, yychar, yys);
2746             }
2747 #endif
2748         }
2749         if (yychar == 0) goto yyaccept;
2750         goto yyloop;
2751     }
2752     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
2753             yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
2754         yystate = yytable[yyn];
2755     else
2756         yystate = yydgoto[yym];
2757 #if YYDEBUG
2758     if (yydebug)
2759         printf("yydebug: after reduction, shifting from state %d \
2760 to state %d\n", *yyssp, yystate);
2761 #endif
2762     if (yyssp >= yyss + yystacksize - 1)
2763     {
2764       long iyyssp= yyssp-yyss;
2765       long iyyvsp= yyvsp-yyvs;
2766       yystacksize*= 2;
2767       if (yystacksize>YYOVERFLOW) goto yyoverflow;
2768       yyss= p_realloc(yyss, yystacksize*sizeof(short));
2769       yyvs= p_realloc(yyvs, yystacksize*sizeof(YYSTYPE));
2770       yyssp= yyss+iyyssp;
2771       yyvsp= yyvs+iyyvsp;
2772     }
2773     *++yyssp = yystate;
2774     *++yyvsp = yyval;
2775     goto yyloop;
2776 yyoverflow:
2777     yyss= p_realloc(yyss, YYSTACKSIZE*sizeof(short));
2778     yyvs= p_realloc(yyvs, YYSTACKSIZE*sizeof(YYSTYPE));
2779     yystacksize= YYSTACKSIZE;
2780     yyerror("yacc stack overflow");
2781 yyabort:
2782     return (1);
2783 yyaccept:
2784     return (0);
2785 }
2786