9d9793f8df7ece6f9ed8b9f2776a681c3933dcb0
[vuplus_bitbake] / lib / bb / parse / parse_c / bitbakeparser.cc
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 #line 43 "bitbakeparser.y"
8
9 #include "token.h"
10 #include "lexer.h"
11 #include "python_output.h"
12 #line 14 "bitbakeparser.c"
13 /* Next is all token values, in a form suitable for use by makeheaders.
14 ** This section will be null unless lemon is run with the -m switch.
15 */
16 /* 
17 ** These constants (all generated automatically by the parser generator)
18 ** specify the various kinds of tokens (terminals) that the parser
19 ** understands. 
20 **
21 ** Each symbol here is a terminal symbol in the grammar.
22 */
23 /* Make sure the INTERFACE macro is defined.
24 */
25 #ifndef INTERFACE
26 # define INTERFACE 1
27 #endif
28 /* The next thing included is series of defines which control
29 ** various aspects of the generated parser.
30 **    YYCODETYPE         is the data type used for storing terminal
31 **                       and nonterminal numbers.  "unsigned char" is
32 **                       used if there are fewer than 250 terminals
33 **                       and nonterminals.  "int" is used otherwise.
34 **    YYNOCODE           is a number of type YYCODETYPE which corresponds
35 **                       to no legal terminal or nonterminal number.  This
36 **                       number is used to fill in empty slots of the hash 
37 **                       table.
38 **    YYFALLBACK         If defined, this indicates that one or more tokens
39 **                       have fall-back values which should be used if the
40 **                       original value of the token will not parse.
41 **    YYACTIONTYPE       is the data type used for storing terminal
42 **                       and nonterminal numbers.  "unsigned char" is
43 **                       used if there are fewer than 250 rules and
44 **                       states combined.  "int" is used otherwise.
45 **    bbparseTOKENTYPE     is the data type used for minor tokens given 
46 **                       directly to the parser from the tokenizer.
47 **    YYMINORTYPE        is the data type used for all minor tokens.
48 **                       This is typically a union of many types, one of
49 **                       which is bbparseTOKENTYPE.  The entry in the union
50 **                       for base tokens is called "yy0".
51 **    YYSTACKDEPTH       is the maximum depth of the parser's stack.
52 **    bbparseARG_SDECL     A static variable declaration for the %extra_argument
53 **    bbparseARG_PDECL     A parameter declaration for the %extra_argument
54 **    bbparseARG_STORE     Code to store %extra_argument into yypParser
55 **    bbparseARG_FETCH     Code to extract %extra_argument from yypParser
56 **    YYNSTATE           the combined number of states.
57 **    YYNRULE            the number of rules in the grammar
58 **    YYERRORSYMBOL      is the code number of the error symbol.  If not
59 **                       defined, then do no error processing.
60 */
61 #define YYCODETYPE unsigned char
62 #define YYNOCODE 44
63 #define YYACTIONTYPE unsigned char
64 #define bbparseTOKENTYPE token_t
65 typedef union {
66   bbparseTOKENTYPE yy0;
67   int yy87;
68 } YYMINORTYPE;
69 #define YYSTACKDEPTH 100
70 #define bbparseARG_SDECL lex_t* lex;
71 #define bbparseARG_PDECL ,lex_t* lex
72 #define bbparseARG_FETCH lex_t* lex = yypParser->lex
73 #define bbparseARG_STORE yypParser->lex = lex
74 #define YYNSTATE 82
75 #define YYNRULE 45
76 #define YYERRORSYMBOL 30
77 #define YYERRSYMDT yy87
78 #define YY_NO_ACTION      (YYNSTATE+YYNRULE+2)
79 #define YY_ACCEPT_ACTION  (YYNSTATE+YYNRULE+1)
80 #define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)
81
82 /* Next are that tables used to determine what action to take based on the
83 ** current state and lookahead token.  These tables are used to implement
84 ** functions that take a state number and lookahead value and return an
85 ** action integer.  
86 **
87 ** Suppose the action integer is N.  Then the action is determined as
88 ** follows
89 **
90 **   0 <= N < YYNSTATE                  Shift N.  That is, push the lookahead
91 **                                      token onto the stack and goto state N.
92 **
93 **   YYNSTATE <= N < YYNSTATE+YYNRULE   Reduce by rule N-YYNSTATE.
94 **
95 **   N == YYNSTATE+YYNRULE              A syntax error has occurred.
96 **
97 **   N == YYNSTATE+YYNRULE+1            The parser accepts its input.
98 **
99 **   N == YYNSTATE+YYNRULE+2            No such action.  Denotes unused
100 **                                      slots in the yy_action[] table.
101 **
102 ** The action table is constructed as a single large table named yy_action[].
103 ** Given state S and lookahead X, the action is computed as
104 **
105 **      yy_action[ yy_shift_ofst[S] + X ]
106 **
107 ** If the index value yy_shift_ofst[S]+X is out of range or if the value
108 ** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
109 ** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
110 ** and that yy_default[S] should be used instead.  
111 **
112 ** The formula above is for computing the action when the lookahead is
113 ** a terminal symbol.  If the lookahead is a non-terminal (as occurs after
114 ** a reduce action) then the yy_reduce_ofst[] array is used in place of
115 ** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
116 ** YY_SHIFT_USE_DFLT.
117 **
118 ** The following are the tables generated in this section:
119 **
120 **  yy_action[]        A single table containing all actions.
121 **  yy_lookahead[]     A table containing the lookahead for each entry in
122 **                     yy_action.  Used to detect hash collisions.
123 **  yy_shift_ofst[]    For each state, the offset into yy_action for
124 **                     shifting terminals.
125 **  yy_reduce_ofst[]   For each state, the offset into yy_action for
126 **                     shifting non-terminals after a reduce.
127 **  yy_default[]       Default action for each state.
128 */
129 static const YYACTIONTYPE yy_action[] = {
130  /*     0 */    82,    3,    7,    8,   38,   22,   39,   24,   26,   32,
131  /*    10 */    34,   28,   30,    2,   21,   40,   53,   70,   55,   44,
132  /*    20 */    60,   65,   67,  128,    1,   36,   69,   77,   42,   46,
133  /*    30 */    11,   66,   13,   15,   17,   19,   64,   62,    9,    7,
134  /*    40 */    74,   38,   45,   81,   59,   57,   38,   38,   73,   76,
135  /*    50 */     5,   68,   52,   50,   14,   31,   47,   71,   48,   10,
136  /*    60 */    72,   33,   23,   49,    6,   41,   51,   78,   75,   16,
137  /*    70 */     4,   54,   35,   25,   18,   80,   79,   56,   27,   37,
138  /*    80 */    58,   12,   61,   29,   43,   63,   20,
139 };
140 static const YYCODETYPE yy_lookahead[] = {
141  /*     0 */     0,    1,    2,    3,   23,    4,   25,    6,    7,    8,
142  /*    10 */     9,   10,   11,   33,   34,   15,   16,    1,   18,   14,
143  /*    20 */    20,   21,   22,   31,   32,   24,   26,   27,   13,   14,
144  /*    30 */     4,   19,    6,    7,    8,    9,   39,   40,    1,    2,
145  /*    40 */    24,   23,   12,   25,   37,   38,   23,   23,   25,   25,
146  /*    50 */    42,   19,   35,   36,    5,    5,   12,   24,   13,   34,
147  /*    60 */    41,    5,    5,   12,   28,   12,   35,    1,   41,    5,
148  /*    70 */    29,    1,    5,    5,    5,   41,   24,   17,    5,   41,
149  /*    80 */    37,    5,   19,    5,   12,   39,    5,
150 };
151 #define YY_SHIFT_USE_DFLT (-20)
152 static const signed char yy_shift_ofst[] = {
153  /*     0 */   -20,    0,  -20,   41,  -20,   36,  -20,  -20,   37,  -20,
154  /*    10 */    26,   76,  -20,   49,  -20,   64,  -20,   69,  -20,   81,
155  /*    20 */   -20,    1,   57,  -20,   68,  -20,   73,  -20,   78,  -20,
156  /*    30 */    50,  -20,   56,  -20,   67,  -20,  -20,  -19,  -20,  -20,
157  /*    40 */    53,   15,   72,    5,   30,  -20,   44,   45,   51,  -20,
158  /*    50 */    53,  -20,  -20,   70,  -20,   60,  -20,   60,  -20,  -20,
159  /*    60 */    63,  -20,   63,  -20,  -20,   12,  -20,   32,  -20,   16,
160  /*    70 */    33,  -20,   23,  -20,  -20,   24,  -20,   66,   52,  -20,
161  /*    80 */    18,  -20,
162 };
163 #define YY_REDUCE_USE_DFLT (-21)
164 static const signed char yy_reduce_ofst[] = {
165  /*     0 */    -8,  -20,  -21,  -21,    8,  -21,  -21,  -21,   25,  -21,
166  /*    10 */   -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,
167  /*    20 */   -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,
168  /*    30 */   -21,  -21,  -21,  -21,  -21,  -21,   38,  -21,  -21,  -21,
169  /*    40 */    17,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,
170  /*    50 */    31,  -21,  -21,  -21,  -21,    7,  -21,   43,  -21,  -21,
171  /*    60 */    -3,  -21,   46,  -21,  -21,  -21,  -21,  -21,  -21,  -21,
172  /*    70 */   -21,   19,  -21,  -21,   27,  -21,  -21,  -21,  -21,   34,
173  /*    80 */   -21,  -21,
174 };
175 static const YYACTIONTYPE yy_default[] = {
176  /*     0 */    84,  127,   83,   85,  125,  126,  124,   86,  127,   85,
177  /*    10 */   127,  127,   87,  127,   88,  127,   89,  127,   90,  127,
178  /*    20 */    91,  127,  127,   92,  127,   93,  127,   94,  127,   95,
179  /*    30 */   127,   96,  127,   97,  127,   98,  119,  127,  118,  120,
180  /*    40 */   127,  101,  127,  102,  127,   99,  127,  103,  127,  100,
181  /*    50 */   106,  104,  105,  127,  107,  127,  108,  111,  109,  110,
182  /*    60 */   127,  112,  115,  113,  114,  127,  116,  127,  117,  127,
183  /*    70 */   127,  119,  127,  121,  119,  127,  122,  127,  127,  119,
184  /*    80 */   127,  123,
185 };
186 #define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0]))
187
188 /* The next table maps tokens into fallback tokens.  If a construct
189 ** like the following:
190 ** 
191 **      %fallback ID X Y Z.
192 **
193 ** appears in the grammer, then ID becomes a fallback token for X, Y,
194 ** and Z.  Whenever one of the tokens X, Y, or Z is input to the parser
195 ** but it does not parse, the type of the token is changed to ID and
196 ** the parse is retried before an error is thrown.
197 */
198 #ifdef YYFALLBACK
199 static const YYCODETYPE yyFallback[] = {
200 };
201 #endif /* YYFALLBACK */
202
203 /* The following structure represents a single element of the
204 ** parser's stack.  Information stored includes:
205 **
206 **   +  The state number for the parser at this level of the stack.
207 **
208 **   +  The value of the token stored at this level of the stack.
209 **      (In other words, the "major" token.)
210 **
211 **   +  The semantic value stored at this level of the stack.  This is
212 **      the information used by the action routines in the grammar.
213 **      It is sometimes called the "minor" token.
214 */
215 struct yyStackEntry {
216   int stateno;       /* The state-number */
217   int major;         /* The major token value.  This is the code
218                      ** number for the token at this stack level */
219   YYMINORTYPE minor; /* The user-supplied minor token value.  This
220                      ** is the value of the token  */
221 };
222 typedef struct yyStackEntry yyStackEntry;
223
224 /* The state of the parser is completely contained in an instance of
225 ** the following structure */
226 struct yyParser {
227   int yyidx;                    /* Index of top element in stack */
228   int yyerrcnt;                 /* Shifts left before out of the error */
229   bbparseARG_SDECL                /* A place to hold %extra_argument */
230   yyStackEntry yystack[YYSTACKDEPTH];  /* The parser's stack */
231 };
232 typedef struct yyParser yyParser;
233
234 #ifndef NDEBUG
235 #include <stdio.h>
236 static FILE *yyTraceFILE = 0;
237 static char *yyTracePrompt = 0;
238 #endif /* NDEBUG */
239
240 #ifndef NDEBUG
241 /* 
242 ** Turn parser tracing on by giving a stream to which to write the trace
243 ** and a prompt to preface each trace message.  Tracing is turned off
244 ** by making either argument NULL 
245 **
246 ** Inputs:
247 ** <ul>
248 ** <li> A FILE* to which trace output should be written.
249 **      If NULL, then tracing is turned off.
250 ** <li> A prefix string written at the beginning of every
251 **      line of trace output.  If NULL, then tracing is
252 **      turned off.
253 ** </ul>
254 **
255 ** Outputs:
256 ** None.
257 */
258 void bbparseTrace(FILE *TraceFILE, char *zTracePrompt){
259   yyTraceFILE = TraceFILE;
260   yyTracePrompt = zTracePrompt;
261   if( yyTraceFILE==0 ) yyTracePrompt = 0;
262   else if( yyTracePrompt==0 ) yyTraceFILE = 0;
263 }
264 #endif /* NDEBUG */
265
266 #ifndef NDEBUG
267 /* For tracing shifts, the names of all terminals and nonterminals
268 ** are required.  The following table supplies these names */
269 static const char *const yyTokenName[] = { 
270   "$",             "SYMBOL",        "VARIABLE",      "EXPORT",      
271   "OP_ASSIGN",     "STRING",        "OP_PREDOT",     "OP_POSTDOT",  
272   "OP_IMMEDIATE",  "OP_COND",       "OP_PREPEND",    "OP_APPEND",   
273   "TSYMBOL",       "BEFORE",        "AFTER",         "ADDTASK",     
274   "ADDHANDLER",    "FSYMBOL",       "EXPORT_FUNC",   "ISYMBOL",     
275   "INHERIT",       "INCLUDE",       "REQUIRE",       "PROC_BODY",   
276   "PROC_OPEN",     "PROC_CLOSE",    "PYTHON",        "FAKEROOT",    
277   "DEF_BODY",      "DEF_ARGS",      "error",         "program",     
278   "statements",    "statement",     "variable",      "task",        
279   "tasks",         "func",          "funcs",         "inherit",     
280   "inherits",      "proc_body",     "def_body",    
281 };
282 #endif /* NDEBUG */
283
284 #ifndef NDEBUG
285 /* For tracing reduce actions, the names of all rules are required.
286 */
287 static const char *const yyRuleName[] = {
288  /*   0 */ "program ::= statements",
289  /*   1 */ "statements ::= statements statement",
290  /*   2 */ "statements ::=",
291  /*   3 */ "variable ::= SYMBOL",
292  /*   4 */ "variable ::= VARIABLE",
293  /*   5 */ "statement ::= EXPORT variable OP_ASSIGN STRING",
294  /*   6 */ "statement ::= EXPORT variable OP_PREDOT STRING",
295  /*   7 */ "statement ::= EXPORT variable OP_POSTDOT STRING",
296  /*   8 */ "statement ::= EXPORT variable OP_IMMEDIATE STRING",
297  /*   9 */ "statement ::= EXPORT variable OP_COND STRING",
298  /*  10 */ "statement ::= variable OP_ASSIGN STRING",
299  /*  11 */ "statement ::= variable OP_PREDOT STRING",
300  /*  12 */ "statement ::= variable OP_POSTDOT STRING",
301  /*  13 */ "statement ::= variable OP_PREPEND STRING",
302  /*  14 */ "statement ::= variable OP_APPEND STRING",
303  /*  15 */ "statement ::= variable OP_IMMEDIATE STRING",
304  /*  16 */ "statement ::= variable OP_COND STRING",
305  /*  17 */ "task ::= TSYMBOL BEFORE TSYMBOL AFTER TSYMBOL",
306  /*  18 */ "task ::= TSYMBOL AFTER TSYMBOL BEFORE TSYMBOL",
307  /*  19 */ "task ::= TSYMBOL",
308  /*  20 */ "task ::= TSYMBOL BEFORE TSYMBOL",
309  /*  21 */ "task ::= TSYMBOL AFTER TSYMBOL",
310  /*  22 */ "tasks ::= tasks task",
311  /*  23 */ "tasks ::= task",
312  /*  24 */ "statement ::= ADDTASK tasks",
313  /*  25 */ "statement ::= ADDHANDLER SYMBOL",
314  /*  26 */ "func ::= FSYMBOL",
315  /*  27 */ "funcs ::= funcs func",
316  /*  28 */ "funcs ::= func",
317  /*  29 */ "statement ::= EXPORT_FUNC funcs",
318  /*  30 */ "inherit ::= ISYMBOL",
319  /*  31 */ "inherits ::= inherits inherit",
320  /*  32 */ "inherits ::= inherit",
321  /*  33 */ "statement ::= INHERIT inherits",
322  /*  34 */ "statement ::= INCLUDE ISYMBOL",
323  /*  35 */ "statement ::= REQUIRE ISYMBOL",
324  /*  36 */ "proc_body ::= proc_body PROC_BODY",
325  /*  37 */ "proc_body ::=",
326  /*  38 */ "statement ::= variable PROC_OPEN proc_body PROC_CLOSE",
327  /*  39 */ "statement ::= PYTHON SYMBOL PROC_OPEN proc_body PROC_CLOSE",
328  /*  40 */ "statement ::= PYTHON PROC_OPEN proc_body PROC_CLOSE",
329  /*  41 */ "statement ::= FAKEROOT SYMBOL PROC_OPEN proc_body PROC_CLOSE",
330  /*  42 */ "def_body ::= def_body DEF_BODY",
331  /*  43 */ "def_body ::=",
332  /*  44 */ "statement ::= SYMBOL DEF_ARGS def_body",
333 };
334 #endif /* NDEBUG */
335
336 /*
337 ** This function returns the symbolic name associated with a token
338 ** value.
339 */
340 const char *bbparseTokenName(int tokenType){
341 #ifndef NDEBUG
342   if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){
343     return yyTokenName[tokenType];
344   }else{
345     return "Unknown";
346   }
347 #else
348   return "";
349 #endif
350 }
351
352 /* 
353 ** This function allocates a new parser.
354 ** The only argument is a pointer to a function which works like
355 ** malloc.
356 **
357 ** Inputs:
358 ** A pointer to the function used to allocate memory.
359 **
360 ** Outputs:
361 ** A pointer to a parser.  This pointer is used in subsequent calls
362 ** to bbparse and bbparseFree.
363 */
364 void *bbparseAlloc(void *(*mallocProc)(size_t)){
365   yyParser *pParser;
366   pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) );
367   if( pParser ){
368     pParser->yyidx = -1;
369   }
370   return pParser;
371 }
372
373 /* The following function deletes the value associated with a
374 ** symbol.  The symbol can be either a terminal or nonterminal.
375 ** "yymajor" is the symbol code, and "yypminor" is a pointer to
376 ** the value.
377 */
378 static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){
379   switch( yymajor ){
380     /* Here is inserted the actions which take place when a
381     ** terminal or non-terminal is destroyed.  This can happen
382     ** when the symbol is popped from the stack during a
383     ** reduce or during error processing or when a parser is 
384     ** being destroyed before it is finished parsing.
385     **
386     ** Note: during a reduce, the only symbols destroyed are those
387     ** which appear on the RHS of the rule, but which are not used
388     ** inside the C code.
389     */
390     case 1:
391     case 2:
392     case 3:
393     case 4:
394     case 5:
395     case 6:
396     case 7:
397     case 8:
398     case 9:
399     case 10:
400     case 11:
401     case 12:
402     case 13:
403     case 14:
404     case 15:
405     case 16:
406     case 17:
407     case 18:
408     case 19:
409     case 20:
410     case 21:
411     case 22:
412     case 23:
413     case 24:
414     case 25:
415     case 26:
416     case 27:
417     case 28:
418     case 29:
419 #line 50 "bitbakeparser.y"
420 { (yypminor->yy0).release_this (); }
421 #line 423 "bitbakeparser.c"
422       break;
423     default:  break;   /* If no destructor action specified: do nothing */
424   }
425 }
426
427 /*
428 ** Pop the parser's stack once.
429 **
430 ** If there is a destructor routine associated with the token which
431 ** is popped from the stack, then call it.
432 **
433 ** Return the major token number for the symbol popped.
434 */
435 static int yy_pop_parser_stack(yyParser *pParser){
436   YYCODETYPE yymajor;
437   yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];
438
439   if( pParser->yyidx<0 ) return 0;
440 #ifndef NDEBUG
441   if( yyTraceFILE && pParser->yyidx>=0 ){
442     fprintf(yyTraceFILE,"%sPopping %s\n",
443       yyTracePrompt,
444       yyTokenName[yytos->major]);
445   }
446 #endif
447   yymajor = yytos->major;
448   yy_destructor( yymajor, &yytos->minor);
449   pParser->yyidx--;
450   return yymajor;
451 }
452
453 /* 
454 ** Deallocate and destroy a parser.  Destructors are all called for
455 ** all stack elements before shutting the parser down.
456 **
457 ** Inputs:
458 ** <ul>
459 ** <li>  A pointer to the parser.  This should be a pointer
460 **       obtained from bbparseAlloc.
461 ** <li>  A pointer to a function used to reclaim memory obtained
462 **       from malloc.
463 ** </ul>
464 */
465 void bbparseFree(
466   void *p,                    /* The parser to be deleted */
467   void (*freeProc)(void*)     /* Function used to reclaim memory */
468 ){
469   yyParser *pParser = (yyParser*)p;
470   if( pParser==0 ) return;
471   while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
472   (*freeProc)((void*)pParser);
473 }
474
475 /*
476 ** Find the appropriate action for a parser given the terminal
477 ** look-ahead token iLookAhead.
478 **
479 ** If the look-ahead token is YYNOCODE, then check to see if the action is
480 ** independent of the look-ahead.  If it is, return the action, otherwise
481 ** return YY_NO_ACTION.
482 */
483 static int yy_find_shift_action(
484   yyParser *pParser,        /* The parser */
485   int iLookAhead            /* The look-ahead token */
486 ){
487   int i;
488   int stateno = pParser->yystack[pParser->yyidx].stateno;
489  
490   /* if( pParser->yyidx<0 ) return YY_NO_ACTION;  */
491   i = yy_shift_ofst[stateno];
492   if( i==YY_SHIFT_USE_DFLT ){
493     return yy_default[stateno];
494   }
495   if( iLookAhead==YYNOCODE ){
496     return YY_NO_ACTION;
497   }
498   i += iLookAhead;
499   if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
500 #ifdef YYFALLBACK
501     int iFallback;            /* Fallback token */
502     if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
503            && (iFallback = yyFallback[iLookAhead])!=0 ){
504 #ifndef NDEBUG
505       if( yyTraceFILE ){
506         fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
507            yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
508       }
509 #endif
510       return yy_find_shift_action(pParser, iFallback);
511     }
512 #endif
513     return yy_default[stateno];
514   }else{
515     return yy_action[i];
516   }
517 }
518
519 /*
520 ** Find the appropriate action for a parser given the non-terminal
521 ** look-ahead token iLookAhead.
522 **
523 ** If the look-ahead token is YYNOCODE, then check to see if the action is
524 ** independent of the look-ahead.  If it is, return the action, otherwise
525 ** return YY_NO_ACTION.
526 */
527 static int yy_find_reduce_action(
528   int stateno,              /* Current state number */
529   int iLookAhead            /* The look-ahead token */
530 ){
531   int i;
532   /* int stateno = pParser->yystack[pParser->yyidx].stateno; */
533  
534   i = yy_reduce_ofst[stateno];
535   if( i==YY_REDUCE_USE_DFLT ){
536     return yy_default[stateno];
537   }
538   if( iLookAhead==YYNOCODE ){
539     return YY_NO_ACTION;
540   }
541   i += iLookAhead;
542   if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
543     return yy_default[stateno];
544   }else{
545     return yy_action[i];
546   }
547 }
548
549 /*
550 ** Perform a shift action.
551 */
552 static void yy_shift(
553   yyParser *yypParser,          /* The parser to be shifted */
554   int yyNewState,               /* The new state to shift in */
555   int yyMajor,                  /* The major token to shift in */
556   YYMINORTYPE *yypMinor         /* Pointer ot the minor token to shift in */
557 ){
558   yyStackEntry *yytos;
559   yypParser->yyidx++;
560   if( yypParser->yyidx>=YYSTACKDEPTH ){
561      bbparseARG_FETCH;
562      yypParser->yyidx--;
563 #ifndef NDEBUG
564      if( yyTraceFILE ){
565        fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
566      }
567 #endif
568      while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
569      /* Here code is inserted which will execute if the parser
570      ** stack every overflows */
571      bbparseARG_STORE; /* Suppress warning about unused %extra_argument var */
572      return;
573   }
574   yytos = &yypParser->yystack[yypParser->yyidx];
575   yytos->stateno = yyNewState;
576   yytos->major = yyMajor;
577   yytos->minor = *yypMinor;
578 #ifndef NDEBUG
579   if( yyTraceFILE && yypParser->yyidx>0 ){
580     int i;
581     fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState);
582     fprintf(yyTraceFILE,"%sStack:",yyTracePrompt);
583     for(i=1; i<=yypParser->yyidx; i++)
584       fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]);
585     fprintf(yyTraceFILE,"\n");
586   }
587 #endif
588 }
589
590 /* The following table contains information about every rule that
591 ** is used during the reduce.
592 */
593 static const struct {
594   YYCODETYPE lhs;         /* Symbol on the left-hand side of the rule */
595   unsigned char nrhs;     /* Number of right-hand side symbols in the rule */
596 } yyRuleInfo[] = {
597   { 31, 1 },
598   { 32, 2 },
599   { 32, 0 },
600   { 34, 1 },
601   { 34, 1 },
602   { 33, 4 },
603   { 33, 4 },
604   { 33, 4 },
605   { 33, 4 },
606   { 33, 4 },
607   { 33, 3 },
608   { 33, 3 },
609   { 33, 3 },
610   { 33, 3 },
611   { 33, 3 },
612   { 33, 3 },
613   { 33, 3 },
614   { 35, 5 },
615   { 35, 5 },
616   { 35, 1 },
617   { 35, 3 },
618   { 35, 3 },
619   { 36, 2 },
620   { 36, 1 },
621   { 33, 2 },
622   { 33, 2 },
623   { 37, 1 },
624   { 38, 2 },
625   { 38, 1 },
626   { 33, 2 },
627   { 39, 1 },
628   { 40, 2 },
629   { 40, 1 },
630   { 33, 2 },
631   { 33, 2 },
632   { 33, 2 },
633   { 41, 2 },
634   { 41, 0 },
635   { 33, 4 },
636   { 33, 5 },
637   { 33, 4 },
638   { 33, 5 },
639   { 42, 2 },
640   { 42, 0 },
641   { 33, 3 },
642 };
643
644 static void yy_accept(yyParser*);  /* Forward Declaration */
645
646 /*
647 ** Perform a reduce action and the shift that must immediately
648 ** follow the reduce.
649 */
650 static void yy_reduce(
651   yyParser *yypParser,         /* The parser */
652   int yyruleno                 /* Number of the rule by which to reduce */
653 ){
654   int yygoto;                     /* The next state */
655   int yyact;                      /* The next action */
656   YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
657   yyStackEntry *yymsp;            /* The top of the parser's stack */
658   int yysize;                     /* Amount to pop the stack */
659   bbparseARG_FETCH;
660   yymsp = &yypParser->yystack[yypParser->yyidx];
661 #ifndef NDEBUG
662   if( yyTraceFILE && yyruleno>=0 
663         && yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
664     fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
665       yyRuleName[yyruleno]);
666   }
667 #endif /* NDEBUG */
668
669 #ifndef NDEBUG
670   /* Silence complaints from purify about yygotominor being uninitialized
671   ** in some cases when it is copied into the stack after the following
672   ** switch.  yygotominor is uninitialized when a rule reduces that does
673   ** not set the value of its left-hand side nonterminal.  Leaving the
674   ** value of the nonterminal uninitialized is utterly harmless as long
675   ** as the value is never used.  So really the only thing this code
676   ** accomplishes is to quieten purify.  
677   */
678   memset(&yygotominor, 0, sizeof(yygotominor));
679 #endif
680
681   switch( yyruleno ){
682   /* Beginning here are the reduction cases.  A typical example
683   ** follows:
684   **   case 0:
685   **  #line <lineno> <grammarfile>
686   **     { ... }           // User supplied code
687   **  #line <lineno> <thisfile>
688   **     break;
689   */
690       case 3:
691 #line 60 "bitbakeparser.y"
692 { yygotominor.yy0.assignString( (char*)yymsp[0].minor.yy0.string() );
693           yymsp[0].minor.yy0.assignString( 0 );
694           yymsp[0].minor.yy0.release_this(); }
695 #line 697 "bitbakeparser.c"
696         break;
697       case 4:
698 #line 64 "bitbakeparser.y"
699 {
700           yygotominor.yy0.assignString( (char*)yymsp[0].minor.yy0.string() );
701           yymsp[0].minor.yy0.assignString( 0 );
702           yymsp[0].minor.yy0.release_this(); }
703 #line 705 "bitbakeparser.c"
704         break;
705       case 5:
706 #line 70 "bitbakeparser.y"
707 { e_assign( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
708           e_export( lex, yymsp[-2].minor.yy0.string() );
709           yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(3,&yymsp[-3].minor);
710   yy_destructor(4,&yymsp[-1].minor);
711 }
712 #line 714 "bitbakeparser.c"
713         break;
714       case 6:
715 #line 74 "bitbakeparser.y"
716 { e_precat( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
717           e_export( lex, yymsp[-2].minor.yy0.string() );
718           yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(3,&yymsp[-3].minor);
719   yy_destructor(6,&yymsp[-1].minor);
720 }
721 #line 723 "bitbakeparser.c"
722         break;
723       case 7:
724 #line 78 "bitbakeparser.y"
725 { e_postcat( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
726           e_export( lex, yymsp[-2].minor.yy0.string() );
727           yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(3,&yymsp[-3].minor);
728   yy_destructor(7,&yymsp[-1].minor);
729 }
730 #line 732 "bitbakeparser.c"
731         break;
732       case 8:
733 #line 82 "bitbakeparser.y"
734 { e_immediate ( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
735           e_export( lex, yymsp[-2].minor.yy0.string() );
736           yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(3,&yymsp[-3].minor);
737   yy_destructor(8,&yymsp[-1].minor);
738 }
739 #line 741 "bitbakeparser.c"
740         break;
741       case 9:
742 #line 86 "bitbakeparser.y"
743 { e_cond( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
744           yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(3,&yymsp[-3].minor);
745   yy_destructor(9,&yymsp[-1].minor);
746 }
747 #line 749 "bitbakeparser.c"
748         break;
749       case 10:
750 #line 90 "bitbakeparser.y"
751 { e_assign( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
752           yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(4,&yymsp[-1].minor);
753 }
754 #line 756 "bitbakeparser.c"
755         break;
756       case 11:
757 #line 93 "bitbakeparser.y"
758 { e_precat( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
759           yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(6,&yymsp[-1].minor);
760 }
761 #line 763 "bitbakeparser.c"
762         break;
763       case 12:
764 #line 96 "bitbakeparser.y"
765 { e_postcat( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
766           yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(7,&yymsp[-1].minor);
767 }
768 #line 770 "bitbakeparser.c"
769         break;
770       case 13:
771 #line 99 "bitbakeparser.y"
772 { e_prepend( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
773           yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(10,&yymsp[-1].minor);
774 }
775 #line 777 "bitbakeparser.c"
776         break;
777       case 14:
778 #line 102 "bitbakeparser.y"
779 { e_append( lex, yymsp[-2].minor.yy0.string() , yymsp[0].minor.yy0.string() );
780           yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(11,&yymsp[-1].minor);
781 }
782 #line 784 "bitbakeparser.c"
783         break;
784       case 15:
785 #line 105 "bitbakeparser.y"
786 { e_immediate( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
787           yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(8,&yymsp[-1].minor);
788 }
789 #line 791 "bitbakeparser.c"
790         break;
791       case 16:
792 #line 108 "bitbakeparser.y"
793 { e_cond( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
794           yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(9,&yymsp[-1].minor);
795 }
796 #line 798 "bitbakeparser.c"
797         break;
798       case 17:
799 #line 112 "bitbakeparser.y"
800 { e_addtask( lex, yymsp[-4].minor.yy0.string(), yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
801           yymsp[-4].minor.yy0.release_this(); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(13,&yymsp[-3].minor);
802   yy_destructor(14,&yymsp[-1].minor);
803 }
804 #line 806 "bitbakeparser.c"
805         break;
806       case 18:
807 #line 115 "bitbakeparser.y"
808 { e_addtask( lex, yymsp[-4].minor.yy0.string(), yymsp[0].minor.yy0.string(), yymsp[-2].minor.yy0.string());
809           yymsp[-4].minor.yy0.release_this(); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(14,&yymsp[-3].minor);
810   yy_destructor(13,&yymsp[-1].minor);
811 }
812 #line 814 "bitbakeparser.c"
813         break;
814       case 19:
815 #line 118 "bitbakeparser.y"
816 { e_addtask( lex, yymsp[0].minor.yy0.string(), NULL, NULL);
817           yymsp[0].minor.yy0.release_this();}
818 #line 820 "bitbakeparser.c"
819         break;
820       case 20:
821 #line 121 "bitbakeparser.y"
822 { e_addtask( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string(), NULL);
823           yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(13,&yymsp[-1].minor);
824 }
825 #line 827 "bitbakeparser.c"
826         break;
827       case 21:
828 #line 124 "bitbakeparser.y"
829 { e_addtask( lex, yymsp[-2].minor.yy0.string(), NULL, yymsp[0].minor.yy0.string());
830           yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this();   yy_destructor(14,&yymsp[-1].minor);
831 }
832 #line 834 "bitbakeparser.c"
833         break;
834       case 25:
835 #line 131 "bitbakeparser.y"
836 { e_addhandler( lex, yymsp[0].minor.yy0.string()); yymsp[0].minor.yy0.release_this ();   yy_destructor(16,&yymsp[-1].minor);
837 }
838 #line 840 "bitbakeparser.c"
839         break;
840       case 26:
841 #line 133 "bitbakeparser.y"
842 { e_export_func( lex, yymsp[0].minor.yy0.string()); yymsp[0].minor.yy0.release_this(); }
843 #line 845 "bitbakeparser.c"
844         break;
845       case 30:
846 #line 138 "bitbakeparser.y"
847 { e_inherit( lex, yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this (); }
848 #line 850 "bitbakeparser.c"
849         break;
850       case 34:
851 #line 144 "bitbakeparser.y"
852 { e_include( lex, yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this();   yy_destructor(21,&yymsp[-1].minor);
853 }
854 #line 856 "bitbakeparser.c"
855         break;
856       case 35:
857 #line 147 "bitbakeparser.y"
858 { e_require( lex, yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this();   yy_destructor(22,&yymsp[-1].minor);
859 }
860 #line 862 "bitbakeparser.c"
861         break;
862       case 36:
863 #line 150 "bitbakeparser.y"
864 { /* concatenate body lines */
865           yygotominor.yy0.assignString( token_t::concatString(yymsp[-1].minor.yy0.string(), yymsp[0].minor.yy0.string()) );
866           yymsp[-1].minor.yy0.release_this ();
867           yymsp[0].minor.yy0.release_this ();
868         }
869 #line 871 "bitbakeparser.c"
870         break;
871       case 37:
872 #line 155 "bitbakeparser.y"
873 { yygotominor.yy0.assignString(0); }
874 #line 876 "bitbakeparser.c"
875         break;
876       case 38:
877 #line 157 "bitbakeparser.y"
878 { e_proc( lex, yymsp[-3].minor.yy0.string(), yymsp[-1].minor.yy0.string() );
879           yymsp[-3].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this();   yy_destructor(24,&yymsp[-2].minor);
880   yy_destructor(25,&yymsp[0].minor);
881 }
882 #line 884 "bitbakeparser.c"
883         break;
884       case 39:
885 #line 160 "bitbakeparser.y"
886 { e_proc_python ( lex, yymsp[-3].minor.yy0.string(), yymsp[-1].minor.yy0.string() );
887           yymsp[-3].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this();   yy_destructor(26,&yymsp[-4].minor);
888   yy_destructor(24,&yymsp[-2].minor);
889   yy_destructor(25,&yymsp[0].minor);
890 }
891 #line 893 "bitbakeparser.c"
892         break;
893       case 40:
894 #line 163 "bitbakeparser.y"
895 { e_proc_python( lex, NULL, yymsp[-1].minor.yy0.string());
896           yymsp[-1].minor.yy0.release_this ();   yy_destructor(26,&yymsp[-3].minor);
897   yy_destructor(24,&yymsp[-2].minor);
898   yy_destructor(25,&yymsp[0].minor);
899 }
900 #line 902 "bitbakeparser.c"
901         break;
902       case 41:
903 #line 167 "bitbakeparser.y"
904 { e_proc_fakeroot( lex, yymsp[-3].minor.yy0.string(), yymsp[-1].minor.yy0.string() );
905           yymsp[-3].minor.yy0.release_this (); yymsp[-1].minor.yy0.release_this ();   yy_destructor(27,&yymsp[-4].minor);
906   yy_destructor(24,&yymsp[-2].minor);
907   yy_destructor(25,&yymsp[0].minor);
908 }
909 #line 911 "bitbakeparser.c"
910         break;
911       case 42:
912 #line 171 "bitbakeparser.y"
913 { /* concatenate body lines */
914           yygotominor.yy0.assignString( token_t::concatString(yymsp[-1].minor.yy0.string(), yymsp[0].minor.yy0.string()) );
915           yymsp[-1].minor.yy0.release_this (); yymsp[0].minor.yy0.release_this ();
916         }
917 #line 919 "bitbakeparser.c"
918         break;
919       case 43:
920 #line 175 "bitbakeparser.y"
921 { yygotominor.yy0.assignString( 0 ); }
922 #line 924 "bitbakeparser.c"
923         break;
924       case 44:
925 #line 177 "bitbakeparser.y"
926 { e_def( lex, yymsp[-2].minor.yy0.string(), yymsp[-1].minor.yy0.string(), yymsp[0].minor.yy0.string());
927           yymsp[-2].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); }
928 #line 930 "bitbakeparser.c"
929         break;
930   };
931   yygoto = yyRuleInfo[yyruleno].lhs;
932   yysize = yyRuleInfo[yyruleno].nrhs;
933   yypParser->yyidx -= yysize;
934   yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto);
935   if( yyact < YYNSTATE ){
936 #ifdef NDEBUG
937     /* If we are not debugging and the reduce action popped at least
938     ** one element off the stack, then we can push the new element back
939     ** onto the stack here, and skip the stack overflow test in yy_shift().
940     ** That gives a significant speed improvement. */
941     if( yysize ){
942       yypParser->yyidx++;
943       yymsp -= yysize-1;
944       yymsp->stateno = yyact;
945       yymsp->major = yygoto;
946       yymsp->minor = yygotominor;
947     }else
948 #endif
949     {
950       yy_shift(yypParser,yyact,yygoto,&yygotominor);
951     }
952   }else if( yyact == YYNSTATE + YYNRULE + 1 ){
953     yy_accept(yypParser);
954   }
955 }
956
957 /*
958 ** The following code executes when the parse fails
959 */
960 static void yy_parse_failed(
961   yyParser *yypParser           /* The parser */
962 ){
963   bbparseARG_FETCH;
964 #ifndef NDEBUG
965   if( yyTraceFILE ){
966     fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
967   }
968 #endif
969   while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
970   /* Here code is inserted which will be executed whenever the
971   ** parser fails */
972   bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */
973 }
974
975 /*
976 ** The following code executes when a syntax error first occurs.
977 */
978 static void yy_syntax_error(
979   yyParser *yypParser,           /* The parser */
980   int yymajor,                   /* The major type of the error token */
981   YYMINORTYPE yyminor            /* The minor type of the error token */
982 ){
983   bbparseARG_FETCH;
984 #define TOKEN (yyminor.yy0)
985 #line 52 "bitbakeparser.y"
986  e_parse_error( lex ); 
987 #line 990 "bitbakeparser.c"
988   bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */
989 }
990
991 /*
992 ** The following is executed when the parser accepts
993 */
994 static void yy_accept(
995   yyParser *yypParser           /* The parser */
996 ){
997   bbparseARG_FETCH;
998 #ifndef NDEBUG
999   if( yyTraceFILE ){
1000     fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
1001   }
1002 #endif
1003   while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
1004   /* Here code is inserted which will be executed whenever the
1005   ** parser accepts */
1006   bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */
1007 }
1008
1009 /* The main parser program.
1010 ** The first argument is a pointer to a structure obtained from
1011 ** "bbparseAlloc" which describes the current state of the parser.
1012 ** The second argument is the major token number.  The third is
1013 ** the minor token.  The fourth optional argument is whatever the
1014 ** user wants (and specified in the grammar) and is available for
1015 ** use by the action routines.
1016 **
1017 ** Inputs:
1018 ** <ul>
1019 ** <li> A pointer to the parser (an opaque structure.)
1020 ** <li> The major token number.
1021 ** <li> The minor token number.
1022 ** <li> An option argument of a grammar-specified type.
1023 ** </ul>
1024 **
1025 ** Outputs:
1026 ** None.
1027 */
1028 void bbparse(
1029   void *yyp,                   /* The parser */
1030   int yymajor,                 /* The major token code number */
1031   bbparseTOKENTYPE yyminor       /* The value for the token */
1032   bbparseARG_PDECL               /* Optional %extra_argument parameter */
1033 ){
1034   YYMINORTYPE yyminorunion;
1035   int yyact;            /* The parser action. */
1036   int yyendofinput;     /* True if we are at the end of input */
1037   int yyerrorhit = 0;   /* True if yymajor has invoked an error */
1038   yyParser *yypParser;  /* The parser */
1039
1040   /* (re)initialize the parser, if necessary */
1041   yypParser = (yyParser*)yyp;
1042   if( yypParser->yyidx<0 ){
1043     if( yymajor==0 ) return;
1044     yypParser->yyidx = 0;
1045     yypParser->yyerrcnt = -1;
1046     yypParser->yystack[0].stateno = 0;
1047     yypParser->yystack[0].major = 0;
1048   }
1049   yyminorunion.yy0 = yyminor;
1050   yyendofinput = (yymajor==0);
1051   bbparseARG_STORE;
1052
1053 #ifndef NDEBUG
1054   if( yyTraceFILE ){
1055     fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
1056   }
1057 #endif
1058
1059   do{
1060     yyact = yy_find_shift_action(yypParser,yymajor);
1061     if( yyact<YYNSTATE ){
1062       yy_shift(yypParser,yyact,yymajor,&yyminorunion);
1063       yypParser->yyerrcnt--;
1064       if( yyendofinput && yypParser->yyidx>=0 ){
1065         yymajor = 0;
1066       }else{
1067         yymajor = YYNOCODE;
1068       }
1069     }else if( yyact < YYNSTATE + YYNRULE ){
1070       yy_reduce(yypParser,yyact-YYNSTATE);
1071     }else if( yyact == YY_ERROR_ACTION ){
1072       int yymx;
1073 #ifndef NDEBUG
1074       if( yyTraceFILE ){
1075         fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
1076       }
1077 #endif
1078 #ifdef YYERRORSYMBOL
1079       /* A syntax error has occurred.
1080       ** The response to an error depends upon whether or not the
1081       ** grammar defines an error token "ERROR".  
1082       **
1083       ** This is what we do if the grammar does define ERROR:
1084       **
1085       **  * Call the %syntax_error function.
1086       **
1087       **  * Begin popping the stack until we enter a state where
1088       **    it is legal to shift the error symbol, then shift
1089       **    the error symbol.
1090       **
1091       **  * Set the error count to three.
1092       **
1093       **  * Begin accepting and shifting new tokens.  No new error
1094       **    processing will occur until three tokens have been
1095       **    shifted successfully.
1096       **
1097       */
1098       if( yypParser->yyerrcnt<0 ){
1099         yy_syntax_error(yypParser,yymajor,yyminorunion);
1100       }
1101       yymx = yypParser->yystack[yypParser->yyidx].major;
1102       if( yymx==YYERRORSYMBOL || yyerrorhit ){
1103 #ifndef NDEBUG
1104         if( yyTraceFILE ){
1105           fprintf(yyTraceFILE,"%sDiscard input token %s\n",
1106              yyTracePrompt,yyTokenName[yymajor]);
1107         }
1108 #endif
1109         yy_destructor(yymajor,&yyminorunion);
1110         yymajor = YYNOCODE;
1111       }else{
1112          while(
1113           yypParser->yyidx >= 0 &&
1114           yymx != YYERRORSYMBOL &&
1115           (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE
1116         ){
1117           yy_pop_parser_stack(yypParser);
1118         }
1119         if( yypParser->yyidx < 0 || yymajor==0 ){
1120           yy_destructor(yymajor,&yyminorunion);
1121           yy_parse_failed(yypParser);
1122           yymajor = YYNOCODE;
1123         }else if( yymx!=YYERRORSYMBOL ){
1124           YYMINORTYPE u2;
1125           u2.YYERRSYMDT = 0;
1126           yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
1127         }
1128       }
1129       yypParser->yyerrcnt = 3;
1130       yyerrorhit = 1;
1131 #else  /* YYERRORSYMBOL is not defined */
1132       /* This is what we do if the grammar does not define ERROR:
1133       **
1134       **  * Report an error message, and throw away the input token.
1135       **
1136       **  * If the input token is $, then fail the parse.
1137       **
1138       ** As before, subsequent error messages are suppressed until
1139       ** three input tokens have been successfully shifted.
1140       */
1141       if( yypParser->yyerrcnt<=0 ){
1142         yy_syntax_error(yypParser,yymajor,yyminorunion);
1143       }
1144       yypParser->yyerrcnt = 3;
1145       yy_destructor(yymajor,&yyminorunion);
1146       if( yyendofinput ){
1147         yy_parse_failed(yypParser);
1148       }
1149       yymajor = YYNOCODE;
1150 #endif
1151     }else{
1152       yy_accept(yypParser);
1153       yymajor = YYNOCODE;
1154     }
1155   }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
1156   return;
1157 }