NCDValParser_parse.c 35 KB

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