cmExprParser.cxx 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433
  1. /* A Bison parser, made by GNU Bison 1.875d. */
  2. /* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984,
  3. 1989, 1990, 2000, 2001, 2002, 2003, 2004 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 2, or (at your option)
  7. 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, write to the Free Software
  14. Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA. */
  16. /* As a special exception, when this file is copied by Bison into a
  17. Bison output file, you may use that output file without restriction.
  18. This special exception was added by the Free Software Foundation
  19. in version 1.24 of Bison. */
  20. /* Written by Richard Stallman by simplifying the original so called
  21. ``semantic'' parser. */
  22. /* All symbols defined below should begin with yy or YY, to avoid
  23. infringing on user name space. This should be done even for local
  24. variables, as they might otherwise be expanded by user macros.
  25. There are some unavoidable exceptions within include files to
  26. define necessary library symbols; they are noted "INFRINGES ON
  27. USER NAME SPACE" below. */
  28. /* turn off some warning as this is generated code */
  29. #if defined(_MSC_VER)
  30. # pragma warning ( disable : 4702 ) /* unreachable code */
  31. #endif
  32. /* Identify Bison output. */
  33. #define YYBISON 1
  34. /* Skeleton name. */
  35. #define YYSKELETON_NAME "yacc.c"
  36. /* Pure parsers. */
  37. #define YYPURE 1
  38. /* Using locations. */
  39. #define YYLSP_NEEDED 0
  40. /* If NAME_PREFIX is specified substitute the variables and functions
  41. names. */
  42. #define yyparse cmExpr_yyparse
  43. #define yylex cmExpr_yylex
  44. #define yyerror cmExpr_yyerror
  45. #define yylval cmExpr_yylval
  46. #define yychar cmExpr_yychar
  47. #define yydebug cmExpr_yydebug
  48. #define yynerrs cmExpr_yynerrs
  49. /* Tokens. */
  50. #ifndef YYTOKENTYPE
  51. # define YYTOKENTYPE
  52. /* Put the tokens into the symbol table, so that GDB and other debuggers
  53. know about them. */
  54. enum yytokentype {
  55. exp_PLUS = 258,
  56. exp_MINUS = 259,
  57. exp_TIMES = 260,
  58. exp_DIVIDE = 261,
  59. exp_MOD = 262,
  60. exp_SHIFTLEFT = 263,
  61. exp_SHIFTRIGHT = 264,
  62. exp_OPENPARENT = 265,
  63. exp_CLOSEPARENT = 266,
  64. exp_OR = 267,
  65. exp_AND = 268,
  66. exp_XOR = 269,
  67. exp_NOT = 270,
  68. exp_NUMBER = 271
  69. };
  70. #endif
  71. #define exp_PLUS 258
  72. #define exp_MINUS 259
  73. #define exp_TIMES 260
  74. #define exp_DIVIDE 261
  75. #define exp_MOD 262
  76. #define exp_SHIFTLEFT 263
  77. #define exp_SHIFTRIGHT 264
  78. #define exp_OPENPARENT 265
  79. #define exp_CLOSEPARENT 266
  80. #define exp_OR 267
  81. #define exp_AND 268
  82. #define exp_XOR 269
  83. #define exp_NOT 270
  84. #define exp_NUMBER 271
  85. /* Copy the first part of user declarations. */
  86. /*============================================================================
  87. CMake - Cross Platform Makefile Generator
  88. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  89. Distributed under the OSI-approved BSD License (the "License");
  90. see accompanying file Copyright.txt for details.
  91. This software is distributed WITHOUT ANY WARRANTY; without even the
  92. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  93. See the License for more information.
  94. ============================================================================*/
  95. /*
  96. This file must be translated to C and modified to build everywhere.
  97. Run bison like this:
  98. bison --yacc --name-prefix=cmExpr_yy --defines=cmExprParserTokens.h
  99. -ocmExprParser.cxx cmExprParser.y
  100. Modify cmExprParser.cxx:
  101. - remove TABs
  102. - add __HP_aCC to the #if test for yyerrorlab warning suppression
  103. */
  104. /* Configure the parser to use a lexer object. */
  105. #define YYPARSE_PARAM yyscanner
  106. #define YYLEX_PARAM yyscanner
  107. #define YYERROR_VERBOSE 1
  108. #define cmExpr_yyerror(x) \
  109. cmExprError(yyscanner, x)
  110. #define yyGetParser (cmExpr_yyget_extra(yyscanner))
  111. /*-------------------------------------------------------------------------*/
  112. #include "cmExprParserHelper.h" /* Interface to parser object. */
  113. #include "cmExprLexer.h" /* Interface to lexer object. */
  114. #include "cmExprParserTokens.h" /* Need YYSTYPE for YY_DECL. */
  115. #include <math.h>
  116. /* Forward declare the lexer entry point. */
  117. YY_DECL;
  118. /* Internal utility functions. */
  119. static void cmExprError(yyscan_t yyscanner, const char* message);
  120. #define YYDEBUG 1
  121. //#define YYMAXDEPTH 100000
  122. //#define YYINITDEPTH 10000
  123. /* Disable some warnings in the generated code. */
  124. #ifdef __BORLANDC__
  125. # pragma warn -8004 /* Variable assigned a value that is not used. */
  126. # pragma warn -8008 /* condition always returns true */
  127. # pragma warn -8060 /* possibly incorrect assignment */
  128. # pragma warn -8066 /* unreachable code */
  129. #endif
  130. #ifdef _MSC_VER
  131. # pragma warning (disable: 4102) /* Unused goto label. */
  132. # pragma warning (disable: 4065) /* Switch statement contains default but
  133. no case. */
  134. #endif
  135. /* Enabling traces. */
  136. #ifndef YYDEBUG
  137. # define YYDEBUG 0
  138. #endif
  139. /* Enabling verbose error messages. */
  140. #ifdef YYERROR_VERBOSE
  141. # undef YYERROR_VERBOSE
  142. # define YYERROR_VERBOSE 1
  143. #else
  144. # define YYERROR_VERBOSE 0
  145. #endif
  146. #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
  147. typedef int YYSTYPE;
  148. # define yystype YYSTYPE /* obsolescent; will be withdrawn */
  149. # define YYSTYPE_IS_DECLARED 1
  150. # define YYSTYPE_IS_TRIVIAL 1
  151. #endif
  152. /* Copy the second part of user declarations. */
  153. /* Line 214 of yacc.c. */
  154. #if ! defined (yyoverflow) || YYERROR_VERBOSE
  155. # ifndef YYFREE
  156. # define YYFREE free
  157. # endif
  158. # ifndef YYMALLOC
  159. # define YYMALLOC malloc
  160. # endif
  161. /* The parser invokes alloca or malloc; define the necessary symbols. */
  162. # ifdef YYSTACK_USE_ALLOCA
  163. # if YYSTACK_USE_ALLOCA
  164. # define YYSTACK_ALLOC alloca
  165. # endif
  166. # else
  167. # if defined (alloca) || defined (_ALLOCA_H)
  168. # define YYSTACK_ALLOC alloca
  169. # else
  170. # ifdef __GNUC__
  171. # define YYSTACK_ALLOC __builtin_alloca
  172. # endif
  173. # endif
  174. # endif
  175. # ifdef YYSTACK_ALLOC
  176. /* Pacify GCC's `empty if-body' warning. */
  177. # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
  178. # else
  179. # if defined (__STDC__) || defined (__cplusplus)
  180. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  181. # define YYSIZE_T size_t
  182. # endif
  183. # define YYSTACK_ALLOC YYMALLOC
  184. # define YYSTACK_FREE YYFREE
  185. # endif
  186. #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
  187. #if (! defined (yyoverflow) \
  188. && (! defined (__cplusplus) \
  189. || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
  190. /* A type that is properly aligned for any stack member. */
  191. union yyalloc
  192. {
  193. short int yyss;
  194. YYSTYPE yyvs;
  195. };
  196. /* The size of the maximum gap between one aligned stack and the next. */
  197. # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
  198. /* The size of an array large to enough to hold all stacks, each with
  199. N elements. */
  200. # define YYSTACK_BYTES(N) \
  201. ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
  202. + YYSTACK_GAP_MAXIMUM)
  203. /* Copy COUNT objects from FROM to TO. The source and destination do
  204. not overlap. */
  205. # ifndef YYCOPY
  206. # if defined (__GNUC__) && 1 < __GNUC__
  207. # define YYCOPY(To, From, Count) \
  208. __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
  209. # else
  210. # define YYCOPY(To, From, Count) \
  211. do \
  212. { \
  213. register YYSIZE_T yyi; \
  214. for (yyi = 0; yyi < (Count); yyi++) \
  215. (To)[yyi] = (From)[yyi]; \
  216. } \
  217. while (0)
  218. # endif
  219. # endif
  220. /* Relocate STACK from its old location to the new one. The
  221. local variables YYSIZE and YYSTACKSIZE give the old and new number of
  222. elements in the stack, and YYPTR gives the new location of the
  223. stack. Advance YYPTR to a properly aligned location for the next
  224. stack. */
  225. # define YYSTACK_RELOCATE(Stack) \
  226. do \
  227. { \
  228. YYSIZE_T yynewbytes; \
  229. YYCOPY (&yyptr->Stack, Stack, yysize); \
  230. Stack = &yyptr->Stack; \
  231. yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
  232. yyptr += yynewbytes / sizeof (*yyptr); \
  233. } \
  234. while (0)
  235. #endif
  236. #if defined (__STDC__) || defined (__cplusplus)
  237. typedef signed char yysigned_char;
  238. #else
  239. typedef short int yysigned_char;
  240. #endif
  241. /* YYFINAL -- State number of the termination state. */
  242. #define YYFINAL 12
  243. /* YYLAST -- Last index in YYTABLE. */
  244. #define YYLAST 25
  245. /* YYNTOKENS -- Number of terminals. */
  246. #define YYNTOKENS 17
  247. /* YYNNTS -- Number of nonterminals. */
  248. #define YYNNTS 9
  249. /* YYNRULES -- Number of rules. */
  250. #define YYNRULES 20
  251. /* YYNRULES -- Number of states. */
  252. #define YYNSTATES 34
  253. /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
  254. #define YYUNDEFTOK 2
  255. #define YYMAXUTOK 271
  256. #define YYTRANSLATE(YYX) \
  257. ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  258. /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
  259. static const unsigned char yytranslate[] =
  260. {
  261. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  262. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  263. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  264. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  265. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  266. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  267. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  268. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  269. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  270. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  271. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  272. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  273. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  274. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  275. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  276. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  277. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  278. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  279. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  280. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  281. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  282. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  283. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  284. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  285. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  286. 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
  287. 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
  288. 15, 16
  289. };
  290. #if YYDEBUG
  291. /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
  292. YYRHS. */
  293. static const unsigned char yyprhs[] =
  294. {
  295. 0, 0, 3, 5, 7, 11, 13, 17, 19, 23,
  296. 25, 29, 33, 35, 39, 43, 45, 49, 53, 57,
  297. 59
  298. };
  299. /* YYRHS -- A `-1'-separated list of the rules' RHS. */
  300. static const yysigned_char yyrhs[] =
  301. {
  302. 18, 0, -1, 19, -1, 20, -1, 19, 12, 20,
  303. -1, 21, -1, 20, 14, 21, -1, 22, -1, 21,
  304. 13, 22, -1, 23, -1, 22, 8, 23, -1, 22,
  305. 9, 23, -1, 24, -1, 23, 3, 24, -1, 23,
  306. 4, 24, -1, 25, -1, 24, 5, 25, -1, 24,
  307. 6, 25, -1, 24, 7, 25, -1, 16, -1, 10,
  308. 19, 11, -1
  309. };
  310. /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
  311. static const unsigned char yyrline[] =
  312. {
  313. 0, 94, 94, 100, 103, 107, 110, 114, 117, 121,
  314. 124, 127, 132, 135, 138, 142, 145, 148, 151, 155,
  315. 158
  316. };
  317. #endif
  318. #if YYDEBUG || YYERROR_VERBOSE
  319. /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  320. First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  321. static const char *const yytname[] =
  322. {
  323. "$end", "error", "$undefined", "exp_PLUS", "exp_MINUS", "exp_TIMES",
  324. "exp_DIVIDE", "exp_MOD", "exp_SHIFTLEFT", "exp_SHIFTRIGHT",
  325. "exp_OPENPARENT", "exp_CLOSEPARENT", "exp_OR", "exp_AND", "exp_XOR",
  326. "exp_NOT", "exp_NUMBER", "$accept", "Start", "exp", "bitwiseor",
  327. "bitwisexor", "bitwiseand", "shift", "term", "factor", 0
  328. };
  329. #endif
  330. # ifdef YYPRINT
  331. /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
  332. token YYLEX-NUM. */
  333. static const unsigned short int yytoknum[] =
  334. {
  335. 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  336. 265, 266, 267, 268, 269, 270, 271
  337. };
  338. # endif
  339. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  340. static const unsigned char yyr1[] =
  341. {
  342. 0, 17, 18, 19, 19, 20, 20, 21, 21, 22,
  343. 22, 22, 23, 23, 23, 24, 24, 24, 24, 25,
  344. 25
  345. };
  346. /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
  347. static const unsigned char yyr2[] =
  348. {
  349. 0, 2, 1, 1, 3, 1, 3, 1, 3, 1,
  350. 3, 3, 1, 3, 3, 1, 3, 3, 3, 1,
  351. 3
  352. };
  353. /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
  354. STATE-NUM when YYTABLE doesn't specify something else to do. Zero
  355. means the default is an error. */
  356. static const unsigned char yydefact[] =
  357. {
  358. 0, 0, 19, 0, 2, 3, 5, 7, 9, 12,
  359. 15, 0, 1, 0, 0, 0, 0, 0, 0, 0,
  360. 0, 0, 0, 20, 4, 6, 8, 10, 11, 13,
  361. 14, 16, 17, 18
  362. };
  363. /* YYDEFGOTO[NTERM-NUM]. */
  364. static const yysigned_char yydefgoto[] =
  365. {
  366. -1, 3, 4, 5, 6, 7, 8, 9, 10
  367. };
  368. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  369. STATE-NUM. */
  370. #define YYPACT_NINF -14
  371. static const yysigned_char yypact[] =
  372. {
  373. -10, -10, -14, 18, 7, 6, 8, 2, 1, -4,
  374. -14, 3, -14, -10, -10, -10, -10, -10, -10, -10,
  375. -10, -10, -10, -14, 6, 8, 2, 1, 1, -4,
  376. -4, -14, -14, -14
  377. };
  378. /* YYPGOTO[NTERM-NUM]. */
  379. static const yysigned_char yypgoto[] =
  380. {
  381. -14, -14, 21, 10, 11, 9, 0, -6, -13
  382. };
  383. /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
  384. positive, shift that token. If negative, reduce the rule which
  385. number is the opposite. If zero, do what YYDEFACT says.
  386. If YYTABLE_NINF, syntax error. */
  387. #define YYTABLE_NINF -1
  388. static const unsigned char yytable[] =
  389. {
  390. 1, 20, 21, 22, 18, 19, 2, 31, 32, 33,
  391. 16, 17, 29, 30, 23, 13, 27, 28, 12, 13,
  392. 14, 15, 11, 24, 26, 25
  393. };
  394. static const unsigned char yycheck[] =
  395. {
  396. 10, 5, 6, 7, 3, 4, 16, 20, 21, 22,
  397. 8, 9, 18, 19, 11, 12, 16, 17, 0, 12,
  398. 14, 13, 1, 13, 15, 14
  399. };
  400. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  401. symbol of state STATE-NUM. */
  402. static const unsigned char yystos[] =
  403. {
  404. 0, 10, 16, 18, 19, 20, 21, 22, 23, 24,
  405. 25, 19, 0, 12, 14, 13, 8, 9, 3, 4,
  406. 5, 6, 7, 11, 20, 21, 22, 23, 23, 24,
  407. 24, 25, 25, 25
  408. };
  409. #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
  410. # define YYSIZE_T __SIZE_TYPE__
  411. #endif
  412. #if ! defined (YYSIZE_T) && defined (size_t)
  413. # define YYSIZE_T size_t
  414. #endif
  415. #if ! defined (YYSIZE_T)
  416. # if defined (__STDC__) || defined (__cplusplus)
  417. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  418. # define YYSIZE_T size_t
  419. # endif
  420. #endif
  421. #if ! defined (YYSIZE_T)
  422. # define YYSIZE_T unsigned int
  423. #endif
  424. #define yyerrok (yyerrstatus = 0)
  425. #define yyclearin (yychar = YYEMPTY)
  426. #define YYEMPTY (-2)
  427. #define YYEOF 0
  428. #define YYACCEPT goto yyacceptlab
  429. #define YYABORT goto yyabortlab
  430. #define YYERROR goto yyerrorlab
  431. /* Like YYERROR except do call yyerror. This remains here temporarily
  432. to ease the transition to the new meaning of YYERROR, for GCC.
  433. Once GCC version 2 has supplanted version 1, this can go. */
  434. #define YYFAIL goto yyerrlab
  435. #define YYRECOVERING() (!!yyerrstatus)
  436. #define YYBACKUP(Token, Value) \
  437. do \
  438. if (yychar == YYEMPTY && yylen == 1) \
  439. { \
  440. yychar = (Token); \
  441. yylval = (Value); \
  442. yytoken = YYTRANSLATE (yychar); \
  443. YYPOPSTACK; \
  444. goto yybackup; \
  445. } \
  446. else \
  447. { \
  448. yyerror ("syntax error: cannot back up");\
  449. YYERROR; \
  450. } \
  451. while (0)
  452. #define YYTERROR 1
  453. #define YYERRCODE 256
  454. /* YYLLOC_DEFAULT -- Compute the default location (before the actions
  455. are run). */
  456. #ifndef YYLLOC_DEFAULT
  457. # define YYLLOC_DEFAULT(Current, Rhs, N) \
  458. ((Current).first_line = (Rhs)[1].first_line, \
  459. (Current).first_column = (Rhs)[1].first_column, \
  460. (Current).last_line = (Rhs)[N].last_line, \
  461. (Current).last_column = (Rhs)[N].last_column)
  462. #endif
  463. /* YYLEX -- calling `yylex' with the right arguments. */
  464. #ifdef YYLEX_PARAM
  465. # define YYLEX yylex (&yylval, YYLEX_PARAM)
  466. #else
  467. # define YYLEX yylex (&yylval)
  468. #endif
  469. /* Enable debugging if requested. */
  470. #if YYDEBUG
  471. # ifndef YYFPRINTF
  472. # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  473. # define YYFPRINTF fprintf
  474. # endif
  475. # define YYDPRINTF(Args) \
  476. do { \
  477. if (yydebug) \
  478. YYFPRINTF Args; \
  479. } while (0)
  480. # define YYDSYMPRINT(Args) \
  481. do { \
  482. if (yydebug) \
  483. yysymprint Args; \
  484. } while (0)
  485. # define YYDSYMPRINTF(Title, Token, Value, Location) \
  486. do { \
  487. if (yydebug) \
  488. { \
  489. YYFPRINTF (stderr, "%s ", Title); \
  490. yysymprint (stderr, \
  491. Token, Value); \
  492. YYFPRINTF (stderr, "\n"); \
  493. } \
  494. } while (0)
  495. /*------------------------------------------------------------------.
  496. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  497. | TOP (included). |
  498. `------------------------------------------------------------------*/
  499. #if defined (__STDC__) || defined (__cplusplus)
  500. static void
  501. yy_stack_print (short int *bottom, short int *top)
  502. #else
  503. static void
  504. yy_stack_print (bottom, top)
  505. short int *bottom;
  506. short int *top;
  507. #endif
  508. {
  509. YYFPRINTF (stderr, "Stack now");
  510. for (/* Nothing. */; bottom <= top; ++bottom)
  511. YYFPRINTF (stderr, " %d", *bottom);
  512. YYFPRINTF (stderr, "\n");
  513. }
  514. # define YY_STACK_PRINT(Bottom, Top) \
  515. do { \
  516. if (yydebug) \
  517. yy_stack_print ((Bottom), (Top)); \
  518. } while (0)
  519. /*------------------------------------------------.
  520. | Report that the YYRULE is going to be reduced. |
  521. `------------------------------------------------*/
  522. #if defined (__STDC__) || defined (__cplusplus)
  523. static void
  524. yy_reduce_print (int yyrule)
  525. #else
  526. static void
  527. yy_reduce_print (yyrule)
  528. int yyrule;
  529. #endif
  530. {
  531. int yyi;
  532. unsigned int yylno = yyrline[yyrule];
  533. YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
  534. yyrule - 1, yylno);
  535. /* Print the symbols being reduced, and their result. */
  536. for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
  537. YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
  538. YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
  539. }
  540. # define YY_REDUCE_PRINT(Rule) \
  541. do { \
  542. if (yydebug) \
  543. yy_reduce_print (Rule); \
  544. } while (0)
  545. /* Nonzero means print parse trace. It is left uninitialized so that
  546. multiple parsers can coexist. */
  547. int yydebug;
  548. #else /* !YYDEBUG */
  549. # define YYDPRINTF(Args)
  550. # define YYDSYMPRINT(Args)
  551. # define YYDSYMPRINTF(Title, Token, Value, Location)
  552. # define YY_STACK_PRINT(Bottom, Top)
  553. # define YY_REDUCE_PRINT(Rule)
  554. #endif /* !YYDEBUG */
  555. /* YYINITDEPTH -- initial size of the parser's stacks. */
  556. #ifndef YYINITDEPTH
  557. # define YYINITDEPTH 200
  558. #endif
  559. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  560. if the built-in stack extension method is used).
  561. Do not make this value too large; the results are undefined if
  562. SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
  563. evaluated with infinite-precision integer arithmetic. */
  564. #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
  565. # undef YYMAXDEPTH
  566. #endif
  567. #ifndef YYMAXDEPTH
  568. # define YYMAXDEPTH 10000
  569. #endif
  570. #if YYERROR_VERBOSE
  571. # ifndef yystrlen
  572. # if defined (__GLIBC__) && defined (_STRING_H)
  573. # define yystrlen strlen
  574. # else
  575. /* Return the length of YYSTR. */
  576. static YYSIZE_T
  577. # if defined (__STDC__) || defined (__cplusplus)
  578. yystrlen (const char *yystr)
  579. # else
  580. yystrlen (yystr)
  581. const char *yystr;
  582. # endif
  583. {
  584. register const char *yys = yystr;
  585. while (*yys++ != '\0')
  586. continue;
  587. return yys - yystr - 1;
  588. }
  589. # endif
  590. # endif
  591. # ifndef yystpcpy
  592. # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
  593. # define yystpcpy stpcpy
  594. # else
  595. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  596. YYDEST. */
  597. static char *
  598. # if defined (__STDC__) || defined (__cplusplus)
  599. yystpcpy (char *yydest, const char *yysrc)
  600. # else
  601. yystpcpy (yydest, yysrc)
  602. char *yydest;
  603. const char *yysrc;
  604. # endif
  605. {
  606. register char *yyd = yydest;
  607. register const char *yys = yysrc;
  608. while ((*yyd++ = *yys++) != '\0')
  609. continue;
  610. return yyd - 1;
  611. }
  612. # endif
  613. # endif
  614. #endif /* !YYERROR_VERBOSE */
  615. #if YYDEBUG
  616. /*--------------------------------.
  617. | Print this symbol on YYOUTPUT. |
  618. `--------------------------------*/
  619. #if defined (__STDC__) || defined (__cplusplus)
  620. static void
  621. yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
  622. #else
  623. static void
  624. yysymprint (yyoutput, yytype, yyvaluep)
  625. FILE *yyoutput;
  626. int yytype;
  627. YYSTYPE *yyvaluep;
  628. #endif
  629. {
  630. /* Pacify ``unused variable'' warnings. */
  631. (void) yyvaluep;
  632. if (yytype < YYNTOKENS)
  633. {
  634. YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
  635. # ifdef YYPRINT
  636. YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
  637. # endif
  638. }
  639. else
  640. YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
  641. switch (yytype)
  642. {
  643. default:
  644. break;
  645. }
  646. YYFPRINTF (yyoutput, ")");
  647. }
  648. #endif /* ! YYDEBUG */
  649. /*-----------------------------------------------.
  650. | Release the memory associated to this symbol. |
  651. `-----------------------------------------------*/
  652. #if defined (__STDC__) || defined (__cplusplus)
  653. static void
  654. yydestruct (int yytype, YYSTYPE *yyvaluep)
  655. #else
  656. static void
  657. yydestruct (yytype, yyvaluep)
  658. int yytype;
  659. YYSTYPE *yyvaluep;
  660. #endif
  661. {
  662. /* Pacify ``unused variable'' warnings. */
  663. (void) yyvaluep;
  664. switch (yytype)
  665. {
  666. default:
  667. break;
  668. }
  669. }
  670. /* Prevent warnings from -Wmissing-prototypes. */
  671. #ifdef YYPARSE_PARAM
  672. # if defined (__STDC__) || defined (__cplusplus)
  673. int yyparse (void *YYPARSE_PARAM);
  674. # else
  675. int yyparse ();
  676. # endif
  677. #else /* ! YYPARSE_PARAM */
  678. #if defined (__STDC__) || defined (__cplusplus)
  679. int yyparse (void);
  680. #else
  681. int yyparse ();
  682. #endif
  683. #endif /* ! YYPARSE_PARAM */
  684. /*----------.
  685. | yyparse. |
  686. `----------*/
  687. #ifdef YYPARSE_PARAM
  688. # if defined (__STDC__) || defined (__cplusplus)
  689. int yyparse (void *YYPARSE_PARAM)
  690. # else
  691. int yyparse (YYPARSE_PARAM)
  692. void *YYPARSE_PARAM;
  693. # endif
  694. #else /* ! YYPARSE_PARAM */
  695. #if defined (__STDC__) || defined (__cplusplus)
  696. int
  697. yyparse (void)
  698. #else
  699. int
  700. yyparse ()
  701. #endif
  702. #endif
  703. {
  704. /* The lookahead symbol. */
  705. int yychar;
  706. /* The semantic value of the lookahead symbol. */
  707. YYSTYPE yylval;
  708. /* Number of syntax errors so far. */
  709. int yynerrs;
  710. register int yystate;
  711. register int yyn;
  712. int yyresult;
  713. /* Number of tokens to shift before error messages enabled. */
  714. int yyerrstatus;
  715. /* Lookahead token as an internal (translated) token number. */
  716. int yytoken = 0;
  717. /* Three stacks and their tools:
  718. `yyss': related to states,
  719. `yyvs': related to semantic values,
  720. `yyls': related to locations.
  721. Refer to the stacks thru separate pointers, to allow yyoverflow
  722. to reallocate them elsewhere. */
  723. /* The state stack. */
  724. short int yyssa[YYINITDEPTH];
  725. short int *yyss = yyssa;
  726. register short int *yyssp;
  727. /* The semantic value stack. */
  728. YYSTYPE yyvsa[YYINITDEPTH];
  729. YYSTYPE *yyvs = yyvsa;
  730. register YYSTYPE *yyvsp;
  731. #define YYPOPSTACK (yyvsp--, yyssp--)
  732. YYSIZE_T yystacksize = YYINITDEPTH;
  733. /* The variables used to return semantic value and location from the
  734. action routines. */
  735. YYSTYPE yyval;
  736. /* When reducing, the number of symbols on the RHS of the reduced
  737. rule. */
  738. int yylen;
  739. YYDPRINTF ((stderr, "Starting parse\n"));
  740. yystate = 0;
  741. yyerrstatus = 0;
  742. yynerrs = 0;
  743. yychar = YYEMPTY; /* Cause a token to be read. */
  744. /* Initialize stack pointers.
  745. Waste one element of value and location stack
  746. so that they stay on the same level as the state stack.
  747. The wasted elements are never initialized. */
  748. yyssp = yyss;
  749. yyvsp = yyvs;
  750. goto yysetstate;
  751. /*------------------------------------------------------------.
  752. | yynewstate -- Push a new state, which is found in yystate. |
  753. `------------------------------------------------------------*/
  754. yynewstate:
  755. /* In all cases, when you get here, the value and location stacks
  756. have just been pushed. so pushing a state here evens the stacks.
  757. */
  758. yyssp++;
  759. yysetstate:
  760. *yyssp = yystate;
  761. if (yyss + yystacksize - 1 <= yyssp)
  762. {
  763. /* Get the current used size of the three stacks, in elements. */
  764. YYSIZE_T yysize = yyssp - yyss + 1;
  765. #ifdef yyoverflow
  766. {
  767. /* Give user a chance to reallocate the stack. Use copies of
  768. these so that the &'s don't force the real ones into
  769. memory. */
  770. YYSTYPE *yyvs1 = yyvs;
  771. short int *yyss1 = yyss;
  772. /* Each stack pointer address is followed by the size of the
  773. data in use in that stack, in bytes. This used to be a
  774. conditional around just the two extra args, but that might
  775. be undefined if yyoverflow is a macro. */
  776. yyoverflow ("parser stack overflow",
  777. &yyss1, yysize * sizeof (*yyssp),
  778. &yyvs1, yysize * sizeof (*yyvsp),
  779. &yystacksize);
  780. yyss = yyss1;
  781. yyvs = yyvs1;
  782. }
  783. #else /* no yyoverflow */
  784. # ifndef YYSTACK_RELOCATE
  785. goto yyoverflowlab;
  786. # else
  787. /* Extend the stack our own way. */
  788. if (YYMAXDEPTH <= yystacksize)
  789. goto yyoverflowlab;
  790. yystacksize *= 2;
  791. if (YYMAXDEPTH < yystacksize)
  792. yystacksize = YYMAXDEPTH;
  793. {
  794. short int *yyss1 = yyss;
  795. union yyalloc *yyptr =
  796. (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  797. if (! yyptr)
  798. goto yyoverflowlab;
  799. YYSTACK_RELOCATE (yyss);
  800. YYSTACK_RELOCATE (yyvs);
  801. # undef YYSTACK_RELOCATE
  802. if (yyss1 != yyssa)
  803. YYSTACK_FREE (yyss1);
  804. }
  805. # endif
  806. #endif /* no yyoverflow */
  807. yyssp = yyss + yysize - 1;
  808. yyvsp = yyvs + yysize - 1;
  809. YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  810. (unsigned long int) yystacksize));
  811. if (yyss + yystacksize - 1 <= yyssp)
  812. YYABORT;
  813. }
  814. YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  815. goto yybackup;
  816. /*-----------.
  817. | yybackup. |
  818. `-----------*/
  819. yybackup:
  820. /* Do appropriate processing given the current state. */
  821. /* Read a lookahead token if we need one and don't already have one. */
  822. /* yyresume: */
  823. /* First try to decide what to do without reference to lookahead token. */
  824. yyn = yypact[yystate];
  825. if (yyn == YYPACT_NINF)
  826. goto yydefault;
  827. /* Not known => get a lookahead token if don't already have one. */
  828. /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
  829. if (yychar == YYEMPTY)
  830. {
  831. YYDPRINTF ((stderr, "Reading a token: "));
  832. yychar = YYLEX;
  833. }
  834. if (yychar <= YYEOF)
  835. {
  836. yychar = yytoken = YYEOF;
  837. YYDPRINTF ((stderr, "Now at end of input.\n"));
  838. }
  839. else
  840. {
  841. yytoken = YYTRANSLATE (yychar);
  842. YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
  843. }
  844. /* If the proper action on seeing token YYTOKEN is to reduce or to
  845. detect an error, take that action. */
  846. yyn += yytoken;
  847. if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  848. goto yydefault;
  849. yyn = yytable[yyn];
  850. if (yyn <= 0)
  851. {
  852. if (yyn == 0 || yyn == YYTABLE_NINF)
  853. goto yyerrlab;
  854. yyn = -yyn;
  855. goto yyreduce;
  856. }
  857. if (yyn == YYFINAL)
  858. YYACCEPT;
  859. /* Shift the lookahead token. */
  860. YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
  861. /* Discard the token being shifted unless it is eof. */
  862. if (yychar != YYEOF)
  863. yychar = YYEMPTY;
  864. *++yyvsp = yylval;
  865. /* Count tokens shifted since error; after three, turn off error
  866. status. */
  867. if (yyerrstatus)
  868. yyerrstatus--;
  869. yystate = yyn;
  870. goto yynewstate;
  871. /*-----------------------------------------------------------.
  872. | yydefault -- do the default action for the current state. |
  873. `-----------------------------------------------------------*/
  874. yydefault:
  875. yyn = yydefact[yystate];
  876. if (yyn == 0)
  877. goto yyerrlab;
  878. goto yyreduce;
  879. /*-----------------------------.
  880. | yyreduce -- Do a reduction. |
  881. `-----------------------------*/
  882. yyreduce:
  883. /* yyn is the number of a rule to reduce with. */
  884. yylen = yyr2[yyn];
  885. /* If YYLEN is nonzero, implement the default value of the action:
  886. `$$ = $1'.
  887. Otherwise, the following line sets YYVAL to garbage.
  888. This behavior is undocumented and Bison
  889. users should not rely upon it. Assigning to YYVAL
  890. unconditionally makes the parser a bit smaller, and it avoids a
  891. GCC warning that YYVAL may be used uninitialized. */
  892. yyval = yyvsp[1-yylen];
  893. YY_REDUCE_PRINT (yyn);
  894. switch (yyn)
  895. {
  896. case 2:
  897. {
  898. yyGetParser->SetResult(yyvsp[0].Number);
  899. }
  900. break;
  901. case 3:
  902. {yyval.Number = yyvsp[0].Number;}
  903. break;
  904. case 4:
  905. {yyval.Number = yyvsp[-2].Number | yyvsp[0].Number;}
  906. break;
  907. case 5:
  908. {yyval.Number = yyvsp[0].Number;}
  909. break;
  910. case 6:
  911. {yyval.Number = yyvsp[-2].Number ^ yyvsp[0].Number;}
  912. break;
  913. case 7:
  914. {yyval.Number = yyvsp[0].Number;}
  915. break;
  916. case 8:
  917. {yyval.Number = yyvsp[-2].Number & yyvsp[0].Number;}
  918. break;
  919. case 9:
  920. {yyval.Number = yyvsp[0].Number;}
  921. break;
  922. case 10:
  923. {yyval.Number = yyvsp[-2].Number << yyvsp[0].Number;}
  924. break;
  925. case 11:
  926. {yyval.Number = yyvsp[-2].Number >> yyvsp[0].Number;}
  927. break;
  928. case 12:
  929. {yyval.Number = yyvsp[0].Number;}
  930. break;
  931. case 13:
  932. {yyval.Number = yyvsp[-2].Number + yyvsp[0].Number;}
  933. break;
  934. case 14:
  935. {yyval.Number = yyvsp[-2].Number - yyvsp[0].Number;}
  936. break;
  937. case 15:
  938. {yyval.Number = yyvsp[0].Number;}
  939. break;
  940. case 16:
  941. {yyval.Number = yyvsp[-2].Number * yyvsp[0].Number;}
  942. break;
  943. case 17:
  944. {yyval.Number = yyvsp[-2].Number / yyvsp[0].Number;}
  945. break;
  946. case 18:
  947. {yyval.Number = yyvsp[-2].Number % yyvsp[0].Number;}
  948. break;
  949. case 19:
  950. {yyval.Number = yyvsp[0].Number;}
  951. break;
  952. case 20:
  953. {yyval.Number = yyvsp[-1].Number;}
  954. break;
  955. }
  956. /* Line 1010 of yacc.c. */
  957. yyvsp -= yylen;
  958. yyssp -= yylen;
  959. YY_STACK_PRINT (yyss, yyssp);
  960. *++yyvsp = yyval;
  961. /* Now `shift' the result of the reduction. Determine what state
  962. that goes to, based on the state we popped back to and the rule
  963. number reduced by. */
  964. yyn = yyr1[yyn];
  965. yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  966. if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  967. yystate = yytable[yystate];
  968. else
  969. yystate = yydefgoto[yyn - YYNTOKENS];
  970. goto yynewstate;
  971. /*------------------------------------.
  972. | yyerrlab -- here on detecting error |
  973. `------------------------------------*/
  974. yyerrlab:
  975. /* If not already recovering from an error, report this error. */
  976. if (!yyerrstatus)
  977. {
  978. ++yynerrs;
  979. #if YYERROR_VERBOSE
  980. yyn = yypact[yystate];
  981. if (YYPACT_NINF < yyn && yyn < YYLAST)
  982. {
  983. YYSIZE_T yysize = 0;
  984. int yytype = YYTRANSLATE (yychar);
  985. const char* yyprefix;
  986. char *yymsg;
  987. int yyx;
  988. /* Start YYX at -YYN if negative to avoid negative indexes in
  989. YYCHECK. */
  990. int yyxbegin = yyn < 0 ? -yyn : 0;
  991. /* Stay within bounds of both yycheck and yytname. */
  992. int yychecklim = YYLAST - yyn;
  993. int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
  994. int yycount = 0;
  995. yyprefix = ", expecting ";
  996. for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  997. if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
  998. {
  999. yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
  1000. yycount += 1;
  1001. if (yycount == 5)
  1002. {
  1003. yysize = 0;
  1004. break;
  1005. }
  1006. }
  1007. yysize += (sizeof ("syntax error, unexpected ")
  1008. + yystrlen (yytname[yytype]));
  1009. yymsg = (char *) YYSTACK_ALLOC (yysize);
  1010. if (yymsg != 0)
  1011. {
  1012. char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
  1013. yyp = yystpcpy (yyp, yytname[yytype]);
  1014. if (yycount < 5)
  1015. {
  1016. yyprefix = ", expecting ";
  1017. for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  1018. if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
  1019. {
  1020. yyp = yystpcpy (yyp, yyprefix);
  1021. yyp = yystpcpy (yyp, yytname[yyx]);
  1022. yyprefix = " or ";
  1023. }
  1024. }
  1025. yyerror (yymsg);
  1026. YYSTACK_FREE (yymsg);
  1027. }
  1028. else
  1029. yyerror ("syntax error; also virtual memory exhausted");
  1030. }
  1031. else
  1032. #endif /* YYERROR_VERBOSE */
  1033. yyerror ("syntax error");
  1034. }
  1035. if (yyerrstatus == 3)
  1036. {
  1037. /* If just tried and failed to reuse lookahead token after an
  1038. error, discard it. */
  1039. if (yychar <= YYEOF)
  1040. {
  1041. /* If at end of input, pop the error token,
  1042. then the rest of the stack, then return failure. */
  1043. if (yychar == YYEOF)
  1044. for (;;)
  1045. {
  1046. YYPOPSTACK;
  1047. if (yyssp == yyss)
  1048. YYABORT;
  1049. YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
  1050. yydestruct (yystos[*yyssp], yyvsp);
  1051. }
  1052. }
  1053. else
  1054. {
  1055. YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
  1056. yydestruct (yytoken, &yylval);
  1057. yychar = YYEMPTY;
  1058. }
  1059. }
  1060. /* Else will try to reuse lookahead token after shifting the error
  1061. token. */
  1062. goto yyerrlab1;
  1063. /*---------------------------------------------------.
  1064. | yyerrorlab -- error raised explicitly by YYERROR. |
  1065. `---------------------------------------------------*/
  1066. yyerrorlab:
  1067. #if defined( __GNUC__ ) || defined(__HP_aCC)
  1068. /* Pacify GCC when the user code never invokes YYERROR and the label
  1069. yyerrorlab therefore never appears in user code. */
  1070. if (0)
  1071. goto yyerrorlab;
  1072. #endif
  1073. yyvsp -= yylen;
  1074. yyssp -= yylen;
  1075. yystate = *yyssp;
  1076. goto yyerrlab1;
  1077. /*-------------------------------------------------------------.
  1078. | yyerrlab1 -- common code for both syntax error and YYERROR. |
  1079. `-------------------------------------------------------------*/
  1080. yyerrlab1:
  1081. yyerrstatus = 3; /* Each real token shifted decrements this. */
  1082. for (;;)
  1083. {
  1084. yyn = yypact[yystate];
  1085. if (yyn != YYPACT_NINF)
  1086. {
  1087. yyn += YYTERROR;
  1088. if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  1089. {
  1090. yyn = yytable[yyn];
  1091. if (0 < yyn)
  1092. break;
  1093. }
  1094. }
  1095. /* Pop the current state because it cannot handle the error token. */
  1096. if (yyssp == yyss)
  1097. YYABORT;
  1098. YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
  1099. yydestruct (yystos[yystate], yyvsp);
  1100. YYPOPSTACK;
  1101. yystate = *yyssp;
  1102. YY_STACK_PRINT (yyss, yyssp);
  1103. }
  1104. if (yyn == YYFINAL)
  1105. YYACCEPT;
  1106. YYDPRINTF ((stderr, "Shifting error token, "));
  1107. *++yyvsp = yylval;
  1108. yystate = yyn;
  1109. goto yynewstate;
  1110. /*-------------------------------------.
  1111. | yyacceptlab -- YYACCEPT comes here. |
  1112. `-------------------------------------*/
  1113. yyacceptlab:
  1114. yyresult = 0;
  1115. goto yyreturn;
  1116. /*-----------------------------------.
  1117. | yyabortlab -- YYABORT comes here. |
  1118. `-----------------------------------*/
  1119. yyabortlab:
  1120. yyresult = 1;
  1121. goto yyreturn;
  1122. #ifndef yyoverflow
  1123. /*----------------------------------------------.
  1124. | yyoverflowlab -- parser overflow comes here. |
  1125. `----------------------------------------------*/
  1126. yyoverflowlab:
  1127. yyerror ("parser stack overflow");
  1128. yyresult = 2;
  1129. /* Fall through. */
  1130. #endif
  1131. yyreturn:
  1132. #ifndef yyoverflow
  1133. if (yyss != yyssa)
  1134. YYSTACK_FREE (yyss);
  1135. #endif
  1136. return yyresult;
  1137. }
  1138. /* End of grammar */
  1139. /*--------------------------------------------------------------------------*/
  1140. void cmExprError(yyscan_t yyscanner, const char* message)
  1141. {
  1142. yyGetParser->Error(message);
  1143. }