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 #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.
17 ** These constants (all generated automatically by the parser generator)
18 ** specify the various kinds of tokens (terminals) that the parser
21 ** Each symbol here is a terminal symbol in the grammar.
23 /* Make sure the INTERFACE macro is defined.
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
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.
61 #define YYCODETYPE unsigned char
63 #define YYACTIONTYPE unsigned char
64 #define bbparseTOKENTYPE token_t
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
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)
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
87 ** Suppose the action integer is N. Then the action is determined as
90 ** 0 <= N < YYNSTATE Shift N. That is, push the lookahead
91 ** token onto the stack and goto state N.
93 ** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE.
95 ** N == YYNSTATE+YYNRULE A syntax error has occurred.
97 ** N == YYNSTATE+YYNRULE+1 The parser accepts its input.
99 ** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused
100 ** slots in the yy_action[] table.
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
105 ** yy_action[ yy_shift_ofst[S] + X ]
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.
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.
118 ** The following are the tables generated in this section:
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.
129 static const YYACTIONTYPE yy_action[] = {
130 /* 0 */ 82, 3, 7, 8, 38, 22, 39, 24, 26, 32,
131 /* 10 */ 34, 28, 30, 128, 1, 40, 53, 70, 55, 5,
132 /* 20 */ 60, 65, 67, 2, 21, 36, 69, 77, 9, 7,
133 /* 30 */ 11, 6, 13, 15, 17, 19, 12, 52, 50, 4,
134 /* 40 */ 74, 42, 46, 59, 57, 10, 64, 62, 38, 14,
135 /* 50 */ 73, 16, 38, 38, 76, 81, 18, 20, 23, 25,
136 /* 60 */ 27, 29, 31, 33, 35, 37, 56, 51, 90, 54,
137 /* 70 */ 58, 71, 41, 43, 63, 45, 44, 47, 72, 48,
138 /* 80 */ 75, 78, 80, 61, 90, 49, 66, 90, 90, 68,
139 /* 90 */ 90, 90, 90, 90, 90, 79,
141 static const YYCODETYPE yy_lookahead[] = {
142 /* 0 */ 0, 1, 2, 3, 23, 4, 25, 6, 7, 8,
143 /* 10 */ 9, 10, 11, 31, 32, 15, 16, 1, 18, 42,
144 /* 20 */ 20, 21, 22, 33, 34, 24, 26, 27, 1, 2,
145 /* 30 */ 4, 28, 6, 7, 8, 9, 5, 35, 36, 29,
146 /* 40 */ 24, 13, 14, 37, 38, 34, 39, 40, 23, 5,
147 /* 50 */ 25, 5, 23, 23, 25, 25, 5, 5, 5, 5,
148 /* 60 */ 5, 5, 5, 5, 5, 41, 17, 35, 43, 1,
149 /* 70 */ 37, 24, 12, 12, 39, 12, 14, 12, 41, 13,
150 /* 80 */ 41, 1, 41, 19, 43, 12, 19, 43, 43, 19,
151 /* 90 */ 43, 43, 43, 43, 43, 24,
153 #define YY_SHIFT_USE_DFLT (-20)
154 static const signed char yy_shift_ofst[] = {
155 /* 0 */ -20, 0, -20, 10, -20, 3, -20, -20, 27, -20,
156 /* 10 */ 26, 31, -20, 44, -20, 46, -20, 51, -20, 52,
157 /* 20 */ -20, 1, 53, -20, 54, -20, 55, -20, 56, -20,
158 /* 30 */ 57, -20, 58, -20, 59, -20, -20, -19, -20, -20,
159 /* 40 */ 60, 28, 61, 62, 63, -20, 65, 66, 73, -20,
160 /* 50 */ 60, -20, -20, 68, -20, 49, -20, 49, -20, -20,
161 /* 60 */ 64, -20, 64, -20, -20, 67, -20, 70, -20, 16,
162 /* 70 */ 47, -20, 25, -20, -20, 29, -20, 80, 71, -20,
165 #define YY_REDUCE_USE_DFLT (-24)
166 static const signed char yy_reduce_ofst[] = {
167 /* 0 */ -18, -10, -24, -24, -23, -24, -24, -24, 11, -24,
168 /* 10 */ -24, -24, -24, -24, -24, -24, -24, -24, -24, -24,
169 /* 20 */ -24, -24, -24, -24, -24, -24, -24, -24, -24, -24,
170 /* 30 */ -24, -24, -24, -24, -24, -24, 24, -24, -24, -24,
171 /* 40 */ 2, -24, -24, -24, -24, -24, -24, -24, -24, -24,
172 /* 50 */ 32, -24, -24, -24, -24, 6, -24, 33, -24, -24,
173 /* 60 */ 7, -24, 35, -24, -24, -24, -24, -24, -24, -24,
174 /* 70 */ -24, 37, -24, -24, 39, -24, -24, -24, -24, 41,
177 static const YYACTIONTYPE yy_default[] = {
178 /* 0 */ 84, 127, 83, 85, 125, 126, 124, 86, 127, 85,
179 /* 10 */ 127, 127, 87, 127, 88, 127, 89, 127, 90, 127,
180 /* 20 */ 91, 127, 127, 92, 127, 93, 127, 94, 127, 95,
181 /* 30 */ 127, 96, 127, 97, 127, 98, 119, 127, 118, 120,
182 /* 40 */ 127, 101, 127, 102, 127, 99, 127, 103, 127, 100,
183 /* 50 */ 106, 104, 105, 127, 107, 127, 108, 111, 109, 110,
184 /* 60 */ 127, 112, 115, 113, 114, 127, 116, 127, 117, 127,
185 /* 70 */ 127, 119, 127, 121, 119, 127, 122, 127, 127, 119,
188 #define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0]))
190 /* The next table maps tokens into fallback tokens. If a construct
191 ** like the following:
193 ** %fallback ID X Y Z.
195 ** appears in the grammer, then ID becomes a fallback token for X, Y,
196 ** and Z. Whenever one of the tokens X, Y, or Z is input to the parser
197 ** but it does not parse, the type of the token is changed to ID and
198 ** the parse is retried before an error is thrown.
201 static const YYCODETYPE yyFallback[] = {
203 #endif /* YYFALLBACK */
205 /* The following structure represents a single element of the
206 ** parser's stack. Information stored includes:
208 ** + The state number for the parser at this level of the stack.
210 ** + The value of the token stored at this level of the stack.
211 ** (In other words, the "major" token.)
213 ** + The semantic value stored at this level of the stack. This is
214 ** the information used by the action routines in the grammar.
215 ** It is sometimes called the "minor" token.
217 struct yyStackEntry {
218 int stateno; /* The state-number */
219 int major; /* The major token value. This is the code
220 ** number for the token at this stack level */
221 YYMINORTYPE minor; /* The user-supplied minor token value. This
222 ** is the value of the token */
224 typedef struct yyStackEntry yyStackEntry;
226 /* The state of the parser is completely contained in an instance of
227 ** the following structure */
229 int yyidx; /* Index of top element in stack */
230 int yyerrcnt; /* Shifts left before out of the error */
231 bbparseARG_SDECL /* A place to hold %extra_argument */
232 yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
234 typedef struct yyParser yyParser;
238 static FILE *yyTraceFILE = 0;
239 static char *yyTracePrompt = 0;
244 ** Turn parser tracing on by giving a stream to which to write the trace
245 ** and a prompt to preface each trace message. Tracing is turned off
246 ** by making either argument NULL
250 ** <li> A FILE* to which trace output should be written.
251 ** If NULL, then tracing is turned off.
252 ** <li> A prefix string written at the beginning of every
253 ** line of trace output. If NULL, then tracing is
260 void bbparseTrace(FILE *TraceFILE, char *zTracePrompt){
261 yyTraceFILE = TraceFILE;
262 yyTracePrompt = zTracePrompt;
263 if( yyTraceFILE==0 ) yyTracePrompt = 0;
264 else if( yyTracePrompt==0 ) yyTraceFILE = 0;
269 /* For tracing shifts, the names of all terminals and nonterminals
270 ** are required. The following table supplies these names */
271 static const char *const yyTokenName[] = {
272 "$", "SYMBOL", "VARIABLE", "EXPORT",
273 "OP_ASSIGN", "STRING", "OP_PREDOT", "OP_POSTDOT",
274 "OP_IMMEDIATE", "OP_COND", "OP_PREPEND", "OP_APPEND",
275 "TSYMBOL", "BEFORE", "AFTER", "ADDTASK",
276 "ADDHANDLER", "FSYMBOL", "EXPORT_FUNC", "ISYMBOL",
277 "INHERIT", "INCLUDE", "REQUIRE", "PROC_BODY",
278 "PROC_OPEN", "PROC_CLOSE", "PYTHON", "FAKEROOT",
279 "DEF_BODY", "DEF_ARGS", "error", "program",
280 "statements", "statement", "variable", "task",
281 "tasks", "func", "funcs", "inherit",
282 "inherits", "proc_body", "def_body",
287 /* For tracing reduce actions, the names of all rules are required.
289 static const char *const yyRuleName[] = {
290 /* 0 */ "program ::= statements",
291 /* 1 */ "statements ::= statements statement",
292 /* 2 */ "statements ::=",
293 /* 3 */ "variable ::= SYMBOL",
294 /* 4 */ "variable ::= VARIABLE",
295 /* 5 */ "statement ::= EXPORT variable OP_ASSIGN STRING",
296 /* 6 */ "statement ::= EXPORT variable OP_PREDOT STRING",
297 /* 7 */ "statement ::= EXPORT variable OP_POSTDOT STRING",
298 /* 8 */ "statement ::= EXPORT variable OP_IMMEDIATE STRING",
299 /* 9 */ "statement ::= EXPORT variable OP_COND STRING",
300 /* 10 */ "statement ::= variable OP_ASSIGN STRING",
301 /* 11 */ "statement ::= variable OP_PREDOT STRING",
302 /* 12 */ "statement ::= variable OP_POSTDOT STRING",
303 /* 13 */ "statement ::= variable OP_PREPEND STRING",
304 /* 14 */ "statement ::= variable OP_APPEND STRING",
305 /* 15 */ "statement ::= variable OP_IMMEDIATE STRING",
306 /* 16 */ "statement ::= variable OP_COND STRING",
307 /* 17 */ "task ::= TSYMBOL BEFORE TSYMBOL AFTER TSYMBOL",
308 /* 18 */ "task ::= TSYMBOL AFTER TSYMBOL BEFORE TSYMBOL",
309 /* 19 */ "task ::= TSYMBOL",
310 /* 20 */ "task ::= TSYMBOL BEFORE TSYMBOL",
311 /* 21 */ "task ::= TSYMBOL AFTER TSYMBOL",
312 /* 22 */ "tasks ::= tasks task",
313 /* 23 */ "tasks ::= task",
314 /* 24 */ "statement ::= ADDTASK tasks",
315 /* 25 */ "statement ::= ADDHANDLER SYMBOL",
316 /* 26 */ "func ::= FSYMBOL",
317 /* 27 */ "funcs ::= funcs func",
318 /* 28 */ "funcs ::= func",
319 /* 29 */ "statement ::= EXPORT_FUNC funcs",
320 /* 30 */ "inherit ::= ISYMBOL",
321 /* 31 */ "inherits ::= inherits inherit",
322 /* 32 */ "inherits ::= inherit",
323 /* 33 */ "statement ::= INHERIT inherits",
324 /* 34 */ "statement ::= INCLUDE ISYMBOL",
325 /* 35 */ "statement ::= REQUIRE ISYMBOL",
326 /* 36 */ "proc_body ::= proc_body PROC_BODY",
327 /* 37 */ "proc_body ::=",
328 /* 38 */ "statement ::= variable PROC_OPEN proc_body PROC_CLOSE",
329 /* 39 */ "statement ::= PYTHON SYMBOL PROC_OPEN proc_body PROC_CLOSE",
330 /* 40 */ "statement ::= PYTHON PROC_OPEN proc_body PROC_CLOSE",
331 /* 41 */ "statement ::= FAKEROOT SYMBOL PROC_OPEN proc_body PROC_CLOSE",
332 /* 42 */ "def_body ::= def_body DEF_BODY",
333 /* 43 */ "def_body ::=",
334 /* 44 */ "statement ::= SYMBOL DEF_ARGS def_body",
339 ** This function returns the symbolic name associated with a token
342 const char *bbparseTokenName(int tokenType){
344 if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){
345 return yyTokenName[tokenType];
355 ** This function allocates a new parser.
356 ** The only argument is a pointer to a function which works like
360 ** A pointer to the function used to allocate memory.
363 ** A pointer to a parser. This pointer is used in subsequent calls
364 ** to bbparse and bbparseFree.
366 void *bbparseAlloc(void *(*mallocProc)(size_t)){
368 pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) );
375 /* The following function deletes the value associated with a
376 ** symbol. The symbol can be either a terminal or nonterminal.
377 ** "yymajor" is the symbol code, and "yypminor" is a pointer to
380 static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){
382 /* Here is inserted the actions which take place when a
383 ** terminal or non-terminal is destroyed. This can happen
384 ** when the symbol is popped from the stack during a
385 ** reduce or during error processing or when a parser is
386 ** being destroyed before it is finished parsing.
388 ** Note: during a reduce, the only symbols destroyed are those
389 ** which appear on the RHS of the rule, but which are not used
390 ** inside the C code.
421 #line 50 "bitbakeparser.y"
422 { (yypminor->yy0).release_this (); }
423 #line 425 "bitbakeparser.c"
425 default: break; /* If no destructor action specified: do nothing */
430 ** Pop the parser's stack once.
432 ** If there is a destructor routine associated with the token which
433 ** is popped from the stack, then call it.
435 ** Return the major token number for the symbol popped.
437 static int yy_pop_parser_stack(yyParser *pParser){
439 yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];
441 if( pParser->yyidx<0 ) return 0;
443 if( yyTraceFILE && pParser->yyidx>=0 ){
444 fprintf(yyTraceFILE,"%sPopping %s\n",
446 yyTokenName[yytos->major]);
449 yymajor = yytos->major;
450 yy_destructor( yymajor, &yytos->minor);
456 ** Deallocate and destroy a parser. Destructors are all called for
457 ** all stack elements before shutting the parser down.
461 ** <li> A pointer to the parser. This should be a pointer
462 ** obtained from bbparseAlloc.
463 ** <li> A pointer to a function used to reclaim memory obtained
468 void *p, /* The parser to be deleted */
469 void (*freeProc)(void*) /* Function used to reclaim memory */
471 yyParser *pParser = (yyParser*)p;
472 if( pParser==0 ) return;
473 while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
474 (*freeProc)((void*)pParser);
478 ** Find the appropriate action for a parser given the terminal
479 ** look-ahead token iLookAhead.
481 ** If the look-ahead token is YYNOCODE, then check to see if the action is
482 ** independent of the look-ahead. If it is, return the action, otherwise
483 ** return YY_NO_ACTION.
485 static int yy_find_shift_action(
486 yyParser *pParser, /* The parser */
487 int iLookAhead /* The look-ahead token */
490 int stateno = pParser->yystack[pParser->yyidx].stateno;
492 /* if( pParser->yyidx<0 ) return YY_NO_ACTION; */
493 i = yy_shift_ofst[stateno];
494 if( i==YY_SHIFT_USE_DFLT ){
495 return yy_default[stateno];
497 if( iLookAhead==YYNOCODE ){
501 if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
503 int iFallback; /* Fallback token */
504 if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
505 && (iFallback = yyFallback[iLookAhead])!=0 ){
508 fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
509 yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
512 return yy_find_shift_action(pParser, iFallback);
515 return yy_default[stateno];
522 ** Find the appropriate action for a parser given the non-terminal
523 ** look-ahead token iLookAhead.
525 ** If the look-ahead token is YYNOCODE, then check to see if the action is
526 ** independent of the look-ahead. If it is, return the action, otherwise
527 ** return YY_NO_ACTION.
529 static int yy_find_reduce_action(
530 int stateno, /* Current state number */
531 int iLookAhead /* The look-ahead token */
534 /* int stateno = pParser->yystack[pParser->yyidx].stateno; */
536 i = yy_reduce_ofst[stateno];
537 if( i==YY_REDUCE_USE_DFLT ){
538 return yy_default[stateno];
540 if( iLookAhead==YYNOCODE ){
544 if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
545 return yy_default[stateno];
552 ** Perform a shift action.
554 static void yy_shift(
555 yyParser *yypParser, /* The parser to be shifted */
556 int yyNewState, /* The new state to shift in */
557 int yyMajor, /* The major token to shift in */
558 YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */
562 if( yypParser->yyidx>=YYSTACKDEPTH ){
567 fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
570 while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
571 /* Here code is inserted which will execute if the parser
572 ** stack every overflows */
573 bbparseARG_STORE; /* Suppress warning about unused %extra_argument var */
576 yytos = &yypParser->yystack[yypParser->yyidx];
577 yytos->stateno = yyNewState;
578 yytos->major = yyMajor;
579 yytos->minor = *yypMinor;
581 if( yyTraceFILE && yypParser->yyidx>0 ){
583 fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState);
584 fprintf(yyTraceFILE,"%sStack:",yyTracePrompt);
585 for(i=1; i<=yypParser->yyidx; i++)
586 fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]);
587 fprintf(yyTraceFILE,"\n");
592 /* The following table contains information about every rule that
593 ** is used during the reduce.
595 static const struct {
596 YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
597 unsigned char nrhs; /* Number of right-hand side symbols in the rule */
646 static void yy_accept(yyParser*); /* Forward Declaration */
649 ** Perform a reduce action and the shift that must immediately
650 ** follow the reduce.
652 static void yy_reduce(
653 yyParser *yypParser, /* The parser */
654 int yyruleno /* Number of the rule by which to reduce */
656 int yygoto; /* The next state */
657 int yyact; /* The next action */
658 YYMINORTYPE yygotominor; /* The LHS of the rule reduced */
659 yyStackEntry *yymsp; /* The top of the parser's stack */
660 int yysize; /* Amount to pop the stack */
662 yymsp = &yypParser->yystack[yypParser->yyidx];
664 if( yyTraceFILE && yyruleno>=0
665 && yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
666 fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
667 yyRuleName[yyruleno]);
672 /* Silence complaints from purify about yygotominor being uninitialized
673 ** in some cases when it is copied into the stack after the following
674 ** switch. yygotominor is uninitialized when a rule reduces that does
675 ** not set the value of its left-hand side nonterminal. Leaving the
676 ** value of the nonterminal uninitialized is utterly harmless as long
677 ** as the value is never used. So really the only thing this code
678 ** accomplishes is to quieten purify.
680 memset(&yygotominor, 0, sizeof(yygotominor));
684 /* Beginning here are the reduction cases. A typical example
687 ** #line <lineno> <grammarfile>
688 ** { ... } // User supplied code
689 ** #line <lineno> <thisfile>
693 #line 60 "bitbakeparser.y"
694 { yygotominor.yy0.assignString( (char*)yymsp[0].minor.yy0.string() );
695 yymsp[0].minor.yy0.assignString( 0 );
696 yymsp[0].minor.yy0.release_this(); }
697 #line 699 "bitbakeparser.c"
700 #line 64 "bitbakeparser.y"
702 yygotominor.yy0.assignString( (char*)yymsp[0].minor.yy0.string() );
703 yymsp[0].minor.yy0.assignString( 0 );
704 yymsp[0].minor.yy0.release_this(); }
705 #line 707 "bitbakeparser.c"
708 #line 70 "bitbakeparser.y"
709 { e_assign( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
710 e_export( lex, yymsp[-2].minor.yy0.string() );
711 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor);
712 yy_destructor(4,&yymsp[-1].minor);
714 #line 716 "bitbakeparser.c"
717 #line 74 "bitbakeparser.y"
718 { e_precat( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
719 e_export( lex, yymsp[-2].minor.yy0.string() );
720 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor);
721 yy_destructor(6,&yymsp[-1].minor);
723 #line 725 "bitbakeparser.c"
726 #line 78 "bitbakeparser.y"
727 { e_postcat( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
728 e_export( lex, yymsp[-2].minor.yy0.string() );
729 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor);
730 yy_destructor(7,&yymsp[-1].minor);
732 #line 734 "bitbakeparser.c"
735 #line 82 "bitbakeparser.y"
736 { e_immediate ( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
737 e_export( lex, yymsp[-2].minor.yy0.string() );
738 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor);
739 yy_destructor(8,&yymsp[-1].minor);
741 #line 743 "bitbakeparser.c"
744 #line 86 "bitbakeparser.y"
745 { e_cond( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
746 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor);
747 yy_destructor(9,&yymsp[-1].minor);
749 #line 751 "bitbakeparser.c"
752 #line 90 "bitbakeparser.y"
753 { e_assign( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
754 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(4,&yymsp[-1].minor);
756 #line 758 "bitbakeparser.c"
759 #line 93 "bitbakeparser.y"
760 { e_precat( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
761 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(6,&yymsp[-1].minor);
763 #line 765 "bitbakeparser.c"
766 #line 96 "bitbakeparser.y"
767 { e_postcat( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
768 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(7,&yymsp[-1].minor);
770 #line 772 "bitbakeparser.c"
773 #line 99 "bitbakeparser.y"
774 { e_prepend( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
775 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(10,&yymsp[-1].minor);
777 #line 779 "bitbakeparser.c"
780 #line 102 "bitbakeparser.y"
781 { e_append( lex, yymsp[-2].minor.yy0.string() , yymsp[0].minor.yy0.string() );
782 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(11,&yymsp[-1].minor);
784 #line 786 "bitbakeparser.c"
787 #line 105 "bitbakeparser.y"
788 { e_immediate( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
789 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(8,&yymsp[-1].minor);
791 #line 793 "bitbakeparser.c"
794 #line 108 "bitbakeparser.y"
795 { e_cond( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
796 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(9,&yymsp[-1].minor);
798 #line 800 "bitbakeparser.c"
801 #line 112 "bitbakeparser.y"
802 { e_addtask( lex, yymsp[-4].minor.yy0.string(), yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() );
803 yymsp[-4].minor.yy0.release_this(); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(13,&yymsp[-3].minor);
804 yy_destructor(14,&yymsp[-1].minor);
806 #line 808 "bitbakeparser.c"
809 #line 115 "bitbakeparser.y"
810 { e_addtask( lex, yymsp[-4].minor.yy0.string(), yymsp[0].minor.yy0.string(), yymsp[-2].minor.yy0.string());
811 yymsp[-4].minor.yy0.release_this(); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(14,&yymsp[-3].minor);
812 yy_destructor(13,&yymsp[-1].minor);
814 #line 816 "bitbakeparser.c"
817 #line 118 "bitbakeparser.y"
818 { e_addtask( lex, yymsp[0].minor.yy0.string(), NULL, NULL);
819 yymsp[0].minor.yy0.release_this();}
820 #line 822 "bitbakeparser.c"
823 #line 121 "bitbakeparser.y"
824 { e_addtask( lex, yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string(), NULL);
825 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(13,&yymsp[-1].minor);
827 #line 829 "bitbakeparser.c"
830 #line 124 "bitbakeparser.y"
831 { e_addtask( lex, yymsp[-2].minor.yy0.string(), NULL, yymsp[0].minor.yy0.string());
832 yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(14,&yymsp[-1].minor);
834 #line 836 "bitbakeparser.c"
837 #line 131 "bitbakeparser.y"
838 { e_addhandler( lex, yymsp[0].minor.yy0.string()); yymsp[0].minor.yy0.release_this (); yy_destructor(16,&yymsp[-1].minor);
840 #line 842 "bitbakeparser.c"
843 #line 133 "bitbakeparser.y"
844 { e_export_func( lex, yymsp[0].minor.yy0.string()); yymsp[0].minor.yy0.release_this(); }
845 #line 847 "bitbakeparser.c"
848 #line 138 "bitbakeparser.y"
849 { e_inherit( lex, yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this (); }
850 #line 852 "bitbakeparser.c"
853 #line 144 "bitbakeparser.y"
854 { e_include( lex, yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this(); yy_destructor(21,&yymsp[-1].minor);
856 #line 858 "bitbakeparser.c"
859 #line 147 "bitbakeparser.y"
860 { e_require( lex, yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this(); yy_destructor(22,&yymsp[-1].minor);
862 #line 864 "bitbakeparser.c"
865 #line 150 "bitbakeparser.y"
866 { /* concatenate body lines */
867 yygotominor.yy0.assignString( token_t::concatString(yymsp[-1].minor.yy0.string(), yymsp[0].minor.yy0.string()) );
868 yymsp[-1].minor.yy0.release_this ();
869 yymsp[0].minor.yy0.release_this ();
871 #line 873 "bitbakeparser.c"
874 #line 155 "bitbakeparser.y"
875 { yygotominor.yy0.assignString(0); }
876 #line 878 "bitbakeparser.c"
879 #line 157 "bitbakeparser.y"
880 { e_proc( lex, yymsp[-3].minor.yy0.string(), yymsp[-1].minor.yy0.string() );
881 yymsp[-3].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this(); yy_destructor(24,&yymsp[-2].minor);
882 yy_destructor(25,&yymsp[0].minor);
884 #line 886 "bitbakeparser.c"
887 #line 160 "bitbakeparser.y"
888 { e_proc_python ( lex, yymsp[-3].minor.yy0.string(), yymsp[-1].minor.yy0.string() );
889 yymsp[-3].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this(); yy_destructor(26,&yymsp[-4].minor);
890 yy_destructor(24,&yymsp[-2].minor);
891 yy_destructor(25,&yymsp[0].minor);
893 #line 895 "bitbakeparser.c"
896 #line 163 "bitbakeparser.y"
897 { e_proc_python( lex, NULL, yymsp[-1].minor.yy0.string());
898 yymsp[-1].minor.yy0.release_this (); yy_destructor(26,&yymsp[-3].minor);
899 yy_destructor(24,&yymsp[-2].minor);
900 yy_destructor(25,&yymsp[0].minor);
902 #line 904 "bitbakeparser.c"
905 #line 167 "bitbakeparser.y"
906 { e_proc_fakeroot( lex, yymsp[-3].minor.yy0.string(), yymsp[-1].minor.yy0.string() );
907 yymsp[-3].minor.yy0.release_this (); yymsp[-1].minor.yy0.release_this (); yy_destructor(27,&yymsp[-4].minor);
908 yy_destructor(24,&yymsp[-2].minor);
909 yy_destructor(25,&yymsp[0].minor);
911 #line 913 "bitbakeparser.c"
914 #line 171 "bitbakeparser.y"
915 { /* concatenate body lines */
916 yygotominor.yy0.assignString( token_t::concatString(yymsp[-1].minor.yy0.string(), yymsp[0].minor.yy0.string()) );
917 yymsp[-1].minor.yy0.release_this (); yymsp[0].minor.yy0.release_this ();
919 #line 921 "bitbakeparser.c"
922 #line 175 "bitbakeparser.y"
923 { yygotominor.yy0.assignString( 0 ); }
924 #line 926 "bitbakeparser.c"
927 #line 177 "bitbakeparser.y"
928 { e_def( lex, yymsp[-2].minor.yy0.string(), yymsp[-1].minor.yy0.string(), yymsp[0].minor.yy0.string());
929 yymsp[-2].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); }
930 #line 932 "bitbakeparser.c"
933 yygoto = yyRuleInfo[yyruleno].lhs;
934 yysize = yyRuleInfo[yyruleno].nrhs;
935 yypParser->yyidx -= yysize;
936 yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto);
937 if( yyact < YYNSTATE ){
939 /* If we are not debugging and the reduce action popped at least
940 ** one element off the stack, then we can push the new element back
941 ** onto the stack here, and skip the stack overflow test in yy_shift().
942 ** That gives a significant speed improvement. */
946 yymsp->stateno = yyact;
947 yymsp->major = yygoto;
948 yymsp->minor = yygotominor;
952 yy_shift(yypParser,yyact,yygoto,&yygotominor);
954 }else if( yyact == YYNSTATE + YYNRULE + 1 ){
955 yy_accept(yypParser);
960 ** The following code executes when the parse fails
962 static void yy_parse_failed(
963 yyParser *yypParser /* The parser */
968 fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
971 while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
972 /* Here code is inserted which will be executed whenever the
974 bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */
978 ** The following code executes when a syntax error first occurs.
980 static void yy_syntax_error(
981 yyParser *yypParser, /* The parser */
982 int yymajor, /* The major type of the error token */
983 YYMINORTYPE yyminor /* The minor type of the error token */
986 #define TOKEN (yyminor.yy0)
987 #line 52 "bitbakeparser.y"
988 e_parse_error( lex );
989 #line 992 "bitbakeparser.c"
990 bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */
994 ** The following is executed when the parser accepts
996 static void yy_accept(
997 yyParser *yypParser /* The parser */
1002 fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
1005 while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
1006 /* Here code is inserted which will be executed whenever the
1007 ** parser accepts */
1008 bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */
1011 /* The main parser program.
1012 ** The first argument is a pointer to a structure obtained from
1013 ** "bbparseAlloc" which describes the current state of the parser.
1014 ** The second argument is the major token number. The third is
1015 ** the minor token. The fourth optional argument is whatever the
1016 ** user wants (and specified in the grammar) and is available for
1017 ** use by the action routines.
1021 ** <li> A pointer to the parser (an opaque structure.)
1022 ** <li> The major token number.
1023 ** <li> The minor token number.
1024 ** <li> An option argument of a grammar-specified type.
1031 void *yyp, /* The parser */
1032 int yymajor, /* The major token code number */
1033 bbparseTOKENTYPE yyminor /* The value for the token */
1034 bbparseARG_PDECL /* Optional %extra_argument parameter */
1036 YYMINORTYPE yyminorunion;
1037 int yyact; /* The parser action. */
1038 int yyendofinput; /* True if we are at the end of input */
1039 int yyerrorhit = 0; /* True if yymajor has invoked an error */
1040 yyParser *yypParser; /* The parser */
1042 /* (re)initialize the parser, if necessary */
1043 yypParser = (yyParser*)yyp;
1044 if( yypParser->yyidx<0 ){
1045 /* if( yymajor==0 ) return; // not sure why this was here... */
1046 yypParser->yyidx = 0;
1047 yypParser->yyerrcnt = -1;
1048 yypParser->yystack[0].stateno = 0;
1049 yypParser->yystack[0].major = 0;
1051 yyminorunion.yy0 = yyminor;
1052 yyendofinput = (yymajor==0);
1057 fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
1062 yyact = yy_find_shift_action(yypParser,yymajor);
1063 if( yyact<YYNSTATE ){
1064 yy_shift(yypParser,yyact,yymajor,&yyminorunion);
1065 yypParser->yyerrcnt--;
1066 if( yyendofinput && yypParser->yyidx>=0 ){
1071 }else if( yyact < YYNSTATE + YYNRULE ){
1072 yy_reduce(yypParser,yyact-YYNSTATE);
1073 }else if( yyact == YY_ERROR_ACTION ){
1077 fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
1080 #ifdef YYERRORSYMBOL
1081 /* A syntax error has occurred.
1082 ** The response to an error depends upon whether or not the
1083 ** grammar defines an error token "ERROR".
1085 ** This is what we do if the grammar does define ERROR:
1087 ** * Call the %syntax_error function.
1089 ** * Begin popping the stack until we enter a state where
1090 ** it is legal to shift the error symbol, then shift
1091 ** the error symbol.
1093 ** * Set the error count to three.
1095 ** * Begin accepting and shifting new tokens. No new error
1096 ** processing will occur until three tokens have been
1097 ** shifted successfully.
1100 if( yypParser->yyerrcnt<0 ){
1101 yy_syntax_error(yypParser,yymajor,yyminorunion);
1103 yymx = yypParser->yystack[yypParser->yyidx].major;
1104 if( yymx==YYERRORSYMBOL || yyerrorhit ){
1107 fprintf(yyTraceFILE,"%sDiscard input token %s\n",
1108 yyTracePrompt,yyTokenName[yymajor]);
1111 yy_destructor(yymajor,&yyminorunion);
1115 yypParser->yyidx >= 0 &&
1116 yymx != YYERRORSYMBOL &&
1117 (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE
1119 yy_pop_parser_stack(yypParser);
1121 if( yypParser->yyidx < 0 || yymajor==0 ){
1122 yy_destructor(yymajor,&yyminorunion);
1123 yy_parse_failed(yypParser);
1125 }else if( yymx!=YYERRORSYMBOL ){
1128 yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
1131 yypParser->yyerrcnt = 3;
1133 #else /* YYERRORSYMBOL is not defined */
1134 /* This is what we do if the grammar does not define ERROR:
1136 ** * Report an error message, and throw away the input token.
1138 ** * If the input token is $, then fail the parse.
1140 ** As before, subsequent error messages are suppressed until
1141 ** three input tokens have been successfully shifted.
1143 if( yypParser->yyerrcnt<=0 ){
1144 yy_syntax_error(yypParser,yymajor,yyminorunion);
1146 yypParser->yyerrcnt = 3;
1147 yy_destructor(yymajor,&yyminorunion);
1149 yy_parse_failed(yypParser);
1154 yy_accept(yypParser);
1157 }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );