NCDValueParser_parse.c 36 KB

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