source: cpp/_old/f8-to-f1/conv_f8tof1_grammar.c @ 1182

Last change on this file since 1182 was 193, checked in by Maciej Komosinski, 11 years ago

Set svn:eol-style native for all textual files

  • Property svn:eol-style set to native
File size: 58.4 KB
Line 
1/* Driver template for the LEMON parser generator.
2** The author disclaims copyright to this source code.
3*/
4/* First off, code is include which follows the "include" declaration
5** in the input file. */
6#include <stdio.h>
7#include <assert.h>
8#line 1 "conv_f8tof1_grammar.y"
9
10#include <iostream>
11#include <sstream>
12#include "lemonglobal.h"
13#include "conv_f8tof1.h"
14#include "conv_f8_utils.h"
15#define PARSER_DEBUG 0
16#line 18 "conv_f8tof1_grammar.c"
17/* Next is all token values, in a form suitable for use by makeheaders.
18** This section will be null unless lemon is run with the -m switch.
19*/
20/*
21** These constants (all generated automatically by the parser generator)
22** specify the various kinds of tokens (terminals) that the parser
23** understands.
24**
25** Each symbol here is a terminal symbol in the grammar.
26*/
27/* Make sure the INTERFACE macro is defined.
28*/
29#ifndef INTERFACE
30# define INTERFACE 1
31#endif
32/* The next thing included is series of defines which control
33** various aspects of the generated parser.
34**    YYCODETYPE         is the data type used for storing terminal
35**                       and nonterminal numbers.  "unsigned char" is
36**                       used if there are fewer than 250 terminals
37**                       and nonterminals.  "int" is used otherwise.
38**    YYNOCODE           is a number of type YYCODETYPE which corresponds
39**                       to no legal terminal or nonterminal number.  This
40**                       number is used to fill in empty slots of the hash
41**                       table.
42**    YYFALLBACK         If defined, this indicates that one or more tokens
43**                       have fall-back values which should be used if the
44**                       original value of the token will not parse.
45**    YYACTIONTYPE       is the data type used for storing terminal
46**                       and nonterminal numbers.  "unsigned char" is
47**                       used if there are fewer than 250 rules and
48**                       states combined.  "int" is used otherwise.
49**    ParseTOKENTYPE     is the data type used for minor tokens given
50**                       directly to the parser from the tokenizer.
51**    YYMINORTYPE        is the data type used for all minor tokens.
52**                       This is typically a union of many types, one of
53**                       which is ParseTOKENTYPE.  The entry in the union
54**                       for base tokens is called "yy0".
55**    YYSTACKDEPTH       is the maximum depth of the parser's stack.  If
56**                       zero the stack is dynamically sized using realloc()
57**    ParseARG_SDECL     A static variable declaration for the %extra_argument
58**    ParseARG_PDECL     A parameter declaration for the %extra_argument
59**    ParseARG_STORE     Code to store %extra_argument into yypParser
60**    ParseARG_FETCH     Code to extract %extra_argument from yypParser
61**    YYNSTATE           the combined number of states.
62**    YYNRULE            the number of rules in the grammar
63**    YYERRORSYMBOL      is the code number of the error symbol.  If not
64**                       defined, then do no error processing.
65*/
66#define YYCODETYPE unsigned char
67#define YYNOCODE 51
68#define YYACTIONTYPE unsigned char
69#define ParseTOKENTYPE Token
70typedef union {
71  ParseTOKENTYPE yy0;
72  ProductionTailToken yy11;
73  Token yy78;
74  ProdPieceToken yy89;
75} YYMINORTYPE;
76#ifndef YYSTACKDEPTH
77#define YYSTACKDEPTH 100
78#endif
79#define ParseARG_SDECL
80#define ParseARG_PDECL
81#define ParseARG_FETCH
82#define ParseARG_STORE
83#define YYNSTATE 91
84#define YYNRULE 47
85#define YY_NO_ACTION      (YYNSTATE+YYNRULE+2)
86#define YY_ACCEPT_ACTION  (YYNSTATE+YYNRULE+1)
87#define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)
88
89/* Next are that tables used to determine what action to take based on the
90** current state and lookahead token.  These tables are used to implement
91** functions that take a state number and lookahead value and return an
92** action integer. 
93**
94** Suppose the action integer is N.  Then the action is determined as
95** follows
96**
97**   0 <= N < YYNSTATE                  Shift N.  That is, push the lookahead
98**                                      token onto the stack and goto state N.
99**
100**   YYNSTATE <= N < YYNSTATE+YYNRULE   Reduce by rule N-YYNSTATE.
101**
102**   N == YYNSTATE+YYNRULE              A syntax error has occurred.
103**
104**   N == YYNSTATE+YYNRULE+1            The parser accepts its input.
105**
106**   N == YYNSTATE+YYNRULE+2            No such action.  Denotes unused
107**                                      slots in the yy_action[] table.
108**
109** The action table is constructed as a single large table named yy_action[].
110** Given state S and lookahead X, the action is computed as
111**
112**      yy_action[ yy_shift_ofst[S] + X ]
113**
114** If the index value yy_shift_ofst[S]+X is out of range or if the value
115** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
116** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
117** and that yy_default[S] should be used instead. 
118**
119** The formula above is for computing the action when the lookahead is
120** a terminal symbol.  If the lookahead is a non-terminal (as occurs after
121** a reduce action) then the yy_reduce_ofst[] array is used in place of
122** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
123** YY_SHIFT_USE_DFLT.
124**
125** The following are the tables generated in this section:
126**
127**  yy_action[]        A single table containing all actions.
128**  yy_lookahead[]     A table containing the lookahead for each entry in
129**                     yy_action.  Used to detect hash collisions.
130**  yy_shift_ofst[]    For each state, the offset into yy_action for
131**                     shifting terminals.
132**  yy_reduce_ofst[]   For each state, the offset into yy_action for
133**                     shifting non-terminals after a reduce.
134**  yy_default[]       Default action for each state.
135*/
136static const YYACTIONTYPE yy_action[] = {
137 /*     0 */    46,    4,   23,   24,   26,   27,   22,   28,   85,   61,
138 /*    10 */    31,   62,   43,   56,    4,   40,   37,   83,   76,   66,
139 /*    20 */    63,   69,   71,   31,   72,   43,    9,    4,   40,   37,
140 /*    30 */    83,   76,   47,    4,   69,   71,   70,   14,   43,  139,
141 /*    40 */    17,    4,   70,   59,   43,   51,   66,   69,   71,   57,
142 /*    50 */    70,   52,   43,   69,   71,   38,    4,   58,   15,   11,
143 /*    60 */    84,   69,   71,   19,   61,   70,   62,   43,   12,   13,
144 /*    70 */    15,   11,   44,   89,   30,   34,   69,   71,   16,   48,
145 /*    80 */    75,    5,   76,   91,   66,   72,   73,   74,   12,   13,
146 /*    90 */    15,   11,   61,   20,   62,   65,   66,    6,    1,    2,
147 /*   100 */    65,    7,   42,   33,   35,   54,   10,   39,   41,   10,
148 /*   110 */    39,   41,   61,   49,   62,   68,   61,   61,   62,   62,
149 /*   120 */    61,   88,   62,   33,   67,   65,   66,   36,   32,   25,
150 /*   130 */     8,   64,   52,   18,   16,   48,   86,   55,   29,   53,
151 /*   140 */    60,   87,   90,   81,    3,   77,   78,   45,   21,   79,
152 /*   150 */   140,  140,   80,   82,   50,
153};
154static const YYCODETYPE yy_lookahead[] = {
155 /*     0 */    27,   28,   13,   14,   15,   16,   17,   18,   11,   35,
156 /*    10 */    37,   37,   39,   27,   28,   42,   43,   44,   45,   22,
157 /*    20 */    46,   48,   49,   37,   23,   39,   33,   28,   42,   43,
158 /*    30 */    44,   45,   39,   28,   48,   49,   37,   10,   39,   29,
159 /*    40 */    30,   28,   37,   44,   39,   35,   22,   48,   49,   44,
160 /*    50 */    37,   37,   39,   48,   49,   41,   28,   44,    4,    5,
161 /*    60 */    11,   48,   49,   10,   35,   37,   37,   39,    2,    3,
162 /*    70 */     4,    5,   44,   31,   37,   46,   48,   49,   36,   37,
163 /*    80 */    43,   19,   45,    0,   22,   23,   24,   25,    2,    3,
164 /*    90 */     4,    5,   35,    1,   37,   21,   22,   11,    9,    9,
165 /*   100 */    21,   10,   34,   46,   47,   34,   38,   39,   40,   38,
166 /*   110 */    39,   40,   35,   20,   37,   11,   35,   35,   37,   37,
167 /*   120 */    35,    6,   37,   46,   47,   21,   22,   46,   46,   31,
168 /*   130 */     1,   46,   37,    1,   36,   37,   41,    6,    8,    6,
169 /*   140 */    11,    6,    6,   35,   12,   35,   35,    7,   32,   35,
170 /*   150 */    50,   50,   35,   35,   35,
171};
172#define YY_SHIFT_USE_DFLT (-12)
173#define YY_SHIFT_MAX 52
174static const short yy_shift_ofst[] = {
175 /*     0 */    79,   62,   62,   62,   62,   62,   62,  104,   74,    1,
176 /*    10 */     1,   74,   74,   74,   74,   74,   24,   24,   24,   -3,
177 /*    20 */    24,    1,   79,   79,   79,  140,   79,   79,   79,   79,
178 /*    30 */   -11,  -11,   86,   66,   54,  129,   54,  132,   49,   53,
179 /*    40 */    89,   90,   83,   91,   93,  115,  131,  135,  130,   27,
180 /*    50 */   136,  133,   92,
181};
182#define YY_REDUCE_USE_DFLT (-28)
183#define YY_REDUCE_MAX 29
184static const signed char yy_reduce_ofst[] = {
185 /*     0 */    10,  -14,  -27,    5,   13,   28,   -1,   57,   77,   68,
186 /*    10 */    71,  -26,   29,   81,   82,   85,   42,   98,   37,   14,
187 /*    20 */    95,   -7,  108,  110,  111,  116,  114,  117,  118,  119,
188};
189static const YYACTIONTYPE yy_default[] = {
190 /*     0 */   138,  117,  117,  117,  117,  117,  117,  138,  138,   98,
191 /*    10 */    98,  138,  138,  138,  138,  138,   95,   95,  138,  138,
192 /*    20 */   138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
193 /*    30 */   138,  123,  138,  125,  129,  138,  130,  138,  138,  138,
194 /*    40 */   106,  138,  138,  138,  138,  138,  138,  138,  138,  138,
195 /*    50 */   138,  138,  104,   92,   97,  100,  105,  107,  118,  119,
196 /*    60 */   120,  127,  128,  131,  132,  133,  134,  126,  121,  122,
197 /*    70 */   123,  124,  135,  136,  137,  109,  110,  111,  112,  113,
198 /*    80 */   114,  115,  116,  108,  101,  102,  103,   99,   93,   94,
199 /*    90 */    96,
200};
201#define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0]))
202
203/* The next table maps tokens into fallback tokens.  If a construct
204** like the following:
205**
206**      %fallback ID X Y Z.
207**
208** appears in the grammer, then ID becomes a fallback token for X, Y,
209** and Z.  Whenever one of the tokens X, Y, or Z is input to the parser
210** but it does not parse, the type of the token is changed to ID and
211** the parse is retried before an error is thrown.
212*/
213#ifdef YYFALLBACK
214static const YYCODETYPE yyFallback[] = {
215};
216#endif /* YYFALLBACK */
217
218/* The following structure represents a single element of the
219** parser's stack.  Information stored includes:
220**
221**   +  The state number for the parser at this level of the stack.
222**
223**   +  The value of the token stored at this level of the stack.
224**      (In other words, the "major" token.)
225**
226**   +  The semantic value stored at this level of the stack.  This is
227**      the information used by the action routines in the grammar.
228**      It is sometimes called the "minor" token.
229*/
230struct yyStackEntry {
231  int stateno;       /* The state-number */
232  int major;         /* The major token value.  This is the code
233                     ** number for the token at this stack level */
234  YYMINORTYPE minor; /* The user-supplied minor token value.  This
235                     ** is the value of the token  */
236};
237typedef struct yyStackEntry yyStackEntry;
238
239/* The state of the parser is completely contained in an instance of
240** the following structure */
241struct yyParser {
242  int yyidx;                    /* Index of top element in stack */
243  int yyerrcnt;                 /* Shifts left before out of the error */
244  ParseARG_SDECL                /* A place to hold %extra_argument */
245#if YYSTACKDEPTH<=0
246  int yystksz;                  /* Current side of the stack */
247  yyStackEntry *yystack;        /* The parser's stack */
248#else
249  yyStackEntry yystack[YYSTACKDEPTH];  /* The parser's stack */
250#endif
251};
252typedef struct yyParser yyParser;
253
254#ifndef NDEBUG
255#include <stdio.h>
256static FILE *yyTraceFILE = 0;
257static char *yyTracePrompt = 0;
258#endif /* NDEBUG */
259
260#ifndef NDEBUG
261/*
262** Turn parser tracing on by giving a stream to which to write the trace
263** and a prompt to preface each trace message.  Tracing is turned off
264** by making either argument NULL
265**
266** Inputs:
267** <ul>
268** <li> A FILE* to which trace output should be written.
269**      If NULL, then tracing is turned off.
270** <li> A prefix string written at the beginning of every
271**      line of trace output.  If NULL, then tracing is
272**      turned off.
273** </ul>
274**
275** Outputs:
276** None.
277*/
278void ParseTrace(FILE *TraceFILE, char *zTracePrompt){
279  yyTraceFILE = TraceFILE;
280  yyTracePrompt = zTracePrompt;
281  if( yyTraceFILE==0 ) yyTracePrompt = 0;
282  else if( yyTracePrompt==0 ) yyTraceFILE = 0;
283}
284#endif /* NDEBUG */
285
286#ifndef NDEBUG
287/* For tracing shifts, the names of all terminals and nonterminals
288** are required.  The following table supplies these names */
289static const char *const yyTokenName[] = {
290  "$",             "COMMA",         "PLUS",          "MINUS",       
291  "DIV",           "TIMES",         "NEWLINE",       "DELIMETER",   
292  "ASSIGN",        "SEMICOLON",     "LPAREN",        "RPAREN",     
293  "PIPE",          "LESS",          "LESS_EQUAL",    "NOT_EQUAL",   
294  "EQUAL",         "GREATER_EQUAL",  "GREATER",       "FORLOOP_BEGIN",
295  "FORLOOP_END",   "DOUBLE_VAL",    "PARAM_NAME",    "PROD_NAME",   
296  "COMMAND",       "NEURON",        "error",         "production_tail",
297  "prod_piece",    "program",       "counter",       "start_params",
298  "delim",         "first_prod",    "productions",   "double_val", 
299  "start_parameter",  "param_name",    "production",    "prod_name",   
300  "production_head",  "prod_params",   "subproduction",  "conditions", 
301  "real_prod",     "condition",     "single_val",    "multiple_val",
302  "command",       "neuron",     
303};
304#endif /* NDEBUG */
305
306#ifndef NDEBUG
307/* For tracing reduce actions, the names of all rules are required.
308*/
309static const char *const yyRuleName[] = {
310 /*   0 */ "program ::= counter start_params delim first_prod productions",
311 /*   1 */ "counter ::= double_val NEWLINE",
312 /*   2 */ "delim ::= DELIMETER NEWLINE",
313 /*   3 */ "start_params ::= start_parameter start_params",
314 /*   4 */ "start_params ::=",
315 /*   5 */ "start_parameter ::= param_name ASSIGN double_val NEWLINE",
316 /*   6 */ "productions ::= production productions",
317 /*   7 */ "productions ::=",
318 /*   8 */ "first_prod ::= prod_name NEWLINE",
319 /*   9 */ "production ::= production_head SEMICOLON production_tail NEWLINE",
320 /*  10 */ "production_head ::= prod_name LPAREN prod_params RPAREN",
321 /*  11 */ "production_head ::= prod_name LPAREN RPAREN",
322 /*  12 */ "prod_params ::= param_name COMMA prod_params",
323 /*  13 */ "prod_params ::= param_name",
324 /*  14 */ "production_tail ::= subproduction SEMICOLON production_tail",
325 /*  15 */ "production_tail ::= subproduction",
326 /*  16 */ "subproduction ::= conditions PIPE real_prod",
327 /*  17 */ "subproduction ::= real_prod",
328 /*  18 */ "conditions ::= conditions COMMA conditions",
329 /*  19 */ "conditions ::= condition",
330 /*  20 */ "condition ::= param_name LESS double_val",
331 /*  21 */ "condition ::= param_name LESS_EQUAL double_val",
332 /*  22 */ "condition ::= param_name NOT_EQUAL double_val",
333 /*  23 */ "condition ::= param_name EQUAL double_val",
334 /*  24 */ "condition ::= param_name GREATER_EQUAL double_val",
335 /*  25 */ "condition ::= param_name GREATER double_val",
336 /*  26 */ "real_prod ::=",
337 /*  27 */ "real_prod ::= prod_piece real_prod",
338 /*  28 */ "real_prod ::= FORLOOP_BEGIN real_prod FORLOOP_END LPAREN single_val RPAREN real_prod",
339 /*  29 */ "prod_piece ::= prod_name LPAREN multiple_val RPAREN",
340 /*  30 */ "prod_piece ::= prod_name LPAREN RPAREN",
341 /*  31 */ "prod_piece ::= command",
342 /*  32 */ "prod_piece ::= param_name",
343 /*  33 */ "prod_piece ::= neuron",
344 /*  34 */ "multiple_val ::= single_val",
345 /*  35 */ "multiple_val ::= multiple_val COMMA multiple_val",
346 /*  36 */ "single_val ::= double_val",
347 /*  37 */ "single_val ::= param_name",
348 /*  38 */ "single_val ::= single_val PLUS single_val",
349 /*  39 */ "single_val ::= single_val MINUS single_val",
350 /*  40 */ "single_val ::= single_val TIMES single_val",
351 /*  41 */ "single_val ::= single_val DIV single_val",
352 /*  42 */ "double_val ::= DOUBLE_VAL",
353 /*  43 */ "param_name ::= PARAM_NAME",
354 /*  44 */ "prod_name ::= PROD_NAME",
355 /*  45 */ "command ::= COMMAND",
356 /*  46 */ "neuron ::= NEURON",
357};
358#endif /* NDEBUG */
359
360
361#if YYSTACKDEPTH<=0
362/*
363** Try to increase the size of the parser stack.
364*/
365static void yyGrowStack(yyParser *p){
366  int newSize;
367  yyStackEntry *pNew;
368
369  newSize = p->yystksz*2 + 100;
370  pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
371  if( pNew ){
372    p->yystack = pNew;
373    p->yystksz = newSize;
374#ifndef NDEBUG
375    if( yyTraceFILE ){
376      fprintf(yyTraceFILE,"%sStack grows to %d entries!\n",
377              yyTracePrompt, p->yystksz);
378    }
379#endif
380  }
381}
382#endif
383
384/* MW */
385Lsystem *lsys;
386bool syntaxOnly;
387bool *syntaxOk;
388
389/*
390** This function allocates a new parser.
391** The only argument is a pointer to a function which works like
392** malloc.
393**
394** Inputs:
395** A pointer to the function used to allocate memory.
396**
397** Outputs:
398** A pointer to a parser.  This pointer is used in subsequent calls
399** to Parse and ParseFree.
400*/
401void *ParseAlloc(void *(*mallocProc)(size_t), Lsystem *lsystem, bool checkSyntaxOnly = false, bool *isSyntaxOk = NULL){
402  yyParser *pParser;
403  pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) );
404  if( pParser ){
405    pParser->yyidx = -1;
406#if YYSTACKDEPTH<=0
407    yyGrowStack(pParser);
408#endif
409          //input = new Lsystem();
410          lsys = lsystem;
411          syntaxOnly = checkSyntaxOnly;
412          syntaxOk = isSyntaxOk;
413  }
414  return pParser;
415}
416
417/* The following function deletes the value associated with a
418** symbol.  The symbol can be either a terminal or nonterminal.
419** "yymajor" is the symbol code, and "yypminor" is a pointer to
420** the value.
421*/
422static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){
423  switch( yymajor ){
424    /* Here is inserted the actions which take place when a
425    ** terminal or non-terminal is destroyed.  This can happen
426    ** when the symbol is popped from the stack during a
427    ** reduce or during error processing or when a parser is
428    ** being destroyed before it is finished parsing.
429    **
430    ** Note: during a reduce, the only symbols destroyed are those
431    ** which appear on the RHS of the rule, but which are not used
432    ** inside the C code.
433    */
434    default:  break;   /* If no destructor action specified: do nothing */
435  }
436}
437
438/*
439** Pop the parser's stack once.
440**
441** If there is a destructor routine associated with the token which
442** is popped from the stack, then call it.
443**
444** Return the major token number for the symbol popped.
445*/
446static int yy_pop_parser_stack(yyParser *pParser){
447  YYCODETYPE yymajor;
448  yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];
449
450  if( pParser->yyidx<0 ) return 0;
451#ifndef NDEBUG
452  if( yyTraceFILE && pParser->yyidx>=0 ){
453    fprintf(yyTraceFILE,"%sPopping %s\n",
454      yyTracePrompt,
455      yyTokenName[yytos->major]);
456  }
457#endif
458  yymajor = yytos->major;
459  yy_destructor( yymajor, &yytos->minor);
460  pParser->yyidx--;
461  return yymajor;
462}
463
464/*
465** Deallocate and destroy a parser.  Destructors are all called for
466** all stack elements before shutting the parser down.
467**
468** Inputs:
469** <ul>
470** <li>  A pointer to the parser.  This should be a pointer
471**       obtained from ParseAlloc.
472** <li>  A pointer to a function used to reclaim memory obtained
473**       from malloc.
474** </ul>
475*/
476void ParseFree(
477  void *p,                    /* The parser to be deleted */
478  void (*freeProc)(void*)     /* Function used to reclaim memory */
479){
480  yyParser *pParser = (yyParser*)p;
481  if( pParser==0 ) return;
482  while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
483#if YYSTACKDEPTH<=0
484  free(pParser->yystack);
485#endif
486  (*freeProc)((void*)pParser);
487        //delete lsys;
488}
489
490/*
491** Find the appropriate action for a parser given the terminal
492** look-ahead token iLookAhead.
493**
494** If the look-ahead token is YYNOCODE, then check to see if the action is
495** independent of the look-ahead.  If it is, return the action, otherwise
496** return YY_NO_ACTION.
497*/
498static int yy_find_shift_action(
499  yyParser *pParser,        /* The parser */
500  YYCODETYPE iLookAhead     /* The look-ahead token */
501){
502  int i;
503  int stateno = pParser->yystack[pParser->yyidx].stateno;
504 
505  if( stateno>YY_SHIFT_MAX || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){
506    return yy_default[stateno];
507  }
508  assert( iLookAhead!=YYNOCODE );
509  i += iLookAhead;
510  if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
511    if( iLookAhead>0 ){
512#ifdef YYFALLBACK
513      int iFallback;            /* Fallback token */
514      if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
515             && (iFallback = yyFallback[iLookAhead])!=0 ){
516#ifndef NDEBUG
517        if( yyTraceFILE ){
518          fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
519             yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
520        }
521#endif
522        return yy_find_shift_action(pParser, iFallback);
523      }
524#endif
525#ifdef YYWILDCARD
526      {
527        int j = i - iLookAhead + YYWILDCARD;
528        if( j>=0 && j<YY_SZ_ACTTAB && yy_lookahead[j]==YYWILDCARD ){
529#ifndef NDEBUG
530          if( yyTraceFILE ){
531            fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
532               yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]);
533          }
534#endif /* NDEBUG */
535          return yy_action[j];
536        }
537      }
538#endif /* YYWILDCARD */
539    }
540    return yy_default[stateno];
541  }else{
542    return yy_action[i];
543  }
544}
545
546/*
547** Find the appropriate action for a parser given the non-terminal
548** look-ahead token iLookAhead.
549**
550** If the look-ahead token is YYNOCODE, then check to see if the action is
551** independent of the look-ahead.  If it is, return the action, otherwise
552** return YY_NO_ACTION.
553*/
554static int yy_find_reduce_action(
555  int stateno,              /* Current state number */
556  YYCODETYPE iLookAhead     /* The look-ahead token */
557){
558  int i;
559  assert( stateno<=YY_REDUCE_MAX );
560  i = yy_reduce_ofst[stateno];
561  assert( i!=YY_REDUCE_USE_DFLT );
562  assert( iLookAhead!=YYNOCODE );
563  i += iLookAhead;
564  assert( i>=0 && i<YY_SZ_ACTTAB );
565  assert( yy_lookahead[i]==iLookAhead );
566  return yy_action[i];
567}
568
569/*
570** The following routine is called if the stack overflows.
571*/
572static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
573   ParseARG_FETCH;
574   yypParser->yyidx--;
575#ifndef NDEBUG
576   if( yyTraceFILE ){
577     fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
578   }
579#endif
580   while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
581   /* Here code is inserted which will execute if the parser
582   ** stack every overflows */
583   ParseARG_STORE; /* Suppress warning about unused %extra_argument var */
584}
585
586/*
587** Perform a shift action.
588*/
589static void yy_shift(
590  yyParser *yypParser,          /* The parser to be shifted */
591  int yyNewState,               /* The new state to shift in */
592  int yyMajor,                  /* The major token to shift in */
593  YYMINORTYPE *yypMinor         /* Pointer ot the minor token to shift in */
594){
595  yyStackEntry *yytos;
596  yypParser->yyidx++;
597#if YYSTACKDEPTH>0
598  if( yypParser->yyidx>=YYSTACKDEPTH ){
599    yyStackOverflow(yypParser, yypMinor);
600    return;
601  }
602#else
603  if( yypParser->yyidx>=yypParser->yystksz ){
604    yyGrowStack(yypParser);
605    if( yypParser->yyidx>=yypParser->yystksz ){
606      yyStackOverflow(yypParser, yypMinor);
607      return;
608    }
609  }
610#endif
611  yytos = &yypParser->yystack[yypParser->yyidx];
612  yytos->stateno = yyNewState;
613  yytos->major = yyMajor;
614  yytos->minor = *yypMinor;
615#ifndef NDEBUG
616  if( yyTraceFILE && yypParser->yyidx>0 ){
617    int i;
618    fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState);
619    fprintf(yyTraceFILE,"%sStack:",yyTracePrompt);
620    for(i=1; i<=yypParser->yyidx; i++)
621      fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]);
622    fprintf(yyTraceFILE,"\n");
623  }
624#endif
625}
626
627/* The following table contains information about every rule that
628** is used during the reduce.
629*/
630static const struct {
631  YYCODETYPE lhs;         /* Symbol on the left-hand side of the rule */
632  unsigned char nrhs;     /* Number of right-hand side symbols in the rule */
633} yyRuleInfo[] = {
634  { 29, 5 },
635  { 30, 2 },
636  { 32, 2 },
637  { 31, 2 },
638  { 31, 0 },
639  { 36, 4 },
640  { 34, 2 },
641  { 34, 0 },
642  { 33, 2 },
643  { 38, 4 },
644  { 40, 4 },
645  { 40, 3 },
646  { 41, 3 },
647  { 41, 1 },
648  { 27, 3 },
649  { 27, 1 },
650  { 42, 3 },
651  { 42, 1 },
652  { 43, 3 },
653  { 43, 1 },
654  { 45, 3 },
655  { 45, 3 },
656  { 45, 3 },
657  { 45, 3 },
658  { 45, 3 },
659  { 45, 3 },
660  { 44, 0 },
661  { 44, 2 },
662  { 44, 7 },
663  { 28, 4 },
664  { 28, 3 },
665  { 28, 1 },
666  { 28, 1 },
667  { 28, 1 },
668  { 47, 1 },
669  { 47, 3 },
670  { 46, 1 },
671  { 46, 1 },
672  { 46, 3 },
673  { 46, 3 },
674  { 46, 3 },
675  { 46, 3 },
676  { 35, 1 },
677  { 37, 1 },
678  { 39, 1 },
679  { 48, 1 },
680  { 49, 1 },
681};
682
683static void yy_accept(yyParser*);  /* Forward Declaration */
684
685/*
686** Perform a reduce action and the shift that must immediately
687** follow the reduce.
688*/
689static void yy_reduce(
690  yyParser *yypParser,         /* The parser */
691  int yyruleno                 /* Number of the rule by which to reduce */
692){
693  int yygoto;                     /* The next state */
694  int yyact;                      /* The next action */
695  YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
696  yyStackEntry *yymsp;            /* The top of the parser's stack */
697  int yysize;                     /* Amount to pop the stack */
698  ParseARG_FETCH;
699  yymsp = &yypParser->yystack[yypParser->yyidx];
700#ifndef NDEBUG
701  if( yyTraceFILE && yyruleno>=0
702        && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
703    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
704      yyRuleName[yyruleno]);
705  }
706#endif /* NDEBUG */
707
708  /* Silence complaints from purify about yygotominor being uninitialized
709  ** in some cases when it is copied into the stack after the following
710  ** switch.  yygotominor is uninitialized when a rule reduces that does
711  ** not set the value of its left-hand side nonterminal.  Leaving the
712  ** value of the nonterminal uninitialized is utterly harmless as long
713  ** as the value is never used.  So really the only thing this code
714  ** accomplishes is to quieten purify. 
715  **
716  ** 2007-01-16:  The wireshark project (www.wireshark.org) reports that
717  ** without this code, their parser segfaults.  I'm not sure what there
718  ** parser is doing to make this happen.  This is the second bug report
719  ** from wireshark this week.  Clearly they are stressing Lemon in ways
720  ** that it has not been previously stressed...  (SQLite ticket #2172)
721  */
722  memset(&yygotominor, 0, sizeof(yygotominor));
723
724
725  switch( yyruleno ){
726  /* Beginning here are the reduction cases.  A typical example
727  ** follows:
728  **   case 0:
729  **  #line <lineno> <grammarfile>
730  **     { ... }           // User supplied code
731  **  #line <lineno> <thisfile>
732  **     break;
733  */
734      case 0: /* program ::= counter start_params delim first_prod productions */
735#line 18 "conv_f8tof1_grammar.y"
736{
737        *syntaxOk = true;       
738}
739#line 741 "conv_f8tof1_grammar.c"
740        break;
741      case 1: /* counter ::= double_val NEWLINE */
742#line 22 "conv_f8tof1_grammar.y"
743{
744        if (!syntaxOnly) {
745                {
746#if PARSER_DEBUG > 0
747                        std::cout << "counter ::= double_val NEWLINE." << std::endl;
748#endif
749                }
750                lsys->iterations = (int) yymsp[-1].minor.yy78.dblValue;
751        }
752}
753#line 755 "conv_f8tof1_grammar.c"
754        break;
755      case 2: /* delim ::= DELIMETER NEWLINE */
756      case 3: /* start_params ::= start_parameter start_params */
757      case 4: /* start_params ::= */
758      case 6: /* productions ::= production productions */
759      case 7: /* productions ::= */
760#line 33 "conv_f8tof1_grammar.y"
761{
762}
763#line 765 "conv_f8tof1_grammar.c"
764        break;
765      case 5: /* start_parameter ::= param_name ASSIGN double_val NEWLINE */
766#line 38 "conv_f8tof1_grammar.y"
767{
768        if (!syntaxOnly) {
769                {       
770#if PARSER_DEBUG > 0
771                        std::cout << "start_parameter ::= param_name ASSIGN double_val NEWLINE." << std::endl;
772#endif
773                }
774                lsys->startParams[sstringToString(*(yymsp[-3].minor.yy78.strValue))] = yymsp[-1].minor.yy78.dblValue;
775#if PARSER_DEBUG > 0
776                cout << "**** " << lsys->startParams["n0"] << endl;
777                cout << "**** " << lsys->startParams["n1"] << endl;
778#endif
779                delete yymsp[-3].minor.yy78.strValue;
780        }
781}
782#line 784 "conv_f8tof1_grammar.c"
783        break;
784      case 8: /* first_prod ::= prod_name NEWLINE */
785#line 57 "conv_f8tof1_grammar.y"
786{
787        if (!syntaxOnly) {
788                {
789#if PARSER_DEBUG > 0
790                        std::cout << "first_prod ::= prod_name NEWLINE." << std::endl;
791#endif
792                }
793                lsys->firstProductionName = sstringToString(*(yymsp[-1].minor.yy78.strValue));
794                delete yymsp[-1].minor.yy78.strValue;
795        }
796}
797#line 799 "conv_f8tof1_grammar.c"
798        break;
799      case 9: /* production ::= production_head SEMICOLON production_tail NEWLINE */
800#line 69 "conv_f8tof1_grammar.y"
801{
802        if (!syntaxOnly) {
803                {
804#if PARSER_DEBUG > 0
805                        std::cout << "production ::= production_head SEMICOLON production_tail NEWLINE." << std::endl;
806#endif
807                }
808                Production *p = lsys->productions[sstringToString(*(yymsp[-3].minor.yy78.strValue))];
809                for (vector<SString>::iterator paramIter = yymsp[-3].minor.yy78.vectorStr->begin(); paramIter != yymsp[-3].minor.yy78.vectorStr->end(); paramIter++) {
810#if PARSER_DEBUG > 0
811                        std::cout << "1.1 " << *paramIter << std::endl;
812                        std::cout << *(yymsp[-3].minor.yy78.strValue) << " # " << (p == NULL) << " # " << true << std::endl;
813#endif
814                        p->parameters.addParameter(*paramIter);
815                }
816                p->subproductions = *(yymsp[-1].minor.yy11.subproductions);
817                delete yymsp[-3].minor.yy78.strValue;
818                delete yymsp[-3].minor.yy78.vectorStr;
819                delete yymsp[-1].minor.yy11.subproductions;
820        }
821}
822#line 824 "conv_f8tof1_grammar.c"
823        break;
824      case 10: /* production_head ::= prod_name LPAREN prod_params RPAREN */
825#line 91 "conv_f8tof1_grammar.y"
826{
827        if (!syntaxOnly) {
828                {
829#if PARSER_DEBUG > 0
830                        std::cout << "production_head ::= prod_name LPAREN prod_params RPAREN." << std::endl;
831#endif
832                }
833#if PARSER_DEBUG > 0
834                std::cout << "---------" << *(yymsp[-3].minor.yy78.strValue) << std::endl;
835#endif
836                yygotominor.yy78.strValue = new SString(*(yymsp[-3].minor.yy78.strValue));
837                yygotominor.yy78.vectorStr = new vector<SString>(*(yymsp[-1].minor.yy78.vectorStr));
838                delete yymsp[-3].minor.yy78.strValue;
839                delete yymsp[-1].minor.yy78.vectorStr;
840        }
841}
842#line 844 "conv_f8tof1_grammar.c"
843        break;
844      case 11: /* production_head ::= prod_name LPAREN RPAREN */
845#line 107 "conv_f8tof1_grammar.y"
846{
847        if (!syntaxOnly) {
848                {
849#if PARSER_DEBUG > 0
850                        std::cout << "production_head ::= prod_name LPAREN RPAREN." << std::endl;
851#endif
852                }
853#if PARSER_DEBUG > 0
854                std::cout << "---------" << *(yymsp[-2].minor.yy78.strValue) << std::endl;
855#endif
856                yygotominor.yy78.strValue = new SString(*(yymsp[-2].minor.yy78.strValue));
857                yygotominor.yy78.vectorStr = new vector<SString>();
858                delete yymsp[-2].minor.yy78.strValue;
859        }
860}
861#line 863 "conv_f8tof1_grammar.c"
862        break;
863      case 12: /* prod_params ::= param_name COMMA prod_params */
864#line 123 "conv_f8tof1_grammar.y"
865{
866        if (!syntaxOnly) {
867                {
868#if PARSER_DEBUG > 0
869                        std::cout << "prod_params ::= param_name COMMA prod_params." << std::endl;
870#endif
871                }
872                yygotominor.yy78.vectorStr = new vector<SString>();
873                yygotominor.yy78.vectorStr->push_back(*(yymsp[-2].minor.yy78.strValue));
874                for (vector<SString>::iterator iter = yymsp[0].minor.yy78.vectorStr->begin(); iter != yymsp[0].minor.yy78.vectorStr->end(); iter++) {
875                        yygotominor.yy78.vectorStr->push_back(*iter);
876                }
877                delete yymsp[-2].minor.yy78.strValue;
878                delete yymsp[0].minor.yy78.vectorStr;
879        }
880}
881#line 883 "conv_f8tof1_grammar.c"
882        break;
883      case 13: /* prod_params ::= param_name */
884#line 139 "conv_f8tof1_grammar.y"
885{
886        if (!syntaxOnly) {
887                {
888#if PARSER_DEBUG > 0
889                        std::cout << "prod_params ::= param_name." << std::endl;
890#endif
891                }
892                yygotominor.yy78.vectorStr = new vector<SString>();
893                yygotominor.yy78.vectorStr->push_back(*(yymsp[0].minor.yy78.strValue));
894                delete yymsp[0].minor.yy78.strValue;
895        }
896}
897#line 899 "conv_f8tof1_grammar.c"
898        break;
899      case 14: /* production_tail ::= subproduction SEMICOLON production_tail */
900#line 152 "conv_f8tof1_grammar.y"
901{
902        if (!syntaxOnly) {
903                {
904#if PARSER_DEBUG > 0
905                        std::cout << "production_tail ::= subproduction SEMICOLON production_tail." << std::endl;
906#endif
907                }
908                SubProduction sp;
909                sp.conditions = *(yymsp[-2].minor.yy78.vectorConditions);
910                vector<ActionStrP> actions;
911                actions.reserve(yymsp[-2].minor.yy78.vectorActions->size());
912                for (int i = 0; i < yymsp[-2].minor.yy78.vectorActions->size() && i < yymsp[-2].minor.yy78.parameters->size(); i++) {
913                        ActionStrP ap;
914                        ap.action = (*(yymsp[-2].minor.yy78.vectorActions)).at(i);
915                        ap.params = (*(yymsp[-2].minor.yy78.parameters)).at(i);
916                        actions.push_back(ap);
917                }
918                sp.actions = actions;
919                yygotominor.yy11.subproductions = new vector<SubProduction>();
920                yygotominor.yy11.subproductions->push_back(sp);
921                for (vector<SubProduction>::iterator iter = yymsp[0].minor.yy11.subproductions->begin(); iter != yymsp[0].minor.yy11.subproductions->end(); iter++) {
922                        yygotominor.yy11.subproductions->push_back(*iter);
923                }
924                delete yymsp[-2].minor.yy78.vectorConditions;
925                delete yymsp[-2].minor.yy78.vectorActions;
926                delete yymsp[-2].minor.yy78.parameters;
927                delete yymsp[0].minor.yy11.subproductions;
928        }
929}
930#line 932 "conv_f8tof1_grammar.c"
931        break;
932      case 15: /* production_tail ::= subproduction */
933#line 181 "conv_f8tof1_grammar.y"
934{
935        if (!syntaxOnly) {
936                {
937#if PARSER_DEBUG > 0
938                        std::cout << "production_tail ::= subproduction." << std::endl;
939#endif
940                }
941                SubProduction sp;
942                sp.conditions = *(yymsp[0].minor.yy78.vectorConditions);
943                vector<ActionStrP> actions;
944                actions.reserve(yymsp[0].minor.yy78.vectorActions->size());
945                for (int i = 0; i < yymsp[0].minor.yy78.vectorActions->size() && i < yymsp[0].minor.yy78.parameters->size(); i++) {
946                        ActionStrP ap;
947                        ap.action = (*(yymsp[0].minor.yy78.vectorActions)).at(i);
948                        ap.params = (*(yymsp[0].minor.yy78.parameters)).at(i);
949                        actions.push_back(ap);
950                }
951                sp.actions = actions;
952                yygotominor.yy11.subproductions = new vector<SubProduction>();
953                yygotominor.yy11.subproductions->push_back(sp);
954                delete yymsp[0].minor.yy78.vectorConditions;
955                delete yymsp[0].minor.yy78.vectorActions;
956                delete yymsp[0].minor.yy78.parameters;
957        }
958}
959#line 961 "conv_f8tof1_grammar.c"
960        break;
961      case 16: /* subproduction ::= conditions PIPE real_prod */
962#line 207 "conv_f8tof1_grammar.y"
963{
964        if (!syntaxOnly) {
965                {
966#if PARSER_DEBUG > 0
967                        std::cout << "subproduction ::= conditions PIPE real_prod." << std::endl;
968#endif
969                }
970                yygotominor.yy78.vectorConditions = new vector<Condition>(*(yymsp[-2].minor.yy78.vectorConditions));
971                yygotominor.yy78.vectorActions = new vector<Action*>(*(yymsp[0].minor.yy78.vectorActions));
972                yygotominor.yy78.parameters = new vector<vector<SString> >(*(yymsp[0].minor.yy78.parameters));
973                delete yymsp[-2].minor.yy78.vectorConditions;
974                delete yymsp[0].minor.yy78.vectorActions;
975                delete yymsp[0].minor.yy78.parameters;
976        }
977}
978#line 980 "conv_f8tof1_grammar.c"
979        break;
980      case 17: /* subproduction ::= real_prod */
981#line 222 "conv_f8tof1_grammar.y"
982{
983        if (!syntaxOnly) {
984                {
985#if PARSER_DEBUG > 0
986                        std::cout << "subproduction ::= real_prod." << std::endl;
987#endif
988                }
989                yygotominor.yy78.vectorConditions = new vector<Condition>();
990                yygotominor.yy78.vectorActions = new vector<Action*>(*(yymsp[0].minor.yy78.vectorActions));
991                yygotominor.yy78.parameters = new vector<vector<SString> >(*(yymsp[0].minor.yy78.parameters));
992                delete yymsp[0].minor.yy78.vectorActions;
993                delete yymsp[0].minor.yy78.parameters;
994        }
995}
996#line 998 "conv_f8tof1_grammar.c"
997        break;
998      case 18: /* conditions ::= conditions COMMA conditions */
999#line 237 "conv_f8tof1_grammar.y"
1000{
1001        if (!syntaxOnly) {
1002                {
1003#if PARSER_DEBUG > 0
1004                        std::cout << "conditions ::= condition COMMA conditions." << std::endl;
1005#endif
1006                }
1007                yygotominor.yy78.vectorConditions = new vector<Condition>(*(yymsp[-2].minor.yy78.vectorConditions));
1008                for (vector<Condition>::iterator iter = yymsp[0].minor.yy78.vectorConditions->begin();
1009                         iter != yymsp[0].minor.yy78.vectorConditions->end(); iter++) {
1010                        yygotominor.yy78.vectorConditions->push_back(*iter);
1011                }       
1012                delete yymsp[-2].minor.yy78.vectorConditions;
1013                delete yymsp[0].minor.yy78.vectorConditions;
1014        }
1015}
1016#line 1018 "conv_f8tof1_grammar.c"
1017        break;
1018      case 19: /* conditions ::= condition */
1019#line 253 "conv_f8tof1_grammar.y"
1020{
1021        if (!syntaxOnly) {
1022                {
1023#if PARSER_DEBUG > 0
1024                        std::cout << "conditions ::= condition." << std::endl;
1025#endif
1026                }
1027                yygotominor.yy78.vectorConditions = new vector<Condition>();
1028                yygotominor.yy78.vectorConditions->push_back(*(yymsp[0].minor.yy78.cond));
1029                delete yymsp[0].minor.yy78.cond;
1030        }
1031}
1032#line 1034 "conv_f8tof1_grammar.c"
1033        break;
1034      case 20: /* condition ::= param_name LESS double_val */
1035#line 266 "conv_f8tof1_grammar.y"
1036{
1037        if (!syntaxOnly) {
1038                {
1039#if PARSER_DEBUG > 0
1040                        std::cout << "condition ::= param_name LESS double_val." << std::endl;
1041#endif
1042                }
1043                yygotominor.yy78.cond = new Condition();
1044                yygotominor.yy78.cond->relation = r_less;
1045                yygotominor.yy78.cond->parameter = *(yymsp[-2].minor.yy78.strValue);
1046                yygotominor.yy78.cond->value = yymsp[0].minor.yy78.dblValue;
1047                delete yymsp[-2].minor.yy78.strValue;
1048        }
1049}
1050#line 1052 "conv_f8tof1_grammar.c"
1051        break;
1052      case 21: /* condition ::= param_name LESS_EQUAL double_val */
1053#line 280 "conv_f8tof1_grammar.y"
1054{
1055        if (!syntaxOnly) {
1056                {
1057#if PARSER_DEBUG > 0
1058                        std::cout << "condition ::= param_name LESS_EQUAL double_val." << std::endl;
1059#endif
1060                }
1061                yygotominor.yy78.cond = new Condition();
1062                yygotominor.yy78.cond->relation = r_lessEqual;
1063                yygotominor.yy78.cond->parameter = *(yymsp[-2].minor.yy78.strValue);
1064                yygotominor.yy78.cond->value = yymsp[0].minor.yy78.dblValue;
1065                delete yymsp[-2].minor.yy78.strValue;
1066        }
1067}
1068#line 1070 "conv_f8tof1_grammar.c"
1069        break;
1070      case 22: /* condition ::= param_name NOT_EQUAL double_val */
1071#line 294 "conv_f8tof1_grammar.y"
1072{
1073        if (!syntaxOnly) {
1074                {
1075#if PARSER_DEBUG > 0
1076                        std::cout << "condition ::= param_name NOT_EQUAL double_val." << std::endl;
1077#endif
1078                }
1079                yygotominor.yy78.cond = new Condition();
1080                yygotominor.yy78.cond->relation = r_different;
1081                yygotominor.yy78.cond->parameter = *(yymsp[-2].minor.yy78.strValue);
1082                yygotominor.yy78.cond->value = yymsp[0].minor.yy78.dblValue;
1083                delete yymsp[-2].minor.yy78.strValue;
1084        }
1085}
1086#line 1088 "conv_f8tof1_grammar.c"
1087        break;
1088      case 23: /* condition ::= param_name EQUAL double_val */
1089#line 308 "conv_f8tof1_grammar.y"
1090{
1091        if (!syntaxOnly) {
1092                {
1093#if PARSER_DEBUG > 0
1094                        std::cout << "condition ::= param_name EQUAL double_val." << std::endl;
1095#endif
1096                }
1097                yygotominor.yy78.cond = new Condition();
1098                yygotominor.yy78.cond->relation = r_equal;
1099                yygotominor.yy78.cond->parameter = *(yymsp[-2].minor.yy78.strValue);
1100                yygotominor.yy78.cond->value = yymsp[0].minor.yy78.dblValue;
1101                delete yymsp[-2].minor.yy78.strValue;
1102        }
1103}
1104#line 1106 "conv_f8tof1_grammar.c"
1105        break;
1106      case 24: /* condition ::= param_name GREATER_EQUAL double_val */
1107#line 322 "conv_f8tof1_grammar.y"
1108{
1109        if (!syntaxOnly) {
1110                {
1111#if PARSER_DEBUG > 0
1112                        std::cout << "condition ::= param_name GREATER_EQUAL double_val." << std::endl;
1113#endif
1114                }
1115                yygotominor.yy78.cond = new Condition();
1116                yygotominor.yy78.cond->relation = r_greaterEqual;
1117                yygotominor.yy78.cond->parameter = *(yymsp[-2].minor.yy78.strValue);
1118                yygotominor.yy78.cond->value = yymsp[0].minor.yy78.dblValue;
1119                delete yymsp[-2].minor.yy78.strValue;
1120        }
1121}
1122#line 1124 "conv_f8tof1_grammar.c"
1123        break;
1124      case 25: /* condition ::= param_name GREATER double_val */
1125#line 336 "conv_f8tof1_grammar.y"
1126{
1127        if (!syntaxOnly) {
1128                {
1129#if PARSER_DEBUG > 0
1130                        std::cout << "condition ::= param_name GREATER double_val." << std::endl;
1131#endif
1132                }
1133                yygotominor.yy78.cond = new Condition();
1134                yygotominor.yy78.cond->relation = r_greater;
1135                yygotominor.yy78.cond->parameter = *(yymsp[-2].minor.yy78.strValue);
1136                yygotominor.yy78.cond->value = yymsp[0].minor.yy78.dblValue;
1137                delete yymsp[-2].minor.yy78.strValue;
1138        }
1139}
1140#line 1142 "conv_f8tof1_grammar.c"
1141        break;
1142      case 26: /* real_prod ::= */
1143#line 351 "conv_f8tof1_grammar.y"
1144{
1145        if (!syntaxOnly) {
1146                {
1147#if PARSER_DEBUG > 0
1148                        std::cout << "real_prod ::= ." << std::endl;
1149#endif
1150                }
1151                yygotominor.yy78.vectorActions = new vector<Action*>();
1152                yygotominor.yy78.parameters = new vector<vector<SString> >();
1153        }
1154}
1155#line 1157 "conv_f8tof1_grammar.c"
1156        break;
1157      case 27: /* real_prod ::= prod_piece real_prod */
1158#line 362 "conv_f8tof1_grammar.y"
1159{
1160        if (!syntaxOnly) {
1161                {
1162#if PARSER_DEBUG > 0
1163                        std::cout << "real_prod ::= prod_piece real_prod." << std::endl;
1164                        for (vector<Action*>::iterator actIter = yymsp[-1].minor.yy89.actions->begin(); actIter != yymsp[-1].minor.yy89.actions->end(); actIter++) {
1165                                cout << "\t" << (*actIter)->name << endl;
1166                        }
1167#endif
1168                }
1169                //yygotominor.yy78 = yymsp[-1].minor.yy89.clone() && yygotominor.yy78.append(yymsp[0].minor.yy78)
1170                yygotominor.yy78.vectorActions = new vector<Action*>(*(yymsp[-1].minor.yy89.actions));
1171                yygotominor.yy78.parameters = new vector<vector<SString> >(*(yymsp[-1].minor.yy89.parameters));
1172                if (yymsp[0].minor.yy78.vectorActions != NULL && yymsp[0].minor.yy78.parameters != NULL) {
1173                        for (vector<Action*>::iterator iter = yymsp[0].minor.yy78.vectorActions->begin(); iter != yymsp[0].minor.yy78.vectorActions->end(); iter++) {
1174                                yygotominor.yy78.vectorActions->push_back(*iter);
1175                        }
1176                        for(vector<vector<SString> >::iterator iter = yymsp[0].minor.yy78.parameters->begin(); iter != yymsp[0].minor.yy78.parameters->end(); iter++) {
1177                                yygotominor.yy78.parameters->push_back(*iter);
1178                        }
1179                        delete yymsp[0].minor.yy78.vectorActions;
1180                        delete yymsp[0].minor.yy78.parameters;
1181                } else {
1182#if PARSER_DEBUG > 0
1183                        cout << "\tNULL~~~~~~~~~~~~" << endl;
1184#endif
1185                }
1186                delete yymsp[-1].minor.yy89.actions;
1187                delete yymsp[-1].minor.yy89.parameters;
1188        }
1189}
1190#line 1192 "conv_f8tof1_grammar.c"
1191        break;
1192      case 28: /* real_prod ::= FORLOOP_BEGIN real_prod FORLOOP_END LPAREN single_val RPAREN real_prod */
1193#line 393 "conv_f8tof1_grammar.y"
1194{
1195        if (!syntaxOnly) {
1196                {
1197#if PARSER_DEBUG > 0
1198                        std::cout << "real_prod ::= FORLOOP_BEGIN real_prod FORLOOP_END LPAREN single_val RPAREN." << std::endl;
1199#endif
1200                }
1201                yygotominor.yy78.vectorActions = new vector<Action*>();
1202                yygotominor.yy78.parameters = new vector<vector<SString> >();
1203                int iterations = (int) parseExpression(*(yymsp[-2].minor.yy78.strValue));
1204                for (int i = 0; i < iterations; i++) {
1205                        for (vector<Action*>::iterator iter = yymsp[-5].minor.yy78.vectorActions->begin(); iter != yymsp[-5].minor.yy78.vectorActions->end(); iter++) {
1206                                yygotominor.yy78.vectorActions->push_back(*iter);
1207                        }
1208                        for (vector<vector<SString> >::iterator iter = yymsp[-5].minor.yy78.parameters->begin(); iter != yymsp[-5].minor.yy78.parameters->end(); iter++) {
1209                                yygotominor.yy78.parameters->push_back(*iter);
1210                        }
1211                }
1212                for (vector<Action*>::iterator iter = yymsp[0].minor.yy78.vectorActions->begin(); iter != yymsp[0].minor.yy78.vectorActions->end(); iter++) {
1213                        yygotominor.yy78.vectorActions->push_back(*iter);
1214                }
1215                for (vector<vector<SString> >::iterator iter = yymsp[0].minor.yy78.parameters->begin(); iter != yymsp[0].minor.yy78.parameters->end(); iter++) {
1216                        yygotominor.yy78.parameters->push_back(*iter);
1217                }
1218                delete yymsp[-5].minor.yy78.vectorActions;
1219                delete yymsp[-5].minor.yy78.parameters;
1220                delete yymsp[-2].minor.yy78.strValue;
1221                delete yymsp[0].minor.yy78.vectorActions;
1222                delete yymsp[0].minor.yy78.parameters;
1223        }
1224}
1225#line 1227 "conv_f8tof1_grammar.c"
1226        break;
1227      case 29: /* prod_piece ::= prod_name LPAREN multiple_val RPAREN */
1228#line 425 "conv_f8tof1_grammar.y"
1229{
1230        if (!syntaxOnly) {
1231                {
1232#if PARSER_DEBUG > 0
1233                        std::cout << "prod_piece ::= prod_name LPAREN multiple_val RPAREN." << std::endl;
1234#endif
1235                }
1236                yygotominor.yy89.actions = new vector<Action*>();
1237                yygotominor.yy89.parameters = new vector<vector<SString> >();
1238               
1239                Production *p = lsys->productions.find(sstringToString(*(yymsp[-3].minor.yy78.strValue)))->second;
1240                yygotominor.yy89.actions->push_back(p);
1241                yygotominor.yy89.parameters->push_back(*(yymsp[-1].minor.yy78.vectorStr));
1242                delete yymsp[-3].minor.yy78.strValue;
1243                delete yymsp[-1].minor.yy78.vectorStr;
1244        }
1245}
1246#line 1248 "conv_f8tof1_grammar.c"
1247        break;
1248      case 30: /* prod_piece ::= prod_name LPAREN RPAREN */
1249#line 442 "conv_f8tof1_grammar.y"
1250{
1251        if (!syntaxOnly) {
1252                {
1253#if PARSER_DEBUG > 0
1254                        std::cout << "prod_piece ::= prod_name LPAREN RPAREN." << std::endl;
1255#endif
1256                }
1257                yygotominor.yy89.actions = new vector<Action*>();
1258                vector<SString> param;
1259                yygotominor.yy89.parameters = new vector<vector<SString> >();
1260                yygotominor.yy89.parameters->push_back(param);
1261               
1262                Production *p = lsys->productions.find(sstringToString(*(yymsp[-2].minor.yy78.strValue)))->second;
1263                yygotominor.yy89.actions->push_back(p);
1264                delete yymsp[-2].minor.yy78.strValue;
1265        }
1266}
1267#line 1269 "conv_f8tof1_grammar.c"
1268        break;
1269      case 31: /* prod_piece ::= command */
1270#line 459 "conv_f8tof1_grammar.y"
1271{
1272        if (!syntaxOnly) {
1273                {
1274#if PARSER_DEBUG > 0
1275                        std::cout << "prod_piece ::= command."  << std::endl;
1276#endif
1277                }
1278                yygotominor.yy89.actions = new vector<Action*>();
1279                yygotominor.yy89.parameters = new vector<vector<SString> >();
1280                PrimitiveProduction *pp = lsys->getPrimitiveProduction(*(yymsp[0].minor.yy78.strValue));
1281                yygotominor.yy89.actions->push_back(pp);
1282                vector<SString> param;
1283                yygotominor.yy89.parameters->push_back(param);
1284                delete yymsp[0].minor.yy78.strValue;
1285        }
1286}
1287#line 1289 "conv_f8tof1_grammar.c"
1288        break;
1289      case 32: /* prod_piece ::= param_name */
1290#line 475 "conv_f8tof1_grammar.y"
1291{
1292        if (!syntaxOnly) {
1293                {
1294#if PARSER_DEBUG > 0
1295                        std::cout << "prod_piece ::= paramName." << std::endl;
1296#endif
1297                }
1298                yygotominor.yy89.actions = new vector<Action*>();
1299                yygotominor.yy89.parameters = new vector<vector<SString> >();
1300                ParamProduction *pp = lsys->getParamProduction(*(yymsp[0].minor.yy78.strValue));
1301                yygotominor.yy89.actions->push_back(pp);
1302                vector<SString> param;
1303                param.push_back(*(yymsp[0].minor.yy78.strValue));
1304                yygotominor.yy89.parameters->push_back(param);
1305                delete yymsp[0].minor.yy78.strValue;
1306        }
1307}
1308#line 1310 "conv_f8tof1_grammar.c"
1309        break;
1310      case 33: /* prod_piece ::= neuron */
1311#line 492 "conv_f8tof1_grammar.y"
1312{
1313        if (!syntaxOnly) {
1314                {
1315#if PARSER_DEBUG > 0
1316                        std::cout << "prod_piece ::= neuron." << std::endl;
1317#endif
1318                }
1319                yygotominor.yy89.actions = new vector<Action*>();
1320                yygotominor.yy89.parameters = new vector<vector<SString> >();
1321                NeuronProduction *np = new NeuronProduction(*(yymsp[0].minor.yy78.strValue));
1322                lsys->neuronProductions.push_back(np);
1323                yygotominor.yy89.actions->push_back(np);
1324                vector<SString> param;
1325                yygotominor.yy89.parameters->push_back(param);
1326                delete yymsp[0].minor.yy78.strValue;           
1327        }
1328}
1329#line 1331 "conv_f8tof1_grammar.c"
1330        break;
1331      case 34: /* multiple_val ::= single_val */
1332#line 510 "conv_f8tof1_grammar.y"
1333{
1334        if (!syntaxOnly) {
1335                {
1336#if PARSER_DEBUG > 0
1337                        std::cout << "multiple_val ::= single_val." << std::endl;
1338#endif
1339                }
1340                yygotominor.yy78.vectorStr = new vector<SString>();
1341                yygotominor.yy78.vectorStr->push_back(SString(*(yymsp[0].minor.yy78.strValue)));
1342                delete yymsp[0].minor.yy78.strValue;
1343        }
1344}
1345#line 1347 "conv_f8tof1_grammar.c"
1346        break;
1347      case 35: /* multiple_val ::= multiple_val COMMA multiple_val */
1348#line 522 "conv_f8tof1_grammar.y"
1349{
1350        if (!syntaxOnly) {
1351                {
1352#if PARSER_DEBUG > 0
1353                        std::cout << "multiple_val ::= multiple_val COMMA multiple_val." << std::endl;
1354#endif
1355                }
1356                yygotominor.yy78.vectorStr = new vector<SString>();
1357                for (vector<SString>::iterator iter = yymsp[-2].minor.yy78.vectorStr->begin(); iter != yymsp[-2].minor.yy78.vectorStr->end(); iter++) {
1358                        yygotominor.yy78.vectorStr->push_back(*iter);
1359                }
1360                for (vector<SString>::iterator iter = yymsp[0].minor.yy78.vectorStr->begin(); iter != yymsp[0].minor.yy78.vectorStr->end(); iter++) {
1361                        yygotominor.yy78.vectorStr->push_back(*iter);
1362                }
1363                delete yymsp[-2].minor.yy78.vectorStr;
1364                delete yymsp[0].minor.yy78.vectorStr;
1365        }
1366}
1367#line 1369 "conv_f8tof1_grammar.c"
1368        break;
1369      case 36: /* single_val ::= double_val */
1370#line 541 "conv_f8tof1_grammar.y"
1371{
1372        if (!syntaxOnly) {
1373                {
1374#if PARSER_DEBUG > 0
1375                        std::cout << "single_val ::= double_val." << std::endl;
1376#endif
1377                }
1378                yygotominor.yy78.strValue = new SString(SString::valueOf(yymsp[0].minor.yy78.dblValue) + ";");
1379                delete yymsp[0].minor.yy78.strValue;
1380        }
1381}
1382#line 1384 "conv_f8tof1_grammar.c"
1383        break;
1384      case 37: /* single_val ::= param_name */
1385#line 552 "conv_f8tof1_grammar.y"
1386{
1387        if (!syntaxOnly) {
1388                {
1389#if PARSER_DEBUG > 0
1390                        std::cout << "single_val ::= param_name." << std::endl;
1391#endif
1392                }
1393                yygotominor.yy78.strValue = new SString(*(yymsp[0].minor.yy78.strValue) + ";");
1394                delete yymsp[0].minor.yy78.strValue;
1395        }
1396}
1397#line 1399 "conv_f8tof1_grammar.c"
1398        break;
1399      case 38: /* single_val ::= single_val PLUS single_val */
1400#line 563 "conv_f8tof1_grammar.y"
1401{
1402        if (!syntaxOnly) {
1403                {
1404#if PARSER_DEBUG > 0
1405                        std::cout << "single_val ::= single_val PLUS single_val." << std::endl;
1406#endif
1407                }
1408                yygotominor.yy78.strValue = new SString(*(yymsp[-2].minor.yy78.strValue) + *(yymsp[0].minor.yy78.strValue) + "+;");
1409                delete yymsp[-2].minor.yy78.strValue;
1410                delete yymsp[0].minor.yy78.strValue;
1411        }
1412}
1413#line 1415 "conv_f8tof1_grammar.c"
1414        break;
1415      case 39: /* single_val ::= single_val MINUS single_val */
1416#line 575 "conv_f8tof1_grammar.y"
1417{
1418        if (!syntaxOnly) {
1419                {
1420#if PARSER_DEBUG > 0
1421                        std::cout << "single_val ::= single_val MINUS single_val." << std::endl;
1422#endif
1423                }
1424                yygotominor.yy78.strValue = new SString(*(yymsp[-2].minor.yy78.strValue) + *(yymsp[0].minor.yy78.strValue) + "-;");
1425                delete yymsp[-2].minor.yy78.strValue;
1426                delete yymsp[0].minor.yy78.strValue;
1427        }
1428}
1429#line 1431 "conv_f8tof1_grammar.c"
1430        break;
1431      case 40: /* single_val ::= single_val TIMES single_val */
1432#line 587 "conv_f8tof1_grammar.y"
1433{
1434        if (!syntaxOnly) {
1435                {
1436#if PARSER_DEBUG > 0
1437                        std::cout << "single_val ::= single_val TIMES single_val." << std::endl;
1438#endif
1439                }
1440                yygotominor.yy78.strValue = new SString(*(yymsp[-2].minor.yy78.strValue) + *(yymsp[0].minor.yy78.strValue) + "*;");
1441                delete yymsp[-2].minor.yy78.strValue;
1442                delete yymsp[0].minor.yy78.strValue;
1443        }
1444}
1445#line 1447 "conv_f8tof1_grammar.c"
1446        break;
1447      case 41: /* single_val ::= single_val DIV single_val */
1448#line 599 "conv_f8tof1_grammar.y"
1449{
1450        if (!syntaxOnly) {
1451                {
1452#if PARSER_DEBUG > 0
1453                        std::cout << "single_val ::= single_val DIV single_val." << std::endl;
1454#endif
1455                }
1456                yygotominor.yy78.strValue = new SString(*(yymsp[-2].minor.yy78.strValue) + *(yymsp[0].minor.yy78.strValue) + "/;");
1457                delete yymsp[-2].minor.yy78.strValue;
1458                delete yymsp[0].minor.yy78.strValue;
1459        }
1460}
1461#line 1463 "conv_f8tof1_grammar.c"
1462        break;
1463      case 42: /* double_val ::= DOUBLE_VAL */
1464#line 612 "conv_f8tof1_grammar.y"
1465{
1466        if (!syntaxOnly) {
1467                {
1468#if PARSER_DEBUG > 0
1469                        std::cout << "double_val ::= DOUBLE_VAL. -> " << (string(yymsp[0].minor.yy0.strArrValue)).c_str() << std::endl;
1470#endif
1471                }
1472                yygotominor.yy78.dblValue = atof((string(yymsp[0].minor.yy0.strArrValue)).c_str());
1473        }
1474}
1475#line 1477 "conv_f8tof1_grammar.c"
1476        break;
1477      case 43: /* param_name ::= PARAM_NAME */
1478#line 622 "conv_f8tof1_grammar.y"
1479{
1480        if (!syntaxOnly) {
1481                {
1482#if PARSER_DEBUG > 0
1483                        std::cout << "param_name ::= PARAM_NAME." << std::endl;
1484#endif
1485                }
1486                yygotominor.yy78.strValue = new SString(string(yymsp[0].minor.yy0.strArrValue).c_str());
1487        }
1488}
1489#line 1491 "conv_f8tof1_grammar.c"
1490        break;
1491      case 44: /* prod_name ::= PROD_NAME */
1492#line 632 "conv_f8tof1_grammar.y"
1493{
1494        if (!syntaxOnly) {
1495                {
1496#if PARSER_DEBUG > 0
1497                        std::cout << "prod_name ::= PROD_NAME." << std::endl;
1498#endif
1499                }
1500                yygotominor.yy78.strValue = new SString(string(yymsp[0].minor.yy0.strArrValue).c_str());
1501        }
1502}
1503#line 1505 "conv_f8tof1_grammar.c"
1504        break;
1505      case 45: /* command ::= COMMAND */
1506#line 642 "conv_f8tof1_grammar.y"
1507{
1508        if (!syntaxOnly) {
1509                {
1510#if PARSER_DEBUG > 0
1511                        std::cout << "command ::= COMMAND." << std::endl;
1512#endif
1513                }
1514                yygotominor.yy78.strValue = new SString(string(yymsp[0].minor.yy0.strArrValue).c_str());
1515        }
1516}
1517#line 1519 "conv_f8tof1_grammar.c"
1518        break;
1519      case 46: /* neuron ::= NEURON */
1520#line 652 "conv_f8tof1_grammar.y"
1521{
1522        if (!syntaxOnly) {
1523                {
1524#if PARSER_DEBUG > 0
1525                        std::cout << "neuron ::= NEURON." << std::endl;
1526#endif
1527                }
1528                yygotominor.yy78.strValue = new SString(string(yymsp[0].minor.yy0.strArrValue).c_str());
1529        }
1530}
1531#line 1533 "conv_f8tof1_grammar.c"
1532        break;
1533  };
1534  yygoto = yyRuleInfo[yyruleno].lhs;
1535  yysize = yyRuleInfo[yyruleno].nrhs;
1536  yypParser->yyidx -= yysize;
1537  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto);
1538  if( yyact < YYNSTATE ){
1539#ifdef NDEBUG
1540    /* If we are not debugging and the reduce action popped at least
1541    ** one element off the stack, then we can push the new element back
1542    ** onto the stack here, and skip the stack overflow test in yy_shift().
1543    ** That gives a significant speed improvement. */
1544    if( yysize ){
1545      yypParser->yyidx++;
1546      yymsp -= yysize-1;
1547      yymsp->stateno = yyact;
1548      yymsp->major = yygoto;
1549      yymsp->minor = yygotominor;
1550    }else
1551#endif
1552    {
1553      yy_shift(yypParser,yyact,yygoto,&yygotominor);
1554    }
1555  }else{
1556    assert( yyact == YYNSTATE + YYNRULE + 1 );
1557    yy_accept(yypParser);
1558  }
1559}
1560
1561/*
1562** The following code executes when the parse fails
1563*/
1564static void yy_parse_failed(
1565  yyParser *yypParser           /* The parser */
1566){
1567  ParseARG_FETCH;
1568#ifndef NDEBUG
1569  if( yyTraceFILE ){
1570    fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
1571  }
1572#endif
1573  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
1574  /* Here code is inserted which will be executed whenever the
1575  ** parser fails */
1576  ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
1577}
1578
1579/*
1580** The following code executes when a syntax error first occurs.
1581*/
1582static void yy_syntax_error(
1583  yyParser *yypParser,           /* The parser */
1584  int yymajor,                   /* The major type of the error token */
1585  YYMINORTYPE yyminor            /* The minor type of the error token */
1586){
1587  ParseARG_FETCH;
1588#define TOKEN (yyminor.yy0)
1589  ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
1590}
1591
1592/*
1593** The following is executed when the parser accepts
1594*/
1595static void yy_accept(
1596  yyParser *yypParser           /* The parser */
1597){
1598  ParseARG_FETCH;
1599#ifndef NDEBUG
1600  if( yyTraceFILE ){
1601    fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
1602  }
1603#endif
1604  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
1605  /* Here code is inserted which will be executed whenever the
1606  ** parser accepts */
1607  ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
1608}
1609
1610/* The main parser program.
1611** The first argument is a pointer to a structure obtained from
1612** "ParseAlloc" which describes the current state of the parser.
1613** The second argument is the major token number.  The third is
1614** the minor token.  The fourth optional argument is whatever the
1615** user wants (and specified in the grammar) and is available for
1616** use by the action routines.
1617**
1618** Inputs:
1619** <ul>
1620** <li> A pointer to the parser (an opaque structure.)
1621** <li> The major token number.
1622** <li> The minor token number.
1623** <li> An option argument of a grammar-specified type.
1624** </ul>
1625**
1626** Outputs:
1627** None.
1628*/
1629void Parse(
1630  void *yyp,                   /* The parser */
1631  int yymajor,                 /* The major token code number */
1632  ParseTOKENTYPE yyminor       /* The value for the token */
1633  ParseARG_PDECL               /* Optional %extra_argument parameter */
1634){
1635  YYMINORTYPE yyminorunion;
1636  int yyact;            /* The parser action. */
1637  int yyendofinput;     /* True if we are at the end of input */
1638#ifdef YYERRORSYMBOL
1639  int yyerrorhit = 0;   /* True if yymajor has invoked an error */
1640#endif
1641  yyParser *yypParser;  /* The parser */
1642
1643  /* (re)initialize the parser, if necessary */
1644  yypParser = (yyParser*)yyp;
1645  if( yypParser->yyidx<0 ){
1646#if YYSTACKDEPTH<=0
1647    if( yypParser->yystksz <=0 ){
1648      memset(&yyminorunion, 0, sizeof(yyminorunion));
1649      yyStackOverflow(yypParser, &yyminorunion);
1650      return;
1651    }
1652#endif
1653    yypParser->yyidx = 0;
1654    yypParser->yyerrcnt = -1;
1655    yypParser->yystack[0].stateno = 0;
1656    yypParser->yystack[0].major = 0;
1657  }
1658  yyminorunion.yy0 = yyminor;
1659  yyendofinput = (yymajor==0);
1660  ParseARG_STORE;
1661
1662#ifndef NDEBUG
1663  if( yyTraceFILE ){
1664    fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
1665  }
1666#endif
1667
1668  do{
1669    yyact = yy_find_shift_action(yypParser,yymajor);
1670    if( yyact<YYNSTATE ){
1671      assert( !yyendofinput );  /* Impossible to shift the $ token */
1672      yy_shift(yypParser,yyact,yymajor,&yyminorunion);
1673      yypParser->yyerrcnt--;
1674      yymajor = YYNOCODE;
1675    }else if( yyact < YYNSTATE + YYNRULE ){
1676      yy_reduce(yypParser,yyact-YYNSTATE);
1677    }else{
1678      assert( yyact == YY_ERROR_ACTION );
1679#ifdef YYERRORSYMBOL
1680      int yymx;
1681#endif
1682#ifndef NDEBUG
1683      if( yyTraceFILE ){
1684        fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
1685      }
1686#endif
1687#ifdef YYERRORSYMBOL
1688      /* A syntax error has occurred.
1689      ** The response to an error depends upon whether or not the
1690      ** grammar defines an error token "ERROR". 
1691      **
1692      ** This is what we do if the grammar does define ERROR:
1693      **
1694      **  * Call the %syntax_error function.
1695      **
1696      **  * Begin popping the stack until we enter a state where
1697      **    it is legal to shift the error symbol, then shift
1698      **    the error symbol.
1699      **
1700      **  * Set the error count to three.
1701      **
1702      **  * Begin accepting and shifting new tokens.  No new error
1703      **    processing will occur until three tokens have been
1704      **    shifted successfully.
1705      **
1706      */
1707      if( yypParser->yyerrcnt<0 ){
1708        yy_syntax_error(yypParser,yymajor,yyminorunion);
1709      }
1710      yymx = yypParser->yystack[yypParser->yyidx].major;
1711      if( yymx==YYERRORSYMBOL || yyerrorhit ){
1712#ifndef NDEBUG
1713        if( yyTraceFILE ){
1714          fprintf(yyTraceFILE,"%sDiscard input token %s\n",
1715             yyTracePrompt,yyTokenName[yymajor]);
1716        }
1717#endif
1718        yy_destructor(yymajor,&yyminorunion);
1719        yymajor = YYNOCODE;
1720      }else{
1721         while(
1722          yypParser->yyidx >= 0 &&
1723          yymx != YYERRORSYMBOL &&
1724          (yyact = yy_find_reduce_action(
1725                        yypParser->yystack[yypParser->yyidx].stateno,
1726                        YYERRORSYMBOL)) >= YYNSTATE
1727        ){
1728          yy_pop_parser_stack(yypParser);
1729        }
1730        if( yypParser->yyidx < 0 || yymajor==0 ){
1731          yy_destructor(yymajor,&yyminorunion);
1732          yy_parse_failed(yypParser);
1733          yymajor = YYNOCODE;
1734        }else if( yymx!=YYERRORSYMBOL ){
1735          YYMINORTYPE u2;
1736          u2.YYERRSYMDT = 0;
1737          yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
1738        }
1739      }
1740      yypParser->yyerrcnt = 3;
1741      yyerrorhit = 1;
1742#else  /* YYERRORSYMBOL is not defined */
1743      /* This is what we do if the grammar does not define ERROR:
1744      **
1745      **  * Report an error message, and throw away the input token.
1746      **
1747      **  * If the input token is $, then fail the parse.
1748      **
1749      ** As before, subsequent error messages are suppressed until
1750      ** three input tokens have been successfully shifted.
1751      */
1752      if( yypParser->yyerrcnt<=0 ){
1753        yy_syntax_error(yypParser,yymajor,yyminorunion);
1754      }
1755      yypParser->yyerrcnt = 3;
1756      yy_destructor(yymajor,&yyminorunion);
1757      if( yyendofinput ){
1758        yy_parse_failed(yypParser);
1759      }
1760      yymajor = YYNOCODE;
1761#endif
1762    }
1763  }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
1764  return;
1765}
1766
1767
Note: See TracBrowser for help on using the repository browser.