cmCommandArgumentParser.cxx 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849
  1. /* A Bison parser, made by GNU Bison 3.7.4. */
  2. /* Bison implementation for Yacc-like parsers in C
  3. Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
  4. Inc.
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  15. /* As a special exception, you may create a larger work that contains
  16. part or all of the Bison parser skeleton and distribute that work
  17. under terms of your choice, so long as that work isn't itself a
  18. parser generator using the skeleton or a modified version thereof
  19. as a parser skeleton. Alternatively, if you modify or redistribute
  20. the parser skeleton itself, you may (at your option) remove this
  21. special exception, which will cause the skeleton and the resulting
  22. Bison output files to be licensed under the GNU General Public
  23. License without this special exception.
  24. This special exception was added by the Free Software Foundation in
  25. version 2.2 of Bison. */
  26. /* C LALR(1) parser skeleton written by Richard Stallman, by
  27. simplifying the original so-called "semantic" parser. */
  28. /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
  29. especially those whose name start with YY_ or yy_. They are
  30. private implementation details that can be changed or removed. */
  31. /* All symbols defined below should begin with yy or YY, to avoid
  32. infringing on user name space. This should be done even for local
  33. variables, as they might otherwise be expanded by user macros.
  34. There are some unavoidable exceptions within include files to
  35. define necessary library symbols; they are noted "INFRINGES ON
  36. USER NAME SPACE" below. */
  37. /* Identify Bison output, and Bison version. */
  38. #define YYBISON 30704
  39. /* Bison version string. */
  40. #define YYBISON_VERSION "3.7.4"
  41. /* Skeleton name. */
  42. #define YYSKELETON_NAME "yacc.c"
  43. /* Pure parsers. */
  44. #define YYPURE 1
  45. /* Push parsers. */
  46. #define YYPUSH 0
  47. /* Pull parsers. */
  48. #define YYPULL 1
  49. /* Substitute the variable and function names. */
  50. #define yyparse cmCommandArgument_yyparse
  51. #define yylex cmCommandArgument_yylex
  52. #define yyerror cmCommandArgument_yyerror
  53. #define yydebug cmCommandArgument_yydebug
  54. #define yynerrs cmCommandArgument_yynerrs
  55. /* First part of user prologue. */
  56. #line 1 "cmCommandArgumentParser.y"
  57. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  58. file Copyright.txt or https://cmake.org/licensing for details. */
  59. /*
  60. This file must be translated to C and modified to build everywhere.
  61. Run bison like this:
  62. bison --name-prefix=cmCommandArgument_yy --defines=cmCommandArgumentParserTokens.h -ocmCommandArgumentParser.cxx cmCommandArgumentParser.y
  63. */
  64. #include "cmConfigure.h" // IWYU pragma: keep
  65. #include <string.h>
  66. #define yyGetParser (cmCommandArgument_yyget_extra(yyscanner))
  67. /* Make sure malloc and free are available on QNX. */
  68. #ifdef __QNX__
  69. # include <malloc.h>
  70. #endif
  71. #include <stdint.h>
  72. /* Make sure the parser uses standard memory allocation. The default
  73. generated parser malloc/free declarations do not work on all
  74. platforms. */
  75. #include <stdlib.h>
  76. #define YYMALLOC malloc
  77. #define YYFREE free
  78. /*-------------------------------------------------------------------------*/
  79. #include "cmCommandArgumentParserHelper.h" /* Interface to parser object. */
  80. #include "cmCommandArgumentLexer.h" /* Interface to lexer object. */
  81. /* Forward declare the lexer entry point. */
  82. YY_DECL;
  83. /* Helper function to forward error callback from parser. */
  84. static void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message);
  85. /* Configure the parser to support large input. */
  86. #define YYMAXDEPTH 100000
  87. #define YYINITDEPTH 10000
  88. /* Disable some warnings in the generated code. */
  89. #ifdef _MSC_VER
  90. # pragma warning (disable: 4102) /* Unused goto label. */
  91. # pragma warning (disable: 4065) /* Switch statement contains default but no
  92. case. */
  93. # pragma warning (disable: 4244) /* loss of precision */
  94. # pragma warning (disable: 4702) /* unreachable code */
  95. #endif
  96. #if defined(__GNUC__) && __GNUC__ >= 8
  97. # pragma GCC diagnostic ignored "-Wconversion"
  98. # pragma GCC diagnostic ignored "-Wfree-nonheap-object"
  99. #endif
  100. #line 136 "cmCommandArgumentParser.cxx"
  101. # ifndef YY_CAST
  102. # ifdef __cplusplus
  103. # define YY_CAST(Type, Val) static_cast<Type> (Val)
  104. # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
  105. # else
  106. # define YY_CAST(Type, Val) ((Type) (Val))
  107. # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
  108. # endif
  109. # endif
  110. # ifndef YY_NULLPTR
  111. # if defined __cplusplus
  112. # if 201103L <= __cplusplus
  113. # define YY_NULLPTR nullptr
  114. # else
  115. # define YY_NULLPTR 0
  116. # endif
  117. # else
  118. # define YY_NULLPTR ((void*)0)
  119. # endif
  120. # endif
  121. #include "cmCommandArgumentParserTokens.h"
  122. /* Symbol kind. */
  123. enum yysymbol_kind_t
  124. {
  125. YYSYMBOL_YYEMPTY = -2,
  126. YYSYMBOL_YYEOF = 0, /* "end of file" */
  127. YYSYMBOL_YYerror = 1, /* error */
  128. YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
  129. YYSYMBOL_cal_ENVCURLY = 3, /* cal_ENVCURLY */
  130. YYSYMBOL_cal_NCURLY = 4, /* cal_NCURLY */
  131. YYSYMBOL_cal_DCURLY = 5, /* cal_DCURLY */
  132. YYSYMBOL_cal_DOLLAR = 6, /* "$" */
  133. YYSYMBOL_cal_LCURLY = 7, /* "{" */
  134. YYSYMBOL_cal_RCURLY = 8, /* "}" */
  135. YYSYMBOL_cal_NAME = 9, /* cal_NAME */
  136. YYSYMBOL_cal_BSLASH = 10, /* "\\" */
  137. YYSYMBOL_cal_SYMBOL = 11, /* cal_SYMBOL */
  138. YYSYMBOL_cal_AT = 12, /* "@" */
  139. YYSYMBOL_cal_ERROR = 13, /* cal_ERROR */
  140. YYSYMBOL_cal_ATNAME = 14, /* cal_ATNAME */
  141. YYSYMBOL_YYACCEPT = 15, /* $accept */
  142. YYSYMBOL_Start = 16, /* Start */
  143. YYSYMBOL_GoalWithOptionalBackSlash = 17, /* GoalWithOptionalBackSlash */
  144. YYSYMBOL_Goal = 18, /* Goal */
  145. YYSYMBOL_String = 19, /* String */
  146. YYSYMBOL_OuterText = 20, /* OuterText */
  147. YYSYMBOL_Variable = 21, /* Variable */
  148. YYSYMBOL_EnvVarName = 22, /* EnvVarName */
  149. YYSYMBOL_MultipleIds = 23, /* MultipleIds */
  150. YYSYMBOL_ID = 24 /* ID */
  151. };
  152. typedef enum yysymbol_kind_t yysymbol_kind_t;
  153. #ifdef short
  154. # undef short
  155. #endif
  156. /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
  157. <limits.h> and (if available) <stdint.h> are included
  158. so that the code can choose integer types of a good width. */
  159. #ifndef __PTRDIFF_MAX__
  160. # include <limits.h> /* INFRINGES ON USER NAME SPACE */
  161. # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
  162. # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
  163. # define YY_STDINT_H
  164. # endif
  165. #endif
  166. /* Narrow types that promote to a signed type and that can represent a
  167. signed or unsigned integer of at least N bits. In tables they can
  168. save space and decrease cache pressure. Promoting to a signed type
  169. helps avoid bugs in integer arithmetic. */
  170. #ifdef __INT_LEAST8_MAX__
  171. typedef __INT_LEAST8_TYPE__ yytype_int8;
  172. #elif defined YY_STDINT_H
  173. typedef int_least8_t yytype_int8;
  174. #else
  175. typedef signed char yytype_int8;
  176. #endif
  177. #ifdef __INT_LEAST16_MAX__
  178. typedef __INT_LEAST16_TYPE__ yytype_int16;
  179. #elif defined YY_STDINT_H
  180. typedef int_least16_t yytype_int16;
  181. #else
  182. typedef short yytype_int16;
  183. #endif
  184. #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
  185. typedef __UINT_LEAST8_TYPE__ yytype_uint8;
  186. #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
  187. && UINT_LEAST8_MAX <= INT_MAX)
  188. typedef uint_least8_t yytype_uint8;
  189. #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
  190. typedef unsigned char yytype_uint8;
  191. #else
  192. typedef short yytype_uint8;
  193. #endif
  194. #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
  195. typedef __UINT_LEAST16_TYPE__ yytype_uint16;
  196. #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
  197. && UINT_LEAST16_MAX <= INT_MAX)
  198. typedef uint_least16_t yytype_uint16;
  199. #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
  200. typedef unsigned short yytype_uint16;
  201. #else
  202. typedef int yytype_uint16;
  203. #endif
  204. #ifndef YYPTRDIFF_T
  205. # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
  206. # define YYPTRDIFF_T __PTRDIFF_TYPE__
  207. # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
  208. # elif defined PTRDIFF_MAX
  209. # ifndef ptrdiff_t
  210. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  211. # endif
  212. # define YYPTRDIFF_T ptrdiff_t
  213. # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
  214. # else
  215. # define YYPTRDIFF_T long
  216. # define YYPTRDIFF_MAXIMUM LONG_MAX
  217. # endif
  218. #endif
  219. #ifndef YYSIZE_T
  220. # ifdef __SIZE_TYPE__
  221. # define YYSIZE_T __SIZE_TYPE__
  222. # elif defined size_t
  223. # define YYSIZE_T size_t
  224. # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
  225. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  226. # define YYSIZE_T size_t
  227. # else
  228. # define YYSIZE_T unsigned
  229. # endif
  230. #endif
  231. #define YYSIZE_MAXIMUM \
  232. YY_CAST (YYPTRDIFF_T, \
  233. (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
  234. ? YYPTRDIFF_MAXIMUM \
  235. : YY_CAST (YYSIZE_T, -1)))
  236. #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
  237. /* Stored state numbers (used for stacks). */
  238. typedef yytype_int8 yy_state_t;
  239. /* State numbers in computations. */
  240. typedef int yy_state_fast_t;
  241. #ifndef YY_
  242. # if defined YYENABLE_NLS && YYENABLE_NLS
  243. # if ENABLE_NLS
  244. # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  245. # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
  246. # endif
  247. # endif
  248. # ifndef YY_
  249. # define YY_(Msgid) Msgid
  250. # endif
  251. #endif
  252. #ifndef YY_ATTRIBUTE_PURE
  253. # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
  254. # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
  255. # else
  256. # define YY_ATTRIBUTE_PURE
  257. # endif
  258. #endif
  259. #ifndef YY_ATTRIBUTE_UNUSED
  260. # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
  261. # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
  262. # else
  263. # define YY_ATTRIBUTE_UNUSED
  264. # endif
  265. #endif
  266. /* Suppress unused-variable warnings by "using" E. */
  267. #if ! defined lint || defined __GNUC__
  268. # define YYUSE(E) ((void) (E))
  269. #else
  270. # define YYUSE(E) /* empty */
  271. #endif
  272. #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
  273. /* Suppress an incorrect diagnostic about yylval being uninitialized. */
  274. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
  275. _Pragma ("GCC diagnostic push") \
  276. _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
  277. _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
  278. # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
  279. _Pragma ("GCC diagnostic pop")
  280. #else
  281. # define YY_INITIAL_VALUE(Value) Value
  282. #endif
  283. #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  284. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  285. # define YY_IGNORE_MAYBE_UNINITIALIZED_END
  286. #endif
  287. #ifndef YY_INITIAL_VALUE
  288. # define YY_INITIAL_VALUE(Value) /* Nothing. */
  289. #endif
  290. #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
  291. # define YY_IGNORE_USELESS_CAST_BEGIN \
  292. _Pragma ("GCC diagnostic push") \
  293. _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
  294. # define YY_IGNORE_USELESS_CAST_END \
  295. _Pragma ("GCC diagnostic pop")
  296. #endif
  297. #ifndef YY_IGNORE_USELESS_CAST_BEGIN
  298. # define YY_IGNORE_USELESS_CAST_BEGIN
  299. # define YY_IGNORE_USELESS_CAST_END
  300. #endif
  301. #define YY_ASSERT(E) ((void) (0 && (E)))
  302. #if 1
  303. /* The parser invokes alloca or malloc; define the necessary symbols. */
  304. # ifdef YYSTACK_USE_ALLOCA
  305. # if YYSTACK_USE_ALLOCA
  306. # ifdef __GNUC__
  307. # define YYSTACK_ALLOC __builtin_alloca
  308. # elif defined __BUILTIN_VA_ARG_INCR
  309. # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  310. # elif defined _AIX
  311. # define YYSTACK_ALLOC __alloca
  312. # elif defined _MSC_VER
  313. # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  314. # define alloca _alloca
  315. # else
  316. # define YYSTACK_ALLOC alloca
  317. # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
  318. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  319. /* Use EXIT_SUCCESS as a witness for stdlib.h. */
  320. # ifndef EXIT_SUCCESS
  321. # define EXIT_SUCCESS 0
  322. # endif
  323. # endif
  324. # endif
  325. # endif
  326. # endif
  327. # ifdef YYSTACK_ALLOC
  328. /* Pacify GCC's 'empty if-body' warning. */
  329. # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
  330. # ifndef YYSTACK_ALLOC_MAXIMUM
  331. /* The OS might guarantee only one guard page at the bottom of the stack,
  332. and a page size can be as small as 4096 bytes. So we cannot safely
  333. invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
  334. to allow for a few compiler-allocated temporary stack slots. */
  335. # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  336. # endif
  337. # else
  338. # define YYSTACK_ALLOC YYMALLOC
  339. # define YYSTACK_FREE YYFREE
  340. # ifndef YYSTACK_ALLOC_MAXIMUM
  341. # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  342. # endif
  343. # if (defined __cplusplus && ! defined EXIT_SUCCESS \
  344. && ! ((defined YYMALLOC || defined malloc) \
  345. && (defined YYFREE || defined free)))
  346. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  347. # ifndef EXIT_SUCCESS
  348. # define EXIT_SUCCESS 0
  349. # endif
  350. # endif
  351. # ifndef YYMALLOC
  352. # define YYMALLOC malloc
  353. # if ! defined malloc && ! defined EXIT_SUCCESS
  354. void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  355. # endif
  356. # endif
  357. # ifndef YYFREE
  358. # define YYFREE free
  359. # if ! defined free && ! defined EXIT_SUCCESS
  360. void free (void *); /* INFRINGES ON USER NAME SPACE */
  361. # endif
  362. # endif
  363. # endif
  364. #endif /* 1 */
  365. #if (! defined yyoverflow \
  366. && (! defined __cplusplus \
  367. || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  368. /* A type that is properly aligned for any stack member. */
  369. union yyalloc
  370. {
  371. yy_state_t yyss_alloc;
  372. YYSTYPE yyvs_alloc;
  373. };
  374. /* The size of the maximum gap between one aligned stack and the next. */
  375. # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
  376. /* The size of an array large to enough to hold all stacks, each with
  377. N elements. */
  378. # define YYSTACK_BYTES(N) \
  379. ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
  380. + YYSTACK_GAP_MAXIMUM)
  381. # define YYCOPY_NEEDED 1
  382. /* Relocate STACK from its old location to the new one. The
  383. local variables YYSIZE and YYSTACKSIZE give the old and new number of
  384. elements in the stack, and YYPTR gives the new location of the
  385. stack. Advance YYPTR to a properly aligned location for the next
  386. stack. */
  387. # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
  388. do \
  389. { \
  390. YYPTRDIFF_T yynewbytes; \
  391. YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
  392. Stack = &yyptr->Stack_alloc; \
  393. yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
  394. yyptr += yynewbytes / YYSIZEOF (*yyptr); \
  395. } \
  396. while (0)
  397. #endif
  398. #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
  399. /* Copy COUNT objects from SRC to DST. The source and destination do
  400. not overlap. */
  401. # ifndef YYCOPY
  402. # if defined __GNUC__ && 1 < __GNUC__
  403. # define YYCOPY(Dst, Src, Count) \
  404. __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
  405. # else
  406. # define YYCOPY(Dst, Src, Count) \
  407. do \
  408. { \
  409. YYPTRDIFF_T yyi; \
  410. for (yyi = 0; yyi < (Count); yyi++) \
  411. (Dst)[yyi] = (Src)[yyi]; \
  412. } \
  413. while (0)
  414. # endif
  415. # endif
  416. #endif /* !YYCOPY_NEEDED */
  417. /* YYFINAL -- State number of the termination state. */
  418. #define YYFINAL 25
  419. /* YYLAST -- Last index in YYTABLE. */
  420. #define YYLAST 40
  421. /* YYNTOKENS -- Number of terminals. */
  422. #define YYNTOKENS 15
  423. /* YYNNTS -- Number of nonterminals. */
  424. #define YYNNTS 10
  425. /* YYNRULES -- Number of rules. */
  426. #define YYNRULES 24
  427. /* YYNSTATES -- Number of states. */
  428. #define YYNSTATES 33
  429. /* YYMAXUTOK -- Last valid token kind. */
  430. #define YYMAXUTOK 269
  431. /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
  432. as returned by yylex, with out-of-bounds checking. */
  433. #define YYTRANSLATE(YYX) \
  434. (0 <= (YYX) && (YYX) <= YYMAXUTOK \
  435. ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
  436. : YYSYMBOL_YYUNDEF)
  437. /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
  438. as returned by yylex. */
  439. static const yytype_int8 yytranslate[] =
  440. {
  441. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  442. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  443. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  444. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  445. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  446. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  447. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  448. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  449. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  450. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  451. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  452. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  453. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  454. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  455. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  456. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  457. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  458. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  459. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  460. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  461. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  462. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  463. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  464. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  465. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  466. 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
  467. 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
  468. };
  469. #if YYDEBUG
  470. /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
  471. static const yytype_uint8 yyrline[] =
  472. {
  473. 0, 97, 97, 103, 106, 111, 114, 119, 122, 127,
  474. 130, 133, 136, 139, 142, 147, 150, 153, 156, 161,
  475. 164, 169, 172, 177, 180
  476. };
  477. #endif
  478. /** Accessing symbol of state STATE. */
  479. #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
  480. #if 1
  481. /* The user-facing name of the symbol whose (internal) number is
  482. YYSYMBOL. No bounds checking. */
  483. static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
  484. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  485. First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  486. static const char *const yytname[] =
  487. {
  488. "\"end of file\"", "error", "\"invalid token\"", "cal_ENVCURLY",
  489. "cal_NCURLY", "cal_DCURLY", "\"$\"", "\"{\"", "\"}\"", "cal_NAME",
  490. "\"\\\\\"", "cal_SYMBOL", "\"@\"", "cal_ERROR", "cal_ATNAME", "$accept",
  491. "Start", "GoalWithOptionalBackSlash", "Goal", "String", "OuterText",
  492. "Variable", "EnvVarName", "MultipleIds", "ID", YY_NULLPTR
  493. };
  494. static const char *
  495. yysymbol_name (yysymbol_kind_t yysymbol)
  496. {
  497. return yytname[yysymbol];
  498. }
  499. #endif
  500. #ifdef YYPRINT
  501. /* YYTOKNUM[NUM] -- (External) token number corresponding to the
  502. (internal) symbol number NUM (which must be that of a token). */
  503. static const yytype_int16 yytoknum[] =
  504. {
  505. 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  506. 265, 266, 267, 268, 269
  507. };
  508. #endif
  509. #define YYPACT_NINF (-3)
  510. #define yypact_value_is_default(Yyn) \
  511. ((Yyn) == YYPACT_NINF)
  512. #define YYTABLE_NINF (-1)
  513. #define yytable_value_is_error(Yyn) \
  514. 0
  515. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  516. STATE-NUM. */
  517. static const yytype_int8 yypact[] =
  518. {
  519. 0, 14, 26, 26, -3, -3, -3, -3, -3, -3,
  520. -3, 10, -3, 3, 0, -3, -3, -3, 14, -3,
  521. 7, -3, 26, 13, 16, -3, -3, -3, -3, -3,
  522. -3, -3, -3
  523. };
  524. /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
  525. Performed when YYTABLE does not specify something else to do. Zero
  526. means the default is an error. */
  527. static const yytype_int8 yydefact[] =
  528. {
  529. 5, 21, 21, 21, 11, 12, 13, 9, 14, 10,
  530. 18, 0, 2, 3, 5, 7, 8, 23, 21, 24,
  531. 0, 19, 21, 0, 0, 1, 4, 6, 20, 15,
  532. 22, 16, 17
  533. };
  534. /* YYPGOTO[NTERM-NUM]. */
  535. static const yytype_int8 yypgoto[] =
  536. {
  537. -3, -3, -3, 8, -3, -3, 2, 9, -2, -3
  538. };
  539. /* YYDEFGOTO[NTERM-NUM]. */
  540. static const yytype_int8 yydefgoto[] =
  541. {
  542. -1, 11, 12, 13, 14, 15, 19, 20, 21, 22
  543. };
  544. /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
  545. positive, shift that token. If negative, reduce the rule whose
  546. number is the opposite. If YYTABLE_NINF, syntax error. */
  547. static const yytype_int8 yytable[] =
  548. {
  549. 23, 24, 16, 1, 2, 3, 4, 5, 6, 7,
  550. 25, 8, 9, 26, 10, 29, 16, 1, 2, 3,
  551. 30, 31, 27, 17, 32, 18, 0, 28, 10, 1,
  552. 2, 3, 0, 0, 0, 17, 0, 0, 0, 0,
  553. 10
  554. };
  555. static const yytype_int8 yycheck[] =
  556. {
  557. 2, 3, 0, 3, 4, 5, 6, 7, 8, 9,
  558. 0, 11, 12, 10, 14, 8, 14, 3, 4, 5,
  559. 22, 8, 14, 9, 8, 11, -1, 18, 14, 3,
  560. 4, 5, -1, -1, -1, 9, -1, -1, -1, -1,
  561. 14
  562. };
  563. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  564. symbol of state STATE-NUM. */
  565. static const yytype_int8 yystos[] =
  566. {
  567. 0, 3, 4, 5, 6, 7, 8, 9, 11, 12,
  568. 14, 16, 17, 18, 19, 20, 21, 9, 11, 21,
  569. 22, 23, 24, 23, 23, 0, 10, 18, 22, 8,
  570. 23, 8, 8
  571. };
  572. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  573. static const yytype_int8 yyr1[] =
  574. {
  575. 0, 15, 16, 17, 17, 18, 18, 19, 19, 20,
  576. 20, 20, 20, 20, 20, 21, 21, 21, 21, 22,
  577. 22, 23, 23, 24, 24
  578. };
  579. /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
  580. static const yytype_int8 yyr2[] =
  581. {
  582. 0, 2, 1, 1, 2, 0, 2, 1, 1, 1,
  583. 1, 1, 1, 1, 1, 3, 3, 3, 1, 1,
  584. 2, 0, 2, 1, 1
  585. };
  586. enum { YYENOMEM = -2 };
  587. #define yyerrok (yyerrstatus = 0)
  588. #define yyclearin (yychar = YYEMPTY)
  589. #define YYACCEPT goto yyacceptlab
  590. #define YYABORT goto yyabortlab
  591. #define YYERROR goto yyerrorlab
  592. #define YYRECOVERING() (!!yyerrstatus)
  593. #define YYBACKUP(Token, Value) \
  594. do \
  595. if (yychar == YYEMPTY) \
  596. { \
  597. yychar = (Token); \
  598. yylval = (Value); \
  599. YYPOPSTACK (yylen); \
  600. yystate = *yyssp; \
  601. goto yybackup; \
  602. } \
  603. else \
  604. { \
  605. yyerror (yyscanner, YY_("syntax error: cannot back up")); \
  606. YYERROR; \
  607. } \
  608. while (0)
  609. /* Backward compatibility with an undocumented macro.
  610. Use YYerror or YYUNDEF. */
  611. #define YYERRCODE YYUNDEF
  612. /* Enable debugging if requested. */
  613. #if YYDEBUG
  614. # ifndef YYFPRINTF
  615. # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  616. # define YYFPRINTF fprintf
  617. # endif
  618. # define YYDPRINTF(Args) \
  619. do { \
  620. if (yydebug) \
  621. YYFPRINTF Args; \
  622. } while (0)
  623. /* This macro is provided for backward compatibility. */
  624. # ifndef YY_LOCATION_PRINT
  625. # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  626. # endif
  627. # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
  628. do { \
  629. if (yydebug) \
  630. { \
  631. YYFPRINTF (stderr, "%s ", Title); \
  632. yy_symbol_print (stderr, \
  633. Kind, Value, yyscanner); \
  634. YYFPRINTF (stderr, "\n"); \
  635. } \
  636. } while (0)
  637. /*-----------------------------------.
  638. | Print this symbol's value on YYO. |
  639. `-----------------------------------*/
  640. static void
  641. yy_symbol_value_print (FILE *yyo,
  642. yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
  643. {
  644. FILE *yyoutput = yyo;
  645. YYUSE (yyoutput);
  646. YYUSE (yyscanner);
  647. if (!yyvaluep)
  648. return;
  649. # ifdef YYPRINT
  650. if (yykind < YYNTOKENS)
  651. YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
  652. # endif
  653. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  654. YYUSE (yykind);
  655. YY_IGNORE_MAYBE_UNINITIALIZED_END
  656. }
  657. /*---------------------------.
  658. | Print this symbol on YYO. |
  659. `---------------------------*/
  660. static void
  661. yy_symbol_print (FILE *yyo,
  662. yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
  663. {
  664. YYFPRINTF (yyo, "%s %s (",
  665. yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
  666. yy_symbol_value_print (yyo, yykind, yyvaluep, yyscanner);
  667. YYFPRINTF (yyo, ")");
  668. }
  669. /*------------------------------------------------------------------.
  670. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  671. | TOP (included). |
  672. `------------------------------------------------------------------*/
  673. static void
  674. yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
  675. {
  676. YYFPRINTF (stderr, "Stack now");
  677. for (; yybottom <= yytop; yybottom++)
  678. {
  679. int yybot = *yybottom;
  680. YYFPRINTF (stderr, " %d", yybot);
  681. }
  682. YYFPRINTF (stderr, "\n");
  683. }
  684. # define YY_STACK_PRINT(Bottom, Top) \
  685. do { \
  686. if (yydebug) \
  687. yy_stack_print ((Bottom), (Top)); \
  688. } while (0)
  689. /*------------------------------------------------.
  690. | Report that the YYRULE is going to be reduced. |
  691. `------------------------------------------------*/
  692. static void
  693. yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
  694. int yyrule, yyscan_t yyscanner)
  695. {
  696. int yylno = yyrline[yyrule];
  697. int yynrhs = yyr2[yyrule];
  698. int yyi;
  699. YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
  700. yyrule - 1, yylno);
  701. /* The symbols being reduced. */
  702. for (yyi = 0; yyi < yynrhs; yyi++)
  703. {
  704. YYFPRINTF (stderr, " $%d = ", yyi + 1);
  705. yy_symbol_print (stderr,
  706. YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
  707. &yyvsp[(yyi + 1) - (yynrhs)], yyscanner);
  708. YYFPRINTF (stderr, "\n");
  709. }
  710. }
  711. # define YY_REDUCE_PRINT(Rule) \
  712. do { \
  713. if (yydebug) \
  714. yy_reduce_print (yyssp, yyvsp, Rule, yyscanner); \
  715. } while (0)
  716. /* Nonzero means print parse trace. It is left uninitialized so that
  717. multiple parsers can coexist. */
  718. int yydebug;
  719. #else /* !YYDEBUG */
  720. # define YYDPRINTF(Args) ((void) 0)
  721. # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
  722. # define YY_STACK_PRINT(Bottom, Top)
  723. # define YY_REDUCE_PRINT(Rule)
  724. #endif /* !YYDEBUG */
  725. /* YYINITDEPTH -- initial size of the parser's stacks. */
  726. #ifndef YYINITDEPTH
  727. # define YYINITDEPTH 200
  728. #endif
  729. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  730. if the built-in stack extension method is used).
  731. Do not make this value too large; the results are undefined if
  732. YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  733. evaluated with infinite-precision integer arithmetic. */
  734. #ifndef YYMAXDEPTH
  735. # define YYMAXDEPTH 10000
  736. #endif
  737. /* Context of a parse error. */
  738. typedef struct
  739. {
  740. yy_state_t *yyssp;
  741. yysymbol_kind_t yytoken;
  742. } yypcontext_t;
  743. /* Put in YYARG at most YYARGN of the expected tokens given the
  744. current YYCTX, and return the number of tokens stored in YYARG. If
  745. YYARG is null, return the number of expected tokens (guaranteed to
  746. be less than YYNTOKENS). Return YYENOMEM on memory exhaustion.
  747. Return 0 if there are more than YYARGN expected tokens, yet fill
  748. YYARG up to YYARGN. */
  749. static int
  750. yypcontext_expected_tokens (const yypcontext_t *yyctx,
  751. yysymbol_kind_t yyarg[], int yyargn)
  752. {
  753. /* Actual size of YYARG. */
  754. int yycount = 0;
  755. int yyn = yypact[+*yyctx->yyssp];
  756. if (!yypact_value_is_default (yyn))
  757. {
  758. /* Start YYX at -YYN if negative to avoid negative indexes in
  759. YYCHECK. In other words, skip the first -YYN actions for
  760. this state because they are default actions. */
  761. int yyxbegin = yyn < 0 ? -yyn : 0;
  762. /* Stay within bounds of both yycheck and yytname. */
  763. int yychecklim = YYLAST - yyn + 1;
  764. int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
  765. int yyx;
  766. for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  767. if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror
  768. && !yytable_value_is_error (yytable[yyx + yyn]))
  769. {
  770. if (!yyarg)
  771. ++yycount;
  772. else if (yycount == yyargn)
  773. return 0;
  774. else
  775. yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
  776. }
  777. }
  778. if (yyarg && yycount == 0 && 0 < yyargn)
  779. yyarg[0] = YYSYMBOL_YYEMPTY;
  780. return yycount;
  781. }
  782. #ifndef yystrlen
  783. # if defined __GLIBC__ && defined _STRING_H
  784. # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
  785. # else
  786. /* Return the length of YYSTR. */
  787. static YYPTRDIFF_T
  788. yystrlen (const char *yystr)
  789. {
  790. YYPTRDIFF_T yylen;
  791. for (yylen = 0; yystr[yylen]; yylen++)
  792. continue;
  793. return yylen;
  794. }
  795. # endif
  796. #endif
  797. #ifndef yystpcpy
  798. # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  799. # define yystpcpy stpcpy
  800. # else
  801. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  802. YYDEST. */
  803. static char *
  804. yystpcpy (char *yydest, const char *yysrc)
  805. {
  806. char *yyd = yydest;
  807. const char *yys = yysrc;
  808. while ((*yyd++ = *yys++) != '\0')
  809. continue;
  810. return yyd - 1;
  811. }
  812. # endif
  813. #endif
  814. #ifndef yytnamerr
  815. /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
  816. quotes and backslashes, so that it's suitable for yyerror. The
  817. heuristic is that double-quoting is unnecessary unless the string
  818. contains an apostrophe, a comma, or backslash (other than
  819. backslash-backslash). YYSTR is taken from yytname. If YYRES is
  820. null, do not copy; instead, return the length of what the result
  821. would have been. */
  822. static YYPTRDIFF_T
  823. yytnamerr (char *yyres, const char *yystr)
  824. {
  825. if (*yystr == '"')
  826. {
  827. YYPTRDIFF_T yyn = 0;
  828. char const *yyp = yystr;
  829. for (;;)
  830. switch (*++yyp)
  831. {
  832. case '\'':
  833. case ',':
  834. goto do_not_strip_quotes;
  835. case '\\':
  836. if (*++yyp != '\\')
  837. goto do_not_strip_quotes;
  838. else
  839. goto append;
  840. append:
  841. default:
  842. if (yyres)
  843. yyres[yyn] = *yyp;
  844. yyn++;
  845. break;
  846. case '"':
  847. if (yyres)
  848. yyres[yyn] = '\0';
  849. return yyn;
  850. }
  851. do_not_strip_quotes: ;
  852. }
  853. if (yyres)
  854. return yystpcpy (yyres, yystr) - yyres;
  855. else
  856. return yystrlen (yystr);
  857. }
  858. #endif
  859. static int
  860. yy_syntax_error_arguments (const yypcontext_t *yyctx,
  861. yysymbol_kind_t yyarg[], int yyargn)
  862. {
  863. /* Actual size of YYARG. */
  864. int yycount = 0;
  865. /* There are many possibilities here to consider:
  866. - If this state is a consistent state with a default action, then
  867. the only way this function was invoked is if the default action
  868. is an error action. In that case, don't check for expected
  869. tokens because there are none.
  870. - The only way there can be no lookahead present (in yychar) is if
  871. this state is a consistent state with a default action. Thus,
  872. detecting the absence of a lookahead is sufficient to determine
  873. that there is no unexpected or expected token to report. In that
  874. case, just report a simple "syntax error".
  875. - Don't assume there isn't a lookahead just because this state is a
  876. consistent state with a default action. There might have been a
  877. previous inconsistent state, consistent state with a non-default
  878. action, or user semantic action that manipulated yychar.
  879. - Of course, the expected token list depends on states to have
  880. correct lookahead information, and it depends on the parser not
  881. to perform extra reductions after fetching a lookahead from the
  882. scanner and before detecting a syntax error. Thus, state merging
  883. (from LALR or IELR) and default reductions corrupt the expected
  884. token list. However, the list is correct for canonical LR with
  885. one exception: it will still contain any token that will not be
  886. accepted due to an error action in a later state.
  887. */
  888. if (yyctx->yytoken != YYSYMBOL_YYEMPTY)
  889. {
  890. int yyn;
  891. if (yyarg)
  892. yyarg[yycount] = yyctx->yytoken;
  893. ++yycount;
  894. yyn = yypcontext_expected_tokens (yyctx,
  895. yyarg ? yyarg + 1 : yyarg, yyargn - 1);
  896. if (yyn == YYENOMEM)
  897. return YYENOMEM;
  898. else
  899. yycount += yyn;
  900. }
  901. return yycount;
  902. }
  903. /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
  904. about the unexpected token YYTOKEN for the state stack whose top is
  905. YYSSP.
  906. Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is
  907. not large enough to hold the message. In that case, also set
  908. *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the
  909. required number of bytes is too large to store. */
  910. static int
  911. yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
  912. const yypcontext_t *yyctx)
  913. {
  914. enum { YYARGS_MAX = 5 };
  915. /* Internationalized format string. */
  916. const char *yyformat = YY_NULLPTR;
  917. /* Arguments of yyformat: reported tokens (one for the "unexpected",
  918. one per "expected"). */
  919. yysymbol_kind_t yyarg[YYARGS_MAX];
  920. /* Cumulated lengths of YYARG. */
  921. YYPTRDIFF_T yysize = 0;
  922. /* Actual size of YYARG. */
  923. int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
  924. if (yycount == YYENOMEM)
  925. return YYENOMEM;
  926. switch (yycount)
  927. {
  928. #define YYCASE_(N, S) \
  929. case N: \
  930. yyformat = S; \
  931. break
  932. default: /* Avoid compiler warnings. */
  933. YYCASE_(0, YY_("syntax error"));
  934. YYCASE_(1, YY_("syntax error, unexpected %s"));
  935. YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
  936. YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
  937. YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
  938. YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
  939. #undef YYCASE_
  940. }
  941. /* Compute error message size. Don't count the "%s"s, but reserve
  942. room for the terminator. */
  943. yysize = yystrlen (yyformat) - 2 * yycount + 1;
  944. {
  945. int yyi;
  946. for (yyi = 0; yyi < yycount; ++yyi)
  947. {
  948. YYPTRDIFF_T yysize1
  949. = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
  950. if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
  951. yysize = yysize1;
  952. else
  953. return YYENOMEM;
  954. }
  955. }
  956. if (*yymsg_alloc < yysize)
  957. {
  958. *yymsg_alloc = 2 * yysize;
  959. if (! (yysize <= *yymsg_alloc
  960. && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
  961. *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
  962. return -1;
  963. }
  964. /* Avoid sprintf, as that infringes on the user's name space.
  965. Don't have undefined behavior even if the translation
  966. produced a string with the wrong number of "%s"s. */
  967. {
  968. char *yyp = *yymsg;
  969. int yyi = 0;
  970. while ((*yyp = *yyformat) != '\0')
  971. if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
  972. {
  973. yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
  974. yyformat += 2;
  975. }
  976. else
  977. {
  978. ++yyp;
  979. ++yyformat;
  980. }
  981. }
  982. return 0;
  983. }
  984. /*-----------------------------------------------.
  985. | Release the memory associated to this symbol. |
  986. `-----------------------------------------------*/
  987. static void
  988. yydestruct (const char *yymsg,
  989. yysymbol_kind_t yykind, YYSTYPE *yyvaluep, yyscan_t yyscanner)
  990. {
  991. YYUSE (yyvaluep);
  992. YYUSE (yyscanner);
  993. if (!yymsg)
  994. yymsg = "Deleting";
  995. YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
  996. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  997. YYUSE (yykind);
  998. YY_IGNORE_MAYBE_UNINITIALIZED_END
  999. }
  1000. /*----------.
  1001. | yyparse. |
  1002. `----------*/
  1003. int
  1004. yyparse (yyscan_t yyscanner)
  1005. {
  1006. /* Lookahead token kind. */
  1007. int yychar;
  1008. /* The semantic value of the lookahead symbol. */
  1009. /* Default value used for initialization, for pacifying older GCCs
  1010. or non-GCC compilers. */
  1011. YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
  1012. YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
  1013. /* Number of syntax errors so far. */
  1014. int yynerrs = 0;
  1015. yy_state_fast_t yystate = 0;
  1016. /* Number of tokens to shift before error messages enabled. */
  1017. int yyerrstatus = 0;
  1018. /* Refer to the stacks through separate pointers, to allow yyoverflow
  1019. to reallocate them elsewhere. */
  1020. /* Their size. */
  1021. YYPTRDIFF_T yystacksize = YYINITDEPTH;
  1022. /* The state stack: array, bottom, top. */
  1023. yy_state_t yyssa[YYINITDEPTH];
  1024. yy_state_t *yyss = yyssa;
  1025. yy_state_t *yyssp = yyss;
  1026. /* The semantic value stack: array, bottom, top. */
  1027. YYSTYPE yyvsa[YYINITDEPTH];
  1028. YYSTYPE *yyvs = yyvsa;
  1029. YYSTYPE *yyvsp = yyvs;
  1030. int yyn;
  1031. /* The return value of yyparse. */
  1032. int yyresult;
  1033. /* Lookahead symbol kind. */
  1034. yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
  1035. /* The variables used to return semantic value and location from the
  1036. action routines. */
  1037. YYSTYPE yyval;
  1038. /* Buffer for error messages, and its allocated size. */
  1039. char yymsgbuf[128];
  1040. char *yymsg = yymsgbuf;
  1041. YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
  1042. #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
  1043. /* The number of symbols on the RHS of the reduced rule.
  1044. Keep to zero when no symbol should be popped. */
  1045. int yylen = 0;
  1046. YYDPRINTF ((stderr, "Starting parse\n"));
  1047. yychar = YYEMPTY; /* Cause a token to be read. */
  1048. goto yysetstate;
  1049. /*------------------------------------------------------------.
  1050. | yynewstate -- push a new state, which is found in yystate. |
  1051. `------------------------------------------------------------*/
  1052. yynewstate:
  1053. /* In all cases, when you get here, the value and location stacks
  1054. have just been pushed. So pushing a state here evens the stacks. */
  1055. yyssp++;
  1056. /*--------------------------------------------------------------------.
  1057. | yysetstate -- set current state (the top of the stack) to yystate. |
  1058. `--------------------------------------------------------------------*/
  1059. yysetstate:
  1060. YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  1061. YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
  1062. YY_IGNORE_USELESS_CAST_BEGIN
  1063. *yyssp = YY_CAST (yy_state_t, yystate);
  1064. YY_IGNORE_USELESS_CAST_END
  1065. YY_STACK_PRINT (yyss, yyssp);
  1066. if (yyss + yystacksize - 1 <= yyssp)
  1067. #if !defined yyoverflow && !defined YYSTACK_RELOCATE
  1068. goto yyexhaustedlab;
  1069. #else
  1070. {
  1071. /* Get the current used size of the three stacks, in elements. */
  1072. YYPTRDIFF_T yysize = yyssp - yyss + 1;
  1073. # if defined yyoverflow
  1074. {
  1075. /* Give user a chance to reallocate the stack. Use copies of
  1076. these so that the &'s don't force the real ones into
  1077. memory. */
  1078. yy_state_t *yyss1 = yyss;
  1079. YYSTYPE *yyvs1 = yyvs;
  1080. /* Each stack pointer address is followed by the size of the
  1081. data in use in that stack, in bytes. This used to be a
  1082. conditional around just the two extra args, but that might
  1083. be undefined if yyoverflow is a macro. */
  1084. yyoverflow (YY_("memory exhausted"),
  1085. &yyss1, yysize * YYSIZEOF (*yyssp),
  1086. &yyvs1, yysize * YYSIZEOF (*yyvsp),
  1087. &yystacksize);
  1088. yyss = yyss1;
  1089. yyvs = yyvs1;
  1090. }
  1091. # else /* defined YYSTACK_RELOCATE */
  1092. /* Extend the stack our own way. */
  1093. if (YYMAXDEPTH <= yystacksize)
  1094. goto yyexhaustedlab;
  1095. yystacksize *= 2;
  1096. if (YYMAXDEPTH < yystacksize)
  1097. yystacksize = YYMAXDEPTH;
  1098. {
  1099. yy_state_t *yyss1 = yyss;
  1100. union yyalloc *yyptr =
  1101. YY_CAST (union yyalloc *,
  1102. YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
  1103. if (! yyptr)
  1104. goto yyexhaustedlab;
  1105. YYSTACK_RELOCATE (yyss_alloc, yyss);
  1106. YYSTACK_RELOCATE (yyvs_alloc, yyvs);
  1107. # undef YYSTACK_RELOCATE
  1108. if (yyss1 != yyssa)
  1109. YYSTACK_FREE (yyss1);
  1110. }
  1111. # endif
  1112. yyssp = yyss + yysize - 1;
  1113. yyvsp = yyvs + yysize - 1;
  1114. YY_IGNORE_USELESS_CAST_BEGIN
  1115. YYDPRINTF ((stderr, "Stack size increased to %ld\n",
  1116. YY_CAST (long, yystacksize)));
  1117. YY_IGNORE_USELESS_CAST_END
  1118. if (yyss + yystacksize - 1 <= yyssp)
  1119. YYABORT;
  1120. }
  1121. #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
  1122. if (yystate == YYFINAL)
  1123. YYACCEPT;
  1124. goto yybackup;
  1125. /*-----------.
  1126. | yybackup. |
  1127. `-----------*/
  1128. yybackup:
  1129. /* Do appropriate processing given the current state. Read a
  1130. lookahead token if we need one and don't already have one. */
  1131. /* First try to decide what to do without reference to lookahead token. */
  1132. yyn = yypact[yystate];
  1133. if (yypact_value_is_default (yyn))
  1134. goto yydefault;
  1135. /* Not known => get a lookahead token if don't already have one. */
  1136. /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
  1137. if (yychar == YYEMPTY)
  1138. {
  1139. YYDPRINTF ((stderr, "Reading a token\n"));
  1140. yychar = yylex (&yylval, yyscanner);
  1141. }
  1142. if (yychar <= YYEOF)
  1143. {
  1144. yychar = YYEOF;
  1145. yytoken = YYSYMBOL_YYEOF;
  1146. YYDPRINTF ((stderr, "Now at end of input.\n"));
  1147. }
  1148. else if (yychar == YYerror)
  1149. {
  1150. /* The scanner already issued an error message, process directly
  1151. to error recovery. But do not keep the error token as
  1152. lookahead, it is too special and may lead us to an endless
  1153. loop in error recovery. */
  1154. yychar = YYUNDEF;
  1155. yytoken = YYSYMBOL_YYerror;
  1156. goto yyerrlab1;
  1157. }
  1158. else
  1159. {
  1160. yytoken = YYTRANSLATE (yychar);
  1161. YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
  1162. }
  1163. /* If the proper action on seeing token YYTOKEN is to reduce or to
  1164. detect an error, take that action. */
  1165. yyn += yytoken;
  1166. if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  1167. goto yydefault;
  1168. yyn = yytable[yyn];
  1169. if (yyn <= 0)
  1170. {
  1171. if (yytable_value_is_error (yyn))
  1172. goto yyerrlab;
  1173. yyn = -yyn;
  1174. goto yyreduce;
  1175. }
  1176. /* Count tokens shifted since error; after three, turn off error
  1177. status. */
  1178. if (yyerrstatus)
  1179. yyerrstatus--;
  1180. /* Shift the lookahead token. */
  1181. YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  1182. yystate = yyn;
  1183. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1184. *++yyvsp = yylval;
  1185. YY_IGNORE_MAYBE_UNINITIALIZED_END
  1186. /* Discard the shifted token. */
  1187. yychar = YYEMPTY;
  1188. goto yynewstate;
  1189. /*-----------------------------------------------------------.
  1190. | yydefault -- do the default action for the current state. |
  1191. `-----------------------------------------------------------*/
  1192. yydefault:
  1193. yyn = yydefact[yystate];
  1194. if (yyn == 0)
  1195. goto yyerrlab;
  1196. goto yyreduce;
  1197. /*-----------------------------.
  1198. | yyreduce -- do a reduction. |
  1199. `-----------------------------*/
  1200. yyreduce:
  1201. /* yyn is the number of a rule to reduce with. */
  1202. yylen = yyr2[yyn];
  1203. /* If YYLEN is nonzero, implement the default value of the action:
  1204. '$$ = $1'.
  1205. Otherwise, the following line sets YYVAL to garbage.
  1206. This behavior is undocumented and Bison
  1207. users should not rely upon it. Assigning to YYVAL
  1208. unconditionally makes the parser a bit smaller, and it avoids a
  1209. GCC warning that YYVAL may be used uninitialized. */
  1210. yyval = yyvsp[1-yylen];
  1211. YY_REDUCE_PRINT (yyn);
  1212. switch (yyn)
  1213. {
  1214. case 2: /* Start: GoalWithOptionalBackSlash */
  1215. #line 97 "cmCommandArgumentParser.y"
  1216. {
  1217. (yyval.str) = 0;
  1218. yyGetParser->SetResult((yyvsp[0].str));
  1219. }
  1220. #line 1437 "cmCommandArgumentParser.cxx"
  1221. break;
  1222. case 3: /* GoalWithOptionalBackSlash: Goal */
  1223. #line 103 "cmCommandArgumentParser.y"
  1224. {
  1225. (yyval.str) = (yyvsp[0].str);
  1226. }
  1227. #line 1445 "cmCommandArgumentParser.cxx"
  1228. break;
  1229. case 4: /* GoalWithOptionalBackSlash: Goal "\\" */
  1230. #line 106 "cmCommandArgumentParser.y"
  1231. {
  1232. (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str));
  1233. }
  1234. #line 1453 "cmCommandArgumentParser.cxx"
  1235. break;
  1236. case 5: /* Goal: %empty */
  1237. #line 111 "cmCommandArgumentParser.y"
  1238. {
  1239. (yyval.str) = 0;
  1240. }
  1241. #line 1461 "cmCommandArgumentParser.cxx"
  1242. break;
  1243. case 6: /* Goal: String Goal */
  1244. #line 114 "cmCommandArgumentParser.y"
  1245. {
  1246. (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str));
  1247. }
  1248. #line 1469 "cmCommandArgumentParser.cxx"
  1249. break;
  1250. case 7: /* String: OuterText */
  1251. #line 119 "cmCommandArgumentParser.y"
  1252. {
  1253. (yyval.str) = (yyvsp[0].str);
  1254. }
  1255. #line 1477 "cmCommandArgumentParser.cxx"
  1256. break;
  1257. case 8: /* String: Variable */
  1258. #line 122 "cmCommandArgumentParser.y"
  1259. {
  1260. (yyval.str) = (yyvsp[0].str);
  1261. }
  1262. #line 1485 "cmCommandArgumentParser.cxx"
  1263. break;
  1264. case 9: /* OuterText: cal_NAME */
  1265. #line 127 "cmCommandArgumentParser.y"
  1266. {
  1267. (yyval.str) = (yyvsp[0].str);
  1268. }
  1269. #line 1493 "cmCommandArgumentParser.cxx"
  1270. break;
  1271. case 10: /* OuterText: "@" */
  1272. #line 130 "cmCommandArgumentParser.y"
  1273. {
  1274. (yyval.str) = (yyvsp[0].str);
  1275. }
  1276. #line 1501 "cmCommandArgumentParser.cxx"
  1277. break;
  1278. case 11: /* OuterText: "$" */
  1279. #line 133 "cmCommandArgumentParser.y"
  1280. {
  1281. (yyval.str) = (yyvsp[0].str);
  1282. }
  1283. #line 1509 "cmCommandArgumentParser.cxx"
  1284. break;
  1285. case 12: /* OuterText: "{" */
  1286. #line 136 "cmCommandArgumentParser.y"
  1287. {
  1288. (yyval.str) = (yyvsp[0].str);
  1289. }
  1290. #line 1517 "cmCommandArgumentParser.cxx"
  1291. break;
  1292. case 13: /* OuterText: "}" */
  1293. #line 139 "cmCommandArgumentParser.y"
  1294. {
  1295. (yyval.str) = (yyvsp[0].str);
  1296. }
  1297. #line 1525 "cmCommandArgumentParser.cxx"
  1298. break;
  1299. case 14: /* OuterText: cal_SYMBOL */
  1300. #line 142 "cmCommandArgumentParser.y"
  1301. {
  1302. (yyval.str) = (yyvsp[0].str);
  1303. }
  1304. #line 1533 "cmCommandArgumentParser.cxx"
  1305. break;
  1306. case 15: /* Variable: cal_ENVCURLY EnvVarName "}" */
  1307. #line 147 "cmCommandArgumentParser.y"
  1308. {
  1309. (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str));
  1310. }
  1311. #line 1541 "cmCommandArgumentParser.cxx"
  1312. break;
  1313. case 16: /* Variable: cal_NCURLY MultipleIds "}" */
  1314. #line 150 "cmCommandArgumentParser.y"
  1315. {
  1316. (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str));
  1317. }
  1318. #line 1549 "cmCommandArgumentParser.cxx"
  1319. break;
  1320. case 17: /* Variable: cal_DCURLY MultipleIds "}" */
  1321. #line 153 "cmCommandArgumentParser.y"
  1322. {
  1323. (yyval.str) = yyGetParser->ExpandVariable((yyvsp[-1].str));
  1324. }
  1325. #line 1557 "cmCommandArgumentParser.cxx"
  1326. break;
  1327. case 18: /* Variable: cal_ATNAME */
  1328. #line 156 "cmCommandArgumentParser.y"
  1329. {
  1330. (yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[0].str));
  1331. }
  1332. #line 1565 "cmCommandArgumentParser.cxx"
  1333. break;
  1334. case 19: /* EnvVarName: MultipleIds */
  1335. #line 161 "cmCommandArgumentParser.y"
  1336. {
  1337. (yyval.str) = (yyvsp[0].str);
  1338. }
  1339. #line 1573 "cmCommandArgumentParser.cxx"
  1340. break;
  1341. case 20: /* EnvVarName: cal_SYMBOL EnvVarName */
  1342. #line 164 "cmCommandArgumentParser.y"
  1343. {
  1344. (yyval.str) = (yyvsp[-1].str);
  1345. }
  1346. #line 1581 "cmCommandArgumentParser.cxx"
  1347. break;
  1348. case 21: /* MultipleIds: %empty */
  1349. #line 169 "cmCommandArgumentParser.y"
  1350. {
  1351. (yyval.str) = 0;
  1352. }
  1353. #line 1589 "cmCommandArgumentParser.cxx"
  1354. break;
  1355. case 22: /* MultipleIds: ID MultipleIds */
  1356. #line 172 "cmCommandArgumentParser.y"
  1357. {
  1358. (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str));
  1359. }
  1360. #line 1597 "cmCommandArgumentParser.cxx"
  1361. break;
  1362. case 23: /* ID: cal_NAME */
  1363. #line 177 "cmCommandArgumentParser.y"
  1364. {
  1365. (yyval.str) = (yyvsp[0].str);
  1366. }
  1367. #line 1605 "cmCommandArgumentParser.cxx"
  1368. break;
  1369. case 24: /* ID: Variable */
  1370. #line 180 "cmCommandArgumentParser.y"
  1371. {
  1372. (yyval.str) = (yyvsp[0].str);
  1373. }
  1374. #line 1613 "cmCommandArgumentParser.cxx"
  1375. break;
  1376. #line 1617 "cmCommandArgumentParser.cxx"
  1377. default: break;
  1378. }
  1379. /* User semantic actions sometimes alter yychar, and that requires
  1380. that yytoken be updated with the new translation. We take the
  1381. approach of translating immediately before every use of yytoken.
  1382. One alternative is translating here after every semantic action,
  1383. but that translation would be missed if the semantic action invokes
  1384. YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
  1385. if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
  1386. incorrect destructor might then be invoked immediately. In the
  1387. case of YYERROR or YYBACKUP, subsequent parser actions might lead
  1388. to an incorrect destructor call or verbose syntax error message
  1389. before the lookahead is translated. */
  1390. YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
  1391. YYPOPSTACK (yylen);
  1392. yylen = 0;
  1393. *++yyvsp = yyval;
  1394. /* Now 'shift' the result of the reduction. Determine what state
  1395. that goes to, based on the state we popped back to and the rule
  1396. number reduced by. */
  1397. {
  1398. const int yylhs = yyr1[yyn] - YYNTOKENS;
  1399. const int yyi = yypgoto[yylhs] + *yyssp;
  1400. yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
  1401. ? yytable[yyi]
  1402. : yydefgoto[yylhs]);
  1403. }
  1404. goto yynewstate;
  1405. /*--------------------------------------.
  1406. | yyerrlab -- here on detecting error. |
  1407. `--------------------------------------*/
  1408. yyerrlab:
  1409. /* Make sure we have latest lookahead translation. See comments at
  1410. user semantic actions for why this is necessary. */
  1411. yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
  1412. /* If not already recovering from an error, report this error. */
  1413. if (!yyerrstatus)
  1414. {
  1415. ++yynerrs;
  1416. {
  1417. yypcontext_t yyctx
  1418. = {yyssp, yytoken};
  1419. char const *yymsgp = YY_("syntax error");
  1420. int yysyntax_error_status;
  1421. yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
  1422. if (yysyntax_error_status == 0)
  1423. yymsgp = yymsg;
  1424. else if (yysyntax_error_status == -1)
  1425. {
  1426. if (yymsg != yymsgbuf)
  1427. YYSTACK_FREE (yymsg);
  1428. yymsg = YY_CAST (char *,
  1429. YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
  1430. if (yymsg)
  1431. {
  1432. yysyntax_error_status
  1433. = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
  1434. yymsgp = yymsg;
  1435. }
  1436. else
  1437. {
  1438. yymsg = yymsgbuf;
  1439. yymsg_alloc = sizeof yymsgbuf;
  1440. yysyntax_error_status = YYENOMEM;
  1441. }
  1442. }
  1443. yyerror (yyscanner, yymsgp);
  1444. if (yysyntax_error_status == YYENOMEM)
  1445. goto yyexhaustedlab;
  1446. }
  1447. }
  1448. if (yyerrstatus == 3)
  1449. {
  1450. /* If just tried and failed to reuse lookahead token after an
  1451. error, discard it. */
  1452. if (yychar <= YYEOF)
  1453. {
  1454. /* Return failure if at end of input. */
  1455. if (yychar == YYEOF)
  1456. YYABORT;
  1457. }
  1458. else
  1459. {
  1460. yydestruct ("Error: discarding",
  1461. yytoken, &yylval, yyscanner);
  1462. yychar = YYEMPTY;
  1463. }
  1464. }
  1465. /* Else will try to reuse lookahead token after shifting the error
  1466. token. */
  1467. goto yyerrlab1;
  1468. /*---------------------------------------------------.
  1469. | yyerrorlab -- error raised explicitly by YYERROR. |
  1470. `---------------------------------------------------*/
  1471. yyerrorlab:
  1472. /* Pacify compilers when the user code never invokes YYERROR and the
  1473. label yyerrorlab therefore never appears in user code. */
  1474. if (0)
  1475. YYERROR;
  1476. /* Do not reclaim the symbols of the rule whose action triggered
  1477. this YYERROR. */
  1478. YYPOPSTACK (yylen);
  1479. yylen = 0;
  1480. YY_STACK_PRINT (yyss, yyssp);
  1481. yystate = *yyssp;
  1482. goto yyerrlab1;
  1483. /*-------------------------------------------------------------.
  1484. | yyerrlab1 -- common code for both syntax error and YYERROR. |
  1485. `-------------------------------------------------------------*/
  1486. yyerrlab1:
  1487. yyerrstatus = 3; /* Each real token shifted decrements this. */
  1488. /* Pop stack until we find a state that shifts the error token. */
  1489. for (;;)
  1490. {
  1491. yyn = yypact[yystate];
  1492. if (!yypact_value_is_default (yyn))
  1493. {
  1494. yyn += YYSYMBOL_YYerror;
  1495. if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
  1496. {
  1497. yyn = yytable[yyn];
  1498. if (0 < yyn)
  1499. break;
  1500. }
  1501. }
  1502. /* Pop the current state because it cannot handle the error token. */
  1503. if (yyssp == yyss)
  1504. YYABORT;
  1505. yydestruct ("Error: popping",
  1506. YY_ACCESSING_SYMBOL (yystate), yyvsp, yyscanner);
  1507. YYPOPSTACK (1);
  1508. yystate = *yyssp;
  1509. YY_STACK_PRINT (yyss, yyssp);
  1510. }
  1511. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1512. *++yyvsp = yylval;
  1513. YY_IGNORE_MAYBE_UNINITIALIZED_END
  1514. /* Shift the error token. */
  1515. YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
  1516. yystate = yyn;
  1517. goto yynewstate;
  1518. /*-------------------------------------.
  1519. | yyacceptlab -- YYACCEPT comes here. |
  1520. `-------------------------------------*/
  1521. yyacceptlab:
  1522. yyresult = 0;
  1523. goto yyreturn;
  1524. /*-----------------------------------.
  1525. | yyabortlab -- YYABORT comes here. |
  1526. `-----------------------------------*/
  1527. yyabortlab:
  1528. yyresult = 1;
  1529. goto yyreturn;
  1530. #if 1
  1531. /*-------------------------------------------------.
  1532. | yyexhaustedlab -- memory exhaustion comes here. |
  1533. `-------------------------------------------------*/
  1534. yyexhaustedlab:
  1535. yyerror (yyscanner, YY_("memory exhausted"));
  1536. yyresult = 2;
  1537. goto yyreturn;
  1538. #endif
  1539. /*-------------------------------------------------------.
  1540. | yyreturn -- parsing is finished, clean up and return. |
  1541. `-------------------------------------------------------*/
  1542. yyreturn:
  1543. if (yychar != YYEMPTY)
  1544. {
  1545. /* Make sure we have latest lookahead translation. See comments at
  1546. user semantic actions for why this is necessary. */
  1547. yytoken = YYTRANSLATE (yychar);
  1548. yydestruct ("Cleanup: discarding lookahead",
  1549. yytoken, &yylval, yyscanner);
  1550. }
  1551. /* Do not reclaim the symbols of the rule whose action triggered
  1552. this YYABORT or YYACCEPT. */
  1553. YYPOPSTACK (yylen);
  1554. YY_STACK_PRINT (yyss, yyssp);
  1555. while (yyssp != yyss)
  1556. {
  1557. yydestruct ("Cleanup: popping",
  1558. YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yyscanner);
  1559. YYPOPSTACK (1);
  1560. }
  1561. #ifndef yyoverflow
  1562. if (yyss != yyssa)
  1563. YYSTACK_FREE (yyss);
  1564. #endif
  1565. if (yymsg != yymsgbuf)
  1566. YYSTACK_FREE (yymsg);
  1567. return yyresult;
  1568. }
  1569. #line 185 "cmCommandArgumentParser.y"
  1570. /* End of grammar */
  1571. /*--------------------------------------------------------------------------*/
  1572. void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message)
  1573. {
  1574. yyGetParser->Error(message);
  1575. }