cmCommandArgumentParser.cxx 58 KB

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