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