cmExprParser.cxx 50 KB

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