cmCommandArgumentParser.cxx 58 KB

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