cmExprParser.cxx 36 KB

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