NCDConfigParser_parse.c 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089
  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 "NCDConfigParser_parse.y"
  8. #include <string.h>
  9. #include <stddef.h>
  10. #include <misc/debug.h>
  11. #include <misc/concat_strings.h>
  12. #include <ncd/NCDAst.h>
  13. struct parser_out {
  14. int out_of_memory;
  15. int syntax_error;
  16. int have_ast;
  17. NCDProgram ast;
  18. };
  19. struct token {
  20. char *str;
  21. size_t len;
  22. };
  23. struct program {
  24. int have;
  25. NCDProgram v;
  26. };
  27. struct block {
  28. int have;
  29. NCDBlock v;
  30. };
  31. struct statement {
  32. int have;
  33. NCDStatement v;
  34. };
  35. struct ifblock {
  36. int have;
  37. NCDIfBlock v;
  38. };
  39. struct value {
  40. int have;
  41. NCDValue v;
  42. };
  43. static void free_token (struct token o) { free(o.str); }
  44. static void free_program (struct program o) { if (o.have) NCDProgram_Free(&o.v); }
  45. static void free_block (struct block o) { if (o.have) NCDBlock_Free(&o.v); }
  46. static void free_statement (struct statement o) { if (o.have) NCDStatement_Free(&o.v); }
  47. static void free_ifblock (struct ifblock o) { if (o.have) NCDIfBlock_Free(&o.v); }
  48. static void free_value (struct value o) { if (o.have) NCDValue_Free(&o.v); }
  49. #line 62 "NCDConfigParser_parse.c"
  50. /* Next is all token values, in a form suitable for use by makeheaders.
  51. ** This section will be null unless lemon is run with the -m switch.
  52. */
  53. /*
  54. ** These constants (all generated automatically by the parser generator)
  55. ** specify the various kinds of tokens (terminals) that the parser
  56. ** understands.
  57. **
  58. ** Each symbol here is a terminal symbol in the grammar.
  59. */
  60. /* Make sure the INTERFACE macro is defined.
  61. */
  62. #ifndef INTERFACE
  63. # define INTERFACE 1
  64. #endif
  65. /* The next thing included is series of defines which control
  66. ** various aspects of the generated parser.
  67. ** YYCODETYPE is the data type used for storing terminal
  68. ** and nonterminal numbers. "unsigned char" is
  69. ** used if there are fewer than 250 terminals
  70. ** and nonterminals. "int" is used otherwise.
  71. ** YYNOCODE is a number of type YYCODETYPE which corresponds
  72. ** to no legal terminal or nonterminal number. This
  73. ** number is used to fill in empty slots of the hash
  74. ** table.
  75. ** YYFALLBACK If defined, this indicates that one or more tokens
  76. ** have fall-back values which should be used if the
  77. ** original value of the token will not parse.
  78. ** YYACTIONTYPE is the data type used for storing terminal
  79. ** and nonterminal numbers. "unsigned char" is
  80. ** used if there are fewer than 250 rules and
  81. ** states combined. "int" is used otherwise.
  82. ** ParseTOKENTYPE is the data type used for minor tokens given
  83. ** directly to the parser from the tokenizer.
  84. ** YYMINORTYPE is the data type used for all minor tokens.
  85. ** This is typically a union of many types, one of
  86. ** which is ParseTOKENTYPE. The entry in the union
  87. ** for base tokens is called "yy0".
  88. ** YYSTACKDEPTH is the maximum depth of the parser's stack. If
  89. ** zero the stack is dynamically sized using realloc()
  90. ** ParseARG_SDECL A static variable declaration for the %extra_argument
  91. ** ParseARG_PDECL A parameter declaration for the %extra_argument
  92. ** ParseARG_STORE Code to store %extra_argument into yypParser
  93. ** ParseARG_FETCH Code to extract %extra_argument from yypParser
  94. ** YYNSTATE the combined number of states.
  95. ** YYNRULE the number of rules in the grammar
  96. ** YYERRORSYMBOL is the code number of the error symbol. If not
  97. ** defined, then do no error processing.
  98. */
  99. #define YYCODETYPE unsigned char
  100. #define YYNOCODE 46
  101. #define YYACTIONTYPE unsigned char
  102. #define ParseTOKENTYPE struct token
  103. typedef union {
  104. int yyinit;
  105. ParseTOKENTYPE yy0;
  106. char * yy13;
  107. int yy22;
  108. struct block yy57;
  109. struct value yy61;
  110. struct program yy84;
  111. struct ifblock yy86;
  112. struct statement yy89;
  113. } YYMINORTYPE;
  114. #ifndef YYSTACKDEPTH
  115. #define YYSTACKDEPTH 0
  116. #endif
  117. #define ParseARG_SDECL struct parser_out *parser_out ;
  118. #define ParseARG_PDECL , struct parser_out *parser_out
  119. #define ParseARG_FETCH struct parser_out *parser_out = yypParser->parser_out
  120. #define ParseARG_STORE yypParser->parser_out = parser_out
  121. #define YYNSTATE 119
  122. #define YYNRULE 46
  123. #define YY_NO_ACTION (YYNSTATE+YYNRULE+2)
  124. #define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1)
  125. #define YY_ERROR_ACTION (YYNSTATE+YYNRULE)
  126. /* The yyzerominor constant is used to initialize instances of
  127. ** YYMINORTYPE objects to zero. */
  128. static const YYMINORTYPE yyzerominor = { 0 };
  129. /* Define the yytestcase() macro to be a no-op if is not already defined
  130. ** otherwise.
  131. **
  132. ** Applications can choose to define yytestcase() in the %include section
  133. ** to a macro that can assist in verifying code coverage. For production
  134. ** code the yytestcase() macro should be turned off. But it is useful
  135. ** for testing.
  136. */
  137. #ifndef yytestcase
  138. # define yytestcase(X)
  139. #endif
  140. /* Next are the tables used to determine what action to take based on the
  141. ** current state and lookahead token. These tables are used to implement
  142. ** functions that take a state number and lookahead value and return an
  143. ** action integer.
  144. **
  145. ** Suppose the action integer is N. Then the action is determined as
  146. ** follows
  147. **
  148. ** 0 <= N < YYNSTATE Shift N. That is, push the lookahead
  149. ** token onto the stack and goto state N.
  150. **
  151. ** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE.
  152. **
  153. ** N == YYNSTATE+YYNRULE A syntax error has occurred.
  154. **
  155. ** N == YYNSTATE+YYNRULE+1 The parser accepts its input.
  156. **
  157. ** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused
  158. ** slots in the yy_action[] table.
  159. **
  160. ** The action table is constructed as a single large table named yy_action[].
  161. ** Given state S and lookahead X, the action is computed as
  162. **
  163. ** yy_action[ yy_shift_ofst[S] + X ]
  164. **
  165. ** If the index value yy_shift_ofst[S]+X is out of range or if the value
  166. ** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
  167. ** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
  168. ** and that yy_default[S] should be used instead.
  169. **
  170. ** The formula above is for computing the action when the lookahead is
  171. ** a terminal symbol. If the lookahead is a non-terminal (as occurs after
  172. ** a reduce action) then the yy_reduce_ofst[] array is used in place of
  173. ** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
  174. ** YY_SHIFT_USE_DFLT.
  175. **
  176. ** The following are the tables generated in this section:
  177. **
  178. ** yy_action[] A single table containing all actions.
  179. ** yy_lookahead[] A table containing the lookahead for each entry in
  180. ** yy_action. Used to detect hash collisions.
  181. ** yy_shift_ofst[] For each state, the offset into yy_action for
  182. ** shifting terminals.
  183. ** yy_reduce_ofst[] For each state, the offset into yy_action for
  184. ** shifting non-terminals after a reduce.
  185. ** yy_default[] Default action for each state.
  186. */
  187. static const YYACTIONTYPE yy_action[] = {
  188. /* 0 */ 98, 85, 55, 3, 95, 9, 98, 86, 55, 3,
  189. /* 10 */ 82, 9, 98, 87, 55, 3, 50, 9, 4, 7,
  190. /* 20 */ 27, 28, 50, 7, 4, 108, 27, 28, 50, 69,
  191. /* 30 */ 4, 5, 27, 28, 102, 53, 93, 103, 54, 104,
  192. /* 40 */ 106, 39, 102, 61, 93, 103, 92, 104, 106, 39,
  193. /* 50 */ 91, 102, 1, 56, 103, 30, 104, 106, 39, 102,
  194. /* 60 */ 32, 117, 103, 59, 104, 106, 40, 102, 55, 94,
  195. /* 70 */ 103, 99, 104, 106, 39, 102, 57, 7, 103, 97,
  196. /* 80 */ 104, 106, 40, 102, 8, 58, 103, 101, 104, 106,
  197. /* 90 */ 39, 102, 100, 48, 103, 49, 104, 106, 41, 102,
  198. /* 100 */ 60, 62, 103, 70, 104, 106, 42, 102, 33, 76,
  199. /* 110 */ 103, 118, 104, 106, 43, 102, 88, 89, 103, 66,
  200. /* 120 */ 104, 106, 44, 102, 47, 55, 103, 67, 104, 106,
  201. /* 130 */ 46, 18, 63, 68, 72, 52, 38, 75, 73, 50,
  202. /* 140 */ 80, 166, 18, 119, 18, 51, 65, 38, 81, 38,
  203. /* 150 */ 18, 21, 18, 22, 71, 38, 74, 38, 18, 13,
  204. /* 160 */ 18, 23, 114, 38, 79, 38, 7, 18, 7, 107,
  205. /* 170 */ 25, 84, 38, 7, 64, 7, 83, 96, 6, 90,
  206. /* 180 */ 105, 26, 29, 2, 110, 31, 109, 10, 14, 45,
  207. /* 190 */ 24, 111, 15, 11, 16, 77, 34, 112, 17, 167,
  208. /* 200 */ 35, 113, 19, 78, 36, 115, 12, 116, 20, 167,
  209. /* 210 */ 37,
  210. };
  211. static const YYCODETYPE yy_lookahead[] = {
  212. /* 0 */ 2, 27, 4, 5, 6, 7, 2, 27, 4, 5,
  213. /* 10 */ 15, 7, 2, 27, 4, 5, 42, 7, 20, 7,
  214. /* 20 */ 22, 23, 42, 7, 20, 21, 22, 23, 42, 13,
  215. /* 30 */ 20, 19, 22, 23, 33, 34, 35, 36, 41, 38,
  216. /* 40 */ 39, 40, 33, 34, 35, 36, 33, 38, 39, 40,
  217. /* 50 */ 4, 33, 7, 35, 36, 10, 38, 39, 40, 33,
  218. /* 60 */ 29, 30, 36, 37, 38, 39, 40, 33, 4, 35,
  219. /* 70 */ 36, 33, 38, 39, 40, 33, 4, 7, 36, 37,
  220. /* 80 */ 38, 39, 40, 33, 14, 35, 36, 43, 38, 39,
  221. /* 90 */ 40, 33, 43, 1, 36, 3, 38, 39, 40, 33,
  222. /* 100 */ 33, 41, 36, 8, 38, 39, 40, 33, 31, 14,
  223. /* 110 */ 36, 30, 38, 39, 40, 33, 24, 25, 36, 41,
  224. /* 120 */ 38, 39, 40, 33, 27, 4, 36, 16, 38, 39,
  225. /* 130 */ 40, 28, 11, 12, 41, 32, 33, 41, 17, 42,
  226. /* 140 */ 41, 44, 28, 0, 28, 4, 32, 33, 32, 33,
  227. /* 150 */ 28, 2, 28, 2, 32, 33, 32, 33, 28, 5,
  228. /* 160 */ 28, 6, 32, 33, 32, 33, 7, 28, 7, 8,
  229. /* 170 */ 8, 32, 33, 7, 8, 7, 8, 6, 19, 9,
  230. /* 180 */ 8, 18, 18, 7, 9, 8, 21, 7, 5, 4,
  231. /* 190 */ 6, 9, 5, 7, 5, 4, 6, 9, 5, 45,
  232. /* 200 */ 6, 9, 5, 8, 6, 9, 7, 6, 5, 45,
  233. /* 210 */ 6,
  234. };
  235. #define YY_SHIFT_USE_DFLT (-6)
  236. #define YY_SHIFT_MAX 84
  237. static const short yy_shift_ofst[] = {
  238. /* 0 */ 92, 10, 10, -2, 4, 10, 10, 10, 10, 10,
  239. /* 10 */ 10, 10, 10, 121, 121, 121, 121, 121, 121, 121,
  240. /* 20 */ 121, 92, 92, 92, -5, 46, 64, 64, 72, 72,
  241. /* 30 */ 64, 46, 111, 46, 46, 46, 46, -5, 45, 12,
  242. /* 40 */ 70, 159, 161, 166, 16, 95, 168, 143, 149, 151,
  243. /* 50 */ 141, 154, 155, 162, 170, 163, 171, 164, 172, 165,
  244. /* 60 */ 176, 177, 175, 180, 183, 184, 182, 187, 186, 185,
  245. /* 70 */ 189, 190, 188, 193, 194, 192, 191, 195, 197, 198,
  246. /* 80 */ 196, 201, 199, 203, 204,
  247. };
  248. #define YY_REDUCE_USE_DFLT (-27)
  249. #define YY_REDUCE_MAX 37
  250. static const short yy_reduce_ofst[] = {
  251. /* 0 */ 97, 1, 9, 18, 26, 34, 42, 50, 58, 66,
  252. /* 10 */ 74, 82, 90, 103, 114, 116, 122, 124, 130, 132,
  253. /* 20 */ 139, -26, -20, -14, 31, -3, 13, 38, 44, 49,
  254. /* 30 */ 67, 60, 77, 78, 93, 96, 99, 81,
  255. };
  256. static const YYACTIONTYPE yy_default[] = {
  257. /* 0 */ 120, 142, 142, 165, 165, 165, 165, 165, 165, 165,
  258. /* 10 */ 165, 165, 165, 165, 165, 165, 165, 165, 136, 165,
  259. /* 20 */ 165, 120, 120, 120, 129, 161, 165, 165, 165, 165,
  260. /* 30 */ 165, 161, 133, 161, 161, 161, 161, 131, 165, 144,
  261. /* 40 */ 165, 148, 165, 165, 165, 165, 165, 165, 165, 165,
  262. /* 50 */ 165, 165, 165, 165, 165, 138, 165, 140, 165, 165,
  263. /* 60 */ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  264. /* 70 */ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  265. /* 80 */ 165, 165, 165, 165, 165, 121, 122, 123, 163, 164,
  266. /* 90 */ 124, 162, 139, 143, 145, 146, 147, 149, 153, 154,
  267. /* 100 */ 141, 155, 156, 157, 158, 152, 160, 159, 150, 151,
  268. /* 110 */ 125, 126, 127, 135, 137, 128, 134, 130, 132,
  269. };
  270. #define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0]))
  271. /* The next table maps tokens into fallback tokens. If a construct
  272. ** like the following:
  273. **
  274. ** %fallback ID X Y Z.
  275. **
  276. ** appears in the grammar, then ID becomes a fallback token for X, Y,
  277. ** and Z. Whenever one of the tokens X, Y, or Z is input to the parser
  278. ** but it does not parse, the type of the token is changed to ID and
  279. ** the parse is retried before an error is thrown.
  280. */
  281. #ifdef YYFALLBACK
  282. static const YYCODETYPE yyFallback[] = {
  283. };
  284. #endif /* YYFALLBACK */
  285. /* The following structure represents a single element of the
  286. ** parser's stack. Information stored includes:
  287. **
  288. ** + The state number for the parser at this level of the stack.
  289. **
  290. ** + The value of the token stored at this level of the stack.
  291. ** (In other words, the "major" token.)
  292. **
  293. ** + The semantic value stored at this level of the stack. This is
  294. ** the information used by the action routines in the grammar.
  295. ** It is sometimes called the "minor" token.
  296. */
  297. struct yyStackEntry {
  298. YYACTIONTYPE stateno; /* The state-number */
  299. YYCODETYPE major; /* The major token value. This is the code
  300. ** number for the token at this stack level */
  301. YYMINORTYPE minor; /* The user-supplied minor token value. This
  302. ** is the value of the token */
  303. };
  304. typedef struct yyStackEntry yyStackEntry;
  305. /* The state of the parser is completely contained in an instance of
  306. ** the following structure */
  307. struct yyParser {
  308. int yyidx; /* Index of top element in stack */
  309. #ifdef YYTRACKMAXSTACKDEPTH
  310. int yyidxMax; /* Maximum value of yyidx */
  311. #endif
  312. int yyerrcnt; /* Shifts left before out of the error */
  313. ParseARG_SDECL /* A place to hold %extra_argument */
  314. #if YYSTACKDEPTH<=0
  315. int yystksz; /* Current side of the stack */
  316. yyStackEntry *yystack; /* The parser's stack */
  317. #else
  318. yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
  319. #endif
  320. };
  321. typedef struct yyParser yyParser;
  322. #ifndef NDEBUG
  323. #include <stdio.h>
  324. static FILE *yyTraceFILE = 0;
  325. static char *yyTracePrompt = 0;
  326. #endif /* NDEBUG */
  327. #ifndef NDEBUG
  328. /*
  329. ** Turn parser tracing on by giving a stream to which to write the trace
  330. ** and a prompt to preface each trace message. Tracing is turned off
  331. ** by making either argument NULL
  332. **
  333. ** Inputs:
  334. ** <ul>
  335. ** <li> A FILE* to which trace output should be written.
  336. ** If NULL, then tracing is turned off.
  337. ** <li> A prefix string written at the beginning of every
  338. ** line of trace output. If NULL, then tracing is
  339. ** turned off.
  340. ** </ul>
  341. **
  342. ** Outputs:
  343. ** None.
  344. */
  345. void ParseTrace(FILE *TraceFILE, char *zTracePrompt){
  346. yyTraceFILE = TraceFILE;
  347. yyTracePrompt = zTracePrompt;
  348. if( yyTraceFILE==0 ) yyTracePrompt = 0;
  349. else if( yyTracePrompt==0 ) yyTraceFILE = 0;
  350. }
  351. #endif /* NDEBUG */
  352. #ifndef NDEBUG
  353. /* For tracing shifts, the names of all terminals and nonterminals
  354. ** are required. The following table supplies these names */
  355. static const char *const yyTokenName[] = {
  356. "$", "INCLUDE", "STRING", "INCLUDE_GUARD",
  357. "NAME", "CURLY_OPEN", "CURLY_CLOSE", "ROUND_OPEN",
  358. "ROUND_CLOSE", "SEMICOLON", "ARROW", "IF",
  359. "FOREACH", "AS", "COLON", "ELIF",
  360. "ELSE", "BLOCK", "DOT", "COMMA",
  361. "BRACKET_OPEN", "BRACKET_CLOSE", "AT_SIGN", "CARET",
  362. "PROCESS", "TEMPLATE", "error", "processes",
  363. "statement", "elif_maybe", "elif", "else_maybe",
  364. "statements", "dotted_name", "statement_args_maybe", "list_contents",
  365. "list", "map_contents", "map", "invoc",
  366. "value", "name_maybe", "process_or_template", "name_list",
  367. "input",
  368. };
  369. #endif /* NDEBUG */
  370. #ifndef NDEBUG
  371. /* For tracing reduce actions, the names of all rules are required.
  372. */
  373. static const char *const yyRuleName[] = {
  374. /* 0 */ "input ::= processes",
  375. /* 1 */ "processes ::=",
  376. /* 2 */ "processes ::= INCLUDE STRING processes",
  377. /* 3 */ "processes ::= INCLUDE_GUARD STRING processes",
  378. /* 4 */ "processes ::= process_or_template NAME CURLY_OPEN statements CURLY_CLOSE processes",
  379. /* 5 */ "statement ::= dotted_name ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON",
  380. /* 6 */ "statement ::= dotted_name ARROW dotted_name ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON",
  381. /* 7 */ "statement ::= IF ROUND_OPEN value ROUND_CLOSE CURLY_OPEN statements CURLY_CLOSE elif_maybe else_maybe name_maybe SEMICOLON",
  382. /* 8 */ "statement ::= FOREACH ROUND_OPEN value AS NAME ROUND_CLOSE CURLY_OPEN statements CURLY_CLOSE name_maybe SEMICOLON",
  383. /* 9 */ "statement ::= FOREACH ROUND_OPEN value AS NAME COLON NAME ROUND_CLOSE CURLY_OPEN statements CURLY_CLOSE name_maybe SEMICOLON",
  384. /* 10 */ "elif_maybe ::=",
  385. /* 11 */ "elif_maybe ::= elif",
  386. /* 12 */ "elif ::= ELIF ROUND_OPEN value ROUND_CLOSE CURLY_OPEN statements CURLY_CLOSE",
  387. /* 13 */ "elif ::= ELIF ROUND_OPEN value ROUND_CLOSE CURLY_OPEN statements CURLY_CLOSE elif",
  388. /* 14 */ "else_maybe ::=",
  389. /* 15 */ "else_maybe ::= ELSE CURLY_OPEN statements CURLY_CLOSE",
  390. /* 16 */ "statement ::= BLOCK CURLY_OPEN statements CURLY_CLOSE name_maybe SEMICOLON",
  391. /* 17 */ "statements ::= statement",
  392. /* 18 */ "statements ::= statement statements",
  393. /* 19 */ "dotted_name ::= NAME",
  394. /* 20 */ "dotted_name ::= NAME DOT dotted_name",
  395. /* 21 */ "name_list ::= NAME",
  396. /* 22 */ "name_list ::= NAME DOT name_list",
  397. /* 23 */ "statement_args_maybe ::=",
  398. /* 24 */ "statement_args_maybe ::= list_contents",
  399. /* 25 */ "list_contents ::= value",
  400. /* 26 */ "list_contents ::= value COMMA list_contents",
  401. /* 27 */ "list ::= CURLY_OPEN CURLY_CLOSE",
  402. /* 28 */ "list ::= CURLY_OPEN list_contents CURLY_CLOSE",
  403. /* 29 */ "map_contents ::= value COLON value",
  404. /* 30 */ "map_contents ::= value COLON value COMMA map_contents",
  405. /* 31 */ "map ::= BRACKET_OPEN BRACKET_CLOSE",
  406. /* 32 */ "map ::= BRACKET_OPEN map_contents BRACKET_CLOSE",
  407. /* 33 */ "invoc ::= value ROUND_OPEN list_contents ROUND_CLOSE",
  408. /* 34 */ "value ::= STRING",
  409. /* 35 */ "value ::= AT_SIGN dotted_name",
  410. /* 36 */ "value ::= CARET name_list",
  411. /* 37 */ "value ::= dotted_name",
  412. /* 38 */ "value ::= list",
  413. /* 39 */ "value ::= map",
  414. /* 40 */ "value ::= ROUND_OPEN value ROUND_CLOSE",
  415. /* 41 */ "value ::= invoc",
  416. /* 42 */ "name_maybe ::=",
  417. /* 43 */ "name_maybe ::= NAME",
  418. /* 44 */ "process_or_template ::= PROCESS",
  419. /* 45 */ "process_or_template ::= TEMPLATE",
  420. };
  421. #endif /* NDEBUG */
  422. #if YYSTACKDEPTH<=0
  423. /*
  424. ** Try to increase the size of the parser stack.
  425. */
  426. static void yyGrowStack(yyParser *p){
  427. int newSize;
  428. yyStackEntry *pNew;
  429. newSize = p->yystksz*2 + 100;
  430. pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
  431. if( pNew ){
  432. p->yystack = pNew;
  433. p->yystksz = newSize;
  434. #ifndef NDEBUG
  435. if( yyTraceFILE ){
  436. fprintf(yyTraceFILE,"%sStack grows to %d entries!\n",
  437. yyTracePrompt, p->yystksz);
  438. }
  439. #endif
  440. }
  441. }
  442. #endif
  443. /*
  444. ** This function allocates a new parser.
  445. ** The only argument is a pointer to a function which works like
  446. ** malloc.
  447. **
  448. ** Inputs:
  449. ** A pointer to the function used to allocate memory.
  450. **
  451. ** Outputs:
  452. ** A pointer to a parser. This pointer is used in subsequent calls
  453. ** to Parse and ParseFree.
  454. */
  455. void *ParseAlloc(void *(*mallocProc)(size_t)){
  456. yyParser *pParser;
  457. pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) );
  458. if( pParser ){
  459. pParser->yyidx = -1;
  460. #ifdef YYTRACKMAXSTACKDEPTH
  461. pParser->yyidxMax = 0;
  462. #endif
  463. #if YYSTACKDEPTH<=0
  464. pParser->yystack = NULL;
  465. pParser->yystksz = 0;
  466. yyGrowStack(pParser);
  467. #endif
  468. }
  469. return pParser;
  470. }
  471. /* The following function deletes the value associated with a
  472. ** symbol. The symbol can be either a terminal or nonterminal.
  473. ** "yymajor" is the symbol code, and "yypminor" is a pointer to
  474. ** the value.
  475. */
  476. static void yy_destructor(
  477. yyParser *yypParser, /* The parser */
  478. YYCODETYPE yymajor, /* Type code for object to destroy */
  479. YYMINORTYPE *yypminor /* The object to be destroyed */
  480. ){
  481. ParseARG_FETCH;
  482. switch( yymajor ){
  483. /* Here is inserted the actions which take place when a
  484. ** terminal or non-terminal is destroyed. This can happen
  485. ** when the symbol is popped from the stack during a
  486. ** reduce or during error processing or when a parser is
  487. ** being destroyed before it is finished parsing.
  488. **
  489. ** Note: during a reduce, the only symbols destroyed are those
  490. ** which appear on the RHS of the rule, but which are not used
  491. ** inside the C code.
  492. */
  493. /* TERMINAL Destructor */
  494. case 1: /* INCLUDE */
  495. case 2: /* STRING */
  496. case 3: /* INCLUDE_GUARD */
  497. case 4: /* NAME */
  498. case 5: /* CURLY_OPEN */
  499. case 6: /* CURLY_CLOSE */
  500. case 7: /* ROUND_OPEN */
  501. case 8: /* ROUND_CLOSE */
  502. case 9: /* SEMICOLON */
  503. case 10: /* ARROW */
  504. case 11: /* IF */
  505. case 12: /* FOREACH */
  506. case 13: /* AS */
  507. case 14: /* COLON */
  508. case 15: /* ELIF */
  509. case 16: /* ELSE */
  510. case 17: /* BLOCK */
  511. case 18: /* DOT */
  512. case 19: /* COMMA */
  513. case 20: /* BRACKET_OPEN */
  514. case 21: /* BRACKET_CLOSE */
  515. case 22: /* AT_SIGN */
  516. case 23: /* CARET */
  517. case 24: /* PROCESS */
  518. case 25: /* TEMPLATE */
  519. {
  520. #line 89 "NCDConfigParser_parse.y"
  521. free_token((yypminor->yy0));
  522. #line 551 "NCDConfigParser_parse.c"
  523. }
  524. break;
  525. case 27: /* processes */
  526. {
  527. #line 110 "NCDConfigParser_parse.y"
  528. (void)parser_out; free_program((yypminor->yy84));
  529. #line 558 "NCDConfigParser_parse.c"
  530. }
  531. break;
  532. case 28: /* statement */
  533. {
  534. #line 111 "NCDConfigParser_parse.y"
  535. free_statement((yypminor->yy89));
  536. #line 565 "NCDConfigParser_parse.c"
  537. }
  538. break;
  539. case 29: /* elif_maybe */
  540. case 30: /* elif */
  541. {
  542. #line 112 "NCDConfigParser_parse.y"
  543. free_ifblock((yypminor->yy86));
  544. #line 573 "NCDConfigParser_parse.c"
  545. }
  546. break;
  547. case 31: /* else_maybe */
  548. case 32: /* statements */
  549. {
  550. #line 114 "NCDConfigParser_parse.y"
  551. free_block((yypminor->yy57));
  552. #line 581 "NCDConfigParser_parse.c"
  553. }
  554. break;
  555. case 33: /* dotted_name */
  556. case 41: /* name_maybe */
  557. {
  558. #line 116 "NCDConfigParser_parse.y"
  559. free((yypminor->yy13));
  560. #line 589 "NCDConfigParser_parse.c"
  561. }
  562. break;
  563. case 34: /* statement_args_maybe */
  564. case 35: /* list_contents */
  565. case 36: /* list */
  566. case 37: /* map_contents */
  567. case 38: /* map */
  568. case 39: /* invoc */
  569. case 40: /* value */
  570. case 43: /* name_list */
  571. {
  572. #line 117 "NCDConfigParser_parse.y"
  573. free_value((yypminor->yy61));
  574. #line 603 "NCDConfigParser_parse.c"
  575. }
  576. break;
  577. default: break; /* If no destructor action specified: do nothing */
  578. }
  579. }
  580. /*
  581. ** Pop the parser's stack once.
  582. **
  583. ** If there is a destructor routine associated with the token which
  584. ** is popped from the stack, then call it.
  585. **
  586. ** Return the major token number for the symbol popped.
  587. */
  588. static int yy_pop_parser_stack(yyParser *pParser){
  589. YYCODETYPE yymajor;
  590. yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];
  591. if( pParser->yyidx<0 ) return 0;
  592. #ifndef NDEBUG
  593. if( yyTraceFILE && pParser->yyidx>=0 ){
  594. fprintf(yyTraceFILE,"%sPopping %s\n",
  595. yyTracePrompt,
  596. yyTokenName[yytos->major]);
  597. }
  598. #endif
  599. yymajor = yytos->major;
  600. yy_destructor(pParser, yymajor, &yytos->minor);
  601. pParser->yyidx--;
  602. return yymajor;
  603. }
  604. /*
  605. ** Deallocate and destroy a parser. Destructors are all called for
  606. ** all stack elements before shutting the parser down.
  607. **
  608. ** Inputs:
  609. ** <ul>
  610. ** <li> A pointer to the parser. This should be a pointer
  611. ** obtained from ParseAlloc.
  612. ** <li> A pointer to a function used to reclaim memory obtained
  613. ** from malloc.
  614. ** </ul>
  615. */
  616. void ParseFree(
  617. void *p, /* The parser to be deleted */
  618. void (*freeProc)(void*) /* Function used to reclaim memory */
  619. ){
  620. yyParser *pParser = (yyParser*)p;
  621. if( pParser==0 ) return;
  622. while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
  623. #if YYSTACKDEPTH<=0
  624. free(pParser->yystack);
  625. #endif
  626. (*freeProc)((void*)pParser);
  627. }
  628. /*
  629. ** Return the peak depth of the stack for a parser.
  630. */
  631. #ifdef YYTRACKMAXSTACKDEPTH
  632. int ParseStackPeak(void *p){
  633. yyParser *pParser = (yyParser*)p;
  634. return pParser->yyidxMax;
  635. }
  636. #endif
  637. /*
  638. ** Find the appropriate action for a parser given the terminal
  639. ** look-ahead token iLookAhead.
  640. **
  641. ** If the look-ahead token is YYNOCODE, then check to see if the action is
  642. ** independent of the look-ahead. If it is, return the action, otherwise
  643. ** return YY_NO_ACTION.
  644. */
  645. static int yy_find_shift_action(
  646. yyParser *pParser, /* The parser */
  647. YYCODETYPE iLookAhead /* The look-ahead token */
  648. ){
  649. int i;
  650. int stateno = pParser->yystack[pParser->yyidx].stateno;
  651. if( stateno>YY_SHIFT_MAX || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){
  652. return yy_default[stateno];
  653. }
  654. assert( iLookAhead!=YYNOCODE );
  655. i += iLookAhead;
  656. if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
  657. if( iLookAhead>0 ){
  658. #ifdef YYFALLBACK
  659. YYCODETYPE iFallback; /* Fallback token */
  660. if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
  661. && (iFallback = yyFallback[iLookAhead])!=0 ){
  662. #ifndef NDEBUG
  663. if( yyTraceFILE ){
  664. fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
  665. yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
  666. }
  667. #endif
  668. return yy_find_shift_action(pParser, iFallback);
  669. }
  670. #endif
  671. #ifdef YYWILDCARD
  672. {
  673. int j = i - iLookAhead + YYWILDCARD;
  674. if( j>=0 && j<YY_SZ_ACTTAB && yy_lookahead[j]==YYWILDCARD ){
  675. #ifndef NDEBUG
  676. if( yyTraceFILE ){
  677. fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
  678. yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]);
  679. }
  680. #endif /* NDEBUG */
  681. return yy_action[j];
  682. }
  683. }
  684. #endif /* YYWILDCARD */
  685. }
  686. return yy_default[stateno];
  687. }else{
  688. return yy_action[i];
  689. }
  690. }
  691. /*
  692. ** Find the appropriate action for a parser given the non-terminal
  693. ** look-ahead token iLookAhead.
  694. **
  695. ** If the look-ahead token is YYNOCODE, then check to see if the action is
  696. ** independent of the look-ahead. If it is, return the action, otherwise
  697. ** return YY_NO_ACTION.
  698. */
  699. static int yy_find_reduce_action(
  700. int stateno, /* Current state number */
  701. YYCODETYPE iLookAhead /* The look-ahead token */
  702. ){
  703. int i;
  704. #ifdef YYERRORSYMBOL
  705. if( stateno>YY_REDUCE_MAX ){
  706. return yy_default[stateno];
  707. }
  708. #else
  709. assert( stateno<=YY_REDUCE_MAX );
  710. #endif
  711. i = yy_reduce_ofst[stateno];
  712. assert( i!=YY_REDUCE_USE_DFLT );
  713. assert( iLookAhead!=YYNOCODE );
  714. i += iLookAhead;
  715. #ifdef YYERRORSYMBOL
  716. if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
  717. return yy_default[stateno];
  718. }
  719. #else
  720. assert( i>=0 && i<YY_SZ_ACTTAB );
  721. assert( yy_lookahead[i]==iLookAhead );
  722. #endif
  723. return yy_action[i];
  724. }
  725. /*
  726. ** The following routine is called if the stack overflows.
  727. */
  728. static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
  729. ParseARG_FETCH;
  730. yypParser->yyidx--;
  731. #ifndef NDEBUG
  732. if( yyTraceFILE ){
  733. fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
  734. }
  735. #endif
  736. while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
  737. /* Here code is inserted which will execute if the parser
  738. ** stack every overflows */
  739. #line 134 "NCDConfigParser_parse.y"
  740. if (yypMinor) {
  741. free_token(yypMinor->yy0);
  742. }
  743. #line 781 "NCDConfigParser_parse.c"
  744. ParseARG_STORE; /* Suppress warning about unused %extra_argument var */
  745. }
  746. /*
  747. ** Perform a shift action.
  748. */
  749. static void yy_shift(
  750. yyParser *yypParser, /* The parser to be shifted */
  751. int yyNewState, /* The new state to shift in */
  752. int yyMajor, /* The major token to shift in */
  753. YYMINORTYPE *yypMinor /* Pointer to the minor token to shift in */
  754. ){
  755. yyStackEntry *yytos;
  756. yypParser->yyidx++;
  757. #ifdef YYTRACKMAXSTACKDEPTH
  758. if( yypParser->yyidx>yypParser->yyidxMax ){
  759. yypParser->yyidxMax = yypParser->yyidx;
  760. }
  761. #endif
  762. #if YYSTACKDEPTH>0
  763. if( yypParser->yyidx>=YYSTACKDEPTH ){
  764. yyStackOverflow(yypParser, yypMinor);
  765. return;
  766. }
  767. #else
  768. if( yypParser->yyidx>=yypParser->yystksz ){
  769. yyGrowStack(yypParser);
  770. if( yypParser->yyidx>=yypParser->yystksz ){
  771. yyStackOverflow(yypParser, yypMinor);
  772. return;
  773. }
  774. }
  775. #endif
  776. yytos = &yypParser->yystack[yypParser->yyidx];
  777. yytos->stateno = (YYACTIONTYPE)yyNewState;
  778. yytos->major = (YYCODETYPE)yyMajor;
  779. yytos->minor = *yypMinor;
  780. #ifndef NDEBUG
  781. if( yyTraceFILE && yypParser->yyidx>0 ){
  782. int i;
  783. fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState);
  784. fprintf(yyTraceFILE,"%sStack:",yyTracePrompt);
  785. for(i=1; i<=yypParser->yyidx; i++)
  786. fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]);
  787. fprintf(yyTraceFILE,"\n");
  788. }
  789. #endif
  790. }
  791. /* The following table contains information about every rule that
  792. ** is used during the reduce.
  793. */
  794. static const struct {
  795. YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
  796. unsigned char nrhs; /* Number of right-hand side symbols in the rule */
  797. } yyRuleInfo[] = {
  798. { 44, 1 },
  799. { 27, 0 },
  800. { 27, 3 },
  801. { 27, 3 },
  802. { 27, 6 },
  803. { 28, 6 },
  804. { 28, 8 },
  805. { 28, 11 },
  806. { 28, 11 },
  807. { 28, 13 },
  808. { 29, 0 },
  809. { 29, 1 },
  810. { 30, 7 },
  811. { 30, 8 },
  812. { 31, 0 },
  813. { 31, 4 },
  814. { 28, 6 },
  815. { 32, 1 },
  816. { 32, 2 },
  817. { 33, 1 },
  818. { 33, 3 },
  819. { 43, 1 },
  820. { 43, 3 },
  821. { 34, 0 },
  822. { 34, 1 },
  823. { 35, 1 },
  824. { 35, 3 },
  825. { 36, 2 },
  826. { 36, 3 },
  827. { 37, 3 },
  828. { 37, 5 },
  829. { 38, 2 },
  830. { 38, 3 },
  831. { 39, 4 },
  832. { 40, 1 },
  833. { 40, 2 },
  834. { 40, 2 },
  835. { 40, 1 },
  836. { 40, 1 },
  837. { 40, 1 },
  838. { 40, 3 },
  839. { 40, 1 },
  840. { 41, 0 },
  841. { 41, 1 },
  842. { 42, 1 },
  843. { 42, 1 },
  844. };
  845. static void yy_accept(yyParser*); /* Forward Declaration */
  846. /*
  847. ** Perform a reduce action and the shift that must immediately
  848. ** follow the reduce.
  849. */
  850. static void yy_reduce(
  851. yyParser *yypParser, /* The parser */
  852. int yyruleno /* Number of the rule by which to reduce */
  853. ){
  854. int yygoto; /* The next state */
  855. int yyact; /* The next action */
  856. YYMINORTYPE yygotominor; /* The LHS of the rule reduced */
  857. yyStackEntry *yymsp; /* The top of the parser's stack */
  858. int yysize; /* Amount to pop the stack */
  859. ParseARG_FETCH;
  860. yymsp = &yypParser->yystack[yypParser->yyidx];
  861. #ifndef NDEBUG
  862. if( yyTraceFILE && yyruleno>=0
  863. && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
  864. fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
  865. yyRuleName[yyruleno]);
  866. }
  867. #endif /* NDEBUG */
  868. /* Silence complaints from purify about yygotominor being uninitialized
  869. ** in some cases when it is copied into the stack after the following
  870. ** switch. yygotominor is uninitialized when a rule reduces that does
  871. ** not set the value of its left-hand side nonterminal. Leaving the
  872. ** value of the nonterminal uninitialized is utterly harmless as long
  873. ** as the value is never used. So really the only thing this code
  874. ** accomplishes is to quieten purify.
  875. **
  876. ** 2007-01-16: The wireshark project (www.wireshark.org) reports that
  877. ** without this code, their parser segfaults. I'm not sure what there
  878. ** parser is doing to make this happen. This is the second bug report
  879. ** from wireshark this week. Clearly they are stressing Lemon in ways
  880. ** that it has not been previously stressed... (SQLite ticket #2172)
  881. */
  882. /*memset(&yygotominor, 0, sizeof(yygotominor));*/
  883. yygotominor = yyzerominor;
  884. switch( yyruleno ){
  885. /* Beginning here are the reduction cases. A typical example
  886. ** follows:
  887. ** case 0:
  888. ** #line <lineno> <grammarfile>
  889. ** { ... } // User supplied code
  890. ** #line <lineno> <thisfile>
  891. ** break;
  892. */
  893. case 0: /* input ::= processes */
  894. #line 140 "NCDConfigParser_parse.y"
  895. {
  896. ASSERT(!parser_out->have_ast)
  897. if (yymsp[0].minor.yy84.have) {
  898. parser_out->have_ast = 1;
  899. parser_out->ast = yymsp[0].minor.yy84.v;
  900. }
  901. }
  902. #line 948 "NCDConfigParser_parse.c"
  903. break;
  904. case 1: /* processes ::= */
  905. #line 149 "NCDConfigParser_parse.y"
  906. {
  907. NCDProgram prog;
  908. NCDProgram_Init(&prog);
  909. yygotominor.yy84.have = 1;
  910. yygotominor.yy84.v = prog;
  911. }
  912. #line 959 "NCDConfigParser_parse.c"
  913. break;
  914. case 2: /* processes ::= INCLUDE STRING processes */
  915. #line 157 "NCDConfigParser_parse.y"
  916. {
  917. ASSERT(yymsp[-1].minor.yy0.str)
  918. if (!yymsp[0].minor.yy84.have) {
  919. goto failA0;
  920. }
  921. NCDProgramElem elem;
  922. if (!NCDProgramElem_InitInclude(&elem, yymsp[-1].minor.yy0.str, yymsp[-1].minor.yy0.len)) {
  923. goto failA0;
  924. }
  925. if (!NCDProgram_PrependElem(&yymsp[0].minor.yy84.v, elem)) {
  926. goto failA1;
  927. }
  928. yygotominor.yy84.have = 1;
  929. yygotominor.yy84.v = yymsp[0].minor.yy84.v;
  930. yymsp[0].minor.yy84.have = 0;
  931. goto doneA;
  932. failA1:
  933. NCDProgramElem_Free(&elem);
  934. failA0:
  935. yygotominor.yy84.have = 0;
  936. parser_out->out_of_memory = 1;
  937. doneA:
  938. free_token(yymsp[-1].minor.yy0);
  939. free_program(yymsp[0].minor.yy84);
  940. yy_destructor(yypParser,1,&yymsp[-2].minor);
  941. }
  942. #line 993 "NCDConfigParser_parse.c"
  943. break;
  944. case 3: /* processes ::= INCLUDE_GUARD STRING processes */
  945. #line 187 "NCDConfigParser_parse.y"
  946. {
  947. ASSERT(yymsp[-1].minor.yy0.str)
  948. if (!yymsp[0].minor.yy84.have) {
  949. goto failZ0;
  950. }
  951. NCDProgramElem elem;
  952. if (!NCDProgramElem_InitIncludeGuard(&elem, yymsp[-1].minor.yy0.str, yymsp[-1].minor.yy0.len)) {
  953. goto failZ0;
  954. }
  955. if (!NCDProgram_PrependElem(&yymsp[0].minor.yy84.v, elem)) {
  956. goto failZ1;
  957. }
  958. yygotominor.yy84.have = 1;
  959. yygotominor.yy84.v = yymsp[0].minor.yy84.v;
  960. yymsp[0].minor.yy84.have = 0;
  961. goto doneZ;
  962. failZ1:
  963. NCDProgramElem_Free(&elem);
  964. failZ0:
  965. yygotominor.yy84.have = 0;
  966. parser_out->out_of_memory = 1;
  967. doneZ:
  968. free_token(yymsp[-1].minor.yy0);
  969. free_program(yymsp[0].minor.yy84);
  970. yy_destructor(yypParser,3,&yymsp[-2].minor);
  971. }
  972. #line 1027 "NCDConfigParser_parse.c"
  973. break;
  974. case 4: /* processes ::= process_or_template NAME CURLY_OPEN statements CURLY_CLOSE processes */
  975. #line 217 "NCDConfigParser_parse.y"
  976. {
  977. ASSERT(yymsp[-4].minor.yy0.str)
  978. if (!yymsp[-2].minor.yy57.have || !yymsp[0].minor.yy84.have) {
  979. goto failB0;
  980. }
  981. NCDProcess proc;
  982. if (!NCDProcess_Init(&proc, yymsp[-5].minor.yy22, yymsp[-4].minor.yy0.str, yymsp[-2].minor.yy57.v)) {
  983. goto failB0;
  984. }
  985. yymsp[-2].minor.yy57.have = 0;
  986. NCDProgramElem elem;
  987. NCDProgramElem_InitProcess(&elem, proc);
  988. if (!NCDProgram_PrependElem(&yymsp[0].minor.yy84.v, elem)) {
  989. goto failB1;
  990. }
  991. yygotominor.yy84.have = 1;
  992. yygotominor.yy84.v = yymsp[0].minor.yy84.v;
  993. yymsp[0].minor.yy84.have = 0;
  994. goto doneB;
  995. failB1:
  996. NCDProgramElem_Free(&elem);
  997. failB0:
  998. yygotominor.yy84.have = 0;
  999. parser_out->out_of_memory = 1;
  1000. doneB:
  1001. free_token(yymsp[-4].minor.yy0);
  1002. free_block(yymsp[-2].minor.yy57);
  1003. free_program(yymsp[0].minor.yy84);
  1004. yy_destructor(yypParser,5,&yymsp[-3].minor);
  1005. yy_destructor(yypParser,6,&yymsp[-1].minor);
  1006. }
  1007. #line 1067 "NCDConfigParser_parse.c"
  1008. break;
  1009. case 5: /* statement ::= dotted_name ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON */
  1010. #line 252 "NCDConfigParser_parse.y"
  1011. {
  1012. if (!yymsp[-5].minor.yy13 || !yymsp[-3].minor.yy61.have) {
  1013. goto failC0;
  1014. }
  1015. if (!NCDStatement_InitReg(&yygotominor.yy89.v, yymsp[-1].minor.yy13, NULL, yymsp[-5].minor.yy13, yymsp[-3].minor.yy61.v)) {
  1016. goto failC0;
  1017. }
  1018. yymsp[-3].minor.yy61.have = 0;
  1019. yygotominor.yy89.have = 1;
  1020. goto doneC;
  1021. failC0:
  1022. yygotominor.yy89.have = 0;
  1023. parser_out->out_of_memory = 1;
  1024. doneC:
  1025. free(yymsp[-5].minor.yy13);
  1026. free_value(yymsp[-3].minor.yy61);
  1027. free(yymsp[-1].minor.yy13);
  1028. yy_destructor(yypParser,7,&yymsp[-4].minor);
  1029. yy_destructor(yypParser,8,&yymsp[-2].minor);
  1030. yy_destructor(yypParser,9,&yymsp[0].minor);
  1031. }
  1032. #line 1095 "NCDConfigParser_parse.c"
  1033. break;
  1034. case 6: /* statement ::= dotted_name ARROW dotted_name ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON */
  1035. #line 274 "NCDConfigParser_parse.y"
  1036. {
  1037. if (!yymsp[-7].minor.yy13 || !yymsp[-5].minor.yy13 || !yymsp[-3].minor.yy61.have) {
  1038. goto failD0;
  1039. }
  1040. if (!NCDStatement_InitReg(&yygotominor.yy89.v, yymsp[-1].minor.yy13, yymsp[-7].minor.yy13, yymsp[-5].minor.yy13, yymsp[-3].minor.yy61.v)) {
  1041. goto failD0;
  1042. }
  1043. yymsp[-3].minor.yy61.have = 0;
  1044. yygotominor.yy89.have = 1;
  1045. goto doneD;
  1046. failD0:
  1047. yygotominor.yy89.have = 0;
  1048. parser_out->out_of_memory = 1;
  1049. doneD:
  1050. free(yymsp[-7].minor.yy13);
  1051. free(yymsp[-5].minor.yy13);
  1052. free_value(yymsp[-3].minor.yy61);
  1053. free(yymsp[-1].minor.yy13);
  1054. yy_destructor(yypParser,10,&yymsp[-6].minor);
  1055. yy_destructor(yypParser,7,&yymsp[-4].minor);
  1056. yy_destructor(yypParser,8,&yymsp[-2].minor);
  1057. yy_destructor(yypParser,9,&yymsp[0].minor);
  1058. }
  1059. #line 1125 "NCDConfigParser_parse.c"
  1060. break;
  1061. case 7: /* statement ::= IF ROUND_OPEN value ROUND_CLOSE CURLY_OPEN statements CURLY_CLOSE elif_maybe else_maybe name_maybe SEMICOLON */
  1062. #line 297 "NCDConfigParser_parse.y"
  1063. {
  1064. if (!yymsp[-8].minor.yy61.have || !yymsp[-5].minor.yy57.have || !yymsp[-3].minor.yy86.have) {
  1065. goto failE0;
  1066. }
  1067. NCDIf ifc;
  1068. NCDIf_Init(&ifc, yymsp[-8].minor.yy61.v, yymsp[-5].minor.yy57.v);
  1069. yymsp[-8].minor.yy61.have = 0;
  1070. yymsp[-5].minor.yy57.have = 0;
  1071. if (!NCDIfBlock_PrependIf(&yymsp[-3].minor.yy86.v, ifc)) {
  1072. NCDIf_Free(&ifc);
  1073. goto failE0;
  1074. }
  1075. if (!NCDStatement_InitIf(&yygotominor.yy89.v, yymsp[-1].minor.yy13, yymsp[-3].minor.yy86.v)) {
  1076. goto failE0;
  1077. }
  1078. yymsp[-3].minor.yy86.have = 0;
  1079. if (yymsp[-2].minor.yy57.have) {
  1080. NCDStatement_IfAddElse(&yygotominor.yy89.v, yymsp[-2].minor.yy57.v);
  1081. yymsp[-2].minor.yy57.have = 0;
  1082. }
  1083. yygotominor.yy89.have = 1;
  1084. goto doneE;
  1085. failE0:
  1086. yygotominor.yy89.have = 0;
  1087. parser_out->out_of_memory = 1;
  1088. doneE:
  1089. free_value(yymsp[-8].minor.yy61);
  1090. free_block(yymsp[-5].minor.yy57);
  1091. free_ifblock(yymsp[-3].minor.yy86);
  1092. free_block(yymsp[-2].minor.yy57);
  1093. free(yymsp[-1].minor.yy13);
  1094. yy_destructor(yypParser,11,&yymsp[-10].minor);
  1095. yy_destructor(yypParser,7,&yymsp[-9].minor);
  1096. yy_destructor(yypParser,8,&yymsp[-7].minor);
  1097. yy_destructor(yypParser,5,&yymsp[-6].minor);
  1098. yy_destructor(yypParser,6,&yymsp[-4].minor);
  1099. yy_destructor(yypParser,9,&yymsp[0].minor);
  1100. }
  1101. #line 1173 "NCDConfigParser_parse.c"
  1102. break;
  1103. case 8: /* statement ::= FOREACH ROUND_OPEN value AS NAME ROUND_CLOSE CURLY_OPEN statements CURLY_CLOSE name_maybe SEMICOLON */
  1104. #line 336 "NCDConfigParser_parse.y"
  1105. {
  1106. if (!yymsp[-8].minor.yy61.have || !yymsp[-6].minor.yy0.str || !yymsp[-3].minor.yy57.have) {
  1107. goto failEA0;
  1108. }
  1109. if (!NCDStatement_InitForeach(&yygotominor.yy89.v, yymsp[-1].minor.yy13, yymsp[-8].minor.yy61.v, yymsp[-6].minor.yy0.str, NULL, yymsp[-3].minor.yy57.v)) {
  1110. goto failEA0;
  1111. }
  1112. yymsp[-8].minor.yy61.have = 0;
  1113. yymsp[-3].minor.yy57.have = 0;
  1114. yygotominor.yy89.have = 1;
  1115. goto doneEA0;
  1116. failEA0:
  1117. yygotominor.yy89.have = 0;
  1118. parser_out->out_of_memory = 1;
  1119. doneEA0:
  1120. free_value(yymsp[-8].minor.yy61);
  1121. free_token(yymsp[-6].minor.yy0);
  1122. free_block(yymsp[-3].minor.yy57);
  1123. free(yymsp[-1].minor.yy13);
  1124. yy_destructor(yypParser,12,&yymsp[-10].minor);
  1125. yy_destructor(yypParser,7,&yymsp[-9].minor);
  1126. yy_destructor(yypParser,13,&yymsp[-7].minor);
  1127. yy_destructor(yypParser,8,&yymsp[-5].minor);
  1128. yy_destructor(yypParser,5,&yymsp[-4].minor);
  1129. yy_destructor(yypParser,6,&yymsp[-2].minor);
  1130. yy_destructor(yypParser,9,&yymsp[0].minor);
  1131. }
  1132. #line 1207 "NCDConfigParser_parse.c"
  1133. break;
  1134. case 9: /* statement ::= FOREACH ROUND_OPEN value AS NAME COLON NAME ROUND_CLOSE CURLY_OPEN statements CURLY_CLOSE name_maybe SEMICOLON */
  1135. #line 360 "NCDConfigParser_parse.y"
  1136. {
  1137. if (!yymsp[-10].minor.yy61.have || !yymsp[-8].minor.yy0.str || !yymsp[-6].minor.yy0.str || !yymsp[-3].minor.yy57.have) {
  1138. goto failEB0;
  1139. }
  1140. if (!NCDStatement_InitForeach(&yygotominor.yy89.v, yymsp[-1].minor.yy13, yymsp[-10].minor.yy61.v, yymsp[-8].minor.yy0.str, yymsp[-6].minor.yy0.str, yymsp[-3].minor.yy57.v)) {
  1141. goto failEB0;
  1142. }
  1143. yymsp[-10].minor.yy61.have = 0;
  1144. yymsp[-3].minor.yy57.have = 0;
  1145. yygotominor.yy89.have = 1;
  1146. goto doneEB0;
  1147. failEB0:
  1148. yygotominor.yy89.have = 0;
  1149. parser_out->out_of_memory = 1;
  1150. doneEB0:
  1151. free_value(yymsp[-10].minor.yy61);
  1152. free_token(yymsp[-8].minor.yy0);
  1153. free_token(yymsp[-6].minor.yy0);
  1154. free_block(yymsp[-3].minor.yy57);
  1155. free(yymsp[-1].minor.yy13);
  1156. yy_destructor(yypParser,12,&yymsp[-12].minor);
  1157. yy_destructor(yypParser,7,&yymsp[-11].minor);
  1158. yy_destructor(yypParser,13,&yymsp[-9].minor);
  1159. yy_destructor(yypParser,14,&yymsp[-7].minor);
  1160. yy_destructor(yypParser,8,&yymsp[-5].minor);
  1161. yy_destructor(yypParser,5,&yymsp[-4].minor);
  1162. yy_destructor(yypParser,6,&yymsp[-2].minor);
  1163. yy_destructor(yypParser,9,&yymsp[0].minor);
  1164. }
  1165. #line 1243 "NCDConfigParser_parse.c"
  1166. break;
  1167. case 10: /* elif_maybe ::= */
  1168. #line 385 "NCDConfigParser_parse.y"
  1169. {
  1170. NCDIfBlock_Init(&yygotominor.yy86.v);
  1171. yygotominor.yy86.have = 1;
  1172. }
  1173. #line 1251 "NCDConfigParser_parse.c"
  1174. break;
  1175. case 11: /* elif_maybe ::= elif */
  1176. #line 390 "NCDConfigParser_parse.y"
  1177. {
  1178. yygotominor.yy86 = yymsp[0].minor.yy86;
  1179. }
  1180. #line 1258 "NCDConfigParser_parse.c"
  1181. break;
  1182. case 12: /* elif ::= ELIF ROUND_OPEN value ROUND_CLOSE CURLY_OPEN statements CURLY_CLOSE */
  1183. #line 394 "NCDConfigParser_parse.y"
  1184. {
  1185. if (!yymsp[-4].minor.yy61.have || !yymsp[-1].minor.yy57.have) {
  1186. goto failF0;
  1187. }
  1188. NCDIfBlock_Init(&yygotominor.yy86.v);
  1189. NCDIf ifc;
  1190. NCDIf_Init(&ifc, yymsp[-4].minor.yy61.v, yymsp[-1].minor.yy57.v);
  1191. yymsp[-4].minor.yy61.have = 0;
  1192. yymsp[-1].minor.yy57.have = 0;
  1193. if (!NCDIfBlock_PrependIf(&yygotominor.yy86.v, ifc)) {
  1194. goto failF1;
  1195. }
  1196. yygotominor.yy86.have = 1;
  1197. goto doneF0;
  1198. failF1:
  1199. NCDIf_Free(&ifc);
  1200. NCDIfBlock_Free(&yygotominor.yy86.v);
  1201. failF0:
  1202. yygotominor.yy86.have = 0;
  1203. parser_out->out_of_memory = 1;
  1204. doneF0:
  1205. free_value(yymsp[-4].minor.yy61);
  1206. free_block(yymsp[-1].minor.yy57);
  1207. yy_destructor(yypParser,15,&yymsp[-6].minor);
  1208. yy_destructor(yypParser,7,&yymsp[-5].minor);
  1209. yy_destructor(yypParser,8,&yymsp[-3].minor);
  1210. yy_destructor(yypParser,5,&yymsp[-2].minor);
  1211. yy_destructor(yypParser,6,&yymsp[0].minor);
  1212. }
  1213. #line 1296 "NCDConfigParser_parse.c"
  1214. break;
  1215. case 13: /* elif ::= ELIF ROUND_OPEN value ROUND_CLOSE CURLY_OPEN statements CURLY_CLOSE elif */
  1216. #line 424 "NCDConfigParser_parse.y"
  1217. {
  1218. if (!yymsp[-5].minor.yy61.have || !yymsp[-2].minor.yy57.have || !yymsp[0].minor.yy86.have) {
  1219. goto failG0;
  1220. }
  1221. NCDIf ifc;
  1222. NCDIf_Init(&ifc, yymsp[-5].minor.yy61.v, yymsp[-2].minor.yy57.v);
  1223. yymsp[-5].minor.yy61.have = 0;
  1224. yymsp[-2].minor.yy57.have = 0;
  1225. if (!NCDIfBlock_PrependIf(&yymsp[0].minor.yy86.v, ifc)) {
  1226. goto failG1;
  1227. }
  1228. yygotominor.yy86.have = 1;
  1229. yygotominor.yy86.v = yymsp[0].minor.yy86.v;
  1230. yymsp[0].minor.yy86.have = 0;
  1231. goto doneG0;
  1232. failG1:
  1233. NCDIf_Free(&ifc);
  1234. failG0:
  1235. yygotominor.yy86.have = 0;
  1236. parser_out->out_of_memory = 1;
  1237. doneG0:
  1238. free_value(yymsp[-5].minor.yy61);
  1239. free_block(yymsp[-2].minor.yy57);
  1240. free_ifblock(yymsp[0].minor.yy86);
  1241. yy_destructor(yypParser,15,&yymsp[-7].minor);
  1242. yy_destructor(yypParser,7,&yymsp[-6].minor);
  1243. yy_destructor(yypParser,8,&yymsp[-4].minor);
  1244. yy_destructor(yypParser,5,&yymsp[-3].minor);
  1245. yy_destructor(yypParser,6,&yymsp[-1].minor);
  1246. }
  1247. #line 1334 "NCDConfigParser_parse.c"
  1248. break;
  1249. case 14: /* else_maybe ::= */
  1250. #line 454 "NCDConfigParser_parse.y"
  1251. {
  1252. yygotominor.yy57.have = 0;
  1253. }
  1254. #line 1341 "NCDConfigParser_parse.c"
  1255. break;
  1256. case 15: /* else_maybe ::= ELSE CURLY_OPEN statements CURLY_CLOSE */
  1257. #line 458 "NCDConfigParser_parse.y"
  1258. {
  1259. yygotominor.yy57 = yymsp[-1].minor.yy57;
  1260. yy_destructor(yypParser,16,&yymsp[-3].minor);
  1261. yy_destructor(yypParser,5,&yymsp[-2].minor);
  1262. yy_destructor(yypParser,6,&yymsp[0].minor);
  1263. }
  1264. #line 1351 "NCDConfigParser_parse.c"
  1265. break;
  1266. case 16: /* statement ::= BLOCK CURLY_OPEN statements CURLY_CLOSE name_maybe SEMICOLON */
  1267. #line 462 "NCDConfigParser_parse.y"
  1268. {
  1269. if (!yymsp[-3].minor.yy57.have) {
  1270. goto failGA0;
  1271. }
  1272. if (!NCDStatement_InitBlock(&yygotominor.yy89.v, yymsp[-1].minor.yy13, yymsp[-3].minor.yy57.v)) {
  1273. goto failGA0;
  1274. }
  1275. yymsp[-3].minor.yy57.have = 0;
  1276. yygotominor.yy89.have = 1;
  1277. goto doneGA0;
  1278. failGA0:
  1279. yygotominor.yy89.have = 0;
  1280. parser_out->out_of_memory = 1;
  1281. doneGA0:
  1282. free_block(yymsp[-3].minor.yy57);
  1283. free(yymsp[-1].minor.yy13);
  1284. yy_destructor(yypParser,17,&yymsp[-5].minor);
  1285. yy_destructor(yypParser,5,&yymsp[-4].minor);
  1286. yy_destructor(yypParser,6,&yymsp[-2].minor);
  1287. yy_destructor(yypParser,9,&yymsp[0].minor);
  1288. }
  1289. #line 1379 "NCDConfigParser_parse.c"
  1290. break;
  1291. case 17: /* statements ::= statement */
  1292. #line 483 "NCDConfigParser_parse.y"
  1293. {
  1294. if (!yymsp[0].minor.yy89.have) {
  1295. goto failH0;
  1296. }
  1297. NCDBlock_Init(&yygotominor.yy57.v);
  1298. if (!NCDBlock_PrependStatement(&yygotominor.yy57.v, yymsp[0].minor.yy89.v)) {
  1299. goto failH1;
  1300. }
  1301. yymsp[0].minor.yy89.have = 0;
  1302. yygotominor.yy57.have = 1;
  1303. goto doneH;
  1304. failH1:
  1305. NCDBlock_Free(&yygotominor.yy57.v);
  1306. failH0:
  1307. yygotominor.yy57.have = 0;
  1308. parser_out->out_of_memory = 1;
  1309. doneH:
  1310. free_statement(yymsp[0].minor.yy89);
  1311. }
  1312. #line 1406 "NCDConfigParser_parse.c"
  1313. break;
  1314. case 18: /* statements ::= statement statements */
  1315. #line 507 "NCDConfigParser_parse.y"
  1316. {
  1317. if (!yymsp[-1].minor.yy89.have || !yymsp[0].minor.yy57.have) {
  1318. goto failI0;
  1319. }
  1320. if (!NCDBlock_PrependStatement(&yymsp[0].minor.yy57.v, yymsp[-1].minor.yy89.v)) {
  1321. goto failI1;
  1322. }
  1323. yymsp[-1].minor.yy89.have = 0;
  1324. yygotominor.yy57.have = 1;
  1325. yygotominor.yy57.v = yymsp[0].minor.yy57.v;
  1326. yymsp[0].minor.yy57.have = 0;
  1327. goto doneI;
  1328. failI1:
  1329. NCDBlock_Free(&yygotominor.yy57.v);
  1330. failI0:
  1331. yygotominor.yy57.have = 0;
  1332. parser_out->out_of_memory = 1;
  1333. doneI:
  1334. free_statement(yymsp[-1].minor.yy89);
  1335. free_block(yymsp[0].minor.yy57);
  1336. }
  1337. #line 1434 "NCDConfigParser_parse.c"
  1338. break;
  1339. case 19: /* dotted_name ::= NAME */
  1340. case 43: /* name_maybe ::= NAME */ yytestcase(yyruleno==43);
  1341. #line 532 "NCDConfigParser_parse.y"
  1342. {
  1343. ASSERT(yymsp[0].minor.yy0.str)
  1344. yygotominor.yy13 = yymsp[0].minor.yy0.str;
  1345. }
  1346. #line 1444 "NCDConfigParser_parse.c"
  1347. break;
  1348. case 20: /* dotted_name ::= NAME DOT dotted_name */
  1349. #line 538 "NCDConfigParser_parse.y"
  1350. {
  1351. ASSERT(yymsp[-2].minor.yy0.str)
  1352. if (!yymsp[0].minor.yy13) {
  1353. goto failJ0;
  1354. }
  1355. if (!(yygotominor.yy13 = concat_strings(3, yymsp[-2].minor.yy0.str, ".", yymsp[0].minor.yy13))) {
  1356. goto failJ0;
  1357. }
  1358. goto doneJ;
  1359. failJ0:
  1360. yygotominor.yy13 = NULL;
  1361. parser_out->out_of_memory = 1;
  1362. doneJ:
  1363. free_token(yymsp[-2].minor.yy0);
  1364. free(yymsp[0].minor.yy13);
  1365. yy_destructor(yypParser,18,&yymsp[-1].minor);
  1366. }
  1367. #line 1468 "NCDConfigParser_parse.c"
  1368. break;
  1369. case 21: /* name_list ::= NAME */
  1370. #line 558 "NCDConfigParser_parse.y"
  1371. {
  1372. if (!yymsp[0].minor.yy0.str) {
  1373. goto failK0;
  1374. }
  1375. NCDValue_InitList(&yygotominor.yy61.v);
  1376. NCDValue this_string;
  1377. if (!NCDValue_InitString(&this_string, yymsp[0].minor.yy0.str)) {
  1378. goto failK1;
  1379. }
  1380. if (!NCDValue_ListPrepend(&yygotominor.yy61.v, this_string)) {
  1381. goto failK2;
  1382. }
  1383. yygotominor.yy61.have = 1;
  1384. goto doneK;
  1385. failK2:
  1386. NCDValue_Free(&this_string);
  1387. failK1:
  1388. NCDValue_Free(&yygotominor.yy61.v);
  1389. failK0:
  1390. yygotominor.yy61.have = 0;
  1391. parser_out->out_of_memory = 1;
  1392. doneK:
  1393. free_token(yymsp[0].minor.yy0);
  1394. }
  1395. #line 1501 "NCDConfigParser_parse.c"
  1396. break;
  1397. case 22: /* name_list ::= NAME DOT name_list */
  1398. #line 588 "NCDConfigParser_parse.y"
  1399. {
  1400. if (!yymsp[-2].minor.yy0.str || !yymsp[0].minor.yy61.have) {
  1401. goto failKA0;
  1402. }
  1403. NCDValue this_string;
  1404. if (!NCDValue_InitString(&this_string, yymsp[-2].minor.yy0.str)) {
  1405. goto failKA0;
  1406. }
  1407. if (!NCDValue_ListPrepend(&yymsp[0].minor.yy61.v, this_string)) {
  1408. goto failKA1;
  1409. }
  1410. yygotominor.yy61.have = 1;
  1411. yygotominor.yy61.v = yymsp[0].minor.yy61.v;
  1412. yymsp[0].minor.yy61.have = 0;
  1413. goto doneKA;
  1414. failKA1:
  1415. NCDValue_Free(&this_string);
  1416. failKA0:
  1417. yygotominor.yy61.have = 0;
  1418. parser_out->out_of_memory = 1;
  1419. doneKA:
  1420. free_token(yymsp[-2].minor.yy0);
  1421. free_value(yymsp[0].minor.yy61);
  1422. yy_destructor(yypParser,18,&yymsp[-1].minor);
  1423. }
  1424. #line 1534 "NCDConfigParser_parse.c"
  1425. break;
  1426. case 23: /* statement_args_maybe ::= */
  1427. #line 617 "NCDConfigParser_parse.y"
  1428. {
  1429. yygotominor.yy61.have = 1;
  1430. NCDValue_InitList(&yygotominor.yy61.v);
  1431. }
  1432. #line 1542 "NCDConfigParser_parse.c"
  1433. break;
  1434. case 24: /* statement_args_maybe ::= list_contents */
  1435. case 38: /* value ::= list */ yytestcase(yyruleno==38);
  1436. case 39: /* value ::= map */ yytestcase(yyruleno==39);
  1437. case 41: /* value ::= invoc */ yytestcase(yyruleno==41);
  1438. #line 622 "NCDConfigParser_parse.y"
  1439. {
  1440. yygotominor.yy61 = yymsp[0].minor.yy61;
  1441. }
  1442. #line 1552 "NCDConfigParser_parse.c"
  1443. break;
  1444. case 25: /* list_contents ::= value */
  1445. #line 626 "NCDConfigParser_parse.y"
  1446. {
  1447. if (!yymsp[0].minor.yy61.have) {
  1448. goto failL0;
  1449. }
  1450. NCDValue_InitList(&yygotominor.yy61.v);
  1451. if (!NCDValue_ListPrepend(&yygotominor.yy61.v, yymsp[0].minor.yy61.v)) {
  1452. goto failL1;
  1453. }
  1454. yymsp[0].minor.yy61.have = 0;
  1455. yygotominor.yy61.have = 1;
  1456. goto doneL;
  1457. failL1:
  1458. NCDValue_Free(&yygotominor.yy61.v);
  1459. failL0:
  1460. yygotominor.yy61.have = 0;
  1461. parser_out->out_of_memory = 1;
  1462. doneL:
  1463. free_value(yymsp[0].minor.yy61);
  1464. }
  1465. #line 1579 "NCDConfigParser_parse.c"
  1466. break;
  1467. case 26: /* list_contents ::= value COMMA list_contents */
  1468. #line 650 "NCDConfigParser_parse.y"
  1469. {
  1470. if (!yymsp[-2].minor.yy61.have || !yymsp[0].minor.yy61.have) {
  1471. goto failM0;
  1472. }
  1473. if (!NCDValue_ListPrepend(&yymsp[0].minor.yy61.v, yymsp[-2].minor.yy61.v)) {
  1474. goto failM0;
  1475. }
  1476. yymsp[-2].minor.yy61.have = 0;
  1477. yygotominor.yy61.have = 1;
  1478. yygotominor.yy61.v = yymsp[0].minor.yy61.v;
  1479. yymsp[0].minor.yy61.have = 0;
  1480. goto doneM;
  1481. failM0:
  1482. yygotominor.yy61.have = 0;
  1483. parser_out->out_of_memory = 1;
  1484. doneM:
  1485. free_value(yymsp[-2].minor.yy61);
  1486. free_value(yymsp[0].minor.yy61);
  1487. yy_destructor(yypParser,19,&yymsp[-1].minor);
  1488. }
  1489. #line 1606 "NCDConfigParser_parse.c"
  1490. break;
  1491. case 27: /* list ::= CURLY_OPEN CURLY_CLOSE */
  1492. #line 673 "NCDConfigParser_parse.y"
  1493. {
  1494. yygotominor.yy61.have = 1;
  1495. NCDValue_InitList(&yygotominor.yy61.v);
  1496. yy_destructor(yypParser,5,&yymsp[-1].minor);
  1497. yy_destructor(yypParser,6,&yymsp[0].minor);
  1498. }
  1499. #line 1616 "NCDConfigParser_parse.c"
  1500. break;
  1501. case 28: /* list ::= CURLY_OPEN list_contents CURLY_CLOSE */
  1502. #line 678 "NCDConfigParser_parse.y"
  1503. {
  1504. yygotominor.yy61 = yymsp[-1].minor.yy61;
  1505. yy_destructor(yypParser,5,&yymsp[-2].minor);
  1506. yy_destructor(yypParser,6,&yymsp[0].minor);
  1507. }
  1508. #line 1625 "NCDConfigParser_parse.c"
  1509. break;
  1510. case 29: /* map_contents ::= value COLON value */
  1511. #line 682 "NCDConfigParser_parse.y"
  1512. {
  1513. if (!yymsp[-2].minor.yy61.have || !yymsp[0].minor.yy61.have) {
  1514. goto failS0;
  1515. }
  1516. NCDValue_InitMap(&yygotominor.yy61.v);
  1517. if (!NCDValue_MapPrepend(&yygotominor.yy61.v, yymsp[-2].minor.yy61.v, yymsp[0].minor.yy61.v)) {
  1518. goto failS1;
  1519. }
  1520. yymsp[-2].minor.yy61.have = 0;
  1521. yymsp[0].minor.yy61.have = 0;
  1522. yygotominor.yy61.have = 1;
  1523. goto doneS;
  1524. failS1:
  1525. NCDValue_Free(&yygotominor.yy61.v);
  1526. failS0:
  1527. yygotominor.yy61.have = 0;
  1528. parser_out->out_of_memory = 1;
  1529. doneS:
  1530. free_value(yymsp[-2].minor.yy61);
  1531. free_value(yymsp[0].minor.yy61);
  1532. yy_destructor(yypParser,14,&yymsp[-1].minor);
  1533. }
  1534. #line 1655 "NCDConfigParser_parse.c"
  1535. break;
  1536. case 30: /* map_contents ::= value COLON value COMMA map_contents */
  1537. #line 708 "NCDConfigParser_parse.y"
  1538. {
  1539. if (!yymsp[-4].minor.yy61.have || !yymsp[-2].minor.yy61.have || !yymsp[0].minor.yy61.have) {
  1540. goto failT0;
  1541. }
  1542. if (!NCDValue_MapPrepend(&yymsp[0].minor.yy61.v, yymsp[-4].minor.yy61.v, yymsp[-2].minor.yy61.v)) {
  1543. goto failT0;
  1544. }
  1545. yymsp[-4].minor.yy61.have = 0;
  1546. yymsp[-2].minor.yy61.have = 0;
  1547. yygotominor.yy61.have = 1;
  1548. yygotominor.yy61.v = yymsp[0].minor.yy61.v;
  1549. yymsp[0].minor.yy61.have = 0;
  1550. goto doneT;
  1551. failT0:
  1552. yygotominor.yy61.have = 0;
  1553. parser_out->out_of_memory = 1;
  1554. doneT:
  1555. free_value(yymsp[-4].minor.yy61);
  1556. free_value(yymsp[-2].minor.yy61);
  1557. free_value(yymsp[0].minor.yy61);
  1558. yy_destructor(yypParser,14,&yymsp[-3].minor);
  1559. yy_destructor(yypParser,19,&yymsp[-1].minor);
  1560. }
  1561. #line 1685 "NCDConfigParser_parse.c"
  1562. break;
  1563. case 31: /* map ::= BRACKET_OPEN BRACKET_CLOSE */
  1564. #line 733 "NCDConfigParser_parse.y"
  1565. {
  1566. yygotominor.yy61.have = 1;
  1567. NCDValue_InitMap(&yygotominor.yy61.v);
  1568. yy_destructor(yypParser,20,&yymsp[-1].minor);
  1569. yy_destructor(yypParser,21,&yymsp[0].minor);
  1570. }
  1571. #line 1695 "NCDConfigParser_parse.c"
  1572. break;
  1573. case 32: /* map ::= BRACKET_OPEN map_contents BRACKET_CLOSE */
  1574. #line 738 "NCDConfigParser_parse.y"
  1575. {
  1576. yygotominor.yy61 = yymsp[-1].minor.yy61;
  1577. yy_destructor(yypParser,20,&yymsp[-2].minor);
  1578. yy_destructor(yypParser,21,&yymsp[0].minor);
  1579. }
  1580. #line 1704 "NCDConfigParser_parse.c"
  1581. break;
  1582. case 33: /* invoc ::= value ROUND_OPEN list_contents ROUND_CLOSE */
  1583. #line 742 "NCDConfigParser_parse.y"
  1584. {
  1585. if (!yymsp[-3].minor.yy61.have || !yymsp[-1].minor.yy61.have) {
  1586. goto failQ0;
  1587. }
  1588. if (!NCDValue_InitInvoc(&yygotominor.yy61.v, yymsp[-3].minor.yy61.v, yymsp[-1].minor.yy61.v)) {
  1589. goto failQ0;
  1590. }
  1591. yymsp[-3].minor.yy61.have = 0;
  1592. yymsp[-1].minor.yy61.have = 0;
  1593. yygotominor.yy61.have = 1;
  1594. goto doneQ;
  1595. failQ0:
  1596. yygotominor.yy61.have = 0;
  1597. parser_out->out_of_memory = 1;
  1598. doneQ:
  1599. free_value(yymsp[-3].minor.yy61);
  1600. free_value(yymsp[-1].minor.yy61);
  1601. yy_destructor(yypParser,7,&yymsp[-2].minor);
  1602. yy_destructor(yypParser,8,&yymsp[0].minor);
  1603. }
  1604. #line 1730 "NCDConfigParser_parse.c"
  1605. break;
  1606. case 34: /* value ::= STRING */
  1607. #line 763 "NCDConfigParser_parse.y"
  1608. {
  1609. ASSERT(yymsp[0].minor.yy0.str)
  1610. if (!NCDValue_InitStringBin(&yygotominor.yy61.v, (uint8_t *)yymsp[0].minor.yy0.str, yymsp[0].minor.yy0.len)) {
  1611. goto failU0;
  1612. }
  1613. yygotominor.yy61.have = 1;
  1614. goto doneU;
  1615. failU0:
  1616. yygotominor.yy61.have = 0;
  1617. parser_out->out_of_memory = 1;
  1618. doneU:
  1619. free_token(yymsp[0].minor.yy0);
  1620. }
  1621. #line 1750 "NCDConfigParser_parse.c"
  1622. break;
  1623. case 35: /* value ::= AT_SIGN dotted_name */
  1624. #line 780 "NCDConfigParser_parse.y"
  1625. {
  1626. if (!yymsp[0].minor.yy13) {
  1627. goto failUA0;
  1628. }
  1629. if (!NCDValue_InitString(&yygotominor.yy61.v, yymsp[0].minor.yy13)) {
  1630. goto failUA0;
  1631. }
  1632. yygotominor.yy61.have = 1;
  1633. goto doneUA0;
  1634. failUA0:
  1635. yygotominor.yy61.have = 0;
  1636. parser_out->out_of_memory = 1;
  1637. doneUA0:
  1638. free(yymsp[0].minor.yy13);
  1639. yy_destructor(yypParser,22,&yymsp[-1].minor);
  1640. }
  1641. #line 1773 "NCDConfigParser_parse.c"
  1642. break;
  1643. case 36: /* value ::= CARET name_list */
  1644. #line 799 "NCDConfigParser_parse.y"
  1645. {
  1646. yygotominor.yy61 = yymsp[0].minor.yy61;
  1647. yy_destructor(yypParser,23,&yymsp[-1].minor);
  1648. }
  1649. #line 1781 "NCDConfigParser_parse.c"
  1650. break;
  1651. case 37: /* value ::= dotted_name */
  1652. #line 803 "NCDConfigParser_parse.y"
  1653. {
  1654. if (!yymsp[0].minor.yy13) {
  1655. goto failV0;
  1656. }
  1657. if (!NCDValue_InitVar(&yygotominor.yy61.v, yymsp[0].minor.yy13)) {
  1658. goto failV0;
  1659. }
  1660. yygotominor.yy61.have = 1;
  1661. goto doneV;
  1662. failV0:
  1663. yygotominor.yy61.have = 0;
  1664. parser_out->out_of_memory = 1;
  1665. doneV:
  1666. free(yymsp[0].minor.yy13);
  1667. }
  1668. #line 1803 "NCDConfigParser_parse.c"
  1669. break;
  1670. case 40: /* value ::= ROUND_OPEN value ROUND_CLOSE */
  1671. #line 830 "NCDConfigParser_parse.y"
  1672. {
  1673. yygotominor.yy61 = yymsp[-1].minor.yy61;
  1674. yy_destructor(yypParser,7,&yymsp[-2].minor);
  1675. yy_destructor(yypParser,8,&yymsp[0].minor);
  1676. }
  1677. #line 1812 "NCDConfigParser_parse.c"
  1678. break;
  1679. case 42: /* name_maybe ::= */
  1680. #line 838 "NCDConfigParser_parse.y"
  1681. {
  1682. yygotominor.yy13 = NULL;
  1683. }
  1684. #line 1819 "NCDConfigParser_parse.c"
  1685. break;
  1686. case 44: /* process_or_template ::= PROCESS */
  1687. #line 848 "NCDConfigParser_parse.y"
  1688. {
  1689. yygotominor.yy22 = 0;
  1690. yy_destructor(yypParser,24,&yymsp[0].minor);
  1691. }
  1692. #line 1827 "NCDConfigParser_parse.c"
  1693. break;
  1694. case 45: /* process_or_template ::= TEMPLATE */
  1695. #line 852 "NCDConfigParser_parse.y"
  1696. {
  1697. yygotominor.yy22 = 1;
  1698. yy_destructor(yypParser,25,&yymsp[0].minor);
  1699. }
  1700. #line 1835 "NCDConfigParser_parse.c"
  1701. break;
  1702. default:
  1703. break;
  1704. };
  1705. yygoto = yyRuleInfo[yyruleno].lhs;
  1706. yysize = yyRuleInfo[yyruleno].nrhs;
  1707. yypParser->yyidx -= yysize;
  1708. yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
  1709. if( yyact < YYNSTATE ){
  1710. #ifdef NDEBUG
  1711. /* If we are not debugging and the reduce action popped at least
  1712. ** one element off the stack, then we can push the new element back
  1713. ** onto the stack here, and skip the stack overflow test in yy_shift().
  1714. ** That gives a significant speed improvement. */
  1715. if( yysize ){
  1716. yypParser->yyidx++;
  1717. yymsp -= yysize-1;
  1718. yymsp->stateno = (YYACTIONTYPE)yyact;
  1719. yymsp->major = (YYCODETYPE)yygoto;
  1720. yymsp->minor = yygotominor;
  1721. }else
  1722. #endif
  1723. {
  1724. yy_shift(yypParser,yyact,yygoto,&yygotominor);
  1725. }
  1726. }else{
  1727. assert( yyact == YYNSTATE + YYNRULE + 1 );
  1728. yy_accept(yypParser);
  1729. }
  1730. }
  1731. /*
  1732. ** The following code executes when the parse fails
  1733. */
  1734. #ifndef YYNOERRORRECOVERY
  1735. static void yy_parse_failed(
  1736. yyParser *yypParser /* The parser */
  1737. ){
  1738. ParseARG_FETCH;
  1739. #ifndef NDEBUG
  1740. if( yyTraceFILE ){
  1741. fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
  1742. }
  1743. #endif
  1744. while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
  1745. /* Here code is inserted which will be executed whenever the
  1746. ** parser fails */
  1747. ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
  1748. }
  1749. #endif /* YYNOERRORRECOVERY */
  1750. /*
  1751. ** The following code executes when a syntax error first occurs.
  1752. */
  1753. static void yy_syntax_error(
  1754. yyParser *yypParser, /* The parser */
  1755. int yymajor, /* The major type of the error token */
  1756. YYMINORTYPE yyminor /* The minor type of the error token */
  1757. ){
  1758. ParseARG_FETCH;
  1759. #define TOKEN (yyminor.yy0)
  1760. #line 129 "NCDConfigParser_parse.y"
  1761. parser_out->syntax_error = 1;
  1762. #line 1900 "NCDConfigParser_parse.c"
  1763. ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
  1764. }
  1765. /*
  1766. ** The following is executed when the parser accepts
  1767. */
  1768. static void yy_accept(
  1769. yyParser *yypParser /* The parser */
  1770. ){
  1771. ParseARG_FETCH;
  1772. #ifndef NDEBUG
  1773. if( yyTraceFILE ){
  1774. fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
  1775. }
  1776. #endif
  1777. while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
  1778. /* Here code is inserted which will be executed whenever the
  1779. ** parser accepts */
  1780. ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
  1781. }
  1782. /* The main parser program.
  1783. ** The first argument is a pointer to a structure obtained from
  1784. ** "ParseAlloc" which describes the current state of the parser.
  1785. ** The second argument is the major token number. The third is
  1786. ** the minor token. The fourth optional argument is whatever the
  1787. ** user wants (and specified in the grammar) and is available for
  1788. ** use by the action routines.
  1789. **
  1790. ** Inputs:
  1791. ** <ul>
  1792. ** <li> A pointer to the parser (an opaque structure.)
  1793. ** <li> The major token number.
  1794. ** <li> The minor token number.
  1795. ** <li> An option argument of a grammar-specified type.
  1796. ** </ul>
  1797. **
  1798. ** Outputs:
  1799. ** None.
  1800. */
  1801. void Parse(
  1802. void *yyp, /* The parser */
  1803. int yymajor, /* The major token code number */
  1804. ParseTOKENTYPE yyminor /* The value for the token */
  1805. ParseARG_PDECL /* Optional %extra_argument parameter */
  1806. ){
  1807. YYMINORTYPE yyminorunion;
  1808. int yyact; /* The parser action. */
  1809. int yyendofinput; /* True if we are at the end of input */
  1810. #ifdef YYERRORSYMBOL
  1811. int yyerrorhit = 0; /* True if yymajor has invoked an error */
  1812. #endif
  1813. yyParser *yypParser; /* The parser */
  1814. /* (re)initialize the parser, if necessary */
  1815. yypParser = (yyParser*)yyp;
  1816. if( yypParser->yyidx<0 ){
  1817. #if YYSTACKDEPTH<=0
  1818. if( yypParser->yystksz <=0 ){
  1819. /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/
  1820. yyminorunion = yyzerominor;
  1821. yyStackOverflow(yypParser, &yyminorunion);
  1822. return;
  1823. }
  1824. #endif
  1825. yypParser->yyidx = 0;
  1826. yypParser->yyerrcnt = -1;
  1827. yypParser->yystack[0].stateno = 0;
  1828. yypParser->yystack[0].major = 0;
  1829. }
  1830. yyminorunion.yy0 = yyminor;
  1831. yyendofinput = (yymajor==0);
  1832. ParseARG_STORE;
  1833. #ifndef NDEBUG
  1834. if( yyTraceFILE ){
  1835. fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
  1836. }
  1837. #endif
  1838. do{
  1839. yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
  1840. if( yyact<YYNSTATE ){
  1841. assert( !yyendofinput ); /* Impossible to shift the $ token */
  1842. yy_shift(yypParser,yyact,yymajor,&yyminorunion);
  1843. yypParser->yyerrcnt--;
  1844. yymajor = YYNOCODE;
  1845. }else if( yyact < YYNSTATE + YYNRULE ){
  1846. yy_reduce(yypParser,yyact-YYNSTATE);
  1847. }else{
  1848. assert( yyact == YY_ERROR_ACTION );
  1849. #ifdef YYERRORSYMBOL
  1850. int yymx;
  1851. #endif
  1852. #ifndef NDEBUG
  1853. if( yyTraceFILE ){
  1854. fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
  1855. }
  1856. #endif
  1857. #ifdef YYERRORSYMBOL
  1858. /* A syntax error has occurred.
  1859. ** The response to an error depends upon whether or not the
  1860. ** grammar defines an error token "ERROR".
  1861. **
  1862. ** This is what we do if the grammar does define ERROR:
  1863. **
  1864. ** * Call the %syntax_error function.
  1865. **
  1866. ** * Begin popping the stack until we enter a state where
  1867. ** it is legal to shift the error symbol, then shift
  1868. ** the error symbol.
  1869. **
  1870. ** * Set the error count to three.
  1871. **
  1872. ** * Begin accepting and shifting new tokens. No new error
  1873. ** processing will occur until three tokens have been
  1874. ** shifted successfully.
  1875. **
  1876. */
  1877. if( yypParser->yyerrcnt<0 ){
  1878. yy_syntax_error(yypParser,yymajor,yyminorunion);
  1879. }
  1880. yymx = yypParser->yystack[yypParser->yyidx].major;
  1881. if( yymx==YYERRORSYMBOL || yyerrorhit ){
  1882. #ifndef NDEBUG
  1883. if( yyTraceFILE ){
  1884. fprintf(yyTraceFILE,"%sDiscard input token %s\n",
  1885. yyTracePrompt,yyTokenName[yymajor]);
  1886. }
  1887. #endif
  1888. yy_destructor(yypParser, (YYCODETYPE)yymajor,&yyminorunion);
  1889. yymajor = YYNOCODE;
  1890. }else{
  1891. while(
  1892. yypParser->yyidx >= 0 &&
  1893. yymx != YYERRORSYMBOL &&
  1894. (yyact = yy_find_reduce_action(
  1895. yypParser->yystack[yypParser->yyidx].stateno,
  1896. YYERRORSYMBOL)) >= YYNSTATE
  1897. ){
  1898. yy_pop_parser_stack(yypParser);
  1899. }
  1900. if( yypParser->yyidx < 0 || yymajor==0 ){
  1901. yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
  1902. yy_parse_failed(yypParser);
  1903. yymajor = YYNOCODE;
  1904. }else if( yymx!=YYERRORSYMBOL ){
  1905. YYMINORTYPE u2;
  1906. u2.YYERRSYMDT = 0;
  1907. yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
  1908. }
  1909. }
  1910. yypParser->yyerrcnt = 3;
  1911. yyerrorhit = 1;
  1912. #elif defined(YYNOERRORRECOVERY)
  1913. /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
  1914. ** do any kind of error recovery. Instead, simply invoke the syntax
  1915. ** error routine and continue going as if nothing had happened.
  1916. **
  1917. ** Applications can set this macro (for example inside %include) if
  1918. ** they intend to abandon the parse upon the first syntax error seen.
  1919. */
  1920. yy_syntax_error(yypParser,yymajor,yyminorunion);
  1921. yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
  1922. yymajor = YYNOCODE;
  1923. #else /* YYERRORSYMBOL is not defined */
  1924. /* This is what we do if the grammar does not define ERROR:
  1925. **
  1926. ** * Report an error message, and throw away the input token.
  1927. **
  1928. ** * If the input token is $, then fail the parse.
  1929. **
  1930. ** As before, subsequent error messages are suppressed until
  1931. ** three input tokens have been successfully shifted.
  1932. */
  1933. if( yypParser->yyerrcnt<=0 ){
  1934. yy_syntax_error(yypParser,yymajor,yyminorunion);
  1935. }
  1936. yypParser->yyerrcnt = 3;
  1937. yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
  1938. if( yyendofinput ){
  1939. yy_parse_failed(yypParser);
  1940. }
  1941. yymajor = YYNOCODE;
  1942. #endif
  1943. }
  1944. }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
  1945. return;
  1946. }