1 /* Driver template for the LEMON parser generator.
2 ** The author disclaims copyright to this source code.
4 /* First off, code is include which follows the "include" declaration
5 ** in the input file. */
7 #line 43 "bitbakeparser.y"
11 #line 13 "bitbakeparser.c"
12 /* Next is all token values, in a form suitable for use by makeheaders.
13 ** This section will be null unless lemon is run with the -m switch.
16 ** These constants (all generated automatically by the parser generator)
17 ** specify the various kinds of tokens (terminals) that the parser
20 ** Each symbol here is a terminal symbol in the grammar.
22 /* Make sure the INTERFACE macro is defined.
27 /* The next thing included is series of defines which control
28 ** various aspects of the generated parser.
29 ** YYCODETYPE is the data type used for storing terminal
30 ** and nonterminal numbers. "unsigned char" is
31 ** used if there are fewer than 250 terminals
32 ** and nonterminals. "int" is used otherwise.
33 ** YYNOCODE is a number of type YYCODETYPE which corresponds
34 ** to no legal terminal or nonterminal number. This
35 ** number is used to fill in empty slots of the hash
37 ** YYFALLBACK If defined, this indicates that one or more tokens
38 ** have fall-back values which should be used if the
39 ** original value of the token will not parse.
40 ** YYACTIONTYPE is the data type used for storing terminal
41 ** and nonterminal numbers. "unsigned char" is
42 ** used if there are fewer than 250 rules and
43 ** states combined. "int" is used otherwise.
44 ** bbparseTOKENTYPE is the data type used for minor tokens given
45 ** directly to the parser from the tokenizer.
46 ** YYMINORTYPE is the data type used for all minor tokens.
47 ** This is typically a union of many types, one of
48 ** which is bbparseTOKENTYPE. The entry in the union
49 ** for base tokens is called "yy0".
50 ** YYSTACKDEPTH is the maximum depth of the parser's stack.
51 ** bbparseARG_SDECL A static variable declaration for the %extra_argument
52 ** bbparseARG_PDECL A parameter declaration for the %extra_argument
53 ** bbparseARG_STORE Code to store %extra_argument into yypParser
54 ** bbparseARG_FETCH Code to extract %extra_argument from yypParser
55 ** YYNSTATE the combined number of states.
56 ** YYNRULE the number of rules in the grammar
57 ** YYERRORSYMBOL is the code number of the error symbol. If not
58 ** defined, then do no error processing.
60 #define YYCODETYPE unsigned char
62 #define YYACTIONTYPE unsigned char
63 #define bbparseTOKENTYPE token_t
68 #define YYSTACKDEPTH 100
69 #define bbparseARG_SDECL lex_t* lex;
70 #define bbparseARG_PDECL ,lex_t* lex
71 #define bbparseARG_FETCH lex_t* lex = yypParser->lex
72 #define bbparseARG_STORE yypParser->lex = lex
75 #define YYERRORSYMBOL 28
76 #define YYERRSYMDT yy83
77 #define YY_NO_ACTION (YYNSTATE+YYNRULE+2)
78 #define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1)
79 #define YY_ERROR_ACTION (YYNSTATE+YYNRULE)
81 /* Next are that tables used to determine what action to take based on the
82 ** current state and lookahead token. These tables are used to implement
83 ** functions that take a state number and lookahead value and return an
86 ** Suppose the action integer is N. Then the action is determined as
89 ** 0 <= N < YYNSTATE Shift N. That is, push the lookahead
90 ** token onto the stack and goto state N.
92 ** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE.
94 ** N == YYNSTATE+YYNRULE A syntax error has occurred.
96 ** N == YYNSTATE+YYNRULE+1 The parser accepts its input.
98 ** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused
99 ** slots in the yy_action[] table.
101 ** The action table is constructed as a single large table named yy_action[].
102 ** Given state S and lookahead X, the action is computed as
104 ** yy_action[ yy_shift_ofst[S] + X ]
106 ** If the index value yy_shift_ofst[S]+X is out of range or if the value
107 ** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
108 ** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
109 ** and that yy_default[S] should be used instead.
111 ** The formula above is for computing the action when the lookahead is
112 ** a terminal symbol. If the lookahead is a non-terminal (as occurs after
113 ** a reduce action) then the yy_reduce_ofst[] array is used in place of
114 ** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
115 ** YY_SHIFT_USE_DFLT.
117 ** The following are the tables generated in this section:
119 ** yy_action[] A single table containing all actions.
120 ** yy_lookahead[] A table containing the lookahead for each entry in
121 ** yy_action. Used to detect hash collisions.
122 ** yy_shift_ofst[] For each state, the offset into yy_action for
123 ** shifting terminals.
124 ** yy_reduce_ofst[] For each state, the offset into yy_action for
125 ** shifting non-terminals after a reduce.
126 ** yy_default[] Default action for each state.
128 static const YYACTIONTYPE yy_action[] = {
129 /* 0 */ 28, 47, 5, 57, 33, 58, 30, 25, 24, 37,
130 /* 10 */ 45, 14, 2, 29, 41, 3, 16, 4, 23, 39,
131 /* 20 */ 69, 8, 11, 17, 26, 48, 47, 32, 21, 42,
132 /* 30 */ 31, 57, 57, 73, 44, 10, 66, 7, 34, 38,
133 /* 40 */ 57, 51, 72, 116, 1, 62, 6, 49, 52, 35,
134 /* 50 */ 36, 59, 54, 9, 20, 64, 43, 22, 40, 50,
135 /* 60 */ 46, 71, 67, 60, 15, 65, 61, 70, 53, 56,
136 /* 70 */ 27, 12, 68, 63, 84, 55, 18, 84, 13, 84,
137 /* 80 */ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
140 static const YYCODETYPE yy_lookahead[] = {
141 /* 0 */ 1, 2, 3, 21, 4, 23, 6, 7, 8, 9,
142 /* 10 */ 31, 32, 13, 14, 1, 16, 39, 18, 19, 20,
143 /* 20 */ 37, 38, 22, 24, 25, 1, 2, 4, 10, 6,
144 /* 30 */ 7, 21, 21, 23, 23, 22, 35, 36, 11, 12,
145 /* 40 */ 21, 5, 23, 29, 30, 33, 34, 5, 5, 10,
146 /* 50 */ 12, 10, 5, 22, 39, 15, 40, 11, 10, 5,
147 /* 60 */ 26, 17, 17, 10, 32, 35, 33, 17, 5, 5,
148 /* 70 */ 1, 22, 37, 1, 41, 5, 39, 41, 27, 41,
149 /* 80 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
152 #define YY_SHIFT_USE_DFLT (-19)
153 #define YY_SHIFT_MAX 43
154 static const signed char yy_shift_ofst[] = {
155 /* 0 */ -19, -1, 18, 40, 45, 24, 18, 40, 45, -19,
156 /* 10 */ -19, -19, -19, -19, 0, 23, -18, 13, 19, 10,
157 /* 20 */ 11, 27, 53, 50, 63, 64, 69, 49, 51, 72,
158 /* 30 */ 70, 36, 42, 43, 39, 38, 41, 47, 48, 44,
159 /* 40 */ 46, 31, 54, 34,
161 #define YY_REDUCE_USE_DFLT (-24)
162 #define YY_REDUCE_MAX 13
163 static const signed char yy_reduce_ofst[] = {
164 /* 0 */ 14, -21, 12, 1, -17, 32, 33, 30, 35, 37,
165 /* 10 */ 52, -23, 15, 16,
167 static const YYACTIONTYPE yy_default[] = {
168 /* 0 */ 76, 74, 115, 115, 115, 115, 94, 99, 103, 107,
169 /* 10 */ 107, 107, 107, 113, 115, 115, 115, 115, 115, 115,
170 /* 20 */ 115, 89, 115, 115, 115, 115, 115, 115, 77, 115,
171 /* 30 */ 115, 115, 115, 115, 115, 90, 115, 115, 115, 115,
172 /* 40 */ 91, 115, 115, 114, 111, 75, 112, 78, 77, 79,
173 /* 50 */ 80, 81, 82, 83, 84, 85, 86, 106, 108, 87,
174 /* 60 */ 88, 92, 93, 95, 96, 97, 98, 100, 101, 102,
175 /* 70 */ 104, 105, 109, 110,
177 #define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0]))
179 /* The next table maps tokens into fallback tokens. If a construct
180 ** like the following:
182 ** %fallback ID X Y Z.
184 ** appears in the grammer, then ID becomes a fallback token for X, Y,
185 ** and Z. Whenever one of the tokens X, Y, or Z is input to the parser
186 ** but it does not parse, the type of the token is changed to ID and
187 ** the parse is retried before an error is thrown.
190 static const YYCODETYPE yyFallback[] = {
192 #endif /* YYFALLBACK */
194 /* The following structure represents a single element of the
195 ** parser's stack. Information stored includes:
197 ** + The state number for the parser at this level of the stack.
199 ** + The value of the token stored at this level of the stack.
200 ** (In other words, the "major" token.)
202 ** + The semantic value stored at this level of the stack. This is
203 ** the information used by the action routines in the grammar.
204 ** It is sometimes called the "minor" token.
206 struct yyStackEntry {
207 int stateno; /* The state-number */
208 int major; /* The major token value. This is the code
209 ** number for the token at this stack level */
210 YYMINORTYPE minor; /* The user-supplied minor token value. This
211 ** is the value of the token */
213 typedef struct yyStackEntry yyStackEntry;
215 /* The state of the parser is completely contained in an instance of
216 ** the following structure */
218 int yyidx; /* Index of top element in stack */
219 int yyerrcnt; /* Shifts left before out of the error */
220 bbparseARG_SDECL /* A place to hold %extra_argument */
221 yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
223 typedef struct yyParser yyParser;
227 static FILE *yyTraceFILE = 0;
228 static char *yyTracePrompt = 0;
233 ** Turn parser tracing on by giving a stream to which to write the trace
234 ** and a prompt to preface each trace message. Tracing is turned off
235 ** by making either argument NULL
239 ** <li> A FILE* to which trace output should be written.
240 ** If NULL, then tracing is turned off.
241 ** <li> A prefix string written at the beginning of every
242 ** line of trace output. If NULL, then tracing is
249 void bbparseTrace(FILE *TraceFILE, char *zTracePrompt){
250 yyTraceFILE = TraceFILE;
251 yyTracePrompt = zTracePrompt;
252 if( yyTraceFILE==0 ) yyTracePrompt = 0;
253 else if( yyTracePrompt==0 ) yyTraceFILE = 0;
258 /* For tracing shifts, the names of all terminals and nonterminals
259 ** are required. The following table supplies these names */
260 static const char *const yyTokenName[] = {
261 "$", "SYMBOL", "VARIABLE", "EXPORT",
262 "OP_ASSIGN", "STRING", "OP_IMMEDIATE", "OP_COND",
263 "OP_PREPEND", "OP_APPEND", "TSYMBOL", "BEFORE",
264 "AFTER", "ADDTASK", "ADDHANDLER", "FSYMBOL",
265 "EXPORT_FUNC", "ISYMBOL", "INHERIT", "INCLUDE",
266 "REQUIRE", "PROC_BODY", "PROC_OPEN", "PROC_CLOSE",
267 "PYTHON", "FAKEROOT", "DEF_BODY", "DEF_ARGS",
268 "error", "program", "statements", "statement",
269 "variable", "task", "tasks", "func",
270 "funcs", "inherit", "inherits", "proc_body",
276 /* For tracing reduce actions, the names of all rules are required.
278 static const char *const yyRuleName[] = {
279 /* 0 */ "program ::= statements",
280 /* 1 */ "statements ::= statements statement",
281 /* 2 */ "statements ::=",
282 /* 3 */ "variable ::= SYMBOL",
283 /* 4 */ "variable ::= VARIABLE",
284 /* 5 */ "statement ::= EXPORT variable OP_ASSIGN STRING",
285 /* 6 */ "statement ::= EXPORT variable OP_IMMEDIATE STRING",
286 /* 7 */ "statement ::= EXPORT variable OP_COND STRING",
287 /* 8 */ "statement ::= variable OP_ASSIGN STRING",
288 /* 9 */ "statement ::= variable OP_PREPEND STRING",
289 /* 10 */ "statement ::= variable OP_APPEND STRING",
290 /* 11 */ "statement ::= variable OP_IMMEDIATE STRING",
291 /* 12 */ "statement ::= variable OP_COND STRING",
292 /* 13 */ "task ::= TSYMBOL BEFORE TSYMBOL AFTER TSYMBOL",
293 /* 14 */ "task ::= TSYMBOL AFTER TSYMBOL BEFORE TSYMBOL",
294 /* 15 */ "task ::= TSYMBOL",
295 /* 16 */ "task ::= TSYMBOL BEFORE TSYMBOL",
296 /* 17 */ "task ::= TSYMBOL AFTER TSYMBOL",
297 /* 18 */ "tasks ::= tasks task",
298 /* 19 */ "tasks ::= task",
299 /* 20 */ "statement ::= ADDTASK tasks",
300 /* 21 */ "statement ::= ADDHANDLER SYMBOL",
301 /* 22 */ "func ::= FSYMBOL",
302 /* 23 */ "funcs ::= funcs func",
303 /* 24 */ "funcs ::= func",
304 /* 25 */ "statement ::= EXPORT_FUNC funcs",
305 /* 26 */ "inherit ::= ISYMBOL",
306 /* 27 */ "inherits ::= inherits inherit",
307 /* 28 */ "inherits ::= inherit",
308 /* 29 */ "statement ::= INHERIT inherits",
309 /* 30 */ "statement ::= INCLUDE ISYMBOL",
310 /* 31 */ "statement ::= REQUIRE ISYMBOL",
311 /* 32 */ "proc_body ::= proc_body PROC_BODY",
312 /* 33 */ "proc_body ::=",
313 /* 34 */ "statement ::= variable PROC_OPEN proc_body PROC_CLOSE",
314 /* 35 */ "statement ::= PYTHON SYMBOL PROC_OPEN proc_body PROC_CLOSE",
315 /* 36 */ "statement ::= PYTHON PROC_OPEN proc_body PROC_CLOSE",
316 /* 37 */ "statement ::= FAKEROOT SYMBOL PROC_OPEN proc_body PROC_CLOSE",
317 /* 38 */ "def_body ::= def_body DEF_BODY",
318 /* 39 */ "def_body ::=",
319 /* 40 */ "statement ::= SYMBOL DEF_ARGS def_body",
324 ** This function returns the symbolic name associated with a token
327 const char *bbparseTokenName(int tokenType){
329 if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){
330 return yyTokenName[tokenType];
340 ** This function allocates a new parser.
341 ** The only argument is a pointer to a function which works like
345 ** A pointer to the function used to allocate memory.
348 ** A pointer to a parser. This pointer is used in subsequent calls
349 ** to bbparse and bbparseFree.
351 void *bbparseAlloc(void *(*mallocProc)(size_t)){
353 pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) );
360 /* The following function deletes the value associated with a
361 ** symbol. The symbol can be either a terminal or nonterminal.
362 ** "yymajor" is the symbol code, and "yypminor" is a pointer to
365 static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){
367 /* Here is inserted the actions which take place when a
368 ** terminal or non-terminal is destroyed. This can happen
369 ** when the symbol is popped from the stack during a
370 ** reduce or during error processing or when a parser is
371 ** being destroyed before it is finished parsing.
373 ** Note: during a reduce, the only symbols destroyed are those
374 ** which appear on the RHS of the rule, but which are not used
375 ** inside the C code.
404 #line 49 "bitbakeparser.y"
405 { (yypminor->yy0).release_this (); }
406 #line 408 "bitbakeparser.c"
408 default: break; /* If no destructor action specified: do nothing */
413 ** Pop the parser's stack once.
415 ** If there is a destructor routine associated with the token which
416 ** is popped from the stack, then call it.
418 ** Return the major token number for the symbol popped.
420 static int yy_pop_parser_stack(yyParser *pParser){
422 yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];
424 if( pParser->yyidx<0 ) return 0;
426 if( yyTraceFILE && pParser->yyidx>=0 ){
427 fprintf(yyTraceFILE,"%sPopping %s\n",
429 yyTokenName[yytos->major]);
432 yymajor = yytos->major;
433 yy_destructor( yymajor, &yytos->minor);
439 ** Deallocate and destroy a parser. Destructors are all called for
440 ** all stack elements before shutting the parser down.
444 ** <li> A pointer to the parser. This should be a pointer
445 ** obtained from bbparseAlloc.
446 ** <li> A pointer to a function used to reclaim memory obtained
451 void *p, /* The parser to be deleted */
452 void (*freeProc)(void*) /* Function used to reclaim memory */
454 yyParser *pParser = (yyParser*)p;
455 if( pParser==0 ) return;
456 while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
457 (*freeProc)((void*)pParser);
461 ** Find the appropriate action for a parser given the terminal
462 ** look-ahead token iLookAhead.
464 ** If the look-ahead token is YYNOCODE, then check to see if the action is
465 ** independent of the look-ahead. If it is, return the action, otherwise
466 ** return YY_NO_ACTION.
468 static int yy_find_shift_action(
469 yyParser *pParser, /* The parser */
470 int iLookAhead /* The look-ahead token */
473 int stateno = pParser->yystack[pParser->yyidx].stateno;
475 if( stateno>YY_SHIFT_MAX || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){
476 return yy_default[stateno];
478 if( iLookAhead==YYNOCODE ){
482 if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
484 int iFallback; /* Fallback token */
485 if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
486 && (iFallback = yyFallback[iLookAhead])!=0 ){
489 fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
490 yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
493 return yy_find_shift_action(pParser, iFallback);
496 return yy_default[stateno];
503 ** Find the appropriate action for a parser given the non-terminal
504 ** look-ahead token iLookAhead.
506 ** If the look-ahead token is YYNOCODE, then check to see if the action is
507 ** independent of the look-ahead. If it is, return the action, otherwise
508 ** return YY_NO_ACTION.
510 static int yy_find_reduce_action(
511 int stateno, /* Current state number */
512 int iLookAhead /* The look-ahead token */
515 /* int stateno = pParser->yystack[pParser->yyidx].stateno; */
517 if( stateno>YY_REDUCE_MAX ||
518 (i = yy_reduce_ofst[stateno])==YY_REDUCE_USE_DFLT ){
519 return yy_default[stateno];
521 if( iLookAhead==YYNOCODE ){
525 if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
526 return yy_default[stateno];
533 ** Perform a shift action.
535 static void yy_shift(
536 yyParser *yypParser, /* The parser to be shifted */
537 int yyNewState, /* The new state to shift in */
538 int yyMajor, /* The major token to shift in */
539 YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */
543 if( yypParser->yyidx>=YYSTACKDEPTH ){
548 fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
551 while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
552 /* Here code is inserted which will execute if the parser
553 ** stack every overflows */
554 bbparseARG_STORE; /* Suppress warning about unused %extra_argument var */
557 yytos = &yypParser->yystack[yypParser->yyidx];
558 yytos->stateno = yyNewState;
559 yytos->major = yyMajor;
560 yytos->minor = *yypMinor;
562 if( yyTraceFILE && yypParser->yyidx>0 ){
564 fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState);
565 fprintf(yyTraceFILE,"%sStack:",yyTracePrompt);
566 for(i=1; i<=yypParser->yyidx; i++)
567 fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]);
568 fprintf(yyTraceFILE,"\n");
573 /* The following table contains information about every rule that
574 ** is used during the reduce.
576 static const struct {
577 YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
578 unsigned char nrhs; /* Number of right-hand side symbols in the rule */
623 static void yy_accept(yyParser*); /* Forward Declaration */
626 ** Perform a reduce action and the shift that must immediately
627 ** follow the reduce.
629 static void yy_reduce(
630 yyParser *yypParser, /* The parser */
631 int yyruleno /* Number of the rule by which to reduce */
633 int yygoto; /* The next state */
634 int yyact; /* The next action */
635 YYMINORTYPE yygotominor; /* The LHS of the rule reduced */
636 yyStackEntry *yymsp; /* The top of the parser's stack */
637 int yysize; /* Amount to pop the stack */
639 yymsp = &yypParser->yystack[yypParser->yyidx];
641 if( yyTraceFILE && yyruleno>=0
642 && yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
643 fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
644 yyRuleName[yyruleno]);
649 /* Silence complaints from purify about yygotominor being uninitialized
650 ** in some cases when it is copied into the stack after the following
651 ** switch. yygotominor is uninitialized when a rule reduces that does
652 ** not set the value of its left-hand side nonterminal. Leaving the
653 ** value of the nonterminal uninitialized is utterly harmless as long
654 ** as the value is never used. So really the only thing this code
655 ** accomplishes is to quieten purify.
657 memset(&yygotominor, 0, sizeof(yygotominor));
661 /* Beginning here are the reduction cases. A typical example
664 ** #line <lineno> <grammarfile>
665 ** { ... } // User supplied code
666 ** #line <lineno> <thisfile>
670 #line 59 "bitbakeparser.y"
671 { yygotominor.yy0.assignString( (char*)yymsp[0].minor.yy0.string() );
672 yymsp[0].minor.yy0.assignString( 0 );
673 yymsp[0].minor.yy0.release_this(); }
674 #line 676 "bitbakeparser.c"
677 #line 63 "bitbakeparser.y"
679 yygotominor.yy0.assignString( (char*)yymsp[0].minor.yy0.string() );
680 yymsp[0].minor.yy0.assignString( 0 );
681 yymsp[0].minor.yy0.release_this(); }
682 #line 684 "bitbakeparser.c"
685 #line 69 "bitbakeparser.y"
686 { e_assign( yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
687 e_export( yymsp[-2].minor.yy0.string() );
688 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor);
689 yy_destructor(4,&yymsp[-1].minor);
691 #line 693 "bitbakeparser.c"
694 #line 73 "bitbakeparser.y"
695 { e_immediate (yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
696 e_export( yymsp[-2].minor.yy0.string() );
697 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor);
698 yy_destructor(6,&yymsp[-1].minor);
700 #line 702 "bitbakeparser.c"
703 #line 77 "bitbakeparser.y"
704 { e_cond( yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
705 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor);
706 yy_destructor(7,&yymsp[-1].minor);
708 #line 710 "bitbakeparser.c"
711 #line 81 "bitbakeparser.y"
712 { e_assign( yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
713 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(4,&yymsp[-1].minor);
715 #line 717 "bitbakeparser.c"
718 #line 84 "bitbakeparser.y"
719 { e_prepend( yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
720 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(8,&yymsp[-1].minor);
722 #line 724 "bitbakeparser.c"
725 #line 87 "bitbakeparser.y"
726 { e_append( yymsp[-2].minor.yy0.string() , yymsp[0].minor.yy0.string() );
727 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(9,&yymsp[-1].minor);
729 #line 731 "bitbakeparser.c"
732 #line 90 "bitbakeparser.y"
733 { e_immediate( yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
734 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(6,&yymsp[-1].minor);
736 #line 738 "bitbakeparser.c"
739 #line 93 "bitbakeparser.y"
740 { e_cond( yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
741 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(7,&yymsp[-1].minor);
743 #line 745 "bitbakeparser.c"
746 #line 97 "bitbakeparser.y"
747 { e_addtask( yymsp[-4].minor.yy0.string(), yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
748 yymsp[-4].minor.yy0.release_this(); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(11,&yymsp[-3].minor);
749 yy_destructor(12,&yymsp[-1].minor);
751 #line 753 "bitbakeparser.c"
754 #line 100 "bitbakeparser.y"
755 { e_addtask( yymsp[-4].minor.yy0.string(), yymsp[0].minor.yy0.string(), yymsp[-2].minor.yy0.string());
756 yymsp[-4].minor.yy0.release_this(); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(12,&yymsp[-3].minor);
757 yy_destructor(11,&yymsp[-1].minor);
759 #line 761 "bitbakeparser.c"
762 #line 103 "bitbakeparser.y"
763 { e_addtask( yymsp[0].minor.yy0.string(), NULL, NULL);
764 yymsp[0].minor.yy0.release_this();}
765 #line 767 "bitbakeparser.c"
768 #line 106 "bitbakeparser.y"
769 { e_addtask( yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string(), NULL);
770 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(11,&yymsp[-1].minor);
772 #line 774 "bitbakeparser.c"
775 #line 109 "bitbakeparser.y"
776 { e_addtask( yymsp[-2].minor.yy0.string(), NULL, yymsp[0].minor.yy0.string());
777 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(12,&yymsp[-1].minor);
779 #line 781 "bitbakeparser.c"
782 #line 116 "bitbakeparser.y"
783 { e_addhandler( yymsp[0].minor.yy0.string()); yymsp[0].minor.yy0.release_this (); yy_destructor(14,&yymsp[-1].minor);
785 #line 787 "bitbakeparser.c"
788 #line 118 "bitbakeparser.y"
789 { e_export_func(yymsp[0].minor.yy0.string()); yymsp[0].minor.yy0.release_this(); }
790 #line 792 "bitbakeparser.c"
793 #line 123 "bitbakeparser.y"
794 { e_inherit(yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this (); }
795 #line 797 "bitbakeparser.c"
798 #line 129 "bitbakeparser.y"
799 { e_include(yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this(); yy_destructor(19,&yymsp[-1].minor);
801 #line 803 "bitbakeparser.c"
804 #line 132 "bitbakeparser.y"
805 { e_require(yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this(); yy_destructor(20,&yymsp[-1].minor);
807 #line 809 "bitbakeparser.c"
810 #line 135 "bitbakeparser.y"
811 { /* concatenate body lines */
812 yygotominor.yy0.assignString( token_t::concatString(yymsp[-1].minor.yy0.string(), yymsp[0].minor.yy0.string()) );
813 yymsp[-1].minor.yy0.release_this ();
814 yymsp[0].minor.yy0.release_this ();
816 #line 818 "bitbakeparser.c"
819 #line 140 "bitbakeparser.y"
820 { yygotominor.yy0.assignString(0); }
821 #line 823 "bitbakeparser.c"
824 #line 142 "bitbakeparser.y"
825 { e_proc( yymsp[-3].minor.yy0.string(), yymsp[-1].minor.yy0.string() );
826 yymsp[-3].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this(); yy_destructor(22,&yymsp[-2].minor);
827 yy_destructor(23,&yymsp[0].minor);
829 #line 831 "bitbakeparser.c"
832 #line 145 "bitbakeparser.y"
833 { e_proc_python (yymsp[-3].minor.yy0.string(), yymsp[-1].minor.yy0.string() );
834 yymsp[-3].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this(); yy_destructor(24,&yymsp[-4].minor);
835 yy_destructor(22,&yymsp[-2].minor);
836 yy_destructor(23,&yymsp[0].minor);
838 #line 840 "bitbakeparser.c"
841 #line 148 "bitbakeparser.y"
842 { e_proc_python( NULL, yymsp[-1].minor.yy0.string());
843 yymsp[-1].minor.yy0.release_this (); yy_destructor(24,&yymsp[-3].minor);
844 yy_destructor(22,&yymsp[-2].minor);
845 yy_destructor(23,&yymsp[0].minor);
847 #line 849 "bitbakeparser.c"
850 #line 152 "bitbakeparser.y"
851 { e_proc_fakeroot(yymsp[-3].minor.yy0.string(), yymsp[-1].minor.yy0.string() );
852 yymsp[-3].minor.yy0.release_this (); yymsp[-1].minor.yy0.release_this (); yy_destructor(25,&yymsp[-4].minor);
853 yy_destructor(22,&yymsp[-2].minor);
854 yy_destructor(23,&yymsp[0].minor);
856 #line 858 "bitbakeparser.c"
859 #line 156 "bitbakeparser.y"
860 { /* concatenate body lines */
861 yygotominor.yy0.assignString( token_t::concatString(yymsp[-1].minor.yy0.string(), yymsp[0].minor.yy0.string()) );
862 yymsp[-1].minor.yy0.release_this (); yymsp[0].minor.yy0.release_this ();
864 #line 866 "bitbakeparser.c"
867 #line 160 "bitbakeparser.y"
868 { yygotominor.yy0.assignString( 0 ); }
869 #line 871 "bitbakeparser.c"
872 #line 162 "bitbakeparser.y"
873 { e_def( yymsp[-2].minor.yy0.string(), yymsp[-1].minor.yy0.string(), yymsp[0].minor.yy0.string());
874 yymsp[-2].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); }
875 #line 877 "bitbakeparser.c"
878 yygoto = yyRuleInfo[yyruleno].lhs;
879 yysize = yyRuleInfo[yyruleno].nrhs;
880 yypParser->yyidx -= yysize;
881 yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto);
882 if( yyact < YYNSTATE ){
884 /* If we are not debugging and the reduce action popped at least
885 ** one element off the stack, then we can push the new element back
886 ** onto the stack here, and skip the stack overflow test in yy_shift().
887 ** That gives a significant speed improvement. */
891 yymsp->stateno = yyact;
892 yymsp->major = yygoto;
893 yymsp->minor = yygotominor;
897 yy_shift(yypParser,yyact,yygoto,&yygotominor);
899 }else if( yyact == YYNSTATE + YYNRULE + 1 ){
900 yy_accept(yypParser);
905 ** The following code executes when the parse fails
907 static void yy_parse_failed(
908 yyParser *yypParser /* The parser */
913 fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
916 while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
917 /* Here code is inserted which will be executed whenever the
919 bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */
923 ** The following code executes when a syntax error first occurs.
925 static void yy_syntax_error(
926 yyParser *yypParser, /* The parser */
927 int yymajor, /* The major type of the error token */
928 YYMINORTYPE yyminor /* The minor type of the error token */
931 #define TOKEN (yyminor.yy0)
932 #line 51 "bitbakeparser.y"
933 e_parse_error( lex->filename(), lex->line() );
934 #line 937 "bitbakeparser.c"
935 bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */
939 ** The following is executed when the parser accepts
941 static void yy_accept(
942 yyParser *yypParser /* The parser */
947 fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
950 while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
951 /* Here code is inserted which will be executed whenever the
953 bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */
956 /* The main parser program.
957 ** The first argument is a pointer to a structure obtained from
958 ** "bbparseAlloc" which describes the current state of the parser.
959 ** The second argument is the major token number. The third is
960 ** the minor token. The fourth optional argument is whatever the
961 ** user wants (and specified in the grammar) and is available for
962 ** use by the action routines.
966 ** <li> A pointer to the parser (an opaque structure.)
967 ** <li> The major token number.
968 ** <li> The minor token number.
969 ** <li> An option argument of a grammar-specified type.
976 void *yyp, /* The parser */
977 int yymajor, /* The major token code number */
978 bbparseTOKENTYPE yyminor /* The value for the token */
979 bbparseARG_PDECL /* Optional %extra_argument parameter */
981 YYMINORTYPE yyminorunion;
982 int yyact; /* The parser action. */
983 int yyendofinput; /* True if we are at the end of input */
984 int yyerrorhit = 0; /* True if yymajor has invoked an error */
985 yyParser *yypParser; /* The parser */
987 /* (re)initialize the parser, if necessary */
988 yypParser = (yyParser*)yyp;
989 if( yypParser->yyidx<0 ){
990 /* if( yymajor==0 ) return; // not sure why this was here... */
991 yypParser->yyidx = 0;
992 yypParser->yyerrcnt = -1;
993 yypParser->yystack[0].stateno = 0;
994 yypParser->yystack[0].major = 0;
996 yyminorunion.yy0 = yyminor;
997 yyendofinput = (yymajor==0);
1002 fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
1007 yyact = yy_find_shift_action(yypParser,yymajor);
1008 if( yyact<YYNSTATE ){
1009 yy_shift(yypParser,yyact,yymajor,&yyminorunion);
1010 yypParser->yyerrcnt--;
1011 if( yyendofinput && yypParser->yyidx>=0 ){
1016 }else if( yyact < YYNSTATE + YYNRULE ){
1017 yy_reduce(yypParser,yyact-YYNSTATE);
1018 }else if( yyact == YY_ERROR_ACTION ){
1022 fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
1025 #ifdef YYERRORSYMBOL
1026 /* A syntax error has occurred.
1027 ** The response to an error depends upon whether or not the
1028 ** grammar defines an error token "ERROR".
1030 ** This is what we do if the grammar does define ERROR:
1032 ** * Call the %syntax_error function.
1034 ** * Begin popping the stack until we enter a state where
1035 ** it is legal to shift the error symbol, then shift
1036 ** the error symbol.
1038 ** * Set the error count to three.
1040 ** * Begin accepting and shifting new tokens. No new error
1041 ** processing will occur until three tokens have been
1042 ** shifted successfully.
1045 if( yypParser->yyerrcnt<0 ){
1046 yy_syntax_error(yypParser,yymajor,yyminorunion);
1048 yymx = yypParser->yystack[yypParser->yyidx].major;
1049 if( yymx==YYERRORSYMBOL || yyerrorhit ){
1052 fprintf(yyTraceFILE,"%sDiscard input token %s\n",
1053 yyTracePrompt,yyTokenName[yymajor]);
1056 yy_destructor(yymajor,&yyminorunion);
1060 yypParser->yyidx >= 0 &&
1061 yymx != YYERRORSYMBOL &&
1062 (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE
1064 yy_pop_parser_stack(yypParser);
1066 if( yypParser->yyidx < 0 || yymajor==0 ){
1067 yy_destructor(yymajor,&yyminorunion);
1068 yy_parse_failed(yypParser);
1070 }else if( yymx!=YYERRORSYMBOL ){
1073 yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
1076 yypParser->yyerrcnt = 3;
1078 #else /* YYERRORSYMBOL is not defined */
1079 /* This is what we do if the grammar does not define ERROR:
1081 ** * Report an error message, and throw away the input token.
1083 ** * If the input token is $, then fail the parse.
1085 ** As before, subsequent error messages are suppressed until
1086 ** three input tokens have been successfully shifted.
1088 if( yypParser->yyerrcnt<=0 ){
1089 yy_syntax_error(yypParser,yymajor,yyminorunion);
1091 yypParser->yyerrcnt = 3;
1092 yy_destructor(yymajor,&yyminorunion);
1094 yy_parse_failed(yypParser);
1099 yy_accept(yypParser);
1102 }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );