diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2006-03-19 19:42:45 +0000 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2006-03-19 19:42:45 +0000 |
commit | 8f6a1e7805cf205aebdbec0ca51d9da7b9effde5 (patch) | |
tree | 3d8c4abaee63acb177dc73b6a450de057df4547a | |
parent | f0a0475b4f23bcabdb8fdceed237f6b9eba50bf9 (diff) | |
download | bitbake-8f6a1e7805cf205aebdbec0ca51d9da7b9effde5.tar.gz |
bitbake/lib/bb/parse/parse_c:
-Update grammar to use require
-Make code compile (almost)
-Add the generated code to svn for portability
reasons.
-rw-r--r-- | lib/bb/parse/parse_c/README.build | 12 | ||||
-rw-r--r-- | lib/bb/parse/parse_c/bitbakeparser.cc | 1104 | ||||
-rw-r--r-- | lib/bb/parse/parse_c/bitbakeparser.h | 27 | ||||
-rw-r--r-- | lib/bb/parse/parse_c/bitbakeparser.py | 133 | ||||
-rw-r--r-- | lib/bb/parse/parse_c/bitbakeparser.y | 17 | ||||
-rw-r--r-- | lib/bb/parse/parse_c/bitbakescanner.cc | 2998 | ||||
-rw-r--r-- | lib/bb/parse/parse_c/bitbakescanner.l (renamed from lib/bb/parse/parse_c/bitbakeparser.l) | 1 | ||||
-rw-r--r-- | lib/bb/parse/parse_c/lexer.h | 2 | ||||
-rw-r--r-- | lib/bb/parse/parse_c/token.h | 20 |
9 files changed, 4170 insertions, 144 deletions
diff --git a/lib/bb/parse/parse_c/README.build b/lib/bb/parse/parse_c/README.build new file mode 100644 index 000000000..eb6ad8c86 --- /dev/null +++ b/lib/bb/parse/parse_c/README.build @@ -0,0 +1,12 @@ +To ease portability (lemon, flex, etc) we keep the +result of flex and lemon in the source code. We agree +to not manually change the scanner and parser. + + + +How we create the files: + flex -t bitbakescanner.l > bitbakescanner.cc + lemon bitbakeparser.y + mv bitbakeparser.c bitbakeparser.cc + +Now manually create two files diff --git a/lib/bb/parse/parse_c/bitbakeparser.cc b/lib/bb/parse/parse_c/bitbakeparser.cc new file mode 100644 index 000000000..8d4af341c --- /dev/null +++ b/lib/bb/parse/parse_c/bitbakeparser.cc @@ -0,0 +1,1104 @@ +/* Driver template for the LEMON parser generator. +** The author disclaims copyright to this source code. +*/ +/* First off, code is include which follows the "include" declaration +** in the input file. */ +#include <stdio.h> +#line 43 "bitbakeparser.y" + +#include "token.h" +#include "lexer.h" +#line 13 "bitbakeparser.c" +/* Next is all token values, in a form suitable for use by makeheaders. +** This section will be null unless lemon is run with the -m switch. +*/ +/* +** These constants (all generated automatically by the parser generator) +** specify the various kinds of tokens (terminals) that the parser +** understands. +** +** Each symbol here is a terminal symbol in the grammar. +*/ +/* Make sure the INTERFACE macro is defined. +*/ +#ifndef INTERFACE +# define INTERFACE 1 +#endif +/* The next thing included is series of defines which control +** various aspects of the generated parser. +** YYCODETYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 terminals +** and nonterminals. "int" is used otherwise. +** YYNOCODE is a number of type YYCODETYPE which corresponds +** to no legal terminal or nonterminal number. This +** number is used to fill in empty slots of the hash +** table. +** YYFALLBACK If defined, this indicates that one or more tokens +** have fall-back values which should be used if the +** original value of the token will not parse. +** YYACTIONTYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 rules and +** states combined. "int" is used otherwise. +** bbparseTOKENTYPE is the data type used for minor tokens given +** directly to the parser from the tokenizer. +** YYMINORTYPE is the data type used for all minor tokens. +** This is typically a union of many types, one of +** which is bbparseTOKENTYPE. The entry in the union +** for base tokens is called "yy0". +** YYSTACKDEPTH is the maximum depth of the parser's stack. +** bbparseARG_SDECL A static variable declaration for the %extra_argument +** bbparseARG_PDECL A parameter declaration for the %extra_argument +** bbparseARG_STORE Code to store %extra_argument into yypParser +** bbparseARG_FETCH Code to extract %extra_argument from yypParser +** YYNSTATE the combined number of states. +** YYNRULE the number of rules in the grammar +** YYERRORSYMBOL is the code number of the error symbol. If not +** defined, then do no error processing. +*/ +#define YYCODETYPE unsigned char +#define YYNOCODE 42 +#define YYACTIONTYPE unsigned char +#define bbparseTOKENTYPE token_t +typedef union { + bbparseTOKENTYPE yy0; + int yy83; +} YYMINORTYPE; +#define YYSTACKDEPTH 100 +#define bbparseARG_SDECL lex_t* lex; +#define bbparseARG_PDECL ,lex_t* lex +#define bbparseARG_FETCH lex_t* lex = yypParser->lex +#define bbparseARG_STORE yypParser->lex = lex +#define YYNSTATE 74 +#define YYNRULE 41 +#define YYERRORSYMBOL 28 +#define YYERRSYMDT yy83 +#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) +#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) +#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) + +/* Next are that tables used to determine what action to take based on the +** current state and lookahead token. These tables are used to implement +** functions that take a state number and lookahead value and return an +** action integer. +** +** Suppose the action integer is N. Then the action is determined as +** follows +** +** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** token onto the stack and goto state N. +** +** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** +** N == YYNSTATE+YYNRULE A syntax error has occurred. +** +** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** +** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused +** slots in the yy_action[] table. +** +** The action table is constructed as a single large table named yy_action[]. +** Given state S and lookahead X, the action is computed as +** +** yy_action[ yy_shift_ofst[S] + X ] +** +** If the index value yy_shift_ofst[S]+X is out of range or if the value +** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] +** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table +** and that yy_default[S] should be used instead. +** +** The formula above is for computing the action when the lookahead is +** a terminal symbol. If the lookahead is a non-terminal (as occurs after +** a reduce action) then the yy_reduce_ofst[] array is used in place of +** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of +** YY_SHIFT_USE_DFLT. +** +** The following are the tables generated in this section: +** +** yy_action[] A single table containing all actions. +** yy_lookahead[] A table containing the lookahead for each entry in +** yy_action. Used to detect hash collisions. +** yy_shift_ofst[] For each state, the offset into yy_action for +** shifting terminals. +** yy_reduce_ofst[] For each state, the offset into yy_action for +** shifting non-terminals after a reduce. +** yy_default[] Default action for each state. +*/ +static const YYACTIONTYPE yy_action[] = { + /* 0 */ 28, 47, 5, 57, 33, 58, 30, 25, 24, 37, + /* 10 */ 45, 14, 2, 29, 41, 3, 16, 4, 23, 39, + /* 20 */ 69, 8, 11, 17, 26, 48, 47, 32, 21, 42, + /* 30 */ 31, 57, 57, 73, 44, 10, 66, 7, 34, 38, + /* 40 */ 57, 51, 72, 116, 1, 62, 6, 49, 52, 35, + /* 50 */ 36, 59, 54, 9, 20, 64, 43, 22, 40, 50, + /* 60 */ 46, 71, 67, 60, 15, 65, 61, 70, 53, 56, + /* 70 */ 27, 12, 68, 63, 84, 55, 18, 84, 13, 84, + /* 80 */ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + /* 90 */ 84, 19, +}; +static const YYCODETYPE yy_lookahead[] = { + /* 0 */ 1, 2, 3, 21, 4, 23, 6, 7, 8, 9, + /* 10 */ 31, 32, 13, 14, 1, 16, 39, 18, 19, 20, + /* 20 */ 37, 38, 22, 24, 25, 1, 2, 4, 10, 6, + /* 30 */ 7, 21, 21, 23, 23, 22, 35, 36, 11, 12, + /* 40 */ 21, 5, 23, 29, 30, 33, 34, 5, 5, 10, + /* 50 */ 12, 10, 5, 22, 39, 15, 40, 11, 10, 5, + /* 60 */ 26, 17, 17, 10, 32, 35, 33, 17, 5, 5, + /* 70 */ 1, 22, 37, 1, 41, 5, 39, 41, 27, 41, + /* 80 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + /* 90 */ 41, 39, +}; +#define YY_SHIFT_USE_DFLT (-19) +#define YY_SHIFT_MAX 43 +static const signed char yy_shift_ofst[] = { + /* 0 */ -19, -1, 18, 40, 45, 24, 18, 40, 45, -19, + /* 10 */ -19, -19, -19, -19, 0, 23, -18, 13, 19, 10, + /* 20 */ 11, 27, 53, 50, 63, 64, 69, 49, 51, 72, + /* 30 */ 70, 36, 42, 43, 39, 38, 41, 47, 48, 44, + /* 40 */ 46, 31, 54, 34, +}; +#define YY_REDUCE_USE_DFLT (-24) +#define YY_REDUCE_MAX 13 +static const signed char yy_reduce_ofst[] = { + /* 0 */ 14, -21, 12, 1, -17, 32, 33, 30, 35, 37, + /* 10 */ 52, -23, 15, 16, +}; +static const YYACTIONTYPE yy_default[] = { + /* 0 */ 76, 74, 115, 115, 115, 115, 94, 99, 103, 107, + /* 10 */ 107, 107, 107, 113, 115, 115, 115, 115, 115, 115, + /* 20 */ 115, 89, 115, 115, 115, 115, 115, 115, 77, 115, + /* 30 */ 115, 115, 115, 115, 115, 90, 115, 115, 115, 115, + /* 40 */ 91, 115, 115, 114, 111, 75, 112, 78, 77, 79, + /* 50 */ 80, 81, 82, 83, 84, 85, 86, 106, 108, 87, + /* 60 */ 88, 92, 93, 95, 96, 97, 98, 100, 101, 102, + /* 70 */ 104, 105, 109, 110, +}; +#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) + +/* The next table maps tokens into fallback tokens. If a construct +** like the following: +** +** %fallback ID X Y Z. +** +** appears in the grammer, then ID becomes a fallback token for X, Y, +** and Z. Whenever one of the tokens X, Y, or Z is input to the parser +** but it does not parse, the type of the token is changed to ID and +** the parse is retried before an error is thrown. +*/ +#ifdef YYFALLBACK +static const YYCODETYPE yyFallback[] = { +}; +#endif /* YYFALLBACK */ + +/* The following structure represents a single element of the +** parser's stack. Information stored includes: +** +** + The state number for the parser at this level of the stack. +** +** + The value of the token stored at this level of the stack. +** (In other words, the "major" token.) +** +** + The semantic value stored at this level of the stack. This is +** the information used by the action routines in the grammar. +** It is sometimes called the "minor" token. +*/ +struct yyStackEntry { + int stateno; /* The state-number */ + int major; /* The major token value. This is the code + ** number for the token at this stack level */ + YYMINORTYPE minor; /* The user-supplied minor token value. This + ** is the value of the token */ +}; +typedef struct yyStackEntry yyStackEntry; + +/* The state of the parser is completely contained in an instance of +** the following structure */ +struct yyParser { + int yyidx; /* Index of top element in stack */ + int yyerrcnt; /* Shifts left before out of the error */ + bbparseARG_SDECL /* A place to hold %extra_argument */ + yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ +}; +typedef struct yyParser yyParser; + +#ifndef NDEBUG +#include <stdio.h> +static FILE *yyTraceFILE = 0; +static char *yyTracePrompt = 0; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* +** Turn parser tracing on by giving a stream to which to write the trace +** and a prompt to preface each trace message. Tracing is turned off +** by making either argument NULL +** +** Inputs: +** <ul> +** <li> A FILE* to which trace output should be written. +** If NULL, then tracing is turned off. +** <li> A prefix string written at the beginning of every +** line of trace output. If NULL, then tracing is +** turned off. +** </ul> +** +** Outputs: +** None. +*/ +void bbparseTrace(FILE *TraceFILE, char *zTracePrompt){ + yyTraceFILE = TraceFILE; + yyTracePrompt = zTracePrompt; + if( yyTraceFILE==0 ) yyTracePrompt = 0; + else if( yyTracePrompt==0 ) yyTraceFILE = 0; +} +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing shifts, the names of all terminals and nonterminals +** are required. The following table supplies these names */ +static const char *const yyTokenName[] = { + "$", "SYMBOL", "VARIABLE", "EXPORT", + "OP_ASSIGN", "STRING", "OP_IMMEDIATE", "OP_COND", + "OP_PREPEND", "OP_APPEND", "TSYMBOL", "BEFORE", + "AFTER", "ADDTASK", "ADDHANDLER", "FSYMBOL", + "EXPORT_FUNC", "ISYMBOL", "INHERIT", "INCLUDE", + "REQUIRE", "PROC_BODY", "PROC_OPEN", "PROC_CLOSE", + "PYTHON", "FAKEROOT", "DEF_BODY", "DEF_ARGS", + "error", "program", "statements", "statement", + "variable", "task", "tasks", "func", + "funcs", "inherit", "inherits", "proc_body", + "def_body", +}; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing reduce actions, the names of all rules are required. +*/ +static const char *const yyRuleName[] = { + /* 0 */ "program ::= statements", + /* 1 */ "statements ::= statements statement", + /* 2 */ "statements ::=", + /* 3 */ "variable ::= SYMBOL", + /* 4 */ "variable ::= VARIABLE", + /* 5 */ "statement ::= EXPORT variable OP_ASSIGN STRING", + /* 6 */ "statement ::= EXPORT variable OP_IMMEDIATE STRING", + /* 7 */ "statement ::= EXPORT variable OP_COND STRING", + /* 8 */ "statement ::= variable OP_ASSIGN STRING", + /* 9 */ "statement ::= variable OP_PREPEND STRING", + /* 10 */ "statement ::= variable OP_APPEND STRING", + /* 11 */ "statement ::= variable OP_IMMEDIATE STRING", + /* 12 */ "statement ::= variable OP_COND STRING", + /* 13 */ "task ::= TSYMBOL BEFORE TSYMBOL AFTER TSYMBOL", + /* 14 */ "task ::= TSYMBOL AFTER TSYMBOL BEFORE TSYMBOL", + /* 15 */ "task ::= TSYMBOL", + /* 16 */ "task ::= TSYMBOL BEFORE TSYMBOL", + /* 17 */ "task ::= TSYMBOL AFTER TSYMBOL", + /* 18 */ "tasks ::= tasks task", + /* 19 */ "tasks ::= task", + /* 20 */ "statement ::= ADDTASK tasks", + /* 21 */ "statement ::= ADDHANDLER SYMBOL", + /* 22 */ "func ::= FSYMBOL", + /* 23 */ "funcs ::= funcs func", + /* 24 */ "funcs ::= func", + /* 25 */ "statement ::= EXPORT_FUNC funcs", + /* 26 */ "inherit ::= ISYMBOL", + /* 27 */ "inherits ::= inherits inherit", + /* 28 */ "inherits ::= inherit", + /* 29 */ "statement ::= INHERIT inherits", + /* 30 */ "statement ::= INCLUDE ISYMBOL", + /* 31 */ "statement ::= REQUIRE ISYMBOL", + /* 32 */ "proc_body ::= proc_body PROC_BODY", + /* 33 */ "proc_body ::=", + /* 34 */ "statement ::= variable PROC_OPEN proc_body PROC_CLOSE", + /* 35 */ "statement ::= PYTHON SYMBOL PROC_OPEN proc_body PROC_CLOSE", + /* 36 */ "statement ::= PYTHON PROC_OPEN proc_body PROC_CLOSE", + /* 37 */ "statement ::= FAKEROOT SYMBOL PROC_OPEN proc_body PROC_CLOSE", + /* 38 */ "def_body ::= def_body DEF_BODY", + /* 39 */ "def_body ::=", + /* 40 */ "statement ::= SYMBOL DEF_ARGS def_body", +}; +#endif /* NDEBUG */ + +/* +** This function returns the symbolic name associated with a token +** value. +*/ +const char *bbparseTokenName(int tokenType){ +#ifndef NDEBUG + if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ + return yyTokenName[tokenType]; + }else{ + return "Unknown"; + } +#else + return ""; +#endif +} + +/* +** This function allocates a new parser. +** The only argument is a pointer to a function which works like +** malloc. +** +** Inputs: +** A pointer to the function used to allocate memory. +** +** Outputs: +** A pointer to a parser. This pointer is used in subsequent calls +** to bbparse and bbparseFree. +*/ +void *bbparseAlloc(void *(*mallocProc)(size_t)){ + yyParser *pParser; + pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); + if( pParser ){ + pParser->yyidx = -1; + } + return pParser; +} + +/* The following function deletes the value associated with a +** symbol. The symbol can be either a terminal or nonterminal. +** "yymajor" is the symbol code, and "yypminor" is a pointer to +** the value. +*/ +static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ + switch( yymajor ){ + /* Here is inserted the actions which take place when a + ** terminal or non-terminal is destroyed. This can happen + ** when the symbol is popped from the stack during a + ** reduce or during error processing or when a parser is + ** being destroyed before it is finished parsing. + ** + ** Note: during a reduce, the only symbols destroyed are those + ** which appear on the RHS of the rule, but which are not used + ** inside the C code. + */ + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: +#line 49 "bitbakeparser.y" +{ (yypminor->yy0).release_this (); } +#line 408 "bitbakeparser.c" + break; + default: break; /* If no destructor action specified: do nothing */ + } +} + +/* +** Pop the parser's stack once. +** +** If there is a destructor routine associated with the token which +** is popped from the stack, then call it. +** +** Return the major token number for the symbol popped. +*/ +static int yy_pop_parser_stack(yyParser *pParser){ + YYCODETYPE yymajor; + yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; + + if( pParser->yyidx<0 ) return 0; +#ifndef NDEBUG + if( yyTraceFILE && pParser->yyidx>=0 ){ + fprintf(yyTraceFILE,"%sPopping %s\n", + yyTracePrompt, + yyTokenName[yytos->major]); + } +#endif + yymajor = yytos->major; + yy_destructor( yymajor, &yytos->minor); + pParser->yyidx--; + return yymajor; +} + +/* +** Deallocate and destroy a parser. Destructors are all called for +** all stack elements before shutting the parser down. +** +** Inputs: +** <ul> +** <li> A pointer to the parser. This should be a pointer +** obtained from bbparseAlloc. +** <li> A pointer to a function used to reclaim memory obtained +** from malloc. +** </ul> +*/ +void bbparseFree( + void *p, /* The parser to be deleted */ + void (*freeProc)(void*) /* Function used to reclaim memory */ +){ + yyParser *pParser = (yyParser*)p; + if( pParser==0 ) return; + while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); + (*freeProc)((void*)pParser); +} + +/* +** Find the appropriate action for a parser given the terminal +** look-ahead token iLookAhead. +** +** If the look-ahead token is YYNOCODE, then check to see if the action is +** independent of the look-ahead. If it is, return the action, otherwise +** return YY_NO_ACTION. +*/ +static int yy_find_shift_action( + yyParser *pParser, /* The parser */ + int iLookAhead /* The look-ahead token */ +){ + int i; + int stateno = pParser->yystack[pParser->yyidx].stateno; + + if( stateno>YY_SHIFT_MAX || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){ + return yy_default[stateno]; + } + if( iLookAhead==YYNOCODE ){ + return YY_NO_ACTION; + } + i += iLookAhead; + if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ +#ifdef YYFALLBACK + int iFallback; /* Fallback token */ + if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0]) + && (iFallback = yyFallback[iLookAhead])!=0 ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n", + yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + } +#endif + return yy_find_shift_action(pParser, iFallback); + } +#endif + return yy_default[stateno]; + }else{ + return yy_action[i]; + } +} + +/* +** Find the appropriate action for a parser given the non-terminal +** look-ahead token iLookAhead. +** +** If the look-ahead token is YYNOCODE, then check to see if the action is +** independent of the look-ahead. If it is, return the action, otherwise +** return YY_NO_ACTION. +*/ +static int yy_find_reduce_action( + int stateno, /* Current state number */ + int iLookAhead /* The look-ahead token */ +){ + int i; + /* int stateno = pParser->yystack[pParser->yyidx].stateno; */ + + if( stateno>YY_REDUCE_MAX || + (i = yy_reduce_ofst[stateno])==YY_REDUCE_USE_DFLT ){ + return yy_default[stateno]; + } + if( iLookAhead==YYNOCODE ){ + return YY_NO_ACTION; + } + i += iLookAhead; + if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ + return yy_default[stateno]; + }else{ + return yy_action[i]; + } +} + +/* +** Perform a shift action. +*/ +static void yy_shift( + yyParser *yypParser, /* The parser to be shifted */ + int yyNewState, /* The new state to shift in */ + int yyMajor, /* The major token to shift in */ + YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ +){ + yyStackEntry *yytos; + yypParser->yyidx++; + if( yypParser->yyidx>=YYSTACKDEPTH ){ + bbparseARG_FETCH; + yypParser->yyidx--; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); + } +#endif + while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will execute if the parser + ** stack every overflows */ + bbparseARG_STORE; /* Suppress warning about unused %extra_argument var */ + return; + } + yytos = &yypParser->yystack[yypParser->yyidx]; + yytos->stateno = yyNewState; + yytos->major = yyMajor; + yytos->minor = *yypMinor; +#ifndef NDEBUG + if( yyTraceFILE && yypParser->yyidx>0 ){ + int i; + fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); + fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); + for(i=1; i<=yypParser->yyidx; i++) + fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); + fprintf(yyTraceFILE,"\n"); + } +#endif +} + +/* The following table contains information about every rule that +** is used during the reduce. +*/ +static const struct { + YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + unsigned char nrhs; /* Number of right-hand side symbols in the rule */ +} yyRuleInfo[] = { + { 29, 1 }, + { 30, 2 }, + { 30, 0 }, + { 32, 1 }, + { 32, 1 }, + { 31, 4 }, + { 31, 4 }, + { 31, 4 }, + { 31, 3 }, + { 31, 3 }, + { 31, 3 }, + { 31, 3 }, + { 31, 3 }, + { 33, 5 }, + { 33, 5 }, + { 33, 1 }, + { 33, 3 }, + { 33, 3 }, + { 34, 2 }, + { 34, 1 }, + { 31, 2 }, + { 31, 2 }, + { 35, 1 }, + { 36, 2 }, + { 36, 1 }, + { 31, 2 }, + { 37, 1 }, + { 38, 2 }, + { 38, 1 }, + { 31, 2 }, + { 31, 2 }, + { 31, 2 }, + { 39, 2 }, + { 39, 0 }, + { 31, 4 }, + { 31, 5 }, + { 31, 4 }, + { 31, 5 }, + { 40, 2 }, + { 40, 0 }, + { 31, 3 }, +}; + +static void yy_accept(yyParser*); /* Forward Declaration */ + +/* +** Perform a reduce action and the shift that must immediately +** follow the reduce. +*/ +static void yy_reduce( + yyParser *yypParser, /* The parser */ + int yyruleno /* Number of the rule by which to reduce */ +){ + int yygoto; /* The next state */ + int yyact; /* The next action */ + YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ + yyStackEntry *yymsp; /* The top of the parser's stack */ + int yysize; /* Amount to pop the stack */ + bbparseARG_FETCH; + yymsp = &yypParser->yystack[yypParser->yyidx]; +#ifndef NDEBUG + if( yyTraceFILE && yyruleno>=0 + && yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){ + fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt, + yyRuleName[yyruleno]); + } +#endif /* NDEBUG */ + +#ifndef NDEBUG + /* Silence complaints from purify about yygotominor being uninitialized + ** in some cases when it is copied into the stack after the following + ** switch. yygotominor is uninitialized when a rule reduces that does + ** not set the value of its left-hand side nonterminal. Leaving the + ** value of the nonterminal uninitialized is utterly harmless as long + ** as the value is never used. So really the only thing this code + ** accomplishes is to quieten purify. + */ + memset(&yygotominor, 0, sizeof(yygotominor)); +#endif + + switch( yyruleno ){ + /* Beginning here are the reduction cases. A typical example + ** follows: + ** case 0: + ** #line <lineno> <grammarfile> + ** { ... } // User supplied code + ** #line <lineno> <thisfile> + ** break; + */ + case 3: +#line 59 "bitbakeparser.y" +{ yygotominor.yy0.assignString( (char*)yymsp[0].minor.yy0.string() ); + yymsp[0].minor.yy0.assignString( 0 ); + yymsp[0].minor.yy0.release_this(); } +#line 676 "bitbakeparser.c" + break; + case 4: +#line 63 "bitbakeparser.y" +{ + yygotominor.yy0.assignString( (char*)yymsp[0].minor.yy0.string() ); + yymsp[0].minor.yy0.assignString( 0 ); + yymsp[0].minor.yy0.release_this(); } +#line 684 "bitbakeparser.c" + break; + case 5: +#line 69 "bitbakeparser.y" +{ e_assign( yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); + e_export( yymsp[-2].minor.yy0.string() ); + yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor); + yy_destructor(4,&yymsp[-1].minor); +} +#line 693 "bitbakeparser.c" + break; + case 6: +#line 73 "bitbakeparser.y" +{ e_immediate (yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); + e_export( yymsp[-2].minor.yy0.string() ); + yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor); + yy_destructor(6,&yymsp[-1].minor); +} +#line 702 "bitbakeparser.c" + break; + case 7: +#line 77 "bitbakeparser.y" +{ e_cond( yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); + yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(3,&yymsp[-3].minor); + yy_destructor(7,&yymsp[-1].minor); +} +#line 710 "bitbakeparser.c" + break; + case 8: +#line 81 "bitbakeparser.y" +{ e_assign( yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); + yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(4,&yymsp[-1].minor); +} +#line 717 "bitbakeparser.c" + break; + case 9: +#line 84 "bitbakeparser.y" +{ e_prepend( yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); + yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(8,&yymsp[-1].minor); +} +#line 724 "bitbakeparser.c" + break; + case 10: +#line 87 "bitbakeparser.y" +{ e_append( yymsp[-2].minor.yy0.string() , yymsp[0].minor.yy0.string() ); + yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(9,&yymsp[-1].minor); +} +#line 731 "bitbakeparser.c" + break; + case 11: +#line 90 "bitbakeparser.y" +{ e_immediate( yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); + yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(6,&yymsp[-1].minor); +} +#line 738 "bitbakeparser.c" + break; + case 12: +#line 93 "bitbakeparser.y" +{ e_cond( yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); + yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(7,&yymsp[-1].minor); +} +#line 745 "bitbakeparser.c" + break; + case 13: +#line 97 "bitbakeparser.y" +{ e_addtask( yymsp[-4].minor.yy0.string(), yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string() ); + yymsp[-4].minor.yy0.release_this(); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(11,&yymsp[-3].minor); + yy_destructor(12,&yymsp[-1].minor); +} +#line 753 "bitbakeparser.c" + break; + case 14: +#line 100 "bitbakeparser.y" +{ e_addtask( yymsp[-4].minor.yy0.string(), yymsp[0].minor.yy0.string(), yymsp[-2].minor.yy0.string()); + yymsp[-4].minor.yy0.release_this(); yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(12,&yymsp[-3].minor); + yy_destructor(11,&yymsp[-1].minor); +} +#line 761 "bitbakeparser.c" + break; + case 15: +#line 103 "bitbakeparser.y" +{ e_addtask( yymsp[0].minor.yy0.string(), NULL, NULL); + yymsp[0].minor.yy0.release_this();} +#line 767 "bitbakeparser.c" + break; + case 16: +#line 106 "bitbakeparser.y" +{ e_addtask( yymsp[-2].minor.yy0.string(), yymsp[0].minor.yy0.string(), NULL); + yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(11,&yymsp[-1].minor); +} +#line 774 "bitbakeparser.c" + break; + case 17: +#line 109 "bitbakeparser.y" +{ e_addtask( yymsp[-2].minor.yy0.string(), NULL, yymsp[0].minor.yy0.string()); + yymsp[-2].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); yy_destructor(12,&yymsp[-1].minor); +} +#line 781 "bitbakeparser.c" + break; + case 21: +#line 116 "bitbakeparser.y" +{ e_addhandler( yymsp[0].minor.yy0.string()); yymsp[0].minor.yy0.release_this (); yy_destructor(14,&yymsp[-1].minor); +} +#line 787 "bitbakeparser.c" + break; + case 22: +#line 118 "bitbakeparser.y" +{ e_export_func(yymsp[0].minor.yy0.string()); yymsp[0].minor.yy0.release_this(); } +#line 792 "bitbakeparser.c" + break; + case 26: +#line 123 "bitbakeparser.y" +{ e_inherit(yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this (); } +#line 797 "bitbakeparser.c" + break; + case 30: +#line 129 "bitbakeparser.y" +{ e_include(yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this(); yy_destructor(19,&yymsp[-1].minor); +} +#line 803 "bitbakeparser.c" + break; + case 31: +#line 132 "bitbakeparser.y" +{ e_require(yymsp[0].minor.yy0.string() ); yymsp[0].minor.yy0.release_this(); yy_destructor(20,&yymsp[-1].minor); +} +#line 809 "bitbakeparser.c" + break; + case 32: +#line 135 "bitbakeparser.y" +{ /* concatenate body lines */ + yygotominor.yy0.assignString( token_t::concatString(yymsp[-1].minor.yy0.string(), yymsp[0].minor.yy0.string()) ); + yymsp[-1].minor.yy0.release_this (); + yymsp[0].minor.yy0.release_this (); + } +#line 818 "bitbakeparser.c" + break; + case 33: +#line 140 "bitbakeparser.y" +{ yygotominor.yy0.assignString(0); } +#line 823 "bitbakeparser.c" + break; + case 34: +#line 142 "bitbakeparser.y" +{ e_proc( yymsp[-3].minor.yy0.string(), yymsp[-1].minor.yy0.string() ); + yymsp[-3].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this(); yy_destructor(22,&yymsp[-2].minor); + yy_destructor(23,&yymsp[0].minor); +} +#line 831 "bitbakeparser.c" + break; + case 35: +#line 145 "bitbakeparser.y" +{ e_proc_python (yymsp[-3].minor.yy0.string(), yymsp[-1].minor.yy0.string() ); + yymsp[-3].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this(); yy_destructor(24,&yymsp[-4].minor); + yy_destructor(22,&yymsp[-2].minor); + yy_destructor(23,&yymsp[0].minor); +} +#line 840 "bitbakeparser.c" + break; + case 36: +#line 148 "bitbakeparser.y" +{ e_proc_python( NULL, yymsp[-1].minor.yy0.string()); + yymsp[-1].minor.yy0.release_this (); yy_destructor(24,&yymsp[-3].minor); + yy_destructor(22,&yymsp[-2].minor); + yy_destructor(23,&yymsp[0].minor); +} +#line 849 "bitbakeparser.c" + break; + case 37: +#line 152 "bitbakeparser.y" +{ e_proc_fakeroot(yymsp[-3].minor.yy0.string(), yymsp[-1].minor.yy0.string() ); + yymsp[-3].minor.yy0.release_this (); yymsp[-1].minor.yy0.release_this (); yy_destructor(25,&yymsp[-4].minor); + yy_destructor(22,&yymsp[-2].minor); + yy_destructor(23,&yymsp[0].minor); +} +#line 858 "bitbakeparser.c" + break; + case 38: +#line 156 "bitbakeparser.y" +{ /* concatenate body lines */ + yygotominor.yy0.assignString( token_t::concatString(yymsp[-1].minor.yy0.string(), yymsp[0].minor.yy0.string()) ); + yymsp[-1].minor.yy0.release_this (); yymsp[0].minor.yy0.release_this (); + } +#line 866 "bitbakeparser.c" + break; + case 39: +#line 160 "bitbakeparser.y" +{ yygotominor.yy0.assignString( 0 ); } +#line 871 "bitbakeparser.c" + break; + case 40: +#line 162 "bitbakeparser.y" +{ e_def( yymsp[-2].minor.yy0.string(), yymsp[-1].minor.yy0.string(), yymsp[0].minor.yy0.string()); + yymsp[-2].minor.yy0.release_this(); yymsp[-1].minor.yy0.release_this(); yymsp[0].minor.yy0.release_this(); } +#line 877 "bitbakeparser.c" + break; + }; + yygoto = yyRuleInfo[yyruleno].lhs; + yysize = yyRuleInfo[yyruleno].nrhs; + yypParser->yyidx -= yysize; + yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto); + if( yyact < YYNSTATE ){ +#ifdef NDEBUG + /* If we are not debugging and the reduce action popped at least + ** one element off the stack, then we can push the new element back + ** onto the stack here, and skip the stack overflow test in yy_shift(). + ** That gives a significant speed improvement. */ + if( yysize ){ + yypParser->yyidx++; + yymsp -= yysize-1; + yymsp->stateno = yyact; + yymsp->major = yygoto; + yymsp->minor = yygotominor; + }else +#endif + { + yy_shift(yypParser,yyact,yygoto,&yygotominor); + } + }else if( yyact == YYNSTATE + YYNRULE + 1 ){ + yy_accept(yypParser); + } +} + +/* +** The following code executes when the parse fails +*/ +static void yy_parse_failed( + yyParser *yypParser /* The parser */ +){ + bbparseARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + } +#endif + while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will be executed whenever the + ** parser fails */ + bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* +** The following code executes when a syntax error first occurs. +*/ +static void yy_syntax_error( + yyParser *yypParser, /* The parser */ + int yymajor, /* The major type of the error token */ + YYMINORTYPE yyminor /* The minor type of the error token */ +){ + bbparseARG_FETCH; +#define TOKEN (yyminor.yy0) +#line 51 "bitbakeparser.y" + e_parse_error( lex->filename(), lex->line() ); +#line 937 "bitbakeparser.c" + bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* +** The following is executed when the parser accepts +*/ +static void yy_accept( + yyParser *yypParser /* The parser */ +){ + bbparseARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + } +#endif + while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will be executed whenever the + ** parser accepts */ + bbparseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* The main parser program. +** The first argument is a pointer to a structure obtained from +** "bbparseAlloc" which describes the current state of the parser. +** The second argument is the major token number. The third is +** the minor token. The fourth optional argument is whatever the +** user wants (and specified in the grammar) and is available for +** use by the action routines. +** +** Inputs: +** <ul> +** <li> A pointer to the parser (an opaque structure.) +** <li> The major token number. +** <li> The minor token number. +** <li> An option argument of a grammar-specified type. +** </ul> +** +** Outputs: +** None. +*/ +void bbparse( + void *yyp, /* The parser */ + int yymajor, /* The major token code number */ + bbparseTOKENTYPE yyminor /* The value for the token */ + bbparseARG_PDECL /* Optional %extra_argument parameter */ +){ + YYMINORTYPE yyminorunion; + int yyact; /* The parser action. */ + int yyendofinput; /* True if we are at the end of input */ + int yyerrorhit = 0; /* True if yymajor has invoked an error */ + yyParser *yypParser; /* The parser */ + + /* (re)initialize the parser, if necessary */ + yypParser = (yyParser*)yyp; + if( yypParser->yyidx<0 ){ + /* if( yymajor==0 ) return; // not sure why this was here... */ + yypParser->yyidx = 0; + yypParser->yyerrcnt = -1; + yypParser->yystack[0].stateno = 0; + yypParser->yystack[0].major = 0; + } + yyminorunion.yy0 = yyminor; + yyendofinput = (yymajor==0); + bbparseARG_STORE; + +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); + } +#endif + + do{ + yyact = yy_find_shift_action(yypParser,yymajor); + if( yyact<YYNSTATE ){ + yy_shift(yypParser,yyact,yymajor,&yyminorunion); + yypParser->yyerrcnt--; + if( yyendofinput && yypParser->yyidx>=0 ){ + yymajor = 0; + }else{ + yymajor = YYNOCODE; + } + }else if( yyact < YYNSTATE + YYNRULE ){ + yy_reduce(yypParser,yyact-YYNSTATE); + }else if( yyact == YY_ERROR_ACTION ){ + int yymx; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + } +#endif +#ifdef YYERRORSYMBOL + /* A syntax error has occurred. + ** The response to an error depends upon whether or not the + ** grammar defines an error token "ERROR". + ** + ** This is what we do if the grammar does define ERROR: + ** + ** * Call the %syntax_error function. + ** + ** * Begin popping the stack until we enter a state where + ** it is legal to shift the error symbol, then shift + ** the error symbol. + ** + ** * Set the error count to three. + ** + ** * Begin accepting and shifting new tokens. No new error + ** processing will occur until three tokens have been + ** shifted successfully. + ** + */ + if( yypParser->yyerrcnt<0 ){ + yy_syntax_error(yypParser,yymajor,yyminorunion); + } + yymx = yypParser->yystack[yypParser->yyidx].major; + if( yymx==YYERRORSYMBOL || yyerrorhit ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sDiscard input token %s\n", + yyTracePrompt,yyTokenName[yymajor]); + } +#endif + yy_destructor(yymajor,&yyminorunion); + yymajor = YYNOCODE; + }else{ + while( + yypParser->yyidx >= 0 && + yymx != YYERRORSYMBOL && + (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE + ){ + yy_pop_parser_stack(yypParser); + } + if( yypParser->yyidx < 0 || yymajor==0 ){ + yy_destructor(yymajor,&yyminorunion); + yy_parse_failed(yypParser); + yymajor = YYNOCODE; + }else if( yymx!=YYERRORSYMBOL ){ + YYMINORTYPE u2; + u2.YYERRSYMDT = 0; + yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); + } + } + yypParser->yyerrcnt = 3; + yyerrorhit = 1; +#else /* YYERRORSYMBOL is not defined */ + /* This is what we do if the grammar does not define ERROR: + ** + ** * Report an error message, and throw away the input token. + ** + ** * If the input token is $, then fail the parse. + ** + ** As before, subsequent error messages are suppressed until + ** three input tokens have been successfully shifted. + */ + if( yypParser->yyerrcnt<=0 ){ + yy_syntax_error(yypParser,yymajor,yyminorunion); + } + yypParser->yyerrcnt = 3; + yy_destructor(yymajor,&yyminorunion); + if( yyendofinput ){ + yy_parse_failed(yypParser); + } + yymajor = YYNOCODE; +#endif + }else{ + yy_accept(yypParser); + yymajor = YYNOCODE; + } + }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); + return; +} diff --git a/lib/bb/parse/parse_c/bitbakeparser.h b/lib/bb/parse/parse_c/bitbakeparser.h new file mode 100644 index 000000000..2e51702be --- /dev/null +++ b/lib/bb/parse/parse_c/bitbakeparser.h @@ -0,0 +1,27 @@ +#define T_SYMBOL 1 +#define T_VARIABLE 2 +#define T_EXPORT 3 +#define T_OP_ASSIGN 4 +#define T_STRING 5 +#define T_OP_IMMEDIATE 6 +#define T_OP_COND 7 +#define T_OP_PREPEND 8 +#define T_OP_APPEND 9 +#define T_TSYMBOL 10 +#define T_BEFORE 11 +#define T_AFTER 12 +#define T_ADDTASK 13 +#define T_ADDHANDLER 14 +#define T_FSYMBOL 15 +#define T_EXPORT_FUNC 16 +#define T_ISYMBOL 17 +#define T_INHERIT 18 +#define T_INCLUDE 19 +#define T_REQUIRE 20 +#define T_PROC_BODY 21 +#define T_PROC_OPEN 22 +#define T_PROC_CLOSE 23 +#define T_PYTHON 24 +#define T_FAKEROOT 25 +#define T_DEF_BODY 26 +#define T_DEF_ARGS 27 diff --git a/lib/bb/parse/parse_c/bitbakeparser.py b/lib/bb/parse/parse_c/bitbakeparser.py deleted file mode 100644 index ed7b13eef..000000000 --- a/lib/bb/parse/parse_c/bitbakeparser.py +++ /dev/null @@ -1,133 +0,0 @@ -""" - -BitBake C Parser Python Code - -Copyright (C) 2005 Holger Hans Peter Freyther - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -THE USE OR OTHER DEALINGS IN THE SOFTWARE. -""" - -__version__ = "0xdeadbeef" - -class CParser: - """ - The C-based Parser for Bitbake - """ - def __init__(self, data, type): - """ - Constructor - """ - self._data = data - - def _syntax_error(self, file, line): - """ - lemon/flex reports an syntax error to us and we will - raise an exception - """ - pass - - def _export(self, data): - """ - EXPORT VAR = "MOO" - we will now export VAR - """ - pass - - def _assign(self, key, value): - """ - VAR = "MOO" - we will assign moo to VAR - """ - pass - - def _assign(self, key, value): - """ - """ - pass - - def _append(self, key, value): - """ - VAR += "MOO" - we will append " MOO" to var - """ - pass - - def _prepend(self, key, value): - """ - VAR =+ "MOO" - we will prepend "MOO " to var - """ - pass - - def _immediate(self, key, value): - """ - VAR := "MOO ${CVSDATE}" - we will assign immediately and expand vars - """ - pass - - def _conditional(self, key, value): - """ - """ - pass - - def _add_task(self, task, before = None, after = None): - """ - """ - pass - - def _include(self, file): - """ - """ - pass - - def _inherit(self, file): - """ - """ - pass - - def _shell_procedure(self, name, body): - """ - """ - pass - - def _python_procedure(self, name, body): - """ - """ - pass - - def _fakeroot_procedure(self, name, body): - """ - """ - pass - - def _def_procedure(self, a, b, c): - """ - """ - pass - - def _export_func(self, name): - """ - """ - pass - - def _add_handler(self, handler): - """ - """ - pass diff --git a/lib/bb/parse/parse_c/bitbakeparser.y b/lib/bb/parse/parse_c/bitbakeparser.y index 4bc81a913..6bf7dc57a 100644 --- a/lib/bb/parse/parse_c/bitbakeparser.y +++ b/lib/bb/parse/parse_c/bitbakeparser.y @@ -42,13 +42,13 @@ %include { #include "token.h" +#include "lexer.h" } %token_destructor { $$.release_this (); } -%syntax_error { printf ("%s:%d: syntax error\n", - lex->filename (), lex->line ()); } +%syntax_error { e_parse_error( lex->filename(), lex->line() ); } program ::= statements. @@ -56,12 +56,12 @@ statements ::= statements statement. statements ::= . variable(r) ::= SYMBOL(s). - { r.assignString( s.string() ); + { r.assignString( (char*)s.string() ); s.assignString( 0 ); s.release_this(); } variable(r) ::= VARIABLE(v). { - r.assignString( v.string() ); + r.assignString( (char*)v.string() ); v.assignString( 0 ); v.release_this(); } @@ -128,7 +128,10 @@ statement ::= INHERIT inherits. statement ::= INCLUDE ISYMBOL(i). { e_include(i.string() ); i.release_this(); } -proc_body(r) ::= proc_body(l) PROC_BODY(b). +statement ::= REQUIRE ISYMBOL(i). + { e_require(i.string() ); i.release_this(); } + +proc_body(r) ::= proc_body(l) PROC_BODY(b). { /* concatenate body lines */ r.assignString( token_t::concatString(l.string(), b.string()) ); l.release_this (); @@ -151,10 +154,10 @@ statement ::= FAKEROOT SYMBOL(p) PROC_OPEN proc_body(b) PROC_CLOSE. def_body(r) ::= def_body(l) DEF_BODY(b). { /* concatenate body lines */ - r.assignString( token_t::concatString(l.string(), b.string()); + r.assignString( token_t::concatString(l.string(), b.string()) ); l.release_this (); b.release_this (); } -def_body(b) ::= . { b.sz = 0; } +def_body(b) ::= . { b.assignString( 0 ); } statement ::= SYMBOL(p) DEF_ARGS(a) def_body(b). { e_def( p.string(), a.string(), b.string()); p.release_this(); a.release_this(); b.release_this(); } diff --git a/lib/bb/parse/parse_c/bitbakescanner.cc b/lib/bb/parse/parse_c/bitbakescanner.cc new file mode 100644 index 000000000..1752b6209 --- /dev/null +++ b/lib/bb/parse/parse_c/bitbakescanner.cc @@ -0,0 +1,2998 @@ + +#line 3 "<stdout>" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 31 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +int yylex_init (yyscan_t* scanner); + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires + * access to the local variable yy_act. Since yyless() is a macro, it would break + * existing scanners that call yyless() from OUTSIDE yylex. + * One obvious solution it to make yy_act a global. I tried that, and saw + * a 5% performance hit in a non-yylineno scanner, because yy_act is + * normally declared as a register variable-- so it is not worth it. + */ + #define YY_LESS_LINENO(n) \ + do { \ + int yyl;\ + for ( yyl = n; yyl < yyleng; ++yyl )\ + if ( yytext[yyl] == '\n' )\ + --yylineno;\ + }while(0) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef unsigned int yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void yyrestart (FILE *input_file ,yyscan_t yyscanner ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void yypop_buffer_state (yyscan_t yyscanner ); + +static void yyensure_buffer_stack (yyscan_t yyscanner ); +static void yy_load_buffer_state (yyscan_t yyscanner ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); + +void *yyalloc (yy_size_t ,yyscan_t yyscanner ); +void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); +void yyfree (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define yywrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 43 +#define YY_END_OF_BUFFER 44 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[662] = + { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 23, 23, 0, 0, 0, 0, + 44, 42, 41, 41, 42, 42, 42, 42, 42, 4, + 42, 32, 32, 32, 32, 32, 32, 32, 32, 25, + 25, 25, 25, 25, 42, 41, 27, 41, 42, 42, + 42, 26, 4, 42, 42, 42, 42, 42, 30, 30, + 29, 30, 30, 30, 30, 30, 4, 30, 30, 30, + 30, 30, 39, 35, 35, 35, 35, 35, 42, 37, + 37, 37, 37, 37, 40, 36, 36, 36, 36, 36, + 23, 23, 23, 23, 23, 23, 23, 4, 23, 23, + + 23, 23, 23, 22, 9, 41, 10, 9, 42, 9, + 42, 9, 9, 9, 4, 9, 9, 9, 9, 9, + 9, 38, 34, 34, 34, 34, 34, 34, 0, 31, + 33, 0, 0, 1, 3, 2, 5, 0, 32, 0, + 32, 32, 32, 32, 32, 32, 32, 25, 25, 25, + 25, 25, 0, 26, 0, 27, 0, 26, 0, 0, + 1, 2, 5, 0, 0, 0, 0, 0, 0, 28, + 0, 0, 0, 0, 35, 35, 35, 35, 35, 0, + 0, 37, 37, 37, 37, 37, 36, 36, 36, 36, + 36, 23, 23, 23, 23, 23, 23, 1, 3, 2, + + 5, 23, 23, 23, 23, 22, 22, 9, 0, 9, + 0, 10, 0, 7, 0, 9, 0, 9, 0, 8, + 0, 0, 9, 1, 3, 2, 5, 9, 6, 9, + 9, 9, 34, 34, 34, 34, 34, 34, 34, 33, + 0, 21, 0, 0, 33, 32, 32, 24, 32, 32, + 32, 32, 32, 25, 25, 24, 25, 25, 0, 21, + 0, 0, 24, 0, 0, 0, 0, 24, 0, 0, + 35, 35, 24, 35, 35, 0, 0, 37, 37, 24, + 37, 37, 36, 36, 24, 36, 36, 23, 21, 23, + 23, 23, 23, 23, 31, 0, 9, 9, 6, 9, + + 9, 9, 9, 34, 34, 34, 34, 24, 34, 34, + 21, 21, 0, 32, 32, 32, 32, 32, 32, 32, + 32, 25, 25, 25, 25, 25, 21, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 35, 35, 35, + 35, 35, 0, 37, 0, 37, 37, 37, 37, 37, + 36, 36, 36, 36, 36, 21, 21, 23, 23, 23, + 23, 23, 21, 9, 9, 9, 9, 9, 34, 34, + 34, 34, 34, 34, 34, 0, 33, 32, 32, 32, + 32, 32, 32, 32, 32, 25, 25, 25, 25, 25, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 35, 35, 35, 35, 35, 0, 37, 37, 37, 37, + 37, 37, 36, 36, 36, 36, 36, 23, 23, 23, + 23, 23, 9, 9, 9, 9, 9, 34, 34, 34, + 17, 34, 34, 34, 32, 32, 32, 18, 32, 32, + 32, 20, 25, 25, 25, 25, 25, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 35, 35, 35, + 35, 35, 37, 37, 37, 37, 37, 36, 36, 36, + 36, 36, 23, 23, 23, 23, 23, 9, 9, 9, + 9, 9, 34, 34, 34, 16, 34, 34, 32, 32, + 13, 32, 11, 12, 25, 25, 13, 11, 12, 0, + + 0, 13, 11, 12, 0, 0, 13, 11, 12, 35, + 35, 13, 11, 12, 37, 37, 13, 11, 12, 36, + 36, 13, 11, 12, 23, 23, 13, 11, 12, 9, + 9, 9, 9, 9, 34, 34, 13, 11, 12, 32, + 32, 19, 25, 25, 0, 0, 0, 0, 35, 35, + 37, 37, 36, 36, 23, 23, 9, 9, 34, 34, + 32, 32, 25, 25, 0, 0, 0, 0, 35, 35, + 37, 37, 36, 36, 23, 23, 9, 9, 34, 34, + 32, 14, 25, 14, 0, 14, 0, 14, 35, 14, + 37, 14, 36, 14, 23, 14, 9, 9, 34, 14, + + 32, 25, 0, 0, 35, 37, 36, 23, 9, 34, + 32, 25, 0, 0, 35, 37, 36, 23, 9, 34, + 32, 25, 0, 0, 35, 37, 36, 23, 9, 34, + 32, 25, 0, 0, 35, 37, 36, 23, 9, 34, + 32, 25, 0, 0, 35, 37, 36, 23, 9, 34, + 15, 15, 15, 15, 15, 15, 15, 15, 9, 15, + 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 5, 6, 7, 1, 1, 8, 9, + 10, 1, 11, 12, 13, 14, 15, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 17, 1, 1, + 18, 1, 19, 1, 20, 20, 21, 20, 22, 23, + 20, 20, 24, 20, 20, 20, 20, 25, 26, 27, + 20, 28, 29, 30, 31, 20, 20, 32, 20, 20, + 33, 34, 35, 1, 36, 1, 37, 38, 39, 40, + + 41, 42, 20, 43, 44, 20, 45, 46, 20, 47, + 48, 49, 20, 50, 51, 52, 53, 20, 20, 54, + 55, 20, 56, 1, 57, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[58] = + { 0, + 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, + 5, 6, 5, 5, 7, 8, 1, 1, 1, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 10, 1, 11, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 1, 12 + } ; + +static yyconst flex_int16_t yy_base[691] = + { 0, + 0, 0, 57, 0, 113, 156, 199, 242, 286, 0, + 343, 0, 400, 0, 456, 512, 568, 611, 655, 0, + 1835, 1836, 1836, 1836, 1831, 0, 116, 1815, 1814, 1820, + 1812, 113, 116, 114, 122, 118, 131, 133, 136, 0, + 1797, 1788, 1786, 1779, 1808, 125, 1836, 1807, 153, 135, + 116, 1805, 160, 164, 144, 166, 168, 167, 1836, 184, + 1836, 1836, 1819, 134, 1803, 1802, 1808, 1800, 1785, 1776, + 1774, 1767, 1836, 0, 1781, 1772, 1770, 1763, 1753, 1801, + 172, 182, 183, 181, 1836, 0, 1775, 1766, 1764, 1757, + 1800, 1799, 1798, 1797, 209, 189, 195, 212, 217, 194, + + 191, 192, 222, 227, 232, 239, 1796, 247, 222, 461, + 224, 474, 483, 501, 478, 502, 546, 555, 557, 559, + 590, 1836, 0, 1766, 99, 1756, 1755, 1748, 1791, 1836, + 240, 252, 466, 1836, 1836, 1836, 1836, 1737, 243, 1757, + 250, 454, 491, 492, 495, 504, 574, 0, 1764, 1750, + 1747, 224, 1771, 1836, 268, 1836, 529, 1784, 586, 488, + 1769, 1768, 1767, 248, 510, 455, 567, 1780, 468, 1836, + 1755, 1741, 1738, 229, 0, 1752, 1738, 1735, 235, 0, + 1720, 1768, 548, 559, 576, 597, 0, 1747, 1733, 1730, + 241, 1768, 1767, 1766, 1765, 629, 711, 1764, 1763, 1762, + + 1761, 598, 542, 196, 712, 536, 1760, 714, 715, 722, + 632, 1759, 589, 604, 723, 729, 736, 756, 534, 613, + 732, 763, 745, 770, 772, 779, 780, 781, 1759, 790, + 791, 814, 0, 1733, 1719, 1706, 1715, 1714, 438, 620, + 744, 639, 0, 1720, 1836, 736, 769, 784, 787, 796, + 798, 819, 803, 1728, 600, 0, 1707, 1711, 821, 825, + 716, 815, 1734, 794, 704, 1724, 766, 1836, 1703, 1707, + 1721, 791, 0, 1700, 1704, 1687, 0, 838, 832, 1736, + 604, 485, 1716, 798, 0, 1695, 1699, 852, 859, 726, + 804, 1736, 846, 848, 861, 863, 871, 878, 1736, 880, + + 888, 901, 905, 1711, 829, 1695, 1687, 0, 1688, 1692, + 896, 1729, 1674, 887, 884, 893, 894, 895, 904, 909, + 917, 1702, 1692, 1691, 1674, 1676, 931, 842, 901, 912, + 701, 908, 1697, 1687, 1686, 1669, 1671, 1692, 1682, 1681, + 1664, 1666, 1658, 1707, 1656, 924, 929, 933, 934, 936, + 1684, 1674, 1673, 1656, 1658, 951, 1704, 948, 952, 953, + 957, 958, 966, 970, 975, 977, 986, 991, 1678, 1668, + 1667, 1653, 1652, 1648, 1650, 1642, 974, 985, 988, 994, + 990, 995, 996, 1015, 999, 1668, 1650, 1645, 1655, 1650, + 996, 1000, 999, 1013, 1007, 1663, 1645, 1640, 1650, 1645, + + 1658, 1640, 1635, 1645, 1640, 1626, 1675, 1024, 1026, 998, + 1012, 1027, 1651, 1633, 1628, 1638, 1633, 1034, 1035, 1037, + 1041, 1052, 1055, 1060, 1064, 1072, 1082, 1646, 1628, 1623, + 0, 1632, 1632, 1627, 1068, 1060, 1069, 1072, 1076, 1084, + 1085, 1088, 1634, 1629, 1623, 1626, 1614, 1061, 1082, 1041, + 719, 1086, 1629, 1624, 1618, 1621, 1609, 1624, 1619, 1613, + 1616, 1604, 1103, 1101, 1104, 1106, 1112, 1619, 1614, 1608, + 1611, 1599, 1117, 1120, 1124, 1125, 1126, 1138, 1128, 1143, + 1150, 1165, 1614, 1609, 1603, 0, 1606, 1594, 1152, 1143, + 1124, 1128, 1149, 1164, 1622, 1598, 0, 0, 0, 950, + + 1117, 1626, 1625, 1624, 1617, 1593, 1836, 1836, 1836, 1615, + 1591, 0, 0, 0, 1158, 1137, 1629, 1628, 1627, 1610, + 1586, 0, 0, 0, 961, 1176, 1628, 1627, 1626, 1185, + 1190, 1198, 1199, 1207, 1605, 1581, 0, 0, 0, 1187, + 1198, 1195, 1595, 1583, 1039, 1169, 1592, 1579, 1585, 1574, + 1204, 1189, 1581, 1567, 1211, 1210, 1221, 1232, 1576, 1563, + 1220, 1214, 1575, 1544, 629, 1199, 1563, 1526, 1550, 1502, + 1218, 1231, 1526, 1489, 1129, 1241, 1252, 1254, 1486, 1455, + 1251, 1241, 1479, 0, 1229, 1446, 1438, 1836, 1432, 0, + 1254, 1381, 1366, 0, 1262, 1383, 1274, 1285, 1364, 0, + + 1264, 1354, 1250, 1353, 1351, 1262, 1350, 1275, 1294, 1349, + 1282, 1354, 1246, 1352, 1351, 1261, 1350, 1297, 1305, 1349, + 1294, 1346, 861, 1344, 1342, 1291, 1340, 1300, 1328, 1339, + 1307, 1336, 1306, 1334, 1330, 1309, 1327, 1319, 1333, 1323, + 1318, 1317, 1320, 1289, 1283, 1335, 1282, 1340, 1348, 1280, + 1338, 0, 1125, 1836, 0, 1054, 0, 960, 1355, 0, + 1836, 1389, 1401, 1413, 1425, 1437, 953, 1446, 1452, 1461, + 1473, 1485, 1493, 1499, 1504, 1513, 1525, 1537, 1549, 1561, + 1573, 1581, 1587, 1590, 640, 635, 1597, 544, 1605, 1613 + } ; + +static yyconst flex_int16_t yy_def[691] = + { 0, + 661, 1, 661, 3, 662, 662, 663, 663, 661, 9, + 661, 11, 661, 13, 664, 664, 665, 665, 661, 19, + 661, 661, 661, 661, 666, 667, 661, 661, 661, 661, + 661, 668, 668, 668, 668, 668, 668, 668, 668, 669, + 669, 669, 669, 669, 670, 670, 661, 670, 671, 670, + 670, 661, 670, 670, 670, 670, 670, 670, 661, 672, + 661, 661, 666, 661, 661, 661, 661, 661, 661, 661, + 661, 661, 661, 673, 673, 673, 673, 673, 661, 674, + 674, 674, 674, 674, 661, 675, 675, 675, 675, 675, + 676, 676, 676, 677, 676, 676, 676, 676, 676, 676, + + 676, 676, 676, 661, 678, 661, 661, 678, 679, 680, + 681, 678, 678, 678, 678, 678, 678, 678, 678, 678, + 678, 661, 682, 682, 682, 682, 682, 682, 666, 661, + 683, 661, 661, 661, 661, 661, 661, 661, 668, 684, + 668, 668, 668, 668, 668, 668, 668, 669, 669, 669, + 669, 669, 670, 661, 670, 661, 671, 666, 670, 670, + 670, 670, 670, 670, 670, 670, 670, 672, 672, 661, + 661, 661, 661, 661, 673, 673, 673, 673, 673, 685, + 661, 674, 674, 674, 674, 674, 675, 675, 675, 675, + 675, 676, 661, 677, 661, 676, 676, 676, 676, 676, + + 676, 676, 676, 676, 676, 661, 661, 678, 678, 678, + 661, 661, 679, 679, 679, 680, 680, 680, 681, 681, + 681, 678, 678, 678, 678, 678, 678, 678, 661, 678, + 678, 678, 682, 682, 682, 682, 682, 682, 682, 683, + 661, 661, 686, 684, 661, 668, 668, 668, 668, 668, + 668, 668, 668, 669, 669, 669, 669, 669, 670, 670, + 670, 670, 670, 670, 670, 661, 661, 661, 661, 661, + 673, 673, 673, 673, 673, 687, 688, 674, 674, 674, + 674, 674, 675, 675, 675, 675, 675, 676, 676, 676, + 676, 676, 676, 676, 678, 678, 678, 678, 661, 678, + + 678, 678, 678, 682, 682, 682, 682, 682, 682, 682, + 661, 661, 689, 668, 668, 668, 668, 668, 668, 668, + 668, 669, 669, 669, 669, 669, 670, 670, 670, 670, + 670, 670, 661, 661, 661, 661, 661, 673, 673, 673, + 673, 673, 687, 674, 690, 674, 674, 674, 674, 674, + 675, 675, 675, 675, 675, 676, 661, 676, 676, 676, + 676, 676, 678, 678, 678, 678, 678, 678, 682, 682, + 682, 682, 682, 682, 682, 689, 683, 668, 668, 668, + 668, 668, 668, 668, 668, 669, 669, 669, 669, 669, + 670, 670, 670, 670, 670, 661, 661, 661, 661, 661, + + 673, 673, 673, 673, 673, 690, 674, 674, 674, 674, + 674, 674, 675, 675, 675, 675, 675, 676, 676, 676, + 676, 676, 678, 678, 678, 678, 678, 682, 682, 682, + 682, 682, 682, 682, 668, 668, 668, 668, 668, 668, + 668, 668, 669, 669, 669, 669, 669, 670, 670, 670, + 670, 670, 661, 661, 661, 661, 661, 673, 673, 673, + 673, 673, 674, 674, 674, 674, 674, 675, 675, 675, + 675, 675, 676, 676, 676, 676, 676, 678, 678, 678, + 678, 678, 682, 682, 682, 682, 682, 682, 668, 668, + 668, 668, 668, 668, 669, 669, 669, 669, 669, 670, + + 670, 670, 670, 670, 661, 661, 661, 661, 661, 673, + 673, 673, 673, 673, 674, 674, 674, 674, 674, 675, + 675, 675, 675, 675, 676, 676, 676, 676, 676, 678, + 678, 678, 678, 678, 682, 682, 682, 682, 682, 668, + 668, 668, 669, 669, 670, 670, 661, 661, 673, 673, + 674, 674, 675, 675, 676, 676, 678, 678, 682, 682, + 668, 668, 669, 669, 670, 670, 661, 661, 673, 673, + 674, 674, 675, 675, 676, 676, 678, 678, 682, 682, + 668, 668, 669, 669, 670, 670, 661, 661, 673, 673, + 674, 674, 675, 675, 676, 676, 678, 678, 682, 682, + + 668, 669, 670, 661, 673, 674, 675, 676, 678, 682, + 668, 669, 670, 661, 673, 674, 675, 676, 678, 682, + 668, 669, 670, 661, 673, 674, 675, 676, 678, 682, + 668, 669, 670, 661, 673, 674, 675, 676, 678, 682, + 668, 669, 670, 661, 673, 674, 675, 676, 678, 682, + 668, 669, 670, 661, 673, 674, 675, 676, 678, 682, + 0, 661, 661, 661, 661, 661, 661, 661, 661, 661, + 661, 661, 661, 661, 661, 661, 661, 661, 661, 661, + 661, 661, 661, 661, 661, 661, 661, 661, 661, 661 + } ; + +static yyconst flex_int16_t yy_nxt[1894] = + { 0, + 22, 23, 24, 23, 22, 25, 26, 22, 27, 22, + 28, 22, 22, 22, 22, 22, 29, 30, 31, 32, + 32, 33, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 22, 22, 22, 32, 34, 32, 32, 35, + 36, 37, 32, 38, 32, 32, 32, 32, 39, 32, + 32, 32, 32, 32, 32, 22, 22, 22, 23, 24, + 23, 22, 25, 22, 22, 27, 22, 28, 22, 22, + 22, 22, 22, 29, 30, 31, 40, 40, 41, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 22, + 22, 22, 40, 42, 40, 40, 43, 40, 40, 40, + + 44, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 22, 22, 46, 47, 48, 132, 49, 138, + 138, 50, 138, 51, 138, 133, 155, 156, 138, 52, + 53, 54, 154, 161, 55, 132, 159, 138, 235, 138, + 236, 154, 138, 133, 160, 140, 140, 141, 140, 56, + 140, 154, 57, 142, 140, 130, 58, 46, 47, 48, + 154, 49, 143, 140, 50, 140, 51, 145, 140, 158, + 162, 144, 52, 53, 54, 164, 154, 55, 181, 146, + 154, 163, 154, 154, 154, 169, 170, 181, 181, 181, + 147, 193, 56, 193, 193, 57, 193, 193, 193, 58, + + 60, 61, 62, 183, 63, 165, 198, 64, 166, 65, + 196, 193, 199, 167, 193, 66, 67, 68, 197, 193, + 69, 184, 200, 185, 193, 202, 214, 186, 206, 207, + 203, 220, 204, 209, 201, 70, 209, 292, 71, 209, + 211, 212, 72, 60, 61, 62, 138, 63, 209, 138, + 64, 209, 65, 132, 209, 215, 138, 221, 66, 67, + 68, 133, 257, 69, 154, 210, 258, 269, 205, 155, + 156, 270, 140, 274, 261, 140, 246, 275, 70, 286, + 210, 71, 140, 287, 154, 72, 22, 23, 73, 23, + 22, 25, 22, 22, 27, 22, 28, 22, 22, 22, + + 22, 22, 29, 30, 31, 74, 74, 75, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 22, 22, + 22, 74, 76, 74, 74, 77, 74, 74, 74, 78, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 22, 22, 22, 23, 24, 23, 22, 25, 79, + 22, 27, 22, 28, 22, 22, 80, 80, 22, 29, + 30, 31, 80, 80, 81, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 22, 22, 22, 80, 82, + 80, 80, 83, 80, 80, 80, 84, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 22, 22, + + 22, 23, 85, 23, 22, 25, 22, 22, 27, 22, + 28, 22, 22, 22, 22, 22, 29, 30, 31, 86, + 86, 87, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 22, 22, 22, 86, 88, 86, 86, 89, + 86, 86, 86, 90, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 22, 22, 92, 93, 92, + 138, 94, 217, 130, 95, 217, 96, 241, 217, 169, + 170, 154, 97, 98, 99, 222, 309, 100, 209, 209, + 310, 209, 209, 223, 209, 209, 140, 209, 226, 259, + 209, 181, 101, 247, 218, 102, 263, 138, 138, 103, + + 224, 138, 209, 209, 154, 209, 209, 210, 209, 209, + 138, 210, 104, 92, 93, 92, 210, 94, 225, 227, + 95, 242, 96, 140, 140, 350, 154, 140, 97, 98, + 99, 130, 248, 100, 210, 210, 140, 206, 207, 250, + 249, 220, 251, 260, 193, 158, 252, 209, 101, 262, + 209, 102, 345, 209, 181, 103, 209, 229, 209, 209, + 209, 209, 209, 209, 209, 181, 209, 221, 104, 106, + 107, 108, 109, 110, 278, 111, 112, 228, 113, 210, + 138, 291, 181, 154, 114, 115, 116, 159, 210, 117, + 210, 209, 210, 214, 209, 160, 230, 209, 279, 231, + + 193, 118, 154, 181, 119, 264, 140, 120, 214, 265, + 181, 121, 106, 107, 108, 109, 110, 280, 111, 112, + 220, 113, 215, 210, 290, 253, 138, 114, 115, 116, + 196, 193, 117, 211, 212, 281, 232, 215, 197, 282, + 311, 312, 323, 313, 118, 154, 221, 119, 276, 349, + 120, 324, 140, 585, 121, 22, 23, 122, 23, 22, + 25, 22, 22, 27, 22, 28, 22, 22, 22, 22, + 22, 29, 30, 31, 123, 123, 124, 123, 123, 123, + 123, 123, 123, 123, 123, 123, 123, 22, 22, 22, + 123, 125, 126, 123, 127, 123, 123, 123, 128, 123, + + 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 22, 22, 288, 193, 193, 209, 209, 154, 209, 209, + 154, 209, 209, 209, 209, 213, 209, 214, 193, 209, + 217, 130, 154, 217, 219, 154, 217, 217, 130, 220, + 217, 328, 138, 217, 332, 241, 296, 210, 210, 209, + 293, 358, 209, 394, 294, 210, 215, 217, 295, 503, + 217, 314, 218, 217, 222, 221, 289, 209, 140, 218, + 209, 209, 223, 209, 209, 138, 209, 209, 210, 209, + 209, 209, 209, 209, 209, 209, 209, 209, 209, 218, + 138, 209, 209, 138, 209, 209, 210, 209, 209, 242, + + 297, 140, 138, 210, 138, 210, 193, 298, 334, 138, + 154, 315, 210, 210, 210, 209, 140, 335, 209, 140, + 316, 209, 259, 210, 210, 138, 327, 312, 140, 300, + 140, 154, 301, 339, 317, 140, 318, 154, 181, 331, + 352, 154, 340, 319, 181, 321, 359, 210, 193, 353, + 193, 140, 302, 288, 193, 360, 303, 329, 154, 320, + 356, 357, 209, 346, 296, 209, 330, 209, 209, 391, + 209, 370, 363, 312, 347, 209, 260, 154, 209, 209, + 371, 209, 209, 348, 209, 209, 633, 209, 362, 209, + 138, 361, 209, 138, 210, 209, 210, 311, 312, 138, + + 138, 138, 209, 364, 210, 209, 209, 289, 209, 209, + 138, 210, 209, 210, 378, 138, 140, 154, 297, 140, + 379, 210, 365, 138, 154, 140, 140, 140, 154, 380, + 181, 366, 327, 312, 210, 181, 140, 392, 210, 181, + 181, 140, 181, 381, 382, 368, 367, 154, 393, 140, + 193, 408, 356, 357, 193, 193, 383, 395, 384, 193, + 193, 131, 193, 193, 385, 409, 154, 363, 312, 410, + 209, 209, 545, 209, 209, 418, 209, 209, 209, 209, + 138, 209, 209, 555, 209, 412, 411, 209, 419, 420, + 209, 138, 209, 209, 138, 209, 138, 423, 209, 210, + + 138, 138, 138, 210, 181, 138, 140, 422, 210, 421, + 210, 424, 154, 425, 435, 154, 154, 140, 181, 210, + 140, 138, 140, 154, 210, 448, 140, 140, 140, 154, + 181, 140, 181, 181, 436, 440, 193, 193, 426, 193, + 427, 438, 439, 193, 437, 442, 449, 140, 465, 450, + 452, 466, 451, 463, 193, 154, 209, 154, 441, 209, + 181, 209, 209, 473, 209, 209, 138, 209, 209, 565, + 467, 209, 464, 209, 138, 138, 209, 154, 138, 209, + 476, 474, 138, 209, 478, 502, 209, 475, 210, 209, + 138, 138, 140, 210, 138, 477, 500, 210, 154, 490, + + 140, 140, 154, 489, 140, 210, 479, 181, 140, 181, + 181, 481, 181, 491, 480, 210, 140, 140, 181, 193, + 140, 501, 193, 492, 493, 482, 193, 193, 193, 209, + 138, 193, 209, 154, 138, 209, 494, 504, 515, 209, + 516, 154, 209, 181, 209, 209, 518, 209, 517, 138, + 209, 209, 525, 595, 209, 138, 140, 209, 138, 526, + 140, 210, 546, 519, 181, 528, 209, 531, 527, 209, + 138, 210, 209, 530, 540, 140, 210, 529, 193, 542, + 551, 140, 552, 210, 140, 154, 209, 532, 541, 209, + 533, 209, 209, 138, 209, 181, 140, 209, 210, 209, + + 209, 138, 209, 209, 138, 209, 209, 557, 209, 566, + 181, 209, 193, 193, 209, 154, 534, 561, 210, 140, + 138, 556, 209, 210, 181, 209, 138, 140, 209, 572, + 140, 210, 210, 209, 571, 558, 209, 181, 562, 209, + 210, 575, 591, 193, 581, 154, 140, 138, 586, 603, + 576, 577, 140, 209, 210, 209, 209, 138, 209, 209, + 181, 209, 154, 582, 193, 210, 154, 181, 181, 623, + 138, 601, 578, 140, 606, 209, 597, 193, 209, 613, + 592, 209, 608, 140, 626, 210, 209, 210, 138, 209, + 596, 616, 209, 611, 609, 209, 140, 181, 209, 193, + + 138, 209, 193, 598, 618, 621, 209, 210, 660, 209, + 657, 655, 209, 138, 140, 181, 636, 654, 210, 631, + 628, 193, 154, 619, 138, 638, 140, 210, 629, 209, + 643, 641, 209, 646, 209, 209, 154, 209, 210, 140, + 209, 181, 193, 648, 138, 652, 651, 650, 653, 209, + 140, 647, 209, 639, 645, 209, 209, 649, 644, 209, + 642, 210, 209, 656, 640, 637, 210, 635, 658, 634, + 140, 632, 630, 627, 625, 624, 659, 622, 620, 617, + 615, 210, 614, 612, 610, 193, 607, 181, 210, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + + 45, 59, 59, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 91, 91, 91, 91, 91, 91, 91, + 91, 91, 91, 91, 91, 105, 105, 105, 105, 105, + 105, 105, 105, 105, 105, 105, 105, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 139, + 139, 139, 605, 139, 139, 139, 148, 148, 604, 148, + 148, 153, 154, 153, 153, 153, 153, 153, 153, 153, + 153, 153, 153, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 175, 175, 602, + + 175, 175, 182, 182, 600, 182, 182, 182, 187, 187, + 599, 187, 187, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 208, 594, 208, + 208, 208, 208, 208, 208, 208, 208, 208, 208, 213, + 593, 590, 213, 213, 213, 213, 213, 213, 213, 213, + 213, 216, 216, 216, 216, 216, 216, 216, 216, 216, + 216, 216, 216, 219, 589, 588, 219, 219, 219, 219, + 219, 219, 219, 219, 219, 233, 233, 587, 233, 233, + 240, 240, 240, 584, 240, 240, 240, 244, 244, 583, + + 244, 343, 343, 580, 343, 343, 579, 574, 343, 376, + 376, 573, 376, 376, 570, 569, 376, 406, 406, 568, + 406, 406, 567, 564, 406, 563, 560, 559, 193, 193, + 193, 554, 553, 181, 181, 181, 550, 549, 548, 547, + 154, 154, 154, 544, 543, 539, 538, 537, 536, 535, + 524, 523, 522, 521, 520, 514, 513, 512, 511, 510, + 509, 508, 507, 506, 505, 499, 498, 497, 496, 495, + 488, 487, 486, 485, 484, 483, 472, 471, 470, 469, + 468, 181, 407, 462, 461, 460, 459, 458, 457, 456, + 455, 454, 453, 447, 446, 445, 444, 443, 377, 434, + + 433, 432, 431, 430, 429, 428, 357, 417, 416, 415, + 414, 413, 407, 181, 344, 405, 404, 403, 402, 401, + 400, 399, 398, 397, 396, 390, 389, 388, 387, 386, + 377, 312, 375, 374, 373, 372, 369, 299, 193, 355, + 354, 351, 181, 344, 342, 341, 338, 337, 336, 333, + 154, 326, 325, 322, 245, 308, 307, 306, 305, 304, + 299, 212, 207, 193, 193, 193, 193, 193, 195, 193, + 193, 285, 284, 283, 181, 277, 273, 272, 271, 268, + 267, 266, 170, 154, 154, 154, 130, 154, 256, 255, + 254, 245, 243, 130, 239, 238, 237, 234, 212, 195, + + 193, 193, 193, 191, 190, 189, 188, 181, 180, 179, + 178, 177, 176, 174, 173, 172, 171, 137, 136, 135, + 134, 130, 135, 154, 154, 152, 151, 150, 149, 137, + 136, 135, 134, 130, 661, 21, 661, 661, 661, 661, + 661, 661, 661, 661, 661, 661, 661, 661, 661, 661, + 661, 661, 661, 661, 661, 661, 661, 661, 661, 661, + 661, 661, 661, 661, 661, 661, 661, 661, 661, 661, + 661, 661, 661, 661, 661, 661, 661, 661, 661, 661, + 661, 661, 661, 661, 661, 661, 661, 661, 661, 661, + 661, 661, 661 + + } ; + +static yyconst flex_int16_t yy_chk[1894] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 5, 5, 5, 27, 5, 32, + 34, 5, 33, 5, 36, 27, 46, 46, 35, 5, + 5, 5, 51, 51, 5, 64, 50, 37, 125, 38, + 125, 46, 39, 64, 50, 32, 34, 33, 33, 5, + 36, 50, 5, 34, 35, 49, 5, 6, 6, 6, + 55, 6, 35, 37, 6, 38, 6, 37, 39, 49, + 53, 36, 6, 6, 6, 55, 53, 6, 81, 38, + 54, 54, 56, 58, 57, 60, 60, 84, 82, 83, + 39, 96, 6, 101, 102, 6, 100, 97, 204, 6, + + 7, 7, 7, 81, 7, 56, 96, 7, 57, 7, + 95, 95, 97, 58, 98, 7, 7, 7, 95, 99, + 7, 82, 98, 83, 103, 100, 109, 84, 104, 104, + 101, 111, 102, 105, 99, 7, 105, 204, 7, 105, + 106, 106, 7, 8, 8, 8, 131, 8, 108, 139, + 8, 108, 8, 132, 108, 109, 141, 111, 8, 8, + 8, 132, 152, 8, 164, 105, 152, 174, 103, 155, + 155, 174, 131, 179, 164, 139, 141, 179, 8, 191, + 108, 8, 141, 191, 155, 8, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 15, 15, 15, + 142, 15, 110, 110, 15, 110, 15, 133, 110, 169, + 169, 166, 15, 15, 15, 112, 239, 15, 112, 115, + 239, 112, 115, 112, 113, 115, 142, 113, 115, 160, + 113, 282, 15, 142, 110, 15, 166, 143, 144, 15, + + 113, 145, 114, 116, 160, 114, 116, 112, 114, 116, + 146, 115, 15, 16, 16, 16, 113, 16, 114, 116, + 16, 133, 16, 143, 144, 282, 165, 145, 16, 16, + 16, 157, 143, 16, 114, 116, 146, 206, 206, 145, + 144, 219, 146, 160, 203, 157, 146, 117, 16, 165, + 117, 16, 688, 117, 183, 16, 118, 118, 119, 118, + 120, 119, 118, 120, 119, 184, 120, 219, 16, 17, + 17, 17, 17, 17, 183, 17, 17, 117, 17, 117, + 147, 203, 185, 167, 17, 17, 17, 159, 118, 17, + 119, 121, 120, 213, 121, 159, 119, 121, 184, 120, + + 202, 17, 159, 186, 17, 167, 147, 17, 214, 167, + 281, 17, 18, 18, 18, 18, 18, 185, 18, 18, + 220, 18, 213, 121, 202, 147, 240, 18, 18, 18, + 196, 196, 18, 211, 211, 186, 121, 214, 196, 186, + 242, 242, 255, 686, 18, 565, 220, 18, 685, 281, + 18, 255, 240, 565, 18, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 197, 197, 205, 208, 209, 331, 208, 209, + 265, 208, 209, 210, 210, 215, 210, 215, 290, 210, + 216, 216, 261, 216, 221, 451, 216, 217, 217, 221, + 217, 261, 246, 217, 265, 241, 223, 208, 209, 223, + 205, 290, 223, 331, 205, 210, 215, 218, 218, 451, + 218, 246, 216, 218, 222, 221, 197, 222, 246, 217, + 222, 224, 222, 225, 224, 247, 225, 224, 223, 225, + 226, 227, 228, 226, 227, 228, 226, 227, 228, 218, + 248, 230, 231, 249, 230, 231, 222, 230, 231, 241, + + 223, 247, 250, 224, 251, 225, 291, 228, 267, 253, + 264, 247, 226, 227, 228, 232, 248, 267, 232, 249, + 247, 232, 259, 230, 231, 252, 260, 260, 250, 230, + 251, 262, 231, 272, 249, 253, 250, 259, 279, 264, + 284, 260, 272, 251, 278, 253, 291, 232, 293, 284, + 294, 252, 232, 288, 288, 291, 232, 262, 328, 252, + 289, 289, 295, 278, 296, 295, 262, 296, 295, 328, + 296, 305, 297, 297, 279, 297, 259, 623, 297, 298, + 305, 300, 298, 279, 300, 298, 623, 300, 294, 301, + 315, 293, 301, 314, 295, 301, 296, 311, 311, 316, + + 317, 318, 302, 298, 297, 302, 303, 288, 302, 303, + 319, 298, 303, 300, 314, 320, 315, 329, 296, 314, + 315, 301, 300, 321, 332, 316, 317, 318, 330, 316, + 346, 300, 327, 327, 302, 347, 319, 329, 303, 348, + 349, 320, 350, 317, 318, 303, 302, 327, 330, 321, + 358, 346, 356, 356, 359, 360, 319, 332, 320, 361, + 362, 667, 658, 525, 321, 347, 500, 363, 363, 348, + 363, 364, 500, 363, 364, 358, 365, 364, 366, 365, + 377, 366, 365, 525, 366, 350, 349, 367, 359, 360, + 367, 378, 368, 367, 379, 368, 381, 364, 368, 363, + + 380, 382, 383, 364, 410, 385, 377, 362, 365, 361, + 366, 365, 391, 366, 378, 393, 392, 378, 411, 367, + 379, 384, 381, 395, 368, 391, 380, 382, 383, 394, + 408, 385, 409, 412, 379, 383, 418, 419, 367, 420, + 368, 381, 382, 421, 380, 385, 392, 384, 410, 393, + 395, 411, 394, 408, 422, 545, 423, 450, 384, 423, + 656, 424, 423, 418, 424, 425, 436, 424, 425, 545, + 412, 425, 409, 426, 435, 437, 426, 448, 438, 426, + 421, 419, 439, 427, 423, 450, 427, 420, 423, 427, + 440, 441, 436, 424, 442, 422, 448, 425, 449, 436, + + 435, 437, 452, 435, 438, 426, 424, 464, 439, 463, + 465, 426, 466, 437, 425, 427, 440, 441, 467, 473, + 442, 449, 474, 439, 440, 427, 475, 476, 477, 479, + 491, 575, 479, 501, 492, 479, 441, 452, 463, 478, + 464, 653, 478, 516, 480, 478, 466, 480, 465, 490, + 480, 481, 473, 575, 481, 493, 491, 481, 489, 474, + 492, 479, 501, 467, 515, 476, 482, 479, 475, 482, + 494, 478, 482, 478, 489, 490, 480, 477, 526, 492, + 515, 493, 516, 481, 489, 546, 530, 480, 490, 530, + 481, 531, 530, 540, 531, 552, 494, 531, 482, 532, + + 533, 542, 532, 533, 541, 532, 533, 530, 534, 546, + 551, 534, 556, 555, 534, 566, 482, 540, 530, 540, + 562, 526, 557, 531, 571, 557, 561, 542, 557, 552, + 541, 532, 533, 558, 551, 531, 558, 572, 541, 558, + 534, 555, 571, 576, 561, 585, 562, 582, 566, 585, + 556, 557, 561, 577, 557, 578, 577, 581, 578, 577, + 591, 578, 613, 562, 595, 558, 603, 616, 606, 613, + 601, 581, 558, 582, 591, 597, 577, 608, 597, 603, + 572, 597, 595, 581, 616, 577, 598, 578, 611, 598, + 576, 606, 598, 601, 597, 609, 601, 626, 609, 618, + + 621, 609, 628, 578, 608, 611, 619, 597, 650, 619, + 647, 645, 619, 631, 611, 636, 626, 644, 598, 621, + 618, 638, 633, 609, 641, 628, 621, 609, 619, 629, + 633, 631, 629, 636, 639, 629, 643, 639, 619, 631, + 639, 646, 648, 638, 651, 642, 641, 640, 643, 649, + 641, 637, 649, 629, 635, 649, 659, 639, 634, 659, + 632, 629, 659, 646, 630, 627, 639, 625, 648, 624, + 651, 622, 620, 617, 615, 614, 649, 612, 610, 607, + 605, 649, 604, 602, 599, 596, 593, 592, 659, 662, + 662, 662, 662, 662, 662, 662, 662, 662, 662, 662, + + 662, 663, 663, 663, 663, 663, 663, 663, 663, 663, + 663, 663, 663, 664, 664, 664, 664, 664, 664, 664, + 664, 664, 664, 664, 664, 665, 665, 665, 665, 665, + 665, 665, 665, 665, 665, 665, 665, 666, 666, 666, + 666, 666, 666, 666, 666, 666, 666, 666, 666, 668, + 668, 668, 589, 668, 668, 668, 669, 669, 587, 669, + 669, 670, 586, 670, 670, 670, 670, 670, 670, 670, + 670, 670, 670, 671, 671, 671, 671, 671, 671, 671, + 671, 671, 671, 671, 671, 672, 672, 672, 672, 672, + 672, 672, 672, 672, 672, 672, 672, 673, 673, 583, + + 673, 673, 674, 674, 580, 674, 674, 674, 675, 675, + 579, 675, 675, 676, 676, 676, 676, 676, 676, 676, + 676, 676, 676, 676, 676, 677, 677, 677, 677, 677, + 677, 677, 677, 677, 677, 677, 677, 678, 574, 678, + 678, 678, 678, 678, 678, 678, 678, 678, 678, 679, + 573, 570, 679, 679, 679, 679, 679, 679, 679, 679, + 679, 680, 680, 680, 680, 680, 680, 680, 680, 680, + 680, 680, 680, 681, 569, 568, 681, 681, 681, 681, + 681, 681, 681, 681, 681, 682, 682, 567, 682, 682, + 683, 683, 683, 564, 683, 683, 683, 684, 684, 563, + + 684, 687, 687, 560, 687, 687, 559, 554, 687, 689, + 689, 553, 689, 689, 550, 549, 689, 690, 690, 548, + 690, 690, 547, 544, 690, 543, 536, 535, 529, 528, + 527, 521, 520, 519, 518, 517, 511, 510, 506, 505, + 504, 503, 502, 496, 495, 488, 487, 485, 484, 483, + 472, 471, 470, 469, 468, 462, 461, 460, 459, 458, + 457, 456, 455, 454, 453, 447, 446, 445, 444, 443, + 434, 433, 432, 430, 429, 428, 417, 416, 415, 414, + 413, 407, 406, 405, 404, 403, 402, 401, 400, 399, + 398, 397, 396, 390, 389, 388, 387, 386, 376, 375, + + 374, 373, 372, 371, 370, 369, 357, 355, 354, 353, + 352, 351, 345, 344, 343, 342, 341, 340, 339, 338, + 337, 336, 335, 334, 333, 326, 325, 324, 323, 322, + 313, 312, 310, 309, 307, 306, 304, 299, 292, 287, + 286, 283, 280, 276, 275, 274, 271, 270, 269, 266, + 263, 258, 257, 254, 244, 238, 237, 236, 235, 234, + 229, 212, 207, 201, 200, 199, 198, 195, 194, 193, + 192, 190, 189, 188, 182, 181, 178, 177, 176, 173, + 172, 171, 168, 163, 162, 161, 158, 153, 151, 150, + 149, 140, 138, 129, 128, 127, 126, 124, 107, 94, + + 93, 92, 91, 90, 89, 88, 87, 80, 79, 78, + 77, 76, 75, 72, 71, 70, 69, 68, 67, 66, + 65, 63, 52, 48, 45, 44, 43, 42, 41, 31, + 30, 29, 28, 25, 21, 661, 661, 661, 661, 661, + 661, 661, 661, 661, 661, 661, 661, 661, 661, 661, + 661, 661, 661, 661, 661, 661, 661, 661, 661, 661, + 661, 661, 661, 661, 661, 661, 661, 661, 661, 661, + 661, 661, 661, 661, 661, 661, 661, 661, 661, 661, + 661, 661, 661, 661, 661, 661, 661, 661, 661, 661, + 661, 661, 661 + + } ; + +/* Table of booleans, true if rule could match eol. */ +static yyconst flex_int32_t yy_rule_can_match_eol[44] = + { 0, +0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, + 1, 1, 0, 0, }; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +#line 1 "bitbakescanner.l" +/* bbf.flex + + written by Marc Singer + 6 January 2005 + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. + + DESCRIPTION + ----------- + + flex lexer specification for a BitBake input file parser. + + Unfortunately, flex doesn't welcome comments within the rule sets. + I say unfortunately because this lexer is unreasonably complex and + comments would make the code much easier to comprehend. + + The BitBake grammar is not regular. In order to interpret all + of the available input files, the lexer maintains much state as it + parses. There are places where this lexer will emit tokens that + are invalid. The parser will tend to catch these. + + The lexer requires C++ at the moment. The only reason for this has + to do with a very small amount of managed state. Producing a C + lexer should be a reasonably easy task as long as the %reentrant + option is used. + + + NOTES + ----- + + o RVALUES. There are three kinds of RVALUES. There are unquoted + values, double quote enclosed strings, and single quote + strings. Quoted strings may contain unescaped quotes (of either + type), *and* any type may span more than one line by using a + continuation '\' at the end of the line. This requires us to + recognize all types of values with a single expression. + Moreover, the only reason to quote a value is to include + trailing or leading whitespace. Whitespace within a value is + preserved, ugh. + + o CLASSES. C_ patterns define classes. Classes ought not include + a repitition operator, instead letting the reference to the class + define the repitition count. + + C_SS - symbol start + C_SB - symbol body + C_SP - whitespace + +*/ +#line 71 "bitbakescanner.l" + +#include "token.h" +#include "lexer.h" +#include "bitbakeparser.h" +#include <ctype.h> + +extern void *bbparseAlloc(void *(*mallocProc)(size_t)); +extern void bbparseFree(void *p, void (*freeProc)(void*)); +extern void *bbparseAlloc(void *(*mallocProc)(size_t)); +extern void *bbparse(void*, int, token_t, lex_t*); +extern void bbparseTrace(FILE *TraceFILE, char *zTracePrompt); + +//static const char* rgbInput; +//static size_t cbInput; + + +int lineError; +int errorParse; + +enum { + errorNone = 0, + errorUnexpectedInput, + errorUnsupportedFeature, +}; + +#define YY_EXTRA_TYPE lex_t* + + /* Read from buffer */ +#define YY_INPUT(buf,result,max_size) \ + { yyextra->input(buf, &result, max_size); } + +//#define YY_DECL static size_t yylex () + +#define ERROR(e) \ + do { lineError = yylineno; errorParse = e; yyterminate (); } while (0) + +static const char* fixup_escapes (const char* sz); + + + + + + + + + + +#line 1196 "<stdout>" + +#define INITIAL 0 +#define S_DEF 1 +#define S_DEF_ARGS 2 +#define S_DEF_BODY 3 +#define S_FUNC 4 +#define S_INCLUDE 5 +#define S_INHERIT 6 +#define S_PROC 7 +#define S_RVALUE 8 +#define S_TASK 9 + +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + int yy_n_chars; + int yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + }; /* end struct yyguts_t */ + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (yyscan_t yyscanner ); + +int yyget_debug (yyscan_t yyscanner ); + +void yyset_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *yyget_in (yyscan_t yyscanner ); + +void yyset_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *yyget_out (yyscan_t yyscanner ); + +void yyset_out (FILE * out_str ,yyscan_t yyscanner ); + +int yyget_leng (yyscan_t yyscanner ); + +char *yyget_text (yyscan_t yyscanner ); + +int yyget_lineno (yyscan_t yyscanner ); + +void yyset_lineno (int line_number ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (yyscan_t yyscanner ); +#else +extern int yywrap (yyscan_t yyscanner ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + + static void yy_push_state (int new_state ,yyscan_t yyscanner); + + static void yy_pop_state (yyscan_t yyscanner ); + + static int yy_top_state (yyscan_t yyscanner ); + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (yyscan_t yyscanner); + +#define YY_DECL int yylex (yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + +#line 157 "bitbakescanner.l" + + +#line 1427 "<stdout>" + + if ( yyg->yy_init ) + { + yyg->yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + yy_load_buffer_state(yyscanner ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 662 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_current_state != 661 ); + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) + { + int yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + + do{ yylineno++; + yycolumn=0; + }while(0) +; + } + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 159 "bitbakescanner.l" +{ BEGIN S_RVALUE; + yyextra->accept (T_OP_APPEND); } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 161 "bitbakescanner.l" +{ BEGIN S_RVALUE; + yyextra->accept (T_OP_PREPEND); } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 163 "bitbakescanner.l" +{ BEGIN S_RVALUE; + yyextra->accept (T_OP_IMMEDIATE); } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 165 "bitbakescanner.l" +{ BEGIN S_RVALUE; + yyextra->accept (T_OP_ASSIGN); } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 167 "bitbakescanner.l" +{ BEGIN S_RVALUE; + yyextra->accept (T_OP_COND); } + YY_BREAK +case 6: +/* rule 6 can match eol */ +YY_RULE_SETUP +#line 170 "bitbakescanner.l" +{ } + YY_BREAK +case 7: +/* rule 7 can match eol */ +YY_RULE_SETUP +#line 171 "bitbakescanner.l" +{ BEGIN INITIAL; + size_t cb = yyleng; + while (cb && isspace (yytext[cb - 1])) + --cb; + yytext[cb - 1] = 0; + yyextra->accept (T_STRING, yytext + 1); } + YY_BREAK +case 8: +/* rule 8 can match eol */ +YY_RULE_SETUP +#line 177 "bitbakescanner.l" +{ BEGIN INITIAL; + size_t cb = yyleng; + while (cb && isspace (yytext[cb - 1])) + --cb; + yytext[cb - 1] = 0; + yyextra->accept (T_STRING, yytext + 1); } + YY_BREAK +case 9: +/* rule 9 can match eol */ +YY_RULE_SETUP +#line 184 "bitbakescanner.l" +{ ERROR (errorUnexpectedInput); } + YY_BREAK +case 10: +/* rule 10 can match eol */ +YY_RULE_SETUP +#line 185 "bitbakescanner.l" +{ BEGIN INITIAL; + yyextra->accept (T_STRING, NULL); } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 188 "bitbakescanner.l" +{ BEGIN S_INCLUDE; + yyextra->accept (T_INCLUDE); } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 190 "bitbakescanner.l" +{ BEGIN S_INHERIT; + yyextra->accept (T_INHERIT); } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 192 "bitbakescanner.l" +{ BEGIN S_TASK; + yyextra->accept (T_ADDTASK); } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 194 "bitbakescanner.l" +{ yyextra->accept (T_ADDHANDLER); } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 195 "bitbakescanner.l" +{ BEGIN S_FUNC; + yyextra->accept (T_EXPORT_FUNC); } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 197 "bitbakescanner.l" +{ yyextra->accept (T_BEFORE); } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 198 "bitbakescanner.l" +{ yyextra->accept (T_AFTER); } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 199 "bitbakescanner.l" +{ yyextra->accept (T_EXPORT); } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 201 "bitbakescanner.l" +{ yyextra->accept (T_FAKEROOT); } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 202 "bitbakescanner.l" +{ yyextra->accept (T_PYTHON); } + YY_BREAK +case 21: +/* rule 21 can match eol */ +YY_RULE_SETUP +#line 203 "bitbakescanner.l" +{ BEGIN S_PROC; + yyextra->accept (T_PROC_OPEN); } + YY_BREAK +case 22: +/* rule 22 can match eol */ +YY_RULE_SETUP +#line 205 "bitbakescanner.l" +{ BEGIN INITIAL; + yyextra->accept (T_PROC_CLOSE); } + YY_BREAK +case 23: +/* rule 23 can match eol */ +YY_RULE_SETUP +#line 207 "bitbakescanner.l" +{ yyextra->accept (T_PROC_BODY, yytext); } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 209 "bitbakescanner.l" +{ BEGIN S_DEF; } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 210 "bitbakescanner.l" +{ BEGIN S_DEF_ARGS; + yyextra->accept (T_SYMBOL, yytext); } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 212 "bitbakescanner.l" +{ yyextra->accept (T_DEF_ARGS, yytext); } + YY_BREAK +case 27: +/* rule 27 can match eol */ +YY_RULE_SETUP +#line 213 "bitbakescanner.l" +{ BEGIN S_DEF_BODY; } + YY_BREAK +case 28: +/* rule 28 can match eol */ +YY_RULE_SETUP +#line 214 "bitbakescanner.l" +{ yyextra->accept (T_DEF_BODY, yytext); } + YY_BREAK +case 29: +/* rule 29 can match eol */ +YY_RULE_SETUP +#line 215 "bitbakescanner.l" +{ yyextra->accept (T_DEF_BODY, yytext); } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 216 "bitbakescanner.l" +{ BEGIN INITIAL; unput (yytext[0]); } + YY_BREAK +case 31: +/* rule 31 can match eol */ +YY_RULE_SETUP +#line 218 "bitbakescanner.l" +{ } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 220 "bitbakescanner.l" +{ yyextra->accept (T_SYMBOL, yytext); } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 221 "bitbakescanner.l" +{ yyextra->accept (T_VARIABLE, yytext); } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 223 "bitbakescanner.l" +{ yyextra->accept (T_TSYMBOL, yytext); } + YY_BREAK +case 35: +YY_RULE_SETUP +#line 224 "bitbakescanner.l" +{ yyextra->accept (T_FSYMBOL, yytext); } + YY_BREAK +case 36: +YY_RULE_SETUP +#line 225 "bitbakescanner.l" +{ yyextra->accept (T_ISYMBOL, yytext); } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 226 "bitbakescanner.l" +{ BEGIN INITIAL; + yyextra->accept (T_ISYMBOL, yytext); } + YY_BREAK +case 38: +/* rule 38 can match eol */ +YY_RULE_SETUP +#line 229 "bitbakescanner.l" +{ BEGIN INITIAL; } + YY_BREAK +case 39: +/* rule 39 can match eol */ +YY_RULE_SETUP +#line 230 "bitbakescanner.l" +{ BEGIN INITIAL; } + YY_BREAK +case 40: +/* rule 40 can match eol */ +YY_RULE_SETUP +#line 231 "bitbakescanner.l" +{ BEGIN INITIAL; } + YY_BREAK +case 41: +/* rule 41 can match eol */ +YY_RULE_SETUP +#line 233 "bitbakescanner.l" +/* Insignificant whitespace */ + YY_BREAK +case 42: +YY_RULE_SETUP +#line 235 "bitbakescanner.l" +{ ERROR (errorUnexpectedInput); } + YY_BREAK +/* Check for premature termination */ +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(S_DEF): +case YY_STATE_EOF(S_DEF_ARGS): +case YY_STATE_EOF(S_DEF_BODY): +case YY_STATE_EOF(S_FUNC): +case YY_STATE_EOF(S_INCLUDE): +case YY_STATE_EOF(S_INHERIT): +case YY_STATE_EOF(S_PROC): +case YY_STATE_EOF(S_RVALUE): +case YY_STATE_EOF(S_TASK): +#line 238 "bitbakescanner.l" +{ return T_EOF; } + YY_BREAK +case 43: +YY_RULE_SETUP +#line 240 "bitbakescanner.l" +ECHO; + YY_BREAK +#line 1787 "<stdout>" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( yywrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 662 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + register int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *yy_cp = yyg->yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 662 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 661); + + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) +{ + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_cp = yyg->yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yyg->yy_hold_char; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yyg->yy_n_chars + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + if ( c == '\n' ){ + --yylineno; + } + + yyg->yytext_ptr = yy_bp; + yyg->yy_hold_char = *yy_cp; + yyg->yy_c_buf_p = yy_cp; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap(yyscanner ) ) + return EOF; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + if ( c == '\n' ) + + do{ yylineno++; + yycolumn=0; + }while(0) +; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + yy_load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void yy_load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * @param yyscanner The scanner object. + */ + void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ,yyscanner ); + + yyfree((void *) b ,yyscanner ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(yyscanner); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void yypop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (yyscan_t yyscanner) +{ + int num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param str a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * str , yyscan_t yyscanner) +{ + + return yy_scan_bytes(str,strlen(str) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yyalloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + + static void yy_push_state (int new_state , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth ) + { + yy_size_t new_size; + + yyg->yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yyg->yy_start_stack_depth * sizeof( int ); + + if ( ! yyg->yy_start_stack ) + yyg->yy_start_stack = (int *) yyalloc(new_size ,yyscanner ); + + else + yyg->yy_start_stack = (int *) yyrealloc((void *) yyg->yy_start_stack,new_size ,yyscanner ); + + if ( ! yyg->yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); +} + + static void yy_pop_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( --yyg->yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]); +} + + static int yy_top_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1]; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int yyget_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int yyget_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +int yyget_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *yyget_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param line_number + * @param yyscanner The scanner object. + */ +void yyset_lineno (int line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner); + + yylineno = line_number; +} + +/** Set the current column. + * @param line_number + * @param yyscanner The scanner object. + */ +void yyset_column (int column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "yyset_column called with no buffer" , yyscanner); + + yycolumn = column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * @param yyscanner The scanner object. + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = in_str ; +} + +void yyset_out (FILE * out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = out_str ; +} + +int yyget_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void yyset_debug (int bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + This function is called once per scanner lifetime. */ + + yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = (char *) 0; + yyg->yy_init = 1; + yyg->yy_start = 0; + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = (int *) 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* User-visible API */ + +/* yylex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int yylex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + memset(*ptr_yy_globals,0,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + yyfree(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + yyfree(yyg->yy_start_stack ,yyscanner ); + yyg->yy_start_stack = NULL; + + /* Destroy the main struct (reentrant only). */ + yyfree ( yyscanner , yyscanner ); + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +{ + register int i; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +{ + register int n; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size , yyscan_t yyscanner) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr , yyscan_t yyscanner) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef yytext_ptr +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif +#line 240 "bitbakescanner.l" + + + +void lex_t::accept (int token, const char* sz) +{ + token_t t; + memset (&t, 0, sizeof (t)); + t.copyString(sz); + + /* tell lemon to parse the token */ + parse (parser, token, t, this); +} + +int lex_t::line ()const +{ + return yyget_lineno (scanner); +} + +const char* lex_t::filename ()const +{ + return m_fileName; +} + +void parse (MappedFile* mf) +{ + void* parser = bbparseAlloc (malloc); + yyscan_t scanner; + lex_t lex; + + yylex_init (&scanner); + + lex.parser = parser; + lex.scanner = scanner; + lex.mf = mf; + lex.rgbInput = mf->m_rgb; + lex.cbInput = mf->m_cb; + lex.parse = bbparse; + yyset_extra (&lex, scanner); + + + int result = yylex (scanner); + + lex.accept (0); + bbparseTrace (NULL, NULL); + + if (result != T_EOF) + WARNING ("premature end of file\n"); + + yylex_destroy (scanner); + bbparseFree (parser, free); +} + diff --git a/lib/bb/parse/parse_c/bitbakeparser.l b/lib/bb/parse/parse_c/bitbakescanner.l index ee4ce1483..3ef077e4f 100644 --- a/lib/bb/parse/parse_c/bitbakeparser.l +++ b/lib/bb/parse/parse_c/bitbakescanner.l @@ -71,6 +71,7 @@ #include "token.h" #include "lexer.h" +#include "bitbakeparser.h" #include <ctype.h> extern void *bbparseAlloc(void *(*mallocProc)(size_t)); diff --git a/lib/bb/parse/parse_c/lexer.h b/lib/bb/parse/parse_c/lexer.h index 1edf72dcf..ef633522a 100644 --- a/lib/bb/parse/parse_c/lexer.h +++ b/lib/bb/parse/parse_c/lexer.h @@ -30,7 +30,7 @@ struct lex_t { void* (*parse)(void*, int, token_t, lex_t*); void accept(int token, const char* string = 0); - void input(char *buf, int *result, int_max_size); + void input(char *buf, int *result, int max_size); int line()const; const char* filename()const; private: diff --git a/lib/bb/parse/parse_c/token.h b/lib/bb/parse/parse_c/token.h index 2351fda6b..dc8e57836 100644 --- a/lib/bb/parse/parse_c/token.h +++ b/lib/bb/parse/parse_c/token.h @@ -24,13 +24,24 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef TOKEN_H #define TOKEN_H +#include <ctype.h> +#include <string.h> + #define PURE_METHOD + +/** + * Special Value for End Of File Handling. We set it to + * 1001 so we can have up to 1000 Terminal Symbols on + * grammar. Currenlty we have around 20 + */ +#define T_EOF 1001 + struct token_t { const char* string()const PURE_METHOD; static char* concatString(const char* l, const char* r); - void assignString(const char* str); + void assignString(char* str); void copyString(const char* str); void release_this(); @@ -50,6 +61,7 @@ inline const char* token_t::string()const */ inline char* token_t::concatString(const char* l, const char* r) { +#if 0 size_t cb = (l ? strlen (l) : 0) + strlen (r) + 1; r_sz = new char[cb]; *r_sz = 0; @@ -57,9 +69,11 @@ inline char* token_t::concatString(const char* l, const char* r) strcat (r_sz, r); return r_sz; +#endif +#warning "XXX fixme" } -inline void token_t::assignString(const char* str) +inline void token_t::assignString(char* str) { m_string = str; m_stringLen = str ? strlen(str) : 0; @@ -70,7 +84,7 @@ inline void token_t::copyString(const char* str) if( str ) { m_stringLen = strlen(str); m_string = new char[m_stringLen+1]; - strcpy(m_string, str) + strcpy(m_string, str); } } |