_ps1.0_parser.cpp 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560
  1. /*
  2. -----------------------------------------------------------------------------
  3. This source file is part of OGRE
  4. (Object-oriented Graphics Rendering Engine)
  5. For the latest info, see http://www.ogre3d.org/
  6. Copyright (c) 2000-2011 Torus Knot Software Ltd
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. THE SOFTWARE.
  22. -----------------------------------------------------------------------------
  23. */
  24. /* A Bison parser, made by GNU Bison 1.875. */
  25. /* Skeleton parser for Yacc-like parsing with Bison,
  26. Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
  27. This program is free software; you can redistribute it and/or modify
  28. it under the terms of the GNU General Public License as published by
  29. the Free Software Foundation; either version 2, or (at your option)
  30. any later version.
  31. This program is distributed in the hope that it will be useful,
  32. but WITHOUT ANY WARRANTY; without even the implied warranty of
  33. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  34. GNU General Public License for more details.
  35. You should have received a copy of the GNU General Public License
  36. along with this program; if not, write to the Free Software
  37. Foundation, Inc., 59 Temple Place - Suite 330,
  38. Boston, MA 02111-1307, USA. */
  39. /* As a special exception, when this file is copied by Bison into a
  40. Bison output file, you may use that output file without restriction.
  41. This special exception was added by the Free Software Foundation
  42. in version 1.24 of Bison. */
  43. /* Written by Richard Stallman by simplifying the original so called
  44. ``semantic'' parser. */
  45. /* All symbols defined below should begin with yy or YY, to avoid
  46. infringing on user name space. This should be done even for local
  47. variables, as they might otherwise be expanded by user macros.
  48. There are some unavoidable exceptions within include files to
  49. define necessary library symbols; they are noted "INFRINGES ON
  50. USER NAME SPACE" below. */
  51. /* Identify Bison output. */
  52. #define YYBISON 1
  53. /* Skeleton name. */
  54. #define YYSKELETON_NAME "yacc.c"
  55. /* Pure parsers. */
  56. #define YYPURE 0
  57. /* Using locations. */
  58. #define YYLSP_NEEDED 0
  59. /* If NAME_PREFIX is specified substitute the variables and functions
  60. names. */
  61. #define yyparse ps10_parse
  62. #define yylex ps10_lex
  63. #define yyerror ps10_error
  64. #define yylval ps10_lval
  65. #define yychar ps10_char
  66. #define yydebug ps10_debug
  67. #define yynerrs ps10_nerrs
  68. /* Tokens. */
  69. #ifndef YYTOKENTYPE
  70. # define YYTOKENTYPE
  71. /* Put the tokens into the symbol table, so that GDB and other debuggers
  72. know about them. */
  73. enum yytokentype {
  74. HEADER = 258,
  75. NEWLINE = 259,
  76. NUMBER = 260,
  77. REG = 261,
  78. DEF = 262,
  79. ADDROP = 263,
  80. BLENDOP = 264
  81. };
  82. #endif
  83. #define HEADER 258
  84. #define NEWLINE 259
  85. #define NUMBER 260
  86. #define REG 261
  87. #define DEF 262
  88. #define ADDROP 263
  89. #define BLENDOP 264
  90. /* Copy the first part of user declarations. */
  91. #line 3 "ps1.0_grammar.y"
  92. /*
  93. This is a parser for the DX8 PS1.0 pixel shaders. I intend
  94. to use it to set NV_texture_shader* and NV_register_combiners*
  95. state in OpenGL, but the parse tree could be used for any
  96. other purpose.
  97. Cass Everitt
  98. 7-19-01
  99. */
  100. void yyerror(const char* s);
  101. int yylex ( void );
  102. #ifdef _WIN32
  103. # define WIN32_LEAN_AND_MEAN
  104. # if !defined(NOMINMAX) && defined(_MSC_VER)
  105. # define NOMINMAX // required to stop windows.h messing up std::min
  106. # endif
  107. #ifndef _WIN32_WINNT
  108. #define _WIN32_WINNT 0x0500
  109. #endif
  110. # include <windows.h>
  111. #endif
  112. #include <stdio.h>
  113. #include <stdlib.h>
  114. #include "ps1.0_program.h"
  115. #include "nvparse_errors.h"
  116. #include "nvparse_externs.h"
  117. #include <list>
  118. #include <vector>
  119. using namespace std;
  120. using namespace ps10;
  121. //#define DBG_MESG(msg, line) errors.set(msg, line)
  122. #define DBG_MESG(msg, line)
  123. /* Enabling traces. */
  124. #ifndef YYDEBUG
  125. # define YYDEBUG 0
  126. #endif
  127. /* Enabling verbose error messages. */
  128. #ifdef YYERROR_VERBOSE
  129. # undef YYERROR_VERBOSE
  130. # define YYERROR_VERBOSE 1
  131. #else
  132. # define YYERROR_VERBOSE 0
  133. #endif
  134. #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
  135. #line 43 "ps1.0_grammar.y"
  136. typedef union YYSTYPE {
  137. int ival;
  138. float fval;
  139. string * sval;
  140. constdef * cdef;
  141. vector<constdef> * consts;
  142. vector<string> * line;
  143. list<vector<string> > * lines;
  144. } YYSTYPE;
  145. /* Line 191 of yacc.c. */
  146. #line 153 "_ps1.0_parser.c"
  147. # define yystype YYSTYPE /* obsolescent; will be withdrawn */
  148. # define YYSTYPE_IS_DECLARED 1
  149. # define YYSTYPE_IS_TRIVIAL 1
  150. #endif
  151. /* Copy the second part of user declarations. */
  152. /* Line 214 of yacc.c. */
  153. #line 165 "_ps1.0_parser.c"
  154. #if ! defined (yyoverflow) || YYERROR_VERBOSE
  155. /* The parser invokes alloca or malloc; define the necessary symbols. */
  156. # if YYSTACK_USE_ALLOCA
  157. # define YYSTACK_ALLOC alloca
  158. # else
  159. # ifndef YYSTACK_USE_ALLOCA
  160. # if defined (alloca) || defined (_ALLOCA_H)
  161. # define YYSTACK_ALLOC alloca
  162. # else
  163. # ifdef __GNUC__
  164. # define YYSTACK_ALLOC __builtin_alloca
  165. # endif
  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 malloc
  178. # define YYSTACK_FREE free
  179. # endif
  180. #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
  181. #if (! defined (yyoverflow) \
  182. && (! defined (__cplusplus) \
  183. || (YYSTYPE_IS_TRIVIAL)))
  184. /* A type that is properly aligned for any stack member. */
  185. union yyalloc
  186. {
  187. short 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) + 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 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. register 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 yysigned_char;
  234. #endif
  235. /* YYFINAL -- State number of the termination state. */
  236. #define YYFINAL 6
  237. /* YYLAST -- Last index in YYTABLE. */
  238. #define YYLAST 80
  239. /* YYNTOKENS -- Number of terminals. */
  240. #define YYNTOKENS 12
  241. /* YYNNTS -- Number of nonterminals. */
  242. #define YYNNTS 10
  243. /* YYNRULES -- Number of rules. */
  244. #define YYNRULES 26
  245. /* YYNRULES -- Number of states. */
  246. #define YYNSTATES 63
  247. /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
  248. #define YYUNDEFTOK 2
  249. #define YYMAXUTOK 264
  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, 11, 10, 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
  282. };
  283. #if YYDEBUG
  284. /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
  285. YYRHS. */
  286. static const unsigned char yyprhs[] =
  287. {
  288. 0, 0, 3, 9, 16, 21, 27, 32, 38, 42,
  289. 47, 49, 52, 64, 66, 69, 73, 79, 87, 89,
  290. 92, 99, 108, 119, 120, 122, 124
  291. };
  292. /* YYRHS -- A `-1'-separated list of the rules' RHS. */
  293. static const yysigned_char yyrhs[] =
  294. {
  295. 13, 0, -1, 3, 21, 14, 16, 18, -1, 21,
  296. 3, 21, 14, 16, 18, -1, 3, 21, 16, 18,
  297. -1, 21, 3, 21, 16, 18, -1, 3, 21, 14,
  298. 18, -1, 21, 3, 21, 14, 18, -1, 3, 21,
  299. 18, -1, 21, 3, 21, 18, -1, 15, -1, 14,
  300. 15, -1, 7, 6, 10, 5, 10, 5, 10, 5,
  301. 10, 5, 21, -1, 17, -1, 16, 17, -1, 8,
  302. 6, 21, -1, 8, 6, 10, 6, 21, -1, 8,
  303. 6, 10, 6, 10, 6, 21, -1, 19, -1, 18,
  304. 19, -1, 20, 9, 6, 10, 6, 21, -1, 20,
  305. 9, 6, 10, 6, 10, 6, 21, -1, 20, 9,
  306. 6, 10, 6, 10, 6, 10, 6, 21, -1, -1,
  307. 11, -1, 4, -1, 21, 4, -1
  308. };
  309. /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
  310. static const unsigned short yyrline[] =
  311. {
  312. 0, 72, 72, 79, 86, 93, 100, 107, 114, 121,
  313. 131, 139, 151, 165, 173, 184, 194, 206, 223, 231,
  314. 243, 257, 273, 293, 295, 301, 305
  315. };
  316. #endif
  317. #if YYDEBUG || YYERROR_VERBOSE
  318. /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  319. First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  320. static const char *const yytname[] =
  321. {
  322. "$end", "error", "$undefined", "HEADER", "NEWLINE", "NUMBER", "REG",
  323. "DEF", "ADDROP", "BLENDOP", "','", "'+'", "$accept", "WholeEnchilada",
  324. "Defs", "Def", "AddrOps", "AddrOp", "BlendOps", "BlendOp", "MaybePlus",
  325. "Newlines", 0
  326. };
  327. #endif
  328. # ifdef YYPRINT
  329. /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
  330. token YYLEX-NUM. */
  331. static const unsigned short yytoknum[] =
  332. {
  333. 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  334. 44, 43
  335. };
  336. # endif
  337. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  338. static const unsigned char yyr1[] =
  339. {
  340. 0, 12, 13, 13, 13, 13, 13, 13, 13, 13,
  341. 14, 14, 15, 16, 16, 17, 17, 17, 18, 18,
  342. 19, 19, 19, 20, 20, 21, 21
  343. };
  344. /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
  345. static const unsigned char yyr2[] =
  346. {
  347. 0, 2, 5, 6, 4, 5, 4, 5, 3, 4,
  348. 1, 2, 11, 1, 2, 3, 5, 7, 1, 2,
  349. 6, 8, 10, 0, 1, 1, 2
  350. };
  351. /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
  352. STATE-NUM when YYTABLE doesn't specify something else to do. Zero
  353. means the default is an error. */
  354. static const unsigned char yydefact[] =
  355. {
  356. 0, 0, 25, 0, 0, 23, 1, 0, 26, 0,
  357. 0, 24, 23, 10, 23, 13, 8, 18, 0, 23,
  358. 0, 0, 11, 23, 6, 14, 4, 19, 0, 23,
  359. 23, 9, 0, 0, 15, 2, 0, 23, 7, 5,
  360. 0, 0, 0, 3, 0, 0, 16, 0, 0, 0,
  361. 0, 20, 0, 17, 0, 0, 0, 21, 0, 0,
  362. 0, 22, 12
  363. };
  364. /* YYDEFGOTO[NTERM-NUM]. */
  365. static const yysigned_char yydefgoto[] =
  366. {
  367. -1, 3, 12, 13, 14, 15, 16, 17, 18, 4
  368. };
  369. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  370. STATE-NUM. */
  371. #define YYPACT_NINF -15
  372. static const yysigned_char yypact[] =
  373. {
  374. 10, 1, -15, 47, 52, 0, -15, 1, -15, 37,
  375. 51, -15, 43, -15, 41, -15, -8, -15, 53, 0,
  376. 50, 26, -15, 41, -8, -15, -8, -15, 55, 43,
  377. 41, -8, 58, 59, 60, -8, 56, 41, -8, -8,
  378. 57, 27, 62, -8, 64, 65, 60, 34, 63, 1,
  379. 66, 60, 69, 60, 35, 67, 70, 60, 73, 1,
  380. 1, 60, 60
  381. };
  382. /* YYPGOTO[NTERM-NUM]. */
  383. static const yysigned_char yypgoto[] =
  384. {
  385. -15, -15, 61, -3, 3, 5, 4, -14, -15, -1
  386. };
  387. /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
  388. positive, shift that token. If negative, reduce the rule which
  389. number is the opposite. If zero, do what YYDEFACT says.
  390. If YYTABLE_NINF, syntax error. */
  391. #define YYTABLE_NINF -24
  392. static const yysigned_char yytable[] =
  393. {
  394. 5, -23, 27, 11, 8, 2, 19, 9, 10, 22,
  395. 27, 11, 27, 1, 2, 23, 24, 27, 26, 25,
  396. 34, 27, 30, 31, 27, 27, 22, 35, 25, 27,
  397. 2, 2, 37, 38, 39, 25, 33, 45, 2, 2,
  398. 46, 43, 25, 20, 50, 56, 51, 6, 53, 10,
  399. 9, 10, 11, 57, 11, 7, 8, 21, 61, 62,
  400. 32, 36, 28, 40, 8, 41, 42, 44, 47, 48,
  401. 0, 49, 54, 52, 55, 0, 59, 58, 60, 0,
  402. 29
  403. };
  404. static const yysigned_char yycheck[] =
  405. {
  406. 1, 9, 16, 11, 4, 4, 7, 7, 8, 12,
  407. 24, 11, 26, 3, 4, 12, 12, 31, 14, 14,
  408. 21, 35, 19, 19, 38, 39, 29, 23, 23, 43,
  409. 4, 4, 29, 29, 30, 30, 10, 10, 4, 4,
  410. 41, 37, 37, 6, 10, 10, 47, 0, 49, 8,
  411. 7, 8, 11, 54, 11, 3, 4, 6, 59, 60,
  412. 10, 6, 9, 5, 4, 6, 10, 10, 6, 5,
  413. -1, 6, 6, 10, 5, -1, 6, 10, 5, -1,
  414. 19
  415. };
  416. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  417. symbol of state STATE-NUM. */
  418. static const unsigned char yystos[] =
  419. {
  420. 0, 3, 4, 13, 21, 21, 0, 3, 4, 7,
  421. 8, 11, 14, 15, 16, 17, 18, 19, 20, 21,
  422. 6, 6, 15, 16, 18, 17, 18, 19, 9, 14,
  423. 16, 18, 10, 10, 21, 18, 6, 16, 18, 18,
  424. 5, 6, 10, 18, 10, 10, 21, 6, 5, 6,
  425. 10, 21, 10, 21, 6, 5, 10, 21, 10, 6,
  426. 5, 21, 21
  427. };
  428. #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
  429. # define YYSIZE_T __SIZE_TYPE__
  430. #endif
  431. #if ! defined (YYSIZE_T) && defined (size_t)
  432. # define YYSIZE_T size_t
  433. #endif
  434. #if ! defined (YYSIZE_T)
  435. # if defined (__STDC__) || defined (__cplusplus)
  436. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  437. # define YYSIZE_T size_t
  438. # endif
  439. #endif
  440. #if ! defined (YYSIZE_T)
  441. # define YYSIZE_T unsigned int
  442. #endif
  443. #define yyerrok (yyerrstatus = 0)
  444. #define yyclearin (yychar = YYEMPTY)
  445. #define YYEMPTY (-2)
  446. #define YYEOF 0
  447. #define YYACCEPT goto yyacceptlab
  448. #define YYABORT goto yyabortlab
  449. #define YYERROR goto yyerrlab1
  450. /* Like YYERROR except do call yyerror. This remains here temporarily
  451. to ease the transition to the new meaning of YYERROR, for GCC.
  452. Once GCC version 2 has supplanted version 1, this can go. */
  453. #define YYFAIL goto yyerrlab
  454. #define YYRECOVERING() (!!yyerrstatus)
  455. #define YYBACKUP(Token, Value) \
  456. do \
  457. if (yychar == YYEMPTY && yylen == 1) \
  458. { \
  459. yychar = (Token); \
  460. yylval = (Value); \
  461. yytoken = YYTRANSLATE (yychar); \
  462. YYPOPSTACK; \
  463. goto yybackup; \
  464. } \
  465. else \
  466. { \
  467. yyerror ("syntax error: cannot back up");\
  468. YYERROR; \
  469. } \
  470. while (0)
  471. #define YYTERROR 1
  472. #define YYERRCODE 256
  473. /* YYLLOC_DEFAULT -- Compute the default location (before the actions
  474. are run). */
  475. #ifndef YYLLOC_DEFAULT
  476. # define YYLLOC_DEFAULT(Current, Rhs, N) \
  477. Current.first_line = Rhs[1].first_line; \
  478. Current.first_column = Rhs[1].first_column; \
  479. Current.last_line = Rhs[N].last_line; \
  480. Current.last_column = Rhs[N].last_column;
  481. #endif
  482. /* YYLEX -- calling `yylex' with the right arguments. */
  483. #ifdef YYLEX_PARAM
  484. # define YYLEX yylex (YYLEX_PARAM)
  485. #else
  486. # define YYLEX yylex ()
  487. #endif
  488. /* Enable debugging if requested. */
  489. #if YYDEBUG
  490. # ifndef YYFPRINTF
  491. # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  492. # define YYFPRINTF fprintf
  493. # endif
  494. # define YYDPRINTF(Args) \
  495. do { \
  496. if (yydebug) \
  497. YYFPRINTF Args; \
  498. } while (0)
  499. # define YYDSYMPRINT(Args) \
  500. do { \
  501. if (yydebug) \
  502. yysymprint Args; \
  503. } while (0)
  504. # define YYDSYMPRINTF(Title, Token, Value, Location) \
  505. do { \
  506. if (yydebug) \
  507. { \
  508. YYFPRINTF (stderr, "%s ", Title); \
  509. yysymprint (stderr, \
  510. Token, Value); \
  511. YYFPRINTF (stderr, "\n"); \
  512. } \
  513. } while (0)
  514. /*------------------------------------------------------------------.
  515. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  516. | TOP (cinluded). |
  517. `------------------------------------------------------------------*/
  518. #if defined (__STDC__) || defined (__cplusplus)
  519. static void
  520. yy_stack_print (short *bottom, short *top)
  521. #else
  522. static void
  523. yy_stack_print (bottom, top)
  524. short *bottom;
  525. short *top;
  526. #endif
  527. {
  528. YYFPRINTF (stderr, "Stack now");
  529. for (/* Nothing. */; bottom <= top; ++bottom)
  530. YYFPRINTF (stderr, " %d", *bottom);
  531. YYFPRINTF (stderr, "\n");
  532. }
  533. # define YY_STACK_PRINT(Bottom, Top) \
  534. do { \
  535. if (yydebug) \
  536. yy_stack_print ((Bottom), (Top)); \
  537. } while (0)
  538. /*------------------------------------------------.
  539. | Report that the YYRULE is going to be reduced. |
  540. `------------------------------------------------*/
  541. #if defined (__STDC__) || defined (__cplusplus)
  542. static void
  543. yy_reduce_print (int yyrule)
  544. #else
  545. static void
  546. yy_reduce_print (yyrule)
  547. int yyrule;
  548. #endif
  549. {
  550. int yyi;
  551. unsigned int yylineno = yyrline[yyrule];
  552. YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
  553. yyrule - 1, yylineno);
  554. /* Print the symbols being reduced, and their result. */
  555. for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
  556. YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
  557. YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
  558. }
  559. # define YY_REDUCE_PRINT(Rule) \
  560. do { \
  561. if (yydebug) \
  562. yy_reduce_print (Rule); \
  563. } while (0)
  564. /* Nonzero means print parse trace. It is left uninitialized so that
  565. multiple parsers can coexist. */
  566. int yydebug;
  567. #else /* !YYDEBUG */
  568. # define YYDPRINTF(Args)
  569. # define YYDSYMPRINT(Args)
  570. # define YYDSYMPRINTF(Title, Token, Value, Location)
  571. # define YY_STACK_PRINT(Bottom, Top)
  572. # define YY_REDUCE_PRINT(Rule)
  573. #endif /* !YYDEBUG */
  574. /* YYINITDEPTH -- initial size of the parser's stacks. */
  575. #ifndef YYINITDEPTH
  576. # define YYINITDEPTH 200
  577. #endif
  578. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  579. if the built-in stack extension method is used).
  580. Do not make this value too large; the results are undefined if
  581. SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
  582. evaluated with infinite-precision integer arithmetic. */
  583. #if YYMAXDEPTH == 0
  584. # undef YYMAXDEPTH
  585. #endif
  586. #ifndef YYMAXDEPTH
  587. # define YYMAXDEPTH 10000
  588. #endif
  589. #if YYERROR_VERBOSE
  590. # ifndef yystrlen
  591. # if defined (__GLIBC__) && defined (_STRING_H)
  592. # define yystrlen strlen
  593. # else
  594. /* Return the length of YYSTR. */
  595. static YYSIZE_T
  596. # if defined (__STDC__) || defined (__cplusplus)
  597. yystrlen (const char *yystr)
  598. # else
  599. yystrlen (yystr)
  600. const char *yystr;
  601. # endif
  602. {
  603. register const char *yys = yystr;
  604. while (*yys++ != '\0')
  605. continue;
  606. return yys - yystr - 1;
  607. }
  608. # endif
  609. # endif
  610. # ifndef yystpcpy
  611. # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
  612. # define yystpcpy stpcpy
  613. # else
  614. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  615. YYDEST. */
  616. static char *
  617. # if defined (__STDC__) || defined (__cplusplus)
  618. yystpcpy (char *yydest, const char *yysrc)
  619. # else
  620. yystpcpy (yydest, yysrc)
  621. char *yydest;
  622. const char *yysrc;
  623. # endif
  624. {
  625. register char *yyd = yydest;
  626. register const char *yys = yysrc;
  627. while ((*yyd++ = *yys++) != '\0')
  628. continue;
  629. return yyd - 1;
  630. }
  631. # endif
  632. # endif
  633. #endif /* !YYERROR_VERBOSE */
  634. #if YYDEBUG
  635. /*--------------------------------.
  636. | Print this symbol on YYOUTPUT. |
  637. `--------------------------------*/
  638. #if defined (__STDC__) || defined (__cplusplus)
  639. static void
  640. yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
  641. #else
  642. static void
  643. yysymprint (yyoutput, yytype, yyvaluep)
  644. FILE *yyoutput;
  645. int yytype;
  646. YYSTYPE *yyvaluep;
  647. #endif
  648. {
  649. /* Pacify ``unused variable'' warnings. */
  650. (void) yyvaluep;
  651. if (yytype < YYNTOKENS)
  652. {
  653. YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
  654. # ifdef YYPRINT
  655. YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
  656. # endif
  657. }
  658. else
  659. YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
  660. switch (yytype)
  661. {
  662. default:
  663. break;
  664. }
  665. YYFPRINTF (yyoutput, ")");
  666. }
  667. #endif /* ! YYDEBUG */
  668. /*-----------------------------------------------.
  669. | Release the memory associated to this symbol. |
  670. `-----------------------------------------------*/
  671. #if defined (__STDC__) || defined (__cplusplus)
  672. static void
  673. yydestruct (int yytype, YYSTYPE *yyvaluep)
  674. #else
  675. static void
  676. yydestruct (yytype, yyvaluep)
  677. int yytype;
  678. YYSTYPE *yyvaluep;
  679. #endif
  680. {
  681. /* Pacify ``unused variable'' warnings. */
  682. (void) yyvaluep;
  683. switch (yytype)
  684. {
  685. default:
  686. break;
  687. }
  688. }
  689. /* Prevent warnings from -Wmissing-prototypes. */
  690. #ifdef YYPARSE_PARAM
  691. # if defined (__STDC__) || defined (__cplusplus)
  692. int yyparse (void *YYPARSE_PARAM);
  693. # else
  694. int yyparse ();
  695. # endif
  696. #else /* ! YYPARSE_PARAM */
  697. #if defined (__STDC__) || defined (__cplusplus)
  698. int yyparse (void);
  699. #else
  700. int yyparse ();
  701. #endif
  702. #endif /* ! YYPARSE_PARAM */
  703. /* The lookahead symbol. */
  704. int yychar;
  705. /* The semantic value of the lookahead symbol. */
  706. YYSTYPE yylval;
  707. /* Number of syntax errors so far. */
  708. int yynerrs;
  709. /*----------.
  710. | yyparse. |
  711. `----------*/
  712. #ifdef YYPARSE_PARAM
  713. # if defined (__STDC__) || defined (__cplusplus)
  714. int yyparse (void *YYPARSE_PARAM)
  715. # else
  716. int yyparse (YYPARSE_PARAM)
  717. void *YYPARSE_PARAM;
  718. # endif
  719. #else /* ! YYPARSE_PARAM */
  720. #if defined (__STDC__) || defined (__cplusplus)
  721. int
  722. yyparse (void)
  723. #else
  724. int
  725. yyparse ()
  726. #endif
  727. #endif
  728. {
  729. register int yystate;
  730. register int yyn;
  731. int yyresult;
  732. /* Number of tokens to shift before error messages enabled. */
  733. int yyerrstatus;
  734. /* Lookahead token as an internal (translated) token number. */
  735. int yytoken = 0;
  736. /* Three stacks and their tools:
  737. `yyss': related to states,
  738. `yyvs': related to semantic values,
  739. `yyls': related to locations.
  740. Refer to the stacks thru separate pointers, to allow yyoverflow
  741. to reallocate them elsewhere. */
  742. /* The state stack. */
  743. short yyssa[YYINITDEPTH];
  744. short *yyss = yyssa;
  745. register short *yyssp;
  746. /* The semantic value stack. */
  747. YYSTYPE yyvsa[YYINITDEPTH];
  748. YYSTYPE *yyvs = yyvsa;
  749. register YYSTYPE *yyvsp;
  750. #define YYPOPSTACK (yyvsp--, yyssp--)
  751. YYSIZE_T yystacksize = YYINITDEPTH;
  752. /* The variables used to return semantic value and location from the
  753. action routines. */
  754. YYSTYPE yyval;
  755. /* When reducing, the number of symbols on the RHS of the reduced
  756. rule. */
  757. int yylen;
  758. YYDPRINTF ((stderr, "Starting parse\n"));
  759. yystate = 0;
  760. yyerrstatus = 0;
  761. yynerrs = 0;
  762. yychar = YYEMPTY; /* Cause a token to be read. */
  763. /* Initialize stack pointers.
  764. Waste one element of value and location stack
  765. so that they stay on the same level as the state stack.
  766. The wasted elements are never initialized. */
  767. yyssp = yyss;
  768. yyvsp = yyvs;
  769. goto yysetstate;
  770. /*------------------------------------------------------------.
  771. | yynewstate -- Push a new state, which is found in yystate. |
  772. `------------------------------------------------------------*/
  773. yynewstate:
  774. /* In all cases, when you get here, the value and location stacks
  775. have just been pushed. so pushing a state here evens the stacks.
  776. */
  777. yyssp++;
  778. yysetstate:
  779. *yyssp = yystate;
  780. if (yyss + yystacksize - 1 <= yyssp)
  781. {
  782. /* Get the current used size of the three stacks, in elements. */
  783. YYSIZE_T yysize = yyssp - yyss + 1;
  784. #ifdef yyoverflow
  785. {
  786. /* Give user a chance to reallocate the stack. Use copies of
  787. these so that the &'s don't force the real ones into
  788. memory. */
  789. YYSTYPE *yyvs1 = yyvs;
  790. short *yyss1 = yyss;
  791. /* Each stack pointer address is followed by the size of the
  792. data in use in that stack, in bytes. This used to be a
  793. conditional around just the two extra args, but that might
  794. be undefined if yyoverflow is a macro. */
  795. yyoverflow ("parser stack overflow",
  796. &yyss1, yysize * sizeof (*yyssp),
  797. &yyvs1, yysize * sizeof (*yyvsp),
  798. &yystacksize);
  799. yyss = yyss1;
  800. yyvs = yyvs1;
  801. }
  802. #else /* no yyoverflow */
  803. # ifndef YYSTACK_RELOCATE
  804. goto yyoverflowlab;
  805. # else
  806. /* Extend the stack our own way. */
  807. if (YYMAXDEPTH <= yystacksize)
  808. goto yyoverflowlab;
  809. yystacksize *= 2;
  810. if (YYMAXDEPTH < yystacksize)
  811. yystacksize = YYMAXDEPTH;
  812. {
  813. short *yyss1 = yyss;
  814. union yyalloc *yyptr =
  815. (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  816. if (! yyptr)
  817. goto yyoverflowlab;
  818. YYSTACK_RELOCATE (yyss);
  819. YYSTACK_RELOCATE (yyvs);
  820. # undef YYSTACK_RELOCATE
  821. if (yyss1 != yyssa)
  822. YYSTACK_FREE (yyss1);
  823. }
  824. # endif
  825. #endif /* no yyoverflow */
  826. yyssp = yyss + yysize - 1;
  827. yyvsp = yyvs + yysize - 1;
  828. YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  829. (unsigned long int) yystacksize));
  830. if (yyss + yystacksize - 1 <= yyssp)
  831. YYABORT;
  832. }
  833. YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  834. goto yybackup;
  835. /*-----------.
  836. | yybackup. |
  837. `-----------*/
  838. yybackup:
  839. /* Do appropriate processing given the current state. */
  840. /* Read a lookahead token if we need one and don't already have one. */
  841. /* yyresume: */
  842. /* First try to decide what to do without reference to lookahead token. */
  843. yyn = yypact[yystate];
  844. if (yyn == YYPACT_NINF)
  845. goto yydefault;
  846. /* Not known => get a lookahead token if don't already have one. */
  847. /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
  848. if (yychar == YYEMPTY)
  849. {
  850. YYDPRINTF ((stderr, "Reading a token: "));
  851. yychar = YYLEX;
  852. }
  853. if (yychar <= YYEOF)
  854. {
  855. yychar = yytoken = YYEOF;
  856. YYDPRINTF ((stderr, "Now at end of input.\n"));
  857. }
  858. else
  859. {
  860. yytoken = YYTRANSLATE (yychar);
  861. YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
  862. }
  863. /* If the proper action on seeing token YYTOKEN is to reduce or to
  864. detect an error, take that action. */
  865. yyn += yytoken;
  866. if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  867. goto yydefault;
  868. yyn = yytable[yyn];
  869. if (yyn <= 0)
  870. {
  871. if (yyn == 0 || yyn == YYTABLE_NINF)
  872. goto yyerrlab;
  873. yyn = -yyn;
  874. goto yyreduce;
  875. }
  876. if (yyn == YYFINAL)
  877. YYACCEPT;
  878. /* Shift the lookahead token. */
  879. YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
  880. /* Discard the token being shifted unless it is eof. */
  881. if (yychar != YYEOF)
  882. yychar = YYEMPTY;
  883. *++yyvsp = yylval;
  884. /* Count tokens shifted since error; after three, turn off error
  885. status. */
  886. if (yyerrstatus)
  887. yyerrstatus--;
  888. yystate = yyn;
  889. goto yynewstate;
  890. /*-----------------------------------------------------------.
  891. | yydefault -- do the default action for the current state. |
  892. `-----------------------------------------------------------*/
  893. yydefault:
  894. yyn = yydefact[yystate];
  895. if (yyn == 0)
  896. goto yyerrlab;
  897. goto yyreduce;
  898. /*-----------------------------.
  899. | yyreduce -- Do a reduction. |
  900. `-----------------------------*/
  901. yyreduce:
  902. /* yyn is the number of a rule to reduce with. */
  903. yylen = yyr2[yyn];
  904. /* If YYLEN is nonzero, implement the default value of the action:
  905. `$$ = $1'.
  906. Otherwise, the following line sets YYVAL to garbage.
  907. This behavior is undocumented and Bison
  908. users should not rely upon it. Assigning to YYVAL
  909. unconditionally makes the parser a bit smaller, and it avoids a
  910. GCC warning that YYVAL may be used uninitialized. */
  911. yyval = yyvsp[1-yylen];
  912. YY_REDUCE_PRINT (yyn);
  913. switch (yyn)
  914. {
  915. case 2:
  916. #line 73 "ps1.0_grammar.y"
  917. {
  918. DBG_MESG("dbg: WholeEnchilada", line_number);
  919. ps10::invoke(yyvsp[-2].consts, yyvsp[-1].lines, yyvsp[0].lines);
  920. ;}
  921. break;
  922. case 3:
  923. #line 80 "ps1.0_grammar.y"
  924. {
  925. DBG_MESG("dbg: WholeEnchilada", line_number);
  926. ps10::invoke(yyvsp[-2].consts, yyvsp[-1].lines, yyvsp[0].lines);
  927. ;}
  928. break;
  929. case 4:
  930. #line 87 "ps1.0_grammar.y"
  931. {
  932. DBG_MESG("dbg: WholeEnchilada", line_number);
  933. ps10::invoke( 0, yyvsp[-1].lines, yyvsp[0].lines);
  934. ;}
  935. break;
  936. case 5:
  937. #line 94 "ps1.0_grammar.y"
  938. {
  939. DBG_MESG("dbg: WholeEnchilada", line_number);
  940. ps10::invoke( 0, yyvsp[-1].lines, yyvsp[0].lines);
  941. ;}
  942. break;
  943. case 6:
  944. #line 101 "ps1.0_grammar.y"
  945. {
  946. DBG_MESG("dbg: WholeEnchilada", line_number);
  947. ps10::invoke(yyvsp[-1].consts, 0, yyvsp[0].lines);
  948. ;}
  949. break;
  950. case 7:
  951. #line 108 "ps1.0_grammar.y"
  952. {
  953. DBG_MESG("dbg: WholeEnchilada", line_number);
  954. ps10::invoke(yyvsp[-1].consts, 0, yyvsp[0].lines);
  955. ;}
  956. break;
  957. case 8:
  958. #line 115 "ps1.0_grammar.y"
  959. {
  960. DBG_MESG("dbg: WholeEnchilada", line_number);
  961. ps10::invoke( 0, 0, yyvsp[0].lines);
  962. ;}
  963. break;
  964. case 9:
  965. #line 122 "ps1.0_grammar.y"
  966. {
  967. DBG_MESG("dbg: WholeEnchilada", line_number);
  968. ps10::invoke( 0, 0, yyvsp[0].lines);
  969. ;}
  970. break;
  971. case 10:
  972. #line 132 "ps1.0_grammar.y"
  973. {
  974. yyval.consts = new vector<constdef>;
  975. yyval.consts->push_back(* yyvsp[0].cdef);
  976. delete yyvsp[0].cdef;
  977. ;}
  978. break;
  979. case 11:
  980. #line 140 "ps1.0_grammar.y"
  981. {
  982. yyval.consts = yyvsp[-1].consts;
  983. yyval.consts->push_back(* yyvsp[0].cdef);
  984. delete yyvsp[0].cdef;
  985. ;}
  986. break;
  987. case 12:
  988. #line 152 "ps1.0_grammar.y"
  989. {
  990. yyval.cdef = new constdef;
  991. yyval.cdef->reg = * yyvsp[-9].sval;
  992. yyval.cdef->r = yyvsp[-7].fval;
  993. yyval.cdef->g = yyvsp[-5].fval;
  994. yyval.cdef->b = yyvsp[-3].fval;
  995. yyval.cdef->a = yyvsp[-1].fval;
  996. delete yyvsp[-9].sval;
  997. ;}
  998. break;
  999. case 13:
  1000. #line 166 "ps1.0_grammar.y"
  1001. {
  1002. yyval.lines = new list<vector<string> >;
  1003. yyval.lines->push_back(* yyvsp[0].line);
  1004. delete yyvsp[0].line;
  1005. ;}
  1006. break;
  1007. case 14:
  1008. #line 174 "ps1.0_grammar.y"
  1009. {
  1010. yyval.lines = yyvsp[-1].lines;
  1011. yyval.lines->push_back(* yyvsp[0].line);
  1012. delete yyvsp[0].line;
  1013. ;}
  1014. break;
  1015. case 15:
  1016. #line 185 "ps1.0_grammar.y"
  1017. {
  1018. yyval.line = new vector<string>;
  1019. yyval.line->push_back(* yyvsp[-2].sval);
  1020. yyval.line->push_back(* yyvsp[-1].sval);
  1021. delete yyvsp[-2].sval;
  1022. delete yyvsp[-1].sval;
  1023. ;}
  1024. break;
  1025. case 16:
  1026. #line 195 "ps1.0_grammar.y"
  1027. {
  1028. yyval.line = new vector<string>;
  1029. yyval.line->push_back(* yyvsp[-4].sval);
  1030. yyval.line->push_back(* yyvsp[-3].sval);
  1031. yyval.line->push_back(* yyvsp[-1].sval);
  1032. delete yyvsp[-4].sval;
  1033. delete yyvsp[-3].sval;
  1034. delete yyvsp[-1].sval;
  1035. ;}
  1036. break;
  1037. case 17:
  1038. #line 207 "ps1.0_grammar.y"
  1039. {
  1040. yyval.line = new vector<string>;
  1041. yyval.line->push_back(* yyvsp[-6].sval);
  1042. yyval.line->push_back(* yyvsp[-5].sval);
  1043. yyval.line->push_back(* yyvsp[-3].sval);
  1044. yyval.line->push_back(* yyvsp[-1].sval);
  1045. delete yyvsp[-6].sval;
  1046. delete yyvsp[-5].sval;
  1047. delete yyvsp[-3].sval;
  1048. delete yyvsp[-1].sval;
  1049. ;}
  1050. break;
  1051. case 18:
  1052. #line 224 "ps1.0_grammar.y"
  1053. {
  1054. yyval.lines = new list<vector<string> >;
  1055. yyval.lines->push_back(* yyvsp[0].line);
  1056. delete yyvsp[0].line;
  1057. ;}
  1058. break;
  1059. case 19:
  1060. #line 232 "ps1.0_grammar.y"
  1061. {
  1062. yyval.lines = yyvsp[-1].lines;
  1063. yyval.lines->push_back(* yyvsp[0].line);
  1064. delete yyvsp[0].line;
  1065. ;}
  1066. break;
  1067. case 20:
  1068. #line 244 "ps1.0_grammar.y"
  1069. {
  1070. yyval.line = new vector<string>;
  1071. if ( yyvsp[-5].ival )
  1072. yyval.line->push_back("+");
  1073. yyval.line->push_back(* yyvsp[-4].sval);
  1074. yyval.line->push_back(* yyvsp[-3].sval);
  1075. yyval.line->push_back(* yyvsp[-1].sval);
  1076. delete yyvsp[-4].sval;
  1077. delete yyvsp[-3].sval;
  1078. delete yyvsp[-1].sval;
  1079. ;}
  1080. break;
  1081. case 21:
  1082. #line 258 "ps1.0_grammar.y"
  1083. {
  1084. yyval.line = new vector<string>;
  1085. if ( yyvsp[-7].ival )
  1086. yyval.line->push_back("+");
  1087. yyval.line->push_back(* yyvsp[-6].sval);
  1088. yyval.line->push_back(* yyvsp[-5].sval);
  1089. yyval.line->push_back(* yyvsp[-3].sval);
  1090. yyval.line->push_back(* yyvsp[-1].sval);
  1091. delete yyvsp[-6].sval;
  1092. delete yyvsp[-5].sval;
  1093. delete yyvsp[-3].sval;
  1094. delete yyvsp[-1].sval;
  1095. ;}
  1096. break;
  1097. case 22:
  1098. #line 274 "ps1.0_grammar.y"
  1099. {
  1100. yyval.line = new vector<string>;
  1101. if ( yyvsp[-9].ival )
  1102. yyval.line->push_back("+");
  1103. yyval.line->push_back(* yyvsp[-8].sval);
  1104. yyval.line->push_back(* yyvsp[-7].sval);
  1105. yyval.line->push_back(* yyvsp[-5].sval);
  1106. yyval.line->push_back(* yyvsp[-3].sval);
  1107. yyval.line->push_back(* yyvsp[-1].sval);
  1108. delete yyvsp[-8].sval;
  1109. delete yyvsp[-7].sval;
  1110. delete yyvsp[-5].sval;
  1111. delete yyvsp[-3].sval;
  1112. delete yyvsp[-1].sval;
  1113. ;}
  1114. break;
  1115. case 23:
  1116. #line 293 "ps1.0_grammar.y"
  1117. { yyval.ival=0; ;}
  1118. break;
  1119. case 24:
  1120. #line 296 "ps1.0_grammar.y"
  1121. { yyval.ival=1; ;}
  1122. break;
  1123. case 25:
  1124. #line 302 "ps1.0_grammar.y"
  1125. {;}
  1126. break;
  1127. case 26:
  1128. #line 306 "ps1.0_grammar.y"
  1129. {;}
  1130. break;
  1131. }
  1132. /* Line 999 of yacc.c. */
  1133. #line 1325 "_ps1.0_parser.c"
  1134. yyvsp -= yylen;
  1135. yyssp -= yylen;
  1136. YY_STACK_PRINT (yyss, yyssp);
  1137. *++yyvsp = yyval;
  1138. /* Now `shift' the result of the reduction. Determine what state
  1139. that goes to, based on the state we popped back to and the rule
  1140. number reduced by. */
  1141. yyn = yyr1[yyn];
  1142. yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  1143. if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1144. yystate = yytable[yystate];
  1145. else
  1146. yystate = yydefgoto[yyn - YYNTOKENS];
  1147. goto yynewstate;
  1148. /*------------------------------------.
  1149. | yyerrlab -- here on detecting error |
  1150. `------------------------------------*/
  1151. yyerrlab:
  1152. /* If not already recovering from an error, report this error. */
  1153. if (!yyerrstatus)
  1154. {
  1155. ++yynerrs;
  1156. #if YYERROR_VERBOSE
  1157. yyn = yypact[yystate];
  1158. if (YYPACT_NINF < yyn && yyn < YYLAST)
  1159. {
  1160. YYSIZE_T yysize = 0;
  1161. int yytype = YYTRANSLATE (yychar);
  1162. char *yymsg;
  1163. int yyx, yycount;
  1164. yycount = 0;
  1165. /* Start YYX at -YYN if negative to avoid negative indexes in
  1166. YYCHECK. */
  1167. for (yyx = yyn < 0 ? -yyn : 0;
  1168. yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
  1169. if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
  1170. yysize += yystrlen (yytname[yyx]) + 15, yycount++;
  1171. yysize += yystrlen ("syntax error, unexpected ") + 1;
  1172. yysize += yystrlen (yytname[yytype]);
  1173. yymsg = (char *) YYSTACK_ALLOC (yysize);
  1174. if (yymsg != 0)
  1175. {
  1176. char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
  1177. yyp = yystpcpy (yyp, yytname[yytype]);
  1178. if (yycount < 5)
  1179. {
  1180. yycount = 0;
  1181. for (yyx = yyn < 0 ? -yyn : 0;
  1182. yyx < (int) (sizeof (yytname) / sizeof (char *));
  1183. yyx++)
  1184. if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
  1185. {
  1186. const char *yyq = ! yycount ? ", expecting " : " or ";
  1187. yyp = yystpcpy (yyp, yyq);
  1188. yyp = yystpcpy (yyp, yytname[yyx]);
  1189. yycount++;
  1190. }
  1191. }
  1192. yyerror (yymsg);
  1193. YYSTACK_FREE (yymsg);
  1194. }
  1195. else
  1196. yyerror ("syntax error; also virtual memory exhausted");
  1197. }
  1198. else
  1199. #endif /* YYERROR_VERBOSE */
  1200. yyerror ("syntax error");
  1201. }
  1202. if (yyerrstatus == 3)
  1203. {
  1204. /* If just tried and failed to reuse lookahead token after an
  1205. error, discard it. */
  1206. /* Return failure if at end of input. */
  1207. if (yychar == YYEOF)
  1208. {
  1209. /* Pop the error token. */
  1210. YYPOPSTACK;
  1211. /* Pop the rest of the stack. */
  1212. while (yyss < yyssp)
  1213. {
  1214. YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
  1215. yydestruct (yystos[*yyssp], yyvsp);
  1216. YYPOPSTACK;
  1217. }
  1218. YYABORT;
  1219. }
  1220. YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
  1221. yydestruct (yytoken, &yylval);
  1222. yychar = YYEMPTY;
  1223. }
  1224. /* Else will try to reuse lookahead token after shifting the error
  1225. token. */
  1226. goto yyerrlab1;
  1227. /*----------------------------------------------------.
  1228. | yyerrlab1 -- error raised explicitly by an action. |
  1229. `----------------------------------------------------*/
  1230. yyerrlab1:
  1231. yyerrstatus = 3; /* Each real token shifted decrements this. */
  1232. for (;;)
  1233. {
  1234. yyn = yypact[yystate];
  1235. if (yyn != YYPACT_NINF)
  1236. {
  1237. yyn += YYTERROR;
  1238. if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  1239. {
  1240. yyn = yytable[yyn];
  1241. if (0 < yyn)
  1242. break;
  1243. }
  1244. }
  1245. /* Pop the current state because it cannot handle the error token. */
  1246. if (yyssp == yyss)
  1247. YYABORT;
  1248. YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
  1249. yydestruct (yystos[yystate], yyvsp);
  1250. yyvsp--;
  1251. yystate = *--yyssp;
  1252. YY_STACK_PRINT (yyss, yyssp);
  1253. }
  1254. if (yyn == YYFINAL)
  1255. YYACCEPT;
  1256. YYDPRINTF ((stderr, "Shifting error token, "));
  1257. *++yyvsp = yylval;
  1258. yystate = yyn;
  1259. goto yynewstate;
  1260. /*-------------------------------------.
  1261. | yyacceptlab -- YYACCEPT comes here. |
  1262. `-------------------------------------*/
  1263. yyacceptlab:
  1264. yyresult = 0;
  1265. goto yyreturn;
  1266. /*-----------------------------------.
  1267. | yyabortlab -- YYABORT comes here. |
  1268. `-----------------------------------*/
  1269. yyabortlab:
  1270. yyresult = 1;
  1271. goto yyreturn;
  1272. #ifndef yyoverflow
  1273. /*----------------------------------------------.
  1274. | yyoverflowlab -- parser overflow comes here. |
  1275. `----------------------------------------------*/
  1276. yyoverflowlab:
  1277. yyerror ("parser stack overflow");
  1278. yyresult = 2;
  1279. /* Fall through. */
  1280. #endif
  1281. yyreturn:
  1282. #ifndef yyoverflow
  1283. if (yyss != yyssa)
  1284. YYSTACK_FREE (yyss);
  1285. #endif
  1286. return yyresult;
  1287. }
  1288. #line 309 "ps1.0_grammar.y"
  1289. void yyerror(const char* s)
  1290. {
  1291. errors.set("parser: syntax error", line_number);
  1292. }