cmCommandArgumentParser.cxx 58 KB

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