The Sol Programming Language!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

parser.tab.c 95KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716
  1. /* A Bison parser, made by GNU Bison 3.0.4. */
  2. /* Bison implementation for Yacc-like parsers in C
  3. Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. /* As a special exception, you may create a larger work that contains
  15. part or all of the Bison parser skeleton and distribute that work
  16. under terms of your choice, so long as that work isn't itself a
  17. parser generator using the skeleton or a modified version thereof
  18. as a parser skeleton. Alternatively, if you modify or redistribute
  19. the parser skeleton itself, you may (at your option) remove this
  20. special exception, which will cause the skeleton and the resulting
  21. Bison output files to be licensed under the GNU General Public
  22. License without this special exception.
  23. This special exception was added by the Free Software Foundation in
  24. version 2.2 of Bison. */
  25. /* C LALR(1) parser skeleton written by Richard Stallman, by
  26. simplifying the original so-called "semantic" parser. */
  27. /* All symbols defined below should begin with yy or YY, to avoid
  28. infringing on user name space. This should be done even for local
  29. variables, as they might otherwise be expanded by user macros.
  30. There are some unavoidable exceptions within include files to
  31. define necessary library symbols; they are noted "INFRINGES ON
  32. USER NAME SPACE" below. */
  33. /* Identify Bison output. */
  34. #define YYBISON 1
  35. /* Bison version. */
  36. #define YYBISON_VERSION "3.0.4"
  37. /* Skeleton name. */
  38. #define YYSKELETON_NAME "yacc.c"
  39. /* Pure parsers. */
  40. #define YYPURE 2
  41. /* Push parsers. */
  42. #define YYPUSH 0
  43. /* Pull parsers. */
  44. #define YYPULL 1
  45. /* Copy the first part of user declarations. */
  46. #line 1 "parser.y" /* yacc.c:339 */
  47. #include "sol.h"
  48. #include "ast.h"
  49. #include <string.h>
  50. #define YYSTYPE void *
  51. #line 76 "parser.tab.c" /* yacc.c:339 */
  52. # ifndef YY_NULLPTR
  53. # if defined __cplusplus && 201103L <= __cplusplus
  54. # define YY_NULLPTR nullptr
  55. # else
  56. # define YY_NULLPTR 0
  57. # endif
  58. # endif
  59. /* Enabling verbose error messages. */
  60. #ifdef YYERROR_VERBOSE
  61. # undef YYERROR_VERBOSE
  62. # define YYERROR_VERBOSE 1
  63. #else
  64. # define YYERROR_VERBOSE 0
  65. #endif
  66. /* In a future release of Bison, this section will be replaced
  67. by #include "parser.tab.h". */
  68. #ifndef YY_YY_PARSER_TAB_H_INCLUDED
  69. # define YY_YY_PARSER_TAB_H_INCLUDED
  70. /* Debug traces. */
  71. #ifndef YYDEBUG
  72. # define YYDEBUG 1
  73. #endif
  74. #if YYDEBUG
  75. extern int yydebug;
  76. #endif
  77. /* Token type. */
  78. #ifndef YYTOKENTYPE
  79. # define YYTOKENTYPE
  80. enum yytokentype
  81. {
  82. IF = 258,
  83. THEN = 259,
  84. ELSE = 260,
  85. WHILE = 261,
  86. FOR = 262,
  87. IN = 263,
  88. DO = 264,
  89. FUNC = 265,
  90. RETURN = 266,
  91. BREAK = 267,
  92. CONTINUE = 268,
  93. END = 269,
  94. NONE = 270,
  95. IDENT = 271,
  96. INT = 272,
  97. FLOAT = 273,
  98. STRING = 274,
  99. PLUS = 275,
  100. MINUS = 276,
  101. STAR = 277,
  102. SLASH = 278,
  103. PERCENT = 279,
  104. DSTAR = 280,
  105. BAND = 281,
  106. BOR = 282,
  107. BXOR = 283,
  108. BNOT = 284,
  109. LAND = 285,
  110. LOR = 286,
  111. LNOT = 287,
  112. ASSIGN = 288,
  113. ASSIGNPLUS = 289,
  114. ASSIGNMINUS = 290,
  115. ASSIGNSTAR = 291,
  116. ASSIGNSLASH = 292,
  117. ASSIGNDSTAR = 293,
  118. ASSIGNBAND = 294,
  119. ASSIGNBOR = 295,
  120. ASSIGNBXOR = 296,
  121. EQUAL = 297,
  122. NEQUAL = 298,
  123. LESS = 299,
  124. GREATER = 300,
  125. LESSEQ = 301,
  126. GREATEREQ = 302,
  127. RSHIFT = 303,
  128. LSHIFT = 304,
  129. LBRACE = 305,
  130. RBRACE = 306,
  131. LPAREN = 307,
  132. RPAREN = 308,
  133. LBRACKET = 309,
  134. RBRACKET = 310,
  135. DOT = 311,
  136. COLON = 312,
  137. SEMICOLON = 313,
  138. COMMA = 314,
  139. POUND = 315
  140. };
  141. #endif
  142. /* Value type. */
  143. #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  144. typedef int YYSTYPE;
  145. # define YYSTYPE_IS_TRIVIAL 1
  146. # define YYSTYPE_IS_DECLARED 1
  147. #endif
  148. /* Location type. */
  149. #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
  150. typedef struct YYLTYPE YYLTYPE;
  151. struct YYLTYPE
  152. {
  153. int first_line;
  154. int first_column;
  155. int last_line;
  156. int last_column;
  157. };
  158. # define YYLTYPE_IS_DECLARED 1
  159. # define YYLTYPE_IS_TRIVIAL 1
  160. #endif
  161. int yyparse (stmt_node **program);
  162. #endif /* !YY_YY_PARSER_TAB_H_INCLUDED */
  163. /* Copy the second part of user declarations. */
  164. #line 201 "parser.tab.c" /* yacc.c:358 */
  165. #ifdef short
  166. # undef short
  167. #endif
  168. #ifdef YYTYPE_UINT8
  169. typedef YYTYPE_UINT8 yytype_uint8;
  170. #else
  171. typedef unsigned char yytype_uint8;
  172. #endif
  173. #ifdef YYTYPE_INT8
  174. typedef YYTYPE_INT8 yytype_int8;
  175. #else
  176. typedef signed char yytype_int8;
  177. #endif
  178. #ifdef YYTYPE_UINT16
  179. typedef YYTYPE_UINT16 yytype_uint16;
  180. #else
  181. typedef unsigned short int yytype_uint16;
  182. #endif
  183. #ifdef YYTYPE_INT16
  184. typedef YYTYPE_INT16 yytype_int16;
  185. #else
  186. typedef short int yytype_int16;
  187. #endif
  188. #ifndef YYSIZE_T
  189. # ifdef __SIZE_TYPE__
  190. # define YYSIZE_T __SIZE_TYPE__
  191. # elif defined size_t
  192. # define YYSIZE_T size_t
  193. # elif ! defined YYSIZE_T
  194. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  195. # define YYSIZE_T size_t
  196. # else
  197. # define YYSIZE_T unsigned int
  198. # endif
  199. #endif
  200. #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
  201. #ifndef YY_
  202. # if defined YYENABLE_NLS && YYENABLE_NLS
  203. # if ENABLE_NLS
  204. # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  205. # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
  206. # endif
  207. # endif
  208. # ifndef YY_
  209. # define YY_(Msgid) Msgid
  210. # endif
  211. #endif
  212. #ifndef YY_ATTRIBUTE
  213. # if (defined __GNUC__ \
  214. && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
  215. || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
  216. # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
  217. # else
  218. # define YY_ATTRIBUTE(Spec) /* empty */
  219. # endif
  220. #endif
  221. #ifndef YY_ATTRIBUTE_PURE
  222. # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
  223. #endif
  224. #ifndef YY_ATTRIBUTE_UNUSED
  225. # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
  226. #endif
  227. #if !defined _Noreturn \
  228. && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
  229. # if defined _MSC_VER && 1200 <= _MSC_VER
  230. # define _Noreturn __declspec (noreturn)
  231. # else
  232. # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
  233. # endif
  234. #endif
  235. /* Suppress unused-variable warnings by "using" E. */
  236. #if ! defined lint || defined __GNUC__
  237. # define YYUSE(E) ((void) (E))
  238. #else
  239. # define YYUSE(E) /* empty */
  240. #endif
  241. #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
  242. /* Suppress an incorrect diagnostic about yylval being uninitialized. */
  243. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
  244. _Pragma ("GCC diagnostic push") \
  245. _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
  246. _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
  247. # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
  248. _Pragma ("GCC diagnostic pop")
  249. #else
  250. # define YY_INITIAL_VALUE(Value) Value
  251. #endif
  252. #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  253. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  254. # define YY_IGNORE_MAYBE_UNINITIALIZED_END
  255. #endif
  256. #ifndef YY_INITIAL_VALUE
  257. # define YY_INITIAL_VALUE(Value) /* Nothing. */
  258. #endif
  259. #if ! defined yyoverflow || YYERROR_VERBOSE
  260. /* The parser invokes alloca or malloc; define the necessary symbols. */
  261. # ifdef YYSTACK_USE_ALLOCA
  262. # if YYSTACK_USE_ALLOCA
  263. # ifdef __GNUC__
  264. # define YYSTACK_ALLOC __builtin_alloca
  265. # elif defined __BUILTIN_VA_ARG_INCR
  266. # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  267. # elif defined _AIX
  268. # define YYSTACK_ALLOC __alloca
  269. # elif defined _MSC_VER
  270. # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  271. # define alloca _alloca
  272. # else
  273. # define YYSTACK_ALLOC alloca
  274. # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
  275. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  276. /* Use EXIT_SUCCESS as a witness for stdlib.h. */
  277. # ifndef EXIT_SUCCESS
  278. # define EXIT_SUCCESS 0
  279. # endif
  280. # endif
  281. # endif
  282. # endif
  283. # endif
  284. # ifdef YYSTACK_ALLOC
  285. /* Pacify GCC's 'empty if-body' warning. */
  286. # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
  287. # ifndef YYSTACK_ALLOC_MAXIMUM
  288. /* The OS might guarantee only one guard page at the bottom of the stack,
  289. and a page size can be as small as 4096 bytes. So we cannot safely
  290. invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
  291. to allow for a few compiler-allocated temporary stack slots. */
  292. # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  293. # endif
  294. # else
  295. # define YYSTACK_ALLOC YYMALLOC
  296. # define YYSTACK_FREE YYFREE
  297. # ifndef YYSTACK_ALLOC_MAXIMUM
  298. # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  299. # endif
  300. # if (defined __cplusplus && ! defined EXIT_SUCCESS \
  301. && ! ((defined YYMALLOC || defined malloc) \
  302. && (defined YYFREE || defined free)))
  303. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  304. # ifndef EXIT_SUCCESS
  305. # define EXIT_SUCCESS 0
  306. # endif
  307. # endif
  308. # ifndef YYMALLOC
  309. # define YYMALLOC malloc
  310. # if ! defined malloc && ! defined EXIT_SUCCESS
  311. void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  312. # endif
  313. # endif
  314. # ifndef YYFREE
  315. # define YYFREE free
  316. # if ! defined free && ! defined EXIT_SUCCESS
  317. void free (void *); /* INFRINGES ON USER NAME SPACE */
  318. # endif
  319. # endif
  320. # endif
  321. #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  322. #if (! defined yyoverflow \
  323. && (! defined __cplusplus \
  324. || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
  325. && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  326. /* A type that is properly aligned for any stack member. */
  327. union yyalloc
  328. {
  329. yytype_int16 yyss_alloc;
  330. YYSTYPE yyvs_alloc;
  331. YYLTYPE yyls_alloc;
  332. };
  333. /* The size of the maximum gap between one aligned stack and the next. */
  334. # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
  335. /* The size of an array large to enough to hold all stacks, each with
  336. N elements. */
  337. # define YYSTACK_BYTES(N) \
  338. ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
  339. + 2 * YYSTACK_GAP_MAXIMUM)
  340. # define YYCOPY_NEEDED 1
  341. /* Relocate STACK from its old location to the new one. The
  342. local variables YYSIZE and YYSTACKSIZE give the old and new number of
  343. elements in the stack, and YYPTR gives the new location of the
  344. stack. Advance YYPTR to a properly aligned location for the next
  345. stack. */
  346. # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
  347. do \
  348. { \
  349. YYSIZE_T yynewbytes; \
  350. YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
  351. Stack = &yyptr->Stack_alloc; \
  352. yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
  353. yyptr += yynewbytes / sizeof (*yyptr); \
  354. } \
  355. while (0)
  356. #endif
  357. #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
  358. /* Copy COUNT objects from SRC to DST. The source and destination do
  359. not overlap. */
  360. # ifndef YYCOPY
  361. # if defined __GNUC__ && 1 < __GNUC__
  362. # define YYCOPY(Dst, Src, Count) \
  363. __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
  364. # else
  365. # define YYCOPY(Dst, Src, Count) \
  366. do \
  367. { \
  368. YYSIZE_T yyi; \
  369. for (yyi = 0; yyi < (Count); yyi++) \
  370. (Dst)[yyi] = (Src)[yyi]; \
  371. } \
  372. while (0)
  373. # endif
  374. # endif
  375. #endif /* !YYCOPY_NEEDED */
  376. /* YYFINAL -- State number of the termination state. */
  377. #define YYFINAL 3
  378. /* YYLAST -- Last index in YYTABLE. */
  379. #define YYLAST 656
  380. /* YYNTOKENS -- Number of terminals. */
  381. #define YYNTOKENS 61
  382. /* YYNNTS -- Number of nonterminals. */
  383. #define YYNNTS 26
  384. /* YYNRULES -- Number of rules. */
  385. #define YYNRULES 101
  386. /* YYNSTATES -- Number of states. */
  387. #define YYNSTATES 187
  388. /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
  389. by yylex, with out-of-bounds checking. */
  390. #define YYUNDEFTOK 2
  391. #define YYMAXUTOK 315
  392. #define YYTRANSLATE(YYX) \
  393. ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  394. /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
  395. as returned by yylex, without out-of-bounds checking. */
  396. static const yytype_uint8 yytranslate[] =
  397. {
  398. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  399. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  400. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  401. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  402. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  403. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  404. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  405. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  406. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  407. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  408. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  409. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  410. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  411. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  412. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  413. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  414. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  415. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  416. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  417. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  418. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  419. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  420. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  421. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  422. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  423. 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
  424. 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
  425. 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
  426. 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
  427. 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
  428. 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
  429. 55, 56, 57, 58, 59, 60
  430. };
  431. #if YYDEBUG
  432. /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
  433. static const yytype_uint16 yyrline[] =
  434. {
  435. 0, 33, 33, 37, 48, 58, 59, 60, 61, 62,
  436. 63, 64, 65, 66, 67, 71, 72, 79, 86, 93,
  437. 100, 107, 114, 121, 128, 141, 154, 167, 180, 193,
  438. 206, 219, 232, 245, 249, 250, 251, 255, 256, 260,
  439. 261, 262, 263, 264, 265, 266, 270, 271, 272, 276,
  440. 277, 278, 279, 283, 284, 288, 289, 290, 291, 292,
  441. 293, 297, 298, 302, 303, 307, 308, 325, 329, 337,
  442. 345, 349, 350, 361, 365, 366, 380, 381, 385, 386,
  443. 387, 388, 389, 390, 394, 395, 396, 400, 404, 405,
  444. 410, 411, 423, 424, 429, 430, 442, 443, 448, 449,
  445. 461, 466
  446. };
  447. #endif
  448. #if YYDEBUG || YYERROR_VERBOSE || 0
  449. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  450. First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  451. static const char *const yytname[] =
  452. {
  453. "$end", "error", "$undefined", "IF", "THEN", "ELSE", "WHILE", "FOR",
  454. "IN", "DO", "FUNC", "RETURN", "BREAK", "CONTINUE", "END", "NONE",
  455. "IDENT", "INT", "FLOAT", "STRING", "PLUS", "MINUS", "STAR", "SLASH",
  456. "PERCENT", "DSTAR", "BAND", "BOR", "BXOR", "BNOT", "LAND", "LOR", "LNOT",
  457. "ASSIGN", "ASSIGNPLUS", "ASSIGNMINUS", "ASSIGNSTAR", "ASSIGNSLASH",
  458. "ASSIGNDSTAR", "ASSIGNBAND", "ASSIGNBOR", "ASSIGNBXOR", "EQUAL",
  459. "NEQUAL", "LESS", "GREATER", "LESSEQ", "GREATEREQ", "RSHIFT", "LSHIFT",
  460. "LBRACE", "RBRACE", "LPAREN", "RPAREN", "LBRACKET", "RBRACKET", "DOT",
  461. "COLON", "SEMICOLON", "COMMA", "POUND", "$accept", "program",
  462. "stmt_list", "stmt", "expr", "logic_expr", "ulogic_expr", "rel_expr",
  463. "term_expr", "factor_expr", "power_expr", "binary_expr", "ubinary_expr",
  464. "ulen_expr", "call_expr", "funcdecl_expr", "index_expr", "ex_index_expr",
  465. "ref_expr", "lit_expr", "gen_expr", "paren_expr", "expr_list",
  466. "ident_list", "assoc_list", "assoc_item", YY_NULLPTR
  467. };
  468. #endif
  469. # ifdef YYPRINT
  470. /* YYTOKNUM[NUM] -- (External) token number corresponding to the
  471. (internal) symbol number NUM (which must be that of a token). */
  472. static const yytype_uint16 yytoknum[] =
  473. {
  474. 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  475. 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
  476. 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
  477. 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
  478. 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
  479. 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
  480. 315
  481. };
  482. # endif
  483. #define YYPACT_NINF -94
  484. #define yypact_value_is_default(Yystate) \
  485. (!!((Yystate) == (-94)))
  486. #define YYTABLE_NINF -76
  487. #define yytable_value_is_error(Yytable_value) \
  488. 0
  489. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  490. STATE-NUM. */
  491. static const yytype_int16 yypact[] =
  492. {
  493. -94, 8, 352, -94, 448, 448, -5, 4, 448, -94,
  494. -94, -94, 113, -94, -94, -94, 18, 448, 448, -9,
  495. 448, 448, 448, -33, -22, -7, -94, -94, 202, 81,
  496. 14, 110, -94, -94, -31, -94, -94, 280, -94, -94,
  497. -94, -94, 1, 7, 65, 22, 71, -22, 448, 448,
  498. 448, 448, 448, 448, 448, 448, 448, -94, -22, 489,
  499. -18, 57, 448, 24, -94, -39, -22, 12, 526, -94,
  500. 448, 72, 448, 448, 448, 448, 448, 448, 448, 448,
  501. 448, 448, 448, 448, 448, 448, 448, 448, 448, 448,
  502. 448, 448, 84, 448, 448, 448, 448, 448, 448, 448,
  503. 448, 448, -94, -94, 448, 71, -94, 53, -22, -22,
  504. -22, -22, -22, -22, -22, -22, -22, 448, 79, -94,
  505. -94, -94, -94, -94, -94, -22, 114, 380, -94, -94,
  506. 81, 81, 55, 55, 55, 55, 55, 55, 14, 14,
  507. 14, 600, 563, 563, 563, 563, 563, 376, 49, -22,
  508. -22, -22, -22, -22, -22, -22, -22, -22, 111, 176,
  509. 28, 60, -94, -94, -94, -22, 74, 450, -94, 448,
  510. -94, -94, -94, -94, -94, 200, 448, 422, 252, 276,
  511. 328, -94, -22, -94, -94, -94, -94
  512. };
  513. /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
  514. Performed when YYTABLE does not specify something else to do. Zero
  515. means the default is an error. */
  516. static const yytype_uint8 yydefact[] =
  517. {
  518. 4, 0, 2, 1, 0, 0, 0, 0, 11, 12,
  519. 13, 82, 76, 78, 80, 81, 0, 0, 0, 96,
  520. 0, 88, 0, 3, 5, 33, 36, 38, 45, 48,
  521. 52, 54, 60, 62, 64, 67, 70, 0, 73, 77,
  522. 83, 86, 0, 0, 0, 0, 92, 10, 0, 0,
  523. 0, 0, 0, 0, 0, 0, 0, 79, 0, 61,
  524. 37, 0, 0, 0, 97, 0, 89, 0, 63, 14,
  525. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  526. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  527. 0, 88, 0, 0, 0, 0, 0, 0, 0, 0,
  528. 0, 0, 4, 4, 0, 92, 93, 0, 15, 16,
  529. 17, 18, 19, 20, 21, 22, 23, 0, 0, 85,
  530. 98, 99, 87, 84, 90, 91, 0, 72, 34, 35,
  531. 46, 47, 39, 40, 41, 42, 43, 44, 49, 50,
  532. 51, 53, 55, 56, 57, 59, 58, 0, 0, 24,
  533. 25, 26, 27, 28, 29, 30, 31, 32, 0, 0,
  534. 0, 0, 95, 4, 94, 101, 0, 71, 65, 88,
  535. 4, 6, 8, 4, 4, 0, 0, 0, 0, 0,
  536. 0, 69, 100, 66, 7, 9, 68
  537. };
  538. /* YYPGOTO[NTERM-NUM]. */
  539. static const yytype_int16 yypgoto[] =
  540. {
  541. -94, -94, -93, -94, -2, -94, -14, 161, -94, -32,
  542. 192, 112, 91, 88, -94, -94, -94, -94, -94, -94,
  543. -94, -94, -90, 15, -94, 68
  544. };
  545. /* YYDEFGOTO[NTERM-NUM]. */
  546. static const yytype_int8 yydefgoto[] =
  547. {
  548. -1, 1, 2, 23, 58, 25, 26, 27, 28, 29,
  549. 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
  550. 40, 41, 67, 107, 63, 64
  551. };
  552. /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
  553. positive, shift that token. If negative, reduce the rule whose
  554. number is the opposite. If YYTABLE_NINF, syntax error. */
  555. static const yytype_int16 yytable[] =
  556. {
  557. 24, 147, 42, 43, 60, 102, 47, 61, 3, 158,
  558. 159, 44, -36, -36, 122, 70, 103, 71, 65, 66,
  559. 45, 91, 7, 72, 73, 69, 92, 11, 12, 13,
  560. 14, 15, 70, 16, 71, 57, -36, 173, -36, 85,
  561. 61, 17, 130, 131, 18, 62, 108, 109, 110, 111,
  562. 112, 113, 114, 115, 116, 70, 46, 71, 128, 129,
  563. 118, 70, 19, 71, 20, 125, 21, 123, 126, 162,
  564. 175, 124, 22, 104, 105, 119, 162, 178, 62, 177,
  565. 179, 180, 70, 120, 71, -38, -38, 106, 127, 66,
  566. 117, 149, 150, 151, 152, 153, 154, 155, 156, 157,
  567. 148, 169, 160, 82, 83, 84, 163, 176, 59, -38,
  568. 68, -38, 164, 174, 4, 165, 170, 5, 6, 164,
  569. 161, 7, 8, 9, 10, 171, 11, 12, 13, 14,
  570. 15, 121, 16, 70, 166, 71, 86, 87, 88, 0,
  571. 17, 0, 0, 18, 0, 125, 48, 49, 50, 51,
  572. 52, 53, 54, 55, 56, 0, 24, 24, 89, 90,
  573. 0, 19, 0, 20, 0, 21, 0, 66, 70, 167,
  574. 71, 22, 0, 24, 182, 125, 24, 24, 24, 4,
  575. 0, 0, 5, 6, 0, 0, 7, 8, 9, 10,
  576. 172, 11, 12, 13, 14, 15, 0, 16, 142, 143,
  577. 144, 145, 146, 4, 0, 17, 5, 6, 18, 0,
  578. 7, 8, 9, 10, 181, 11, 12, 13, 14, 15,
  579. 0, 16, 74, 75, 0, 0, 19, 0, 20, 17,
  580. 21, 0, 18, 0, 0, 0, 22, 132, 133, 134,
  581. 135, 136, 137, 0, 76, 77, 78, 79, 80, 81,
  582. 19, 0, 20, 0, 21, 4, 0, 0, 5, 6,
  583. 22, 0, 7, 8, 9, 10, 184, 11, 12, 13,
  584. 14, 15, 0, 16, 138, 139, 140, 141, 0, 4,
  585. 0, 17, 5, 6, 18, 0, 7, 8, 9, 10,
  586. 185, 11, 12, 13, 14, 15, 0, 16, 0, 0,
  587. 0, 0, 19, 0, 20, 17, 21, 0, 18, 0,
  588. 0, 0, 22, 93, 94, 95, 96, 97, 98, 99,
  589. 100, 101, 0, 0, 0, 0, 19, 0, 20, 0,
  590. 21, 4, 0, 0, 5, 6, 22, 0, 7, 8,
  591. 9, 10, 186, 11, 12, 13, 14, 15, 0, 16,
  592. 0, 0, 0, 0, 0, 4, 0, 17, 5, 6,
  593. 18, 0, 7, 8, 9, 10, 0, 11, 12, 13,
  594. 14, 15, 0, 16, 0, 0, 0, 0, 19, 0,
  595. 20, 17, 21, 0, 18, 0, 7, 0, 22, 0,
  596. 0, 11, 12, 13, 14, 15, 0, 16, 0, 0,
  597. 0, 0, 19, 0, 20, 17, 21, 0, 18, 0,
  598. 0, 0, 22, -75, -75, -75, -75, -75, -75, -75,
  599. -75, -75, 0, 0, 0, 0, 19, 0, 20, 168,
  600. 21, 0, 7, 0, 0, 124, 22, 11, 12, 13,
  601. 14, 15, 0, 16, 0, 0, 0, 0, 0, 0,
  602. 0, 17, 0, 0, 18, 0, 0, 0, 7, 0,
  603. 0, 0, 0, 11, 12, 13, 14, 15, 0, 16,
  604. 0, 0, 19, 0, 20, 183, 21, 17, 0, 0,
  605. 18, 124, 22, -74, -74, -74, -74, -74, -74, -74,
  606. -74, -74, 0, 0, 0, 0, 0, 0, 19, 0,
  607. 20, 0, 21, 0, 0, 0, 0, 0, 22, -60,
  608. -60, -60, -60, -60, -60, -60, -60, -60, 0, -60,
  609. -60, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  610. 0, -60, -60, -60, -60, -60, -60, -60, -60, 0,
  611. 0, 0, 0, -60, 0, -60, -62, -62, -62, -62,
  612. -62, -62, -62, -62, -62, 0, -62, -62, 0, 0,
  613. 0, 0, 0, 0, 0, 0, 0, 0, -62, -62,
  614. -62, -62, -62, -62, -62, -62, 0, 0, 0, 0,
  615. -62, 0, -62, -54, -54, -54, -54, -54, -54, 86,
  616. 87, 88, 0, -54, -54, 0, 0, 0, 0, 0,
  617. 0, 0, 0, 0, 0, -54, -54, -54, -54, -54,
  618. -54, 89, 90, 0, 0, 0, 0, -54, 0, -54,
  619. -52, -52, -52, -52, -52, 85, 0, 0, 0, 0,
  620. -52, -52, 0, 0, 0, 0, 0, 0, 0, 0,
  621. 0, 0, -52, -52, -52, -52, -52, -52, 0, 0,
  622. 0, 0, 0, 0, -52, 0, -52
  623. };
  624. static const yytype_int16 yycheck[] =
  625. {
  626. 2, 91, 4, 5, 18, 4, 8, 16, 0, 102,
  627. 103, 16, 30, 31, 53, 54, 9, 56, 20, 21,
  628. 16, 52, 10, 30, 31, 58, 57, 15, 16, 17,
  629. 18, 19, 54, 21, 56, 17, 54, 9, 56, 25,
  630. 16, 29, 74, 75, 32, 54, 48, 49, 50, 51,
  631. 52, 53, 54, 55, 56, 54, 52, 56, 72, 73,
  632. 62, 54, 50, 56, 52, 67, 54, 55, 70, 16,
  633. 163, 59, 60, 8, 52, 51, 16, 170, 54, 169,
  634. 173, 174, 54, 59, 56, 30, 31, 16, 16, 91,
  635. 33, 93, 94, 95, 96, 97, 98, 99, 100, 101,
  636. 16, 52, 104, 22, 23, 24, 53, 33, 17, 54,
  637. 22, 56, 59, 53, 3, 117, 5, 6, 7, 59,
  638. 105, 10, 11, 12, 13, 14, 15, 16, 17, 18,
  639. 19, 63, 21, 54, 55, 56, 26, 27, 28, -1,
  640. 29, -1, -1, 32, -1, 147, 33, 34, 35, 36,
  641. 37, 38, 39, 40, 41, -1, 158, 159, 48, 49,
  642. -1, 50, -1, 52, -1, 54, -1, 169, 54, 55,
  643. 56, 60, -1, 175, 176, 177, 178, 179, 180, 3,
  644. -1, -1, 6, 7, -1, -1, 10, 11, 12, 13,
  645. 14, 15, 16, 17, 18, 19, -1, 21, 86, 87,
  646. 88, 89, 90, 3, -1, 29, 6, 7, 32, -1,
  647. 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
  648. -1, 21, 20, 21, -1, -1, 50, -1, 52, 29,
  649. 54, -1, 32, -1, -1, -1, 60, 76, 77, 78,
  650. 79, 80, 81, -1, 42, 43, 44, 45, 46, 47,
  651. 50, -1, 52, -1, 54, 3, -1, -1, 6, 7,
  652. 60, -1, 10, 11, 12, 13, 14, 15, 16, 17,
  653. 18, 19, -1, 21, 82, 83, 84, 85, -1, 3,
  654. -1, 29, 6, 7, 32, -1, 10, 11, 12, 13,
  655. 14, 15, 16, 17, 18, 19, -1, 21, -1, -1,
  656. -1, -1, 50, -1, 52, 29, 54, -1, 32, -1,
  657. -1, -1, 60, 33, 34, 35, 36, 37, 38, 39,
  658. 40, 41, -1, -1, -1, -1, 50, -1, 52, -1,
  659. 54, 3, -1, -1, 6, 7, 60, -1, 10, 11,
  660. 12, 13, 14, 15, 16, 17, 18, 19, -1, 21,
  661. -1, -1, -1, -1, -1, 3, -1, 29, 6, 7,
  662. 32, -1, 10, 11, 12, 13, -1, 15, 16, 17,
  663. 18, 19, -1, 21, -1, -1, -1, -1, 50, -1,
  664. 52, 29, 54, -1, 32, -1, 10, -1, 60, -1,
  665. -1, 15, 16, 17, 18, 19, -1, 21, -1, -1,
  666. -1, -1, 50, -1, 52, 29, 54, -1, 32, -1,
  667. -1, -1, 60, 33, 34, 35, 36, 37, 38, 39,
  668. 40, 41, -1, -1, -1, -1, 50, -1, 52, 53,
  669. 54, -1, 10, -1, -1, 59, 60, 15, 16, 17,
  670. 18, 19, -1, 21, -1, -1, -1, -1, -1, -1,
  671. -1, 29, -1, -1, 32, -1, -1, -1, 10, -1,
  672. -1, -1, -1, 15, 16, 17, 18, 19, -1, 21,
  673. -1, -1, 50, -1, 52, 53, 54, 29, -1, -1,
  674. 32, 59, 60, 33, 34, 35, 36, 37, 38, 39,
  675. 40, 41, -1, -1, -1, -1, -1, -1, 50, -1,
  676. 52, -1, 54, -1, -1, -1, -1, -1, 60, 20,
  677. 21, 22, 23, 24, 25, 26, 27, 28, -1, 30,
  678. 31, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  679. -1, 42, 43, 44, 45, 46, 47, 48, 49, -1,
  680. -1, -1, -1, 54, -1, 56, 20, 21, 22, 23,
  681. 24, 25, 26, 27, 28, -1, 30, 31, -1, -1,
  682. -1, -1, -1, -1, -1, -1, -1, -1, 42, 43,
  683. 44, 45, 46, 47, 48, 49, -1, -1, -1, -1,
  684. 54, -1, 56, 20, 21, 22, 23, 24, 25, 26,
  685. 27, 28, -1, 30, 31, -1, -1, -1, -1, -1,
  686. -1, -1, -1, -1, -1, 42, 43, 44, 45, 46,
  687. 47, 48, 49, -1, -1, -1, -1, 54, -1, 56,
  688. 20, 21, 22, 23, 24, 25, -1, -1, -1, -1,
  689. 30, 31, -1, -1, -1, -1, -1, -1, -1, -1,
  690. -1, -1, 42, 43, 44, 45, 46, 47, -1, -1,
  691. -1, -1, -1, -1, 54, -1, 56
  692. };
  693. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  694. symbol of state STATE-NUM. */
  695. static const yytype_uint8 yystos[] =
  696. {
  697. 0, 62, 63, 0, 3, 6, 7, 10, 11, 12,
  698. 13, 15, 16, 17, 18, 19, 21, 29, 32, 50,
  699. 52, 54, 60, 64, 65, 66, 67, 68, 69, 70,
  700. 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
  701. 81, 82, 65, 65, 16, 16, 52, 65, 33, 34,
  702. 35, 36, 37, 38, 39, 40, 41, 17, 65, 73,
  703. 67, 16, 54, 85, 86, 65, 65, 83, 74, 58,
  704. 54, 56, 30, 31, 20, 21, 42, 43, 44, 45,
  705. 46, 47, 22, 23, 24, 25, 26, 27, 28, 48,
  706. 49, 52, 57, 33, 34, 35, 36, 37, 38, 39,
  707. 40, 41, 4, 9, 8, 52, 16, 84, 65, 65,
  708. 65, 65, 65, 65, 65, 65, 65, 33, 65, 51,
  709. 59, 86, 53, 55, 59, 65, 65, 16, 67, 67,
  710. 70, 70, 68, 68, 68, 68, 68, 68, 71, 71,
  711. 71, 71, 72, 72, 72, 72, 72, 83, 16, 65,
  712. 65, 65, 65, 65, 65, 65, 65, 65, 63, 63,
  713. 65, 84, 16, 53, 59, 65, 55, 55, 53, 52,
  714. 5, 14, 14, 9, 53, 63, 33, 83, 63, 63,
  715. 63, 14, 65, 53, 14, 14, 14
  716. };
  717. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  718. static const yytype_uint8 yyr1[] =
  719. {
  720. 0, 61, 62, 63, 63, 64, 64, 64, 64, 64,
  721. 64, 64, 64, 64, 64, 65, 65, 65, 65, 65,
  722. 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
  723. 65, 65, 65, 65, 66, 66, 66, 67, 67, 68,
  724. 68, 68, 68, 68, 68, 68, 69, 69, 69, 70,
  725. 70, 70, 70, 71, 71, 72, 72, 72, 72, 72,
  726. 72, 73, 73, 74, 74, 75, 75, 75, 76, 76,
  727. 76, 77, 77, 77, 78, 78, 79, 79, 80, 80,
  728. 80, 80, 80, 80, 81, 81, 81, 82, 83, 83,
  729. 83, 83, 84, 84, 84, 84, 85, 85, 85, 85,
  730. 86, 86
  731. };
  732. /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
  733. static const yytype_uint8 yyr2[] =
  734. {
  735. 0, 2, 1, 2, 0, 1, 5, 7, 5, 7,
  736. 2, 1, 1, 1, 2, 3, 3, 3, 3, 3,
  737. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  738. 3, 3, 3, 1, 3, 3, 1, 2, 1, 3,
  739. 3, 3, 3, 3, 3, 1, 3, 3, 1, 3,
  740. 3, 3, 1, 3, 1, 3, 3, 3, 3, 3,
  741. 1, 2, 1, 2, 1, 4, 6, 1, 7, 6,
  742. 1, 4, 3, 1, 4, 3, 1, 1, 1, 2,
  743. 1, 1, 1, 1, 3, 3, 1, 3, 0, 1,
  744. 2, 2, 0, 1, 2, 2, 0, 1, 2, 2,
  745. 5, 3
  746. };
  747. #define yyerrok (yyerrstatus = 0)
  748. #define yyclearin (yychar = YYEMPTY)
  749. #define YYEMPTY (-2)
  750. #define YYEOF 0
  751. #define YYACCEPT goto yyacceptlab
  752. #define YYABORT goto yyabortlab
  753. #define YYERROR goto yyerrorlab
  754. #define YYRECOVERING() (!!yyerrstatus)
  755. #define YYBACKUP(Token, Value) \
  756. do \
  757. if (yychar == YYEMPTY) \
  758. { \
  759. yychar = (Token); \
  760. yylval = (Value); \
  761. YYPOPSTACK (yylen); \
  762. yystate = *yyssp; \
  763. goto yybackup; \
  764. } \
  765. else \
  766. { \
  767. yyerror (&yylloc, program, YY_("syntax error: cannot back up")); \
  768. YYERROR; \
  769. } \
  770. while (0)
  771. /* Error token number */
  772. #define YYTERROR 1
  773. #define YYERRCODE 256
  774. /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
  775. If N is 0, then set CURRENT to the empty location which ends
  776. the previous symbol: RHS[0] (always defined). */
  777. #ifndef YYLLOC_DEFAULT
  778. # define YYLLOC_DEFAULT(Current, Rhs, N) \
  779. do \
  780. if (N) \
  781. { \
  782. (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
  783. (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
  784. (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
  785. (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
  786. } \
  787. else \
  788. { \
  789. (Current).first_line = (Current).last_line = \
  790. YYRHSLOC (Rhs, 0).last_line; \
  791. (Current).first_column = (Current).last_column = \
  792. YYRHSLOC (Rhs, 0).last_column; \
  793. } \
  794. while (0)
  795. #endif
  796. #define YYRHSLOC(Rhs, K) ((Rhs)[K])
  797. /* Enable debugging if requested. */
  798. #if YYDEBUG
  799. # ifndef YYFPRINTF
  800. # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  801. # define YYFPRINTF fprintf
  802. # endif
  803. # define YYDPRINTF(Args) \
  804. do { \
  805. if (yydebug) \
  806. YYFPRINTF Args; \
  807. } while (0)
  808. /* YY_LOCATION_PRINT -- Print the location on the stream.
  809. This macro was not mandated originally: define only if we know
  810. we won't break user code: when these are the locations we know. */
  811. #ifndef YY_LOCATION_PRINT
  812. # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
  813. /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
  814. YY_ATTRIBUTE_UNUSED
  815. static unsigned
  816. yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
  817. {
  818. unsigned res = 0;
  819. int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
  820. if (0 <= yylocp->first_line)
  821. {
  822. res += YYFPRINTF (yyo, "%d", yylocp->first_line);
  823. if (0 <= yylocp->first_column)
  824. res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
  825. }
  826. if (0 <= yylocp->last_line)
  827. {
  828. if (yylocp->first_line < yylocp->last_line)
  829. {
  830. res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
  831. if (0 <= end_col)
  832. res += YYFPRINTF (yyo, ".%d", end_col);
  833. }
  834. else if (0 <= end_col && yylocp->first_column < end_col)
  835. res += YYFPRINTF (yyo, "-%d", end_col);
  836. }
  837. return res;
  838. }
  839. # define YY_LOCATION_PRINT(File, Loc) \
  840. yy_location_print_ (File, &(Loc))
  841. # else
  842. # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  843. # endif
  844. #endif
  845. # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
  846. do { \
  847. if (yydebug) \
  848. { \
  849. YYFPRINTF (stderr, "%s ", Title); \
  850. yy_symbol_print (stderr, \
  851. Type, Value, Location, program); \
  852. YYFPRINTF (stderr, "\n"); \
  853. } \
  854. } while (0)
  855. /*----------------------------------------.
  856. | Print this symbol's value on YYOUTPUT. |
  857. `----------------------------------------*/
  858. static void
  859. yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, stmt_node **program)
  860. {
  861. FILE *yyo = yyoutput;
  862. YYUSE (yyo);
  863. YYUSE (yylocationp);
  864. YYUSE (program);
  865. if (!yyvaluep)
  866. return;
  867. # ifdef YYPRINT
  868. if (yytype < YYNTOKENS)
  869. YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
  870. # endif
  871. YYUSE (yytype);
  872. }
  873. /*--------------------------------.
  874. | Print this symbol on YYOUTPUT. |
  875. `--------------------------------*/
  876. static void
  877. yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, stmt_node **program)
  878. {
  879. YYFPRINTF (yyoutput, "%s %s (",
  880. yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
  881. YY_LOCATION_PRINT (yyoutput, *yylocationp);
  882. YYFPRINTF (yyoutput, ": ");
  883. yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, program);
  884. YYFPRINTF (yyoutput, ")");
  885. }
  886. /*------------------------------------------------------------------.
  887. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  888. | TOP (included). |
  889. `------------------------------------------------------------------*/
  890. static void
  891. yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
  892. {
  893. YYFPRINTF (stderr, "Stack now");
  894. for (; yybottom <= yytop; yybottom++)
  895. {
  896. int yybot = *yybottom;
  897. YYFPRINTF (stderr, " %d", yybot);
  898. }
  899. YYFPRINTF (stderr, "\n");
  900. }
  901. # define YY_STACK_PRINT(Bottom, Top) \
  902. do { \
  903. if (yydebug) \
  904. yy_stack_print ((Bottom), (Top)); \
  905. } while (0)
  906. /*------------------------------------------------.
  907. | Report that the YYRULE is going to be reduced. |
  908. `------------------------------------------------*/
  909. static void
  910. yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, stmt_node **program)
  911. {
  912. unsigned long int yylno = yyrline[yyrule];
  913. int yynrhs = yyr2[yyrule];
  914. int yyi;
  915. YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
  916. yyrule - 1, yylno);
  917. /* The symbols being reduced. */
  918. for (yyi = 0; yyi < yynrhs; yyi++)
  919. {
  920. YYFPRINTF (stderr, " $%d = ", yyi + 1);
  921. yy_symbol_print (stderr,
  922. yystos[yyssp[yyi + 1 - yynrhs]],
  923. &(yyvsp[(yyi + 1) - (yynrhs)])
  924. , &(yylsp[(yyi + 1) - (yynrhs)]) , program);
  925. YYFPRINTF (stderr, "\n");
  926. }
  927. }
  928. # define YY_REDUCE_PRINT(Rule) \
  929. do { \
  930. if (yydebug) \
  931. yy_reduce_print (yyssp, yyvsp, yylsp, Rule, program); \
  932. } while (0)
  933. /* Nonzero means print parse trace. It is left uninitialized so that
  934. multiple parsers can coexist. */
  935. int yydebug;
  936. #else /* !YYDEBUG */
  937. # define YYDPRINTF(Args)
  938. # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  939. # define YY_STACK_PRINT(Bottom, Top)
  940. # define YY_REDUCE_PRINT(Rule)
  941. #endif /* !YYDEBUG */
  942. /* YYINITDEPTH -- initial size of the parser's stacks. */
  943. #ifndef YYINITDEPTH
  944. # define YYINITDEPTH 200
  945. #endif
  946. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  947. if the built-in stack extension method is used).
  948. Do not make this value too large; the results are undefined if
  949. YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  950. evaluated with infinite-precision integer arithmetic. */
  951. #ifndef YYMAXDEPTH
  952. # define YYMAXDEPTH 10000
  953. #endif
  954. #if YYERROR_VERBOSE
  955. # ifndef yystrlen
  956. # if defined __GLIBC__ && defined _STRING_H
  957. # define yystrlen strlen
  958. # else
  959. /* Return the length of YYSTR. */
  960. static YYSIZE_T
  961. yystrlen (const char *yystr)
  962. {
  963. YYSIZE_T yylen;
  964. for (yylen = 0; yystr[yylen]; yylen++)
  965. continue;
  966. return yylen;
  967. }
  968. # endif
  969. # endif
  970. # ifndef yystpcpy
  971. # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  972. # define yystpcpy stpcpy
  973. # else
  974. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  975. YYDEST. */
  976. static char *
  977. yystpcpy (char *yydest, const char *yysrc)
  978. {
  979. char *yyd = yydest;
  980. const char *yys = yysrc;
  981. while ((*yyd++ = *yys++) != '\0')
  982. continue;
  983. return yyd - 1;
  984. }
  985. # endif
  986. # endif
  987. # ifndef yytnamerr
  988. /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
  989. quotes and backslashes, so that it's suitable for yyerror. The
  990. heuristic is that double-quoting is unnecessary unless the string
  991. contains an apostrophe, a comma, or backslash (other than
  992. backslash-backslash). YYSTR is taken from yytname. If YYRES is
  993. null, do not copy; instead, return the length of what the result
  994. would have been. */
  995. static YYSIZE_T
  996. yytnamerr (char *yyres, const char *yystr)
  997. {
  998. if (*yystr == '"')
  999. {
  1000. YYSIZE_T yyn = 0;
  1001. char const *yyp = yystr;
  1002. for (;;)
  1003. switch (*++yyp)
  1004. {
  1005. case '\'':
  1006. case ',':
  1007. goto do_not_strip_quotes;
  1008. case '\\':
  1009. if (*++yyp != '\\')
  1010. goto do_not_strip_quotes;
  1011. /* Fall through. */
  1012. default:
  1013. if (yyres)
  1014. yyres[yyn] = *yyp;
  1015. yyn++;
  1016. break;
  1017. case '"':
  1018. if (yyres)
  1019. yyres[yyn] = '\0';
  1020. return yyn;
  1021. }
  1022. do_not_strip_quotes: ;
  1023. }
  1024. if (! yyres)
  1025. return yystrlen (yystr);
  1026. return yystpcpy (yyres, yystr) - yyres;
  1027. }
  1028. # endif
  1029. /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
  1030. about the unexpected token YYTOKEN for the state stack whose top is
  1031. YYSSP.
  1032. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
  1033. not large enough to hold the message. In that case, also set
  1034. *YYMSG_ALLOC to the required number of bytes. Return 2 if the
  1035. required number of bytes is too large to store. */
  1036. static int
  1037. yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
  1038. yytype_int16 *yyssp, int yytoken)
  1039. {
  1040. YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
  1041. YYSIZE_T yysize = yysize0;
  1042. enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  1043. /* Internationalized format string. */
  1044. const char *yyformat = YY_NULLPTR;
  1045. /* Arguments of yyformat. */
  1046. char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  1047. /* Number of reported tokens (one for the "unexpected", one per
  1048. "expected"). */
  1049. int yycount = 0;
  1050. /* There are many possibilities here to consider:
  1051. - If this state is a consistent state with a default action, then
  1052. the only way this function was invoked is if the default action
  1053. is an error action. In that case, don't check for expected
  1054. tokens because there are none.
  1055. - The only way there can be no lookahead present (in yychar) is if
  1056. this state is a consistent state with a default action. Thus,
  1057. detecting the absence of a lookahead is sufficient to determine
  1058. that there is no unexpected or expected token to report. In that
  1059. case, just report a simple "syntax error".
  1060. - Don't assume there isn't a lookahead just because this state is a
  1061. consistent state with a default action. There might have been a
  1062. previous inconsistent state, consistent state with a non-default
  1063. action, or user semantic action that manipulated yychar.
  1064. - Of course, the expected token list depends on states to have
  1065. correct lookahead information, and it depends on the parser not
  1066. to perform extra reductions after fetching a lookahead from the
  1067. scanner and before detecting a syntax error. Thus, state merging
  1068. (from LALR or IELR) and default reductions corrupt the expected
  1069. token list. However, the list is correct for canonical LR with
  1070. one exception: it will still contain any token that will not be
  1071. accepted due to an error action in a later state.
  1072. */
  1073. if (yytoken != YYEMPTY)
  1074. {
  1075. int yyn = yypact[*yyssp];
  1076. yyarg[yycount++] = yytname[yytoken];
  1077. if (!yypact_value_is_default (yyn))
  1078. {
  1079. /* Start YYX at -YYN if negative to avoid negative indexes in
  1080. YYCHECK. In other words, skip the first -YYN actions for
  1081. this state because they are default actions. */
  1082. int yyxbegin = yyn < 0 ? -yyn : 0;
  1083. /* Stay within bounds of both yycheck and yytname. */
  1084. int yychecklim = YYLAST - yyn + 1;
  1085. int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
  1086. int yyx;
  1087. for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  1088. if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
  1089. && !yytable_value_is_error (yytable[yyx + yyn]))
  1090. {
  1091. if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
  1092. {
  1093. yycount = 1;
  1094. yysize = yysize0;
  1095. break;
  1096. }
  1097. yyarg[yycount++] = yytname[yyx];
  1098. {
  1099. YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
  1100. if (! (yysize <= yysize1
  1101. && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
  1102. return 2;
  1103. yysize = yysize1;
  1104. }
  1105. }
  1106. }
  1107. }
  1108. switch (yycount)
  1109. {
  1110. # define YYCASE_(N, S) \
  1111. case N: \
  1112. yyformat = S; \
  1113. break
  1114. YYCASE_(0, YY_("syntax error"));
  1115. YYCASE_(1, YY_("syntax error, unexpected %s"));
  1116. YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
  1117. YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
  1118. YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
  1119. YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
  1120. # undef YYCASE_
  1121. }
  1122. {
  1123. YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
  1124. if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
  1125. return 2;
  1126. yysize = yysize1;
  1127. }
  1128. if (*yymsg_alloc < yysize)
  1129. {
  1130. *yymsg_alloc = 2 * yysize;
  1131. if (! (yysize <= *yymsg_alloc
  1132. && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
  1133. *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
  1134. return 1;
  1135. }
  1136. /* Avoid sprintf, as that infringes on the user's name space.
  1137. Don't have undefined behavior even if the translation
  1138. produced a string with the wrong number of "%s"s. */
  1139. {
  1140. char *yyp = *yymsg;
  1141. int yyi = 0;
  1142. while ((*yyp = *yyformat) != '\0')
  1143. if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
  1144. {
  1145. yyp += yytnamerr (yyp, yyarg[yyi++]);
  1146. yyformat += 2;
  1147. }
  1148. else
  1149. {
  1150. yyp++;
  1151. yyformat++;
  1152. }
  1153. }
  1154. return 0;
  1155. }
  1156. #endif /* YYERROR_VERBOSE */
  1157. /*-----------------------------------------------.
  1158. | Release the memory associated to this symbol. |
  1159. `-----------------------------------------------*/
  1160. static void
  1161. yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, stmt_node **program)
  1162. {
  1163. YYUSE (yyvaluep);
  1164. YYUSE (yylocationp);
  1165. YYUSE (program);
  1166. if (!yymsg)
  1167. yymsg = "Deleting";
  1168. YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
  1169. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1170. YYUSE (yytype);
  1171. YY_IGNORE_MAYBE_UNINITIALIZED_END
  1172. }
  1173. /*----------.
  1174. | yyparse. |
  1175. `----------*/
  1176. int
  1177. yyparse (stmt_node **program)
  1178. {
  1179. /* The lookahead symbol. */
  1180. int yychar;
  1181. /* The semantic value of the lookahead symbol. */
  1182. /* Default value used for initialization, for pacifying older GCCs
  1183. or non-GCC compilers. */
  1184. YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
  1185. YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
  1186. /* Location data for the lookahead symbol. */
  1187. static YYLTYPE yyloc_default
  1188. # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
  1189. = { 1, 1, 1, 1 }
  1190. # endif
  1191. ;
  1192. YYLTYPE yylloc = yyloc_default;
  1193. /* Number of syntax errors so far. */
  1194. int yynerrs;
  1195. int yystate;
  1196. /* Number of tokens to shift before error messages enabled. */
  1197. int yyerrstatus;
  1198. /* The stacks and their tools:
  1199. 'yyss': related to states.
  1200. 'yyvs': related to semantic values.
  1201. 'yyls': related to locations.
  1202. Refer to the stacks through separate pointers, to allow yyoverflow
  1203. to reallocate them elsewhere. */
  1204. /* The state stack. */
  1205. yytype_int16 yyssa[YYINITDEPTH];
  1206. yytype_int16 *yyss;
  1207. yytype_int16 *yyssp;
  1208. /* The semantic value stack. */
  1209. YYSTYPE yyvsa[YYINITDEPTH];
  1210. YYSTYPE *yyvs;
  1211. YYSTYPE *yyvsp;
  1212. /* The location stack. */
  1213. YYLTYPE yylsa[YYINITDEPTH];
  1214. YYLTYPE *yyls;
  1215. YYLTYPE *yylsp;
  1216. /* The locations where the error started and ended. */
  1217. YYLTYPE yyerror_range[3];
  1218. YYSIZE_T yystacksize;
  1219. int yyn;
  1220. int yyresult;
  1221. /* Lookahead token as an internal (translated) token number. */
  1222. int yytoken = 0;
  1223. /* The variables used to return semantic value and location from the
  1224. action routines. */
  1225. YYSTYPE yyval;
  1226. YYLTYPE yyloc;
  1227. #if YYERROR_VERBOSE
  1228. /* Buffer for error messages, and its allocated size. */
  1229. char yymsgbuf[128];
  1230. char *yymsg = yymsgbuf;
  1231. YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
  1232. #endif
  1233. #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
  1234. /* The number of symbols on the RHS of the reduced rule.
  1235. Keep to zero when no symbol should be popped. */
  1236. int yylen = 0;
  1237. yyssp = yyss = yyssa;
  1238. yyvsp = yyvs = yyvsa;
  1239. yylsp = yyls = yylsa;
  1240. yystacksize = YYINITDEPTH;
  1241. YYDPRINTF ((stderr, "Starting parse\n"));
  1242. yystate = 0;
  1243. yyerrstatus = 0;
  1244. yynerrs = 0;
  1245. yychar = YYEMPTY; /* Cause a token to be read. */
  1246. yylsp[0] = yylloc;
  1247. goto yysetstate;
  1248. /*------------------------------------------------------------.
  1249. | yynewstate -- Push a new state, which is found in yystate. |
  1250. `------------------------------------------------------------*/
  1251. yynewstate:
  1252. /* In all cases, when you get here, the value and location stacks
  1253. have just been pushed. So pushing a state here evens the stacks. */
  1254. yyssp++;
  1255. yysetstate:
  1256. *yyssp = yystate;
  1257. if (yyss + yystacksize - 1 <= yyssp)
  1258. {
  1259. /* Get the current used size of the three stacks, in elements. */
  1260. YYSIZE_T yysize = yyssp - yyss + 1;
  1261. #ifdef yyoverflow
  1262. {
  1263. /* Give user a chance to reallocate the stack. Use copies of
  1264. these so that the &'s don't force the real ones into
  1265. memory. */
  1266. YYSTYPE *yyvs1 = yyvs;
  1267. yytype_int16 *yyss1 = yyss;
  1268. YYLTYPE *yyls1 = yyls;
  1269. /* Each stack pointer address is followed by the size of the
  1270. data in use in that stack, in bytes. This used to be a
  1271. conditional around just the two extra args, but that might
  1272. be undefined if yyoverflow is a macro. */
  1273. yyoverflow (YY_("memory exhausted"),
  1274. &yyss1, yysize * sizeof (*yyssp),
  1275. &yyvs1, yysize * sizeof (*yyvsp),
  1276. &yyls1, yysize * sizeof (*yylsp),
  1277. &yystacksize);
  1278. yyls = yyls1;
  1279. yyss = yyss1;
  1280. yyvs = yyvs1;
  1281. }
  1282. #else /* no yyoverflow */
  1283. # ifndef YYSTACK_RELOCATE
  1284. goto yyexhaustedlab;
  1285. # else
  1286. /* Extend the stack our own way. */
  1287. if (YYMAXDEPTH <= yystacksize)
  1288. goto yyexhaustedlab;
  1289. yystacksize *= 2;
  1290. if (YYMAXDEPTH < yystacksize)
  1291. yystacksize = YYMAXDEPTH;
  1292. {
  1293. yytype_int16 *yyss1 = yyss;
  1294. union yyalloc *yyptr =
  1295. (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  1296. if (! yyptr)
  1297. goto yyexhaustedlab;
  1298. YYSTACK_RELOCATE (yyss_alloc, yyss);
  1299. YYSTACK_RELOCATE (yyvs_alloc, yyvs);
  1300. YYSTACK_RELOCATE (yyls_alloc, yyls);
  1301. # undef YYSTACK_RELOCATE
  1302. if (yyss1 != yyssa)
  1303. YYSTACK_FREE (yyss1);
  1304. }
  1305. # endif
  1306. #endif /* no yyoverflow */
  1307. yyssp = yyss + yysize - 1;
  1308. yyvsp = yyvs + yysize - 1;
  1309. yylsp = yyls + yysize - 1;
  1310. YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  1311. (unsigned long int) yystacksize));
  1312. if (yyss + yystacksize - 1 <= yyssp)
  1313. YYABORT;
  1314. }
  1315. YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  1316. if (yystate == YYFINAL)
  1317. YYACCEPT;
  1318. goto yybackup;
  1319. /*-----------.
  1320. | yybackup. |
  1321. `-----------*/
  1322. yybackup:
  1323. /* Do appropriate processing given the current state. Read a
  1324. lookahead token if we need one and don't already have one. */
  1325. /* First try to decide what to do without reference to lookahead token. */
  1326. yyn = yypact[yystate];
  1327. if (yypact_value_is_default (yyn))
  1328. goto yydefault;
  1329. /* Not known => get a lookahead token if don't already have one. */
  1330. /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
  1331. if (yychar == YYEMPTY)
  1332. {
  1333. YYDPRINTF ((stderr, "Reading a token: "));
  1334. yychar = yylex (&yylval, &yylloc);
  1335. }
  1336. if (yychar <= YYEOF)
  1337. {
  1338. yychar = yytoken = YYEOF;
  1339. YYDPRINTF ((stderr, "Now at end of input.\n"));
  1340. }
  1341. else
  1342. {
  1343. yytoken = YYTRANSLATE (yychar);
  1344. YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
  1345. }
  1346. /* If the proper action on seeing token YYTOKEN is to reduce or to
  1347. detect an error, take that action. */
  1348. yyn += yytoken;
  1349. if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  1350. goto yydefault;
  1351. yyn = yytable[yyn];
  1352. if (yyn <= 0)
  1353. {
  1354. if (yytable_value_is_error (yyn))
  1355. goto yyerrlab;
  1356. yyn = -yyn;
  1357. goto yyreduce;
  1358. }
  1359. /* Count tokens shifted since error; after three, turn off error
  1360. status. */
  1361. if (yyerrstatus)
  1362. yyerrstatus--;
  1363. /* Shift the lookahead token. */
  1364. YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  1365. /* Discard the shifted token. */
  1366. yychar = YYEMPTY;
  1367. yystate = yyn;
  1368. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1369. *++yyvsp = yylval;
  1370. YY_IGNORE_MAYBE_UNINITIALIZED_END
  1371. *++yylsp = yylloc;
  1372. goto yynewstate;
  1373. /*-----------------------------------------------------------.
  1374. | yydefault -- do the default action for the current state. |
  1375. `-----------------------------------------------------------*/
  1376. yydefault:
  1377. yyn = yydefact[yystate];
  1378. if (yyn == 0)
  1379. goto yyerrlab;
  1380. goto yyreduce;
  1381. /*-----------------------------.
  1382. | yyreduce -- Do a reduction. |
  1383. `-----------------------------*/
  1384. yyreduce:
  1385. /* yyn is the number of a rule to reduce with. */
  1386. yylen = yyr2[yyn];
  1387. /* If YYLEN is nonzero, implement the default value of the action:
  1388. '$$ = $1'.
  1389. Otherwise, the following line sets YYVAL to garbage.
  1390. This behavior is undocumented and Bison
  1391. users should not rely upon it. Assigning to YYVAL
  1392. unconditionally makes the parser a bit smaller, and it avoids a
  1393. GCC warning that YYVAL may be used uninitialized. */
  1394. yyval = yyvsp[1-yylen];
  1395. /* Default location. */
  1396. YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
  1397. YY_REDUCE_PRINT (yyn);
  1398. switch (yyn)
  1399. {
  1400. case 2:
  1401. #line 33 "parser.y" /* yacc.c:1646 */
  1402. { *program = AS_ST((yyvsp[0])); }
  1403. #line 1611 "parser.tab.c" /* yacc.c:1646 */
  1404. break;
  1405. case 3:
  1406. #line 37 "parser.y" /* yacc.c:1646 */
  1407. {
  1408. stmtlist_node *cur = AS_ST((yyvsp[-1]))->stmtlist;
  1409. while(cur->next) cur = cur->next;
  1410. if(cur->stmt) {
  1411. cur->next = NEW(stmtlist_node);
  1412. cur = cur->next;
  1413. }
  1414. cur->stmt = (yyvsp[0]);
  1415. cur->next = NULL;
  1416. (yyval) = (yyvsp[-1]);
  1417. }
  1418. #line 1627 "parser.tab.c" /* yacc.c:1646 */
  1419. break;
  1420. case 4:
  1421. #line 48 "parser.y" /* yacc.c:1646 */
  1422. {
  1423. (yyval) = NEW_ST();
  1424. AS_ST((yyval))->type = ST_LIST;
  1425. AS_ST((yyval))->stmtlist = NEW(stmtlist_node);
  1426. AS_ST((yyval))->stmtlist->stmt = NULL;
  1427. AS_ST((yyval))->stmtlist->next = NULL;
  1428. }
  1429. #line 1639 "parser.tab.c" /* yacc.c:1646 */
  1430. break;
  1431. case 5:
  1432. #line 58 "parser.y" /* yacc.c:1646 */
  1433. { (yyval) = NEW_ST(); SET_LOC(AS_ST((yyval)), (yyloc)); AS_ST((yyval))->type = ST_EXPR; AS_ST((yyval))->expr = (yyvsp[0]); }
  1434. #line 1645 "parser.tab.c" /* yacc.c:1646 */
  1435. break;
  1436. case 6:
  1437. #line 59 "parser.y" /* yacc.c:1646 */
  1438. { (yyval) = NEW_ST(); SET_LOC(AS_ST((yyval)), (yyloc)); AS_ST((yyval))->type = ST_IFELSE; AS_ST((yyval))->ifelse = NEW(ifelse_node); AS_ST((yyval))->ifelse->cond = (yyvsp[-3]); AS_ST((yyval))->ifelse->iftrue = (yyvsp[-1]); AS_ST((yyval))->ifelse->iffalse = NULL; }
  1439. #line 1651 "parser.tab.c" /* yacc.c:1646 */
  1440. break;
  1441. case 7:
  1442. #line 60 "parser.y" /* yacc.c:1646 */
  1443. { (yyval) = NEW_ST(); SET_LOC(AS_ST((yyval)), (yyloc)); AS_ST((yyval))->type = ST_IFELSE; AS_ST((yyval))->ifelse = NEW(ifelse_node); AS_ST((yyval))->ifelse->cond = (yyvsp[-5]); AS_ST((yyval))->ifelse->iftrue = (yyvsp[-3]); AS_ST((yyval))->ifelse->iffalse = (yyvsp[-1]); }
  1444. #line 1657 "parser.tab.c" /* yacc.c:1646 */
  1445. break;
  1446. case 8:
  1447. #line 61 "parser.y" /* yacc.c:1646 */
  1448. { (yyval) = NEW_ST(); SET_LOC(AS_ST((yyval)), (yyloc)); AS_ST((yyval))->type = ST_LOOP; AS_ST((yyval))->loop = NEW(loop_node); AS_ST((yyval))->loop->cond = (yyvsp[-3]); AS_ST((yyval))->loop->loop = (yyvsp[-1]); }
  1449. #line 1663 "parser.tab.c" /* yacc.c:1646 */
  1450. break;
  1451. case 9:
  1452. #line 62 "parser.y" /* yacc.c:1646 */
  1453. { (yyval) = NEW_ST(); SET_LOC(AS_ST((yyval)), (yyloc)); AS_ST((yyval))->type = ST_ITER; AS_ST((yyval))->iter = NEW(iter_node); AS_ST((yyval))->iter->var = (yyvsp[-5]); AS_ST((yyval))->iter->iter = (yyvsp[-3]); AS_ST((yyval))->iter->loop = (yyvsp[-1]); }
  1454. #line 1669 "parser.tab.c" /* yacc.c:1646 */
  1455. break;
  1456. case 10:
  1457. #line 63 "parser.y" /* yacc.c:1646 */
  1458. { (yyval) = NEW_ST(); SET_LOC(AS_ST((yyval)), (yyloc)); AS_ST((yyval))->type = ST_RET; AS_ST((yyval))->ret = NEW(ret_node); AS_ST((yyval))->ret->ret = (yyvsp[0]); }
  1459. #line 1675 "parser.tab.c" /* yacc.c:1646 */
  1460. break;
  1461. case 11:
  1462. #line 64 "parser.y" /* yacc.c:1646 */
  1463. { (yyval) = NEW_ST(); SET_LOC(AS_ST((yyval)), (yyloc)); AS_ST((yyval))->type = ST_RET; AS_ST((yyval))->ret = NEW(ret_node); AS_ST((yyval))->ret->ret = NULL; }
  1464. #line 1681 "parser.tab.c" /* yacc.c:1646 */
  1465. break;
  1466. case 12:
  1467. #line 65 "parser.y" /* yacc.c:1646 */
  1468. { (yyval) = NEW_ST(); SET_LOC(AS_ST((yyval)), (yyloc)); AS_ST((yyval))->type = ST_BREAK; }
  1469. #line 1687 "parser.tab.c" /* yacc.c:1646 */
  1470. break;
  1471. case 13:
  1472. #line 66 "parser.y" /* yacc.c:1646 */
  1473. { (yyval) = NEW_ST(); SET_LOC(AS_ST((yyval)), (yyloc)); AS_ST((yyval))->type = ST_CONT; }
  1474. #line 1693 "parser.tab.c" /* yacc.c:1646 */
  1475. break;
  1476. case 14:
  1477. #line 67 "parser.y" /* yacc.c:1646 */
  1478. { (yyval) = (yyvsp[-1]); }
  1479. #line 1699 "parser.tab.c" /* yacc.c:1646 */
  1480. break;
  1481. case 15:
  1482. #line 71 "parser.y" /* yacc.c:1646 */
  1483. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_ASSIGN; AS_EX((yyval))->assign = NEW(assign_node); AS_EX((yyval))->assign->ident = (yyvsp[-2]); AS_EX((yyval))->assign->value = (yyvsp[0]); }
  1484. #line 1705 "parser.tab.c" /* yacc.c:1646 */
  1485. break;
  1486. case 16:
  1487. #line 72 "parser.y" /* yacc.c:1646 */
  1488. {
  1489. (yyval) = NEW_EX();
  1490. AS_EX((yyval))->type = EX_ASSIGN;
  1491. AS_EX((yyval))->assign = NEW(assign_node);
  1492. AS_EX((yyval))->assign->ident = (yyvsp[-2]);
  1493. MAKE_REF_BINOP(AS_EX((yyval))->assign->value, OP_ADD, (yyvsp[-2]), (yyvsp[0]));
  1494. }
  1495. #line 1717 "parser.tab.c" /* yacc.c:1646 */
  1496. break;
  1497. case 17:
  1498. #line 79 "parser.y" /* yacc.c:1646 */
  1499. {
  1500. (yyval) = NEW_EX();
  1501. AS_EX((yyval))->type = EX_ASSIGN;
  1502. AS_EX((yyval))->assign = NEW(assign_node);
  1503. AS_EX((yyval))->assign->ident = (yyvsp[-2]);
  1504. MAKE_REF_BINOP(AS_EX((yyval))->assign->value, OP_SUB, (yyvsp[-2]), (yyvsp[0]));
  1505. }
  1506. #line 1729 "parser.tab.c" /* yacc.c:1646 */
  1507. break;
  1508. case 18:
  1509. #line 86 "parser.y" /* yacc.c:1646 */
  1510. {
  1511. (yyval) = NEW_EX();
  1512. AS_EX((yyval))->type = EX_ASSIGN;
  1513. AS_EX((yyval))->assign = NEW(assign_node);
  1514. AS_EX((yyval))->assign->ident = (yyvsp[-2]);
  1515. MAKE_REF_BINOP(AS_EX((yyval))->assign->value, OP_MUL, (yyvsp[-2]), (yyvsp[0]));
  1516. }
  1517. #line 1741 "parser.tab.c" /* yacc.c:1646 */
  1518. break;
  1519. case 19:
  1520. #line 93 "parser.y" /* yacc.c:1646 */
  1521. {
  1522. (yyval) = NEW_EX();
  1523. AS_EX((yyval))->type = EX_ASSIGN;
  1524. AS_EX((yyval))->assign = NEW(assign_node);
  1525. AS_EX((yyval))->assign->ident = (yyvsp[-2]);
  1526. MAKE_REF_BINOP(AS_EX((yyval))->assign->value, OP_DIV, (yyvsp[-2]), (yyvsp[0]));
  1527. }
  1528. #line 1753 "parser.tab.c" /* yacc.c:1646 */
  1529. break;
  1530. case 20:
  1531. #line 100 "parser.y" /* yacc.c:1646 */
  1532. {
  1533. (yyval) = NEW_EX();
  1534. AS_EX((yyval))->type = EX_ASSIGN;
  1535. AS_EX((yyval))->assign = NEW(assign_node);
  1536. AS_EX((yyval))->assign->ident = (yyvsp[-2]);
  1537. MAKE_REF_BINOP(AS_EX((yyval))->assign->value, OP_POW, (yyvsp[-2]), (yyvsp[0]));
  1538. }
  1539. #line 1765 "parser.tab.c" /* yacc.c:1646 */
  1540. break;
  1541. case 21:
  1542. #line 107 "parser.y" /* yacc.c:1646 */
  1543. {
  1544. (yyval) = NEW_EX();
  1545. AS_EX((yyval))->type = EX_ASSIGN;
  1546. AS_EX((yyval))->assign = NEW(assign_node);
  1547. AS_EX((yyval))->assign->ident = (yyvsp[-2]);
  1548. MAKE_REF_BINOP(AS_EX((yyval))->assign->value, OP_BAND, (yyvsp[-2]), (yyvsp[0]));
  1549. }
  1550. #line 1777 "parser.tab.c" /* yacc.c:1646 */
  1551. break;
  1552. case 22:
  1553. #line 114 "parser.y" /* yacc.c:1646 */
  1554. {
  1555. (yyval) = NEW_EX();
  1556. AS_EX((yyval))->type = EX_ASSIGN;
  1557. AS_EX((yyval))->assign = NEW(assign_node);
  1558. AS_EX((yyval))->assign->ident = (yyvsp[-2]);
  1559. MAKE_REF_BINOP(AS_EX((yyval))->assign->value, OP_BOR, (yyvsp[-2]), (yyvsp[0]));
  1560. }
  1561. #line 1789 "parser.tab.c" /* yacc.c:1646 */
  1562. break;
  1563. case 23:
  1564. #line 121 "parser.y" /* yacc.c:1646 */
  1565. {
  1566. (yyval) = NEW_EX();
  1567. AS_EX((yyval))->type = EX_ASSIGN;
  1568. AS_EX((yyval))->assign = NEW(assign_node);
  1569. AS_EX((yyval))->assign->ident = (yyvsp[-2]);
  1570. MAKE_REF_BINOP(AS_EX((yyval))->assign->value, OP_BXOR, (yyvsp[-2]), (yyvsp[0]));
  1571. }
  1572. #line 1801 "parser.tab.c" /* yacc.c:1646 */
  1573. break;
  1574. case 24:
  1575. #line 128 "parser.y" /* yacc.c:1646 */
  1576. {
  1577. if(AS_EX((yyvsp[-2]))->type != EX_INDEX) {
  1578. yyerror("Assigning to non-indexing expression");
  1579. YYABORT;
  1580. }
  1581. (yyval) = NEW_EX();
  1582. AS_EX((yyval))->type = EX_SETINDEX;
  1583. AS_EX((yyval))->setindex = NEW(setindex_node);
  1584. AS_EX((yyval))->setindex->expr = AS_EX((yyvsp[-2]))->index->expr;
  1585. AS_EX((yyval))->setindex->index = AS_EX((yyvsp[-2]))->index->index;
  1586. AS_EX((yyval))->setindex->value = (yyvsp[0]);
  1587. //ex_free(AS_EX($1));
  1588. }
  1589. #line 1819 "parser.tab.c" /* yacc.c:1646 */
  1590. break;
  1591. case 25:
  1592. #line 141 "parser.y" /* yacc.c:1646 */
  1593. {
  1594. if(AS_EX((yyvsp[-2]))->type != EX_INDEX) {
  1595. yyerror("Assigning to non-indexing expression");
  1596. YYABORT;
  1597. }
  1598. (yyval) = NEW_EX();
  1599. AS_EX((yyval))->type = EX_SETINDEX;
  1600. AS_EX((yyval))->setindex = NEW(setindex_node);
  1601. AS_EX((yyval))->setindex->expr = AS_EX((yyvsp[-2]))->index->expr;
  1602. AS_EX((yyval))->setindex->index = AS_EX((yyvsp[-2]))->index->index;
  1603. MAKE_IDX_BINOP(AS_EX((yyval))->setindex->value, OP_ADD, AS_EX((yyvsp[-2]))->index->expr, AS_EX((yyvsp[-2]))->index->index, (yyvsp[0]));
  1604. //ex_free(AS_EX($1));
  1605. }
  1606. #line 1837 "parser.tab.c" /* yacc.c:1646 */
  1607. break;
  1608. case 26:
  1609. #line 154 "parser.y" /* yacc.c:1646 */
  1610. {
  1611. if(AS_EX((yyvsp[-2]))->type != EX_INDEX) {
  1612. yyerror("Assigning to non-indexing expression");
  1613. YYABORT;
  1614. }
  1615. (yyval) = NEW_EX();
  1616. AS_EX((yyval))->type = EX_SETINDEX;
  1617. AS_EX((yyval))->setindex = NEW(setindex_node);
  1618. AS_EX((yyval))->setindex->expr = AS_EX((yyvsp[-2]))->index->expr;
  1619. AS_EX((yyval))->setindex->index = AS_EX((yyvsp[-2]))->index->index;
  1620. MAKE_IDX_BINOP(AS_EX((yyval))->setindex->value, OP_SUB, AS_EX((yyvsp[-2]))->index->expr, AS_EX((yyvsp[-2]))->index->index, (yyvsp[0]));
  1621. //ex_free(AS_EX($1));
  1622. }
  1623. #line 1855 "parser.tab.c" /* yacc.c:1646 */
  1624. break;
  1625. case 27:
  1626. #line 167 "parser.y" /* yacc.c:1646 */
  1627. {
  1628. if(AS_EX((yyvsp[-2]))->type != EX_INDEX) {
  1629. yyerror("Assigning to non-indexing expression");
  1630. YYABORT;
  1631. }
  1632. (yyval) = NEW_EX();
  1633. AS_EX((yyval))->type = EX_SETINDEX;
  1634. AS_EX((yyval))->setindex = NEW(setindex_node);
  1635. AS_EX((yyval))->setindex->expr = AS_EX((yyvsp[-2]))->index->expr;
  1636. AS_EX((yyval))->setindex->index = AS_EX((yyvsp[-2]))->index->index;
  1637. MAKE_IDX_BINOP(AS_EX((yyval))->setindex->value, OP_MUL, AS_EX((yyvsp[-2]))->index->expr, AS_EX((yyvsp[-2]))->index->index, (yyvsp[0]));
  1638. //ex_free(AS_EX($1));
  1639. }
  1640. #line 1873 "parser.tab.c" /* yacc.c:1646 */
  1641. break;
  1642. case 28:
  1643. #line 180 "parser.y" /* yacc.c:1646 */
  1644. {
  1645. if(AS_EX((yyvsp[-2]))->type != EX_INDEX) {
  1646. yyerror("Assigning to non-indexing expression");
  1647. YYABORT;
  1648. }
  1649. (yyval) = NEW_EX();
  1650. AS_EX((yyval))->type = EX_SETINDEX;
  1651. AS_EX((yyval))->setindex = NEW(setindex_node);
  1652. AS_EX((yyval))->setindex->expr = AS_EX((yyvsp[-2]))->index->expr;
  1653. AS_EX((yyval))->setindex->index = AS_EX((yyvsp[-2]))->index->index;
  1654. MAKE_IDX_BINOP(AS_EX((yyval))->setindex->value, OP_DIV, AS_EX((yyvsp[-2]))->index->expr, AS_EX((yyvsp[-2]))->index->index, (yyvsp[0]));
  1655. //ex_free(AS_EX($1));
  1656. }
  1657. #line 1891 "parser.tab.c" /* yacc.c:1646 */
  1658. break;
  1659. case 29:
  1660. #line 193 "parser.y" /* yacc.c:1646 */
  1661. {
  1662. if(AS_EX((yyvsp[-2]))->type != EX_INDEX) {
  1663. yyerror("Assigning to non-indexing expression");
  1664. YYABORT;
  1665. }
  1666. (yyval) = NEW_EX();
  1667. AS_EX((yyval))->type = EX_SETINDEX;
  1668. AS_EX((yyval))->setindex = NEW(setindex_node);
  1669. AS_EX((yyval))->setindex->expr = AS_EX((yyvsp[-2]))->index->expr;
  1670. AS_EX((yyval))->setindex->index = AS_EX((yyvsp[-2]))->index->index;
  1671. MAKE_IDX_BINOP(AS_EX((yyval))->setindex->value, OP_POW, AS_EX((yyvsp[-2]))->index->expr, AS_EX((yyvsp[-2]))->index->index, (yyvsp[0]));
  1672. //ex_free(AS_EX($1));
  1673. }
  1674. #line 1909 "parser.tab.c" /* yacc.c:1646 */
  1675. break;
  1676. case 30:
  1677. #line 206 "parser.y" /* yacc.c:1646 */
  1678. {
  1679. if(AS_EX((yyvsp[-2]))->type != EX_INDEX) {
  1680. yyerror("Assigning to non-indexing expression");
  1681. YYABORT;
  1682. }
  1683. (yyval) = NEW_EX();
  1684. AS_EX((yyval))->type = EX_SETINDEX;
  1685. AS_EX((yyval))->setindex = NEW(setindex_node);
  1686. AS_EX((yyval))->setindex->expr = AS_EX((yyvsp[-2]))->index->expr;
  1687. AS_EX((yyval))->setindex->index = AS_EX((yyvsp[-2]))->index->index;
  1688. MAKE_IDX_BINOP(AS_EX((yyval))->setindex->value, OP_BAND, AS_EX((yyvsp[-2]))->index->expr, AS_EX((yyvsp[-2]))->index->index, (yyvsp[0]));
  1689. //ex_free(AS_EX($1));
  1690. }
  1691. #line 1927 "parser.tab.c" /* yacc.c:1646 */
  1692. break;
  1693. case 31:
  1694. #line 219 "parser.y" /* yacc.c:1646 */
  1695. {
  1696. if(AS_EX((yyvsp[-2]))->type != EX_INDEX) {
  1697. yyerror("Assigning to non-indexing expression");
  1698. YYABORT;
  1699. }
  1700. (yyval) = NEW_EX();
  1701. AS_EX((yyval))->type = EX_SETINDEX;
  1702. AS_EX((yyval))->setindex = NEW(setindex_node);
  1703. AS_EX((yyval))->setindex->expr = AS_EX((yyvsp[-2]))->index->expr;
  1704. AS_EX((yyval))->setindex->index = AS_EX((yyvsp[-2]))->index->index;
  1705. MAKE_IDX_BINOP(AS_EX((yyval))->setindex->value, OP_BOR, AS_EX((yyvsp[-2]))->index->expr, AS_EX((yyvsp[-2]))->index->index, (yyvsp[0]));
  1706. //ex_free(AS_EX($1));
  1707. }
  1708. #line 1945 "parser.tab.c" /* yacc.c:1646 */
  1709. break;
  1710. case 32:
  1711. #line 232 "parser.y" /* yacc.c:1646 */
  1712. {
  1713. if(AS_EX((yyvsp[-2]))->type != EX_INDEX) {
  1714. yyerror("Assigning to non-indexing expression");
  1715. YYABORT;
  1716. }
  1717. (yyval) = NEW_EX();
  1718. AS_EX((yyval))->type = EX_SETINDEX;
  1719. AS_EX((yyval))->setindex = NEW(setindex_node);
  1720. AS_EX((yyval))->setindex->expr = AS_EX((yyvsp[-2]))->index->expr;
  1721. AS_EX((yyval))->setindex->index = AS_EX((yyvsp[-2]))->index->index;
  1722. MAKE_IDX_BINOP(AS_EX((yyval))->setindex->value, OP_BXOR, AS_EX((yyvsp[-2]))->index->expr, AS_EX((yyvsp[-2]))->index->index, (yyvsp[0]));
  1723. //ex_free(AS_EX($1));
  1724. }
  1725. #line 1963 "parser.tab.c" /* yacc.c:1646 */
  1726. break;
  1727. case 33:
  1728. #line 245 "parser.y" /* yacc.c:1646 */
  1729. { (yyval) = (yyvsp[0]); }
  1730. #line 1969 "parser.tab.c" /* yacc.c:1646 */
  1731. break;
  1732. case 34:
  1733. #line 249 "parser.y" /* yacc.c:1646 */
  1734. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_LAND; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1735. #line 1975 "parser.tab.c" /* yacc.c:1646 */
  1736. break;
  1737. case 35:
  1738. #line 250 "parser.y" /* yacc.c:1646 */
  1739. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_LOR; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1740. #line 1981 "parser.tab.c" /* yacc.c:1646 */
  1741. break;
  1742. case 36:
  1743. #line 251 "parser.y" /* yacc.c:1646 */
  1744. { (yyval) = (yyvsp[0]); }
  1745. #line 1987 "parser.tab.c" /* yacc.c:1646 */
  1746. break;
  1747. case 37:
  1748. #line 255 "parser.y" /* yacc.c:1646 */
  1749. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_UNOP; AS_EX((yyval))->unop = NEW(unop_node); AS_EX((yyval))->unop->type = OP_LNOT; AS_EX((yyval))->unop->expr = (yyvsp[0]); }
  1750. #line 1993 "parser.tab.c" /* yacc.c:1646 */
  1751. break;
  1752. case 38:
  1753. #line 256 "parser.y" /* yacc.c:1646 */
  1754. { (yyval) = (yyvsp[0]); }
  1755. #line 1999 "parser.tab.c" /* yacc.c:1646 */
  1756. break;
  1757. case 39:
  1758. #line 260 "parser.y" /* yacc.c:1646 */
  1759. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_EQUAL; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1760. #line 2005 "parser.tab.c" /* yacc.c:1646 */
  1761. break;
  1762. case 40:
  1763. #line 261 "parser.y" /* yacc.c:1646 */
  1764. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_NEQUAL; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1765. #line 2011 "parser.tab.c" /* yacc.c:1646 */
  1766. break;
  1767. case 41:
  1768. #line 262 "parser.y" /* yacc.c:1646 */
  1769. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_LESS; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1770. #line 2017 "parser.tab.c" /* yacc.c:1646 */
  1771. break;
  1772. case 42:
  1773. #line 263 "parser.y" /* yacc.c:1646 */
  1774. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_GREATER; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1775. #line 2023 "parser.tab.c" /* yacc.c:1646 */
  1776. break;
  1777. case 43:
  1778. #line 264 "parser.y" /* yacc.c:1646 */
  1779. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_LESSEQ; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1780. #line 2029 "parser.tab.c" /* yacc.c:1646 */
  1781. break;
  1782. case 44:
  1783. #line 265 "parser.y" /* yacc.c:1646 */
  1784. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_GREATEREQ; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1785. #line 2035 "parser.tab.c" /* yacc.c:1646 */
  1786. break;
  1787. case 45:
  1788. #line 266 "parser.y" /* yacc.c:1646 */
  1789. { (yyval) = (yyvsp[0]); }
  1790. #line 2041 "parser.tab.c" /* yacc.c:1646 */
  1791. break;
  1792. case 46:
  1793. #line 270 "parser.y" /* yacc.c:1646 */
  1794. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_ADD; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1795. #line 2047 "parser.tab.c" /* yacc.c:1646 */
  1796. break;
  1797. case 47:
  1798. #line 271 "parser.y" /* yacc.c:1646 */
  1799. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_SUB; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1800. #line 2053 "parser.tab.c" /* yacc.c:1646 */
  1801. break;
  1802. case 48:
  1803. #line 272 "parser.y" /* yacc.c:1646 */
  1804. { (yyval) = (yyvsp[0]); }
  1805. #line 2059 "parser.tab.c" /* yacc.c:1646 */
  1806. break;
  1807. case 49:
  1808. #line 276 "parser.y" /* yacc.c:1646 */
  1809. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_MUL; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1810. #line 2065 "parser.tab.c" /* yacc.c:1646 */
  1811. break;
  1812. case 50:
  1813. #line 277 "parser.y" /* yacc.c:1646 */
  1814. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_DIV; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1815. #line 2071 "parser.tab.c" /* yacc.c:1646 */
  1816. break;
  1817. case 51:
  1818. #line 278 "parser.y" /* yacc.c:1646 */
  1819. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_MOD; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1820. #line 2077 "parser.tab.c" /* yacc.c:1646 */
  1821. break;
  1822. case 52:
  1823. #line 279 "parser.y" /* yacc.c:1646 */
  1824. { (yyval) = (yyvsp[0]); }
  1825. #line 2083 "parser.tab.c" /* yacc.c:1646 */
  1826. break;
  1827. case 53:
  1828. #line 283 "parser.y" /* yacc.c:1646 */
  1829. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_POW; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1830. #line 2089 "parser.tab.c" /* yacc.c:1646 */
  1831. break;
  1832. case 54:
  1833. #line 284 "parser.y" /* yacc.c:1646 */
  1834. { (yyval) = (yyvsp[0]); }
  1835. #line 2095 "parser.tab.c" /* yacc.c:1646 */
  1836. break;
  1837. case 55:
  1838. #line 288 "parser.y" /* yacc.c:1646 */
  1839. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_BAND; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1840. #line 2101 "parser.tab.c" /* yacc.c:1646 */
  1841. break;
  1842. case 56:
  1843. #line 289 "parser.y" /* yacc.c:1646 */
  1844. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_BOR; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1845. #line 2107 "parser.tab.c" /* yacc.c:1646 */
  1846. break;
  1847. case 57:
  1848. #line 290 "parser.y" /* yacc.c:1646 */
  1849. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_BXOR; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1850. #line 2113 "parser.tab.c" /* yacc.c:1646 */
  1851. break;
  1852. case 58:
  1853. #line 291 "parser.y" /* yacc.c:1646 */
  1854. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_LSHIFT; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1855. #line 2119 "parser.tab.c" /* yacc.c:1646 */
  1856. break;
  1857. case 59:
  1858. #line 292 "parser.y" /* yacc.c:1646 */
  1859. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_BINOP; AS_EX((yyval))->binop = NEW(binop_node); AS_EX((yyval))->binop->type = OP_RSHIFT; AS_EX((yyval))->binop->left = (yyvsp[-2]); AS_EX((yyval))->binop->right = (yyvsp[0]); }
  1860. #line 2125 "parser.tab.c" /* yacc.c:1646 */
  1861. break;
  1862. case 60:
  1863. #line 293 "parser.y" /* yacc.c:1646 */
  1864. { (yyval) = (yyvsp[0]); }
  1865. #line 2131 "parser.tab.c" /* yacc.c:1646 */
  1866. break;
  1867. case 61:
  1868. #line 297 "parser.y" /* yacc.c:1646 */
  1869. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_UNOP; AS_EX((yyval))->unop = NEW(unop_node); AS_EX((yyval))->unop->type = OP_BNOT; AS_EX((yyval))->unop->expr = (yyvsp[0]); }
  1870. #line 2137 "parser.tab.c" /* yacc.c:1646 */
  1871. break;
  1872. case 62:
  1873. #line 298 "parser.y" /* yacc.c:1646 */
  1874. { (yyval) = (yyvsp[0]); }
  1875. #line 2143 "parser.tab.c" /* yacc.c:1646 */
  1876. break;
  1877. case 63:
  1878. #line 302 "parser.y" /* yacc.c:1646 */
  1879. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_UNOP; AS_EX((yyval))->unop = NEW(unop_node); AS_EX((yyval))->unop->type = OP_LEN; AS_EX((yyval))->unop->expr = (yyvsp[0]); }
  1880. #line 2149 "parser.tab.c" /* yacc.c:1646 */
  1881. break;
  1882. case 64:
  1883. #line 303 "parser.y" /* yacc.c:1646 */
  1884. { (yyval) = (yyvsp[0]); }
  1885. #line 2155 "parser.tab.c" /* yacc.c:1646 */
  1886. break;
  1887. case 65:
  1888. #line 307 "parser.y" /* yacc.c:1646 */
  1889. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_CALL; AS_EX((yyval))->call = NEW(call_node); AS_EX((yyval))->call->expr = (yyvsp[-3]); AS_EX((yyval))->call->args = (yyvsp[-1]); }
  1890. #line 2161 "parser.tab.c" /* yacc.c:1646 */
  1891. break;
  1892. case 66:
  1893. #line 308 "parser.y" /* yacc.c:1646 */
  1894. {
  1895. (yyval) = NEW_EX();
  1896. AS_EX((yyval))->type = EX_CALL;
  1897. AS_EX((yyval))->call = NEW(call_node);
  1898. AS_EX((yyval))->call->expr = NEW_EX();
  1899. AS_EX((yyval))->call->expr->type = EX_INDEX;
  1900. AS_EX((yyval))->call->expr->index = NEW(index_node);
  1901. AS_EX((yyval))->call->expr->index->expr = (yyvsp[-5]);
  1902. AS_EX((yyval))->call->expr->index->index = NEW_EX();
  1903. AS_EX((yyval))->call->expr->index->index->type = EX_LIT;
  1904. AS_EX((yyval))->call->expr->index->index->lit = NEW(lit_node);
  1905. AS_EX((yyval))->call->expr->index->index->lit->type = LIT_STRING;
  1906. AS_EX((yyval))->call->expr->index->index->lit->str = (yyvsp[-3]);
  1907. AS_EX((yyval))->call->args = NEW(exprlist_node);
  1908. AS_EX((yyval))->call->args->expr = (yyvsp[-5]);
  1909. AS_EX((yyval))->call->args->next = (yyvsp[-1]);
  1910. }
  1911. #line 2183 "parser.tab.c" /* yacc.c:1646 */
  1912. break;
  1913. case 67:
  1914. #line 325 "parser.y" /* yacc.c:1646 */
  1915. { (yyval) = (yyvsp[0]); }
  1916. #line 2189 "parser.tab.c" /* yacc.c:1646 */
  1917. break;
  1918. case 68:
  1919. #line 329 "parser.y" /* yacc.c:1646 */
  1920. {
  1921. (yyval) = NEW_EX();
  1922. AS_EX((yyval))->type = EX_FUNCDECL;
  1923. AS_EX((yyval))->funcdecl = NEW(funcdecl_node);
  1924. AS_EX((yyval))->funcdecl->name = (yyvsp[-5]);
  1925. AS_EX((yyval))->funcdecl->args = (yyvsp[-3]);
  1926. AS_EX((yyval))->funcdecl->body = (yyvsp[-1]);
  1927. }
  1928. #line 2202 "parser.tab.c" /* yacc.c:1646 */
  1929. break;
  1930. case 69:
  1931. #line 337 "parser.y" /* yacc.c:1646 */
  1932. {
  1933. (yyval) = NEW_EX();
  1934. AS_EX((yyval))->type = EX_FUNCDECL;
  1935. AS_EX((yyval))->funcdecl = NEW(funcdecl_node);
  1936. AS_EX((yyval))->funcdecl->name = NULL;
  1937. AS_EX((yyval))->funcdecl->args = (yyvsp[-3]);
  1938. AS_EX((yyval))->funcdecl->body = (yyvsp[-1]);
  1939. }
  1940. #line 2215 "parser.tab.c" /* yacc.c:1646 */
  1941. break;
  1942. case 70:
  1943. #line 345 "parser.y" /* yacc.c:1646 */
  1944. { (yyval) = (yyvsp[0]); }
  1945. #line 2221 "parser.tab.c" /* yacc.c:1646 */
  1946. break;
  1947. case 71:
  1948. #line 349 "parser.y" /* yacc.c:1646 */
  1949. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_INDEX; AS_EX((yyval))->index = NEW(index_node); AS_EX((yyval))->index->expr = (yyvsp[-3]); AS_EX((yyval))->index->index = (yyvsp[-1]); }
  1950. #line 2227 "parser.tab.c" /* yacc.c:1646 */
  1951. break;
  1952. case 72:
  1953. #line 350 "parser.y" /* yacc.c:1646 */
  1954. {
  1955. (yyval) = NEW_EX();
  1956. AS_EX((yyval))->type = EX_INDEX;
  1957. AS_EX((yyval))->index = NEW(index_node);
  1958. AS_EX((yyval))->index->expr = (yyvsp[-2]);
  1959. AS_EX((yyval))->index->index = NEW_EX();
  1960. AS_EX((yyval))->index->index->type = EX_LIT;
  1961. AS_EX((yyval))->index->index->lit = NEW(lit_node);
  1962. AS_EX((yyval))->index->index->lit->type = LIT_STRING;
  1963. AS_EX((yyval))->index->index->lit->str = (yyvsp[0]);
  1964. }
  1965. #line 2243 "parser.tab.c" /* yacc.c:1646 */
  1966. break;
  1967. case 73:
  1968. #line 361 "parser.y" /* yacc.c:1646 */
  1969. { (yyval) = (yyvsp[0]); }
  1970. #line 2249 "parser.tab.c" /* yacc.c:1646 */
  1971. break;
  1972. case 74:
  1973. #line 365 "parser.y" /* yacc.c:1646 */
  1974. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_INDEX; AS_EX((yyval))->index = NEW(index_node); AS_EX((yyval))->index->expr = (yyvsp[-3]); AS_EX((yyval))->index->index = (yyvsp[-1]); }
  1975. #line 2255 "parser.tab.c" /* yacc.c:1646 */
  1976. break;
  1977. case 75:
  1978. #line 366 "parser.y" /* yacc.c:1646 */
  1979. {
  1980. (yyval) = NEW_EX();
  1981. AS_EX((yyval))->type = EX_INDEX;
  1982. AS_EX((yyval))->index = NEW(index_node);
  1983. AS_EX((yyval))->index->expr = (yyvsp[-2]);
  1984. AS_EX((yyval))->index->index = NEW_EX();
  1985. AS_EX((yyval))->index->index->type = EX_LIT;
  1986. AS_EX((yyval))->index->index->lit = NEW(lit_node);
  1987. AS_EX((yyval))->index->index->lit->type = LIT_STRING;
  1988. AS_EX((yyval))->index->index->lit->str = (yyvsp[0]);
  1989. }
  1990. #line 2271 "parser.tab.c" /* yacc.c:1646 */
  1991. break;
  1992. case 76:
  1993. #line 380 "parser.y" /* yacc.c:1646 */
  1994. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_REF; AS_EX((yyval))->ref = NEW(ref_node); AS_EX((yyval))->ref->ident = (yyvsp[0]); }
  1995. #line 2277 "parser.tab.c" /* yacc.c:1646 */
  1996. break;
  1997. case 77:
  1998. #line 381 "parser.y" /* yacc.c:1646 */
  1999. { (yyval) = (yyvsp[0]); }
  2000. #line 2283 "parser.tab.c" /* yacc.c:1646 */
  2001. break;
  2002. case 78:
  2003. #line 385 "parser.y" /* yacc.c:1646 */
  2004. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_LIT; AS_EX((yyval))->lit = NEW(lit_node); AS_EX((yyval))->lit->type = LIT_INT; AS_EX((yyval))->lit->ival = *AS((yyvsp[0]), long); free((yyvsp[0])); }
  2005. #line 2289 "parser.tab.c" /* yacc.c:1646 */
  2006. break;
  2007. case 79:
  2008. #line 386 "parser.y" /* yacc.c:1646 */
  2009. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_LIT; AS_EX((yyval))->lit = NEW(lit_node); AS_EX((yyval))->lit->type = LIT_INT; AS_EX((yyval))->lit->ival = -(*AS((yyvsp[0]), long)); free((yyvsp[0])); }
  2010. #line 2295 "parser.tab.c" /* yacc.c:1646 */
  2011. break;
  2012. case 80:
  2013. #line 387 "parser.y" /* yacc.c:1646 */
  2014. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_LIT; AS_EX((yyval))->lit = NEW(lit_node); AS_EX((yyval))->lit->type = LIT_FLOAT; AS_EX((yyval))->lit->fval = *AS((yyvsp[0]), double); free((yyvsp[0])); }
  2015. #line 2301 "parser.tab.c" /* yacc.c:1646 */
  2016. break;
  2017. case 81:
  2018. #line 388 "parser.y" /* yacc.c:1646 */
  2019. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_LIT; AS_EX((yyval))->lit = NEW(lit_node); AS_EX((yyval))->lit->type = LIT_STRING; AS_EX((yyval))->lit->str = (yyvsp[0]); }
  2020. #line 2307 "parser.tab.c" /* yacc.c:1646 */
  2021. break;
  2022. case 82:
  2023. #line 389 "parser.y" /* yacc.c:1646 */
  2024. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_LIT; AS_EX((yyval))->lit = NEW(lit_node); AS_EX((yyval))->lit->type = LIT_NONE; }
  2025. #line 2313 "parser.tab.c" /* yacc.c:1646 */
  2026. break;
  2027. case 83:
  2028. #line 390 "parser.y" /* yacc.c:1646 */
  2029. { (yyval) = (yyvsp[0]); }
  2030. #line 2319 "parser.tab.c" /* yacc.c:1646 */
  2031. break;
  2032. case 84:
  2033. #line 394 "parser.y" /* yacc.c:1646 */
  2034. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_LISTGEN; AS_EX((yyval))->listgen = NEW(listgen_node); AS_EX((yyval))->listgen->list = (yyvsp[-1]); }
  2035. #line 2325 "parser.tab.c" /* yacc.c:1646 */
  2036. break;
  2037. case 85:
  2038. #line 395 "parser.y" /* yacc.c:1646 */
  2039. { (yyval) = NEW_EX(); AS_EX((yyval))->type = EX_MAPGEN; AS_EX((yyval))->mapgen = NEW(mapgen_node); AS_EX((yyval))->mapgen->map = (yyvsp[-1]); }
  2040. #line 2331 "parser.tab.c" /* yacc.c:1646 */
  2041. break;
  2042. case 86:
  2043. #line 396 "parser.y" /* yacc.c:1646 */
  2044. { (yyval) = (yyvsp[0]); }
  2045. #line 2337 "parser.tab.c" /* yacc.c:1646 */
  2046. break;
  2047. case 87:
  2048. #line 400 "parser.y" /* yacc.c:1646 */
  2049. { (yyval) = (yyvsp[-1]); }
  2050. #line 2343 "parser.tab.c" /* yacc.c:1646 */
  2051. break;
  2052. case 88:
  2053. #line 404 "parser.y" /* yacc.c:1646 */
  2054. { (yyval) = NULL; }
  2055. #line 2349 "parser.tab.c" /* yacc.c:1646 */
  2056. break;
  2057. case 89:
  2058. #line 405 "parser.y" /* yacc.c:1646 */
  2059. {
  2060. (yyval) = NEW(exprlist_node);
  2061. AS((yyval), exprlist_node)->expr = (yyvsp[0]);
  2062. AS((yyval), exprlist_node)->next = NULL;
  2063. }
  2064. #line 2359 "parser.tab.c" /* yacc.c:1646 */
  2065. break;
  2066. case 90:
  2067. #line 410 "parser.y" /* yacc.c:1646 */
  2068. { (yyval) = (yyvsp[-1]); }
  2069. #line 2365 "parser.tab.c" /* yacc.c:1646 */
  2070. break;
  2071. case 91:
  2072. #line 411 "parser.y" /* yacc.c:1646 */
  2073. {
  2074. exprlist_node *cur = (yyvsp[-1]);
  2075. while(cur->next) cur = cur->next;
  2076. cur->next = NEW(exprlist_node);
  2077. cur = cur->next;
  2078. cur->expr = (yyvsp[0]);
  2079. cur->next = NULL;
  2080. (yyval) = (yyvsp[-1]);
  2081. }
  2082. #line 2379 "parser.tab.c" /* yacc.c:1646 */
  2083. break;
  2084. case 92:
  2085. #line 423 "parser.y" /* yacc.c:1646 */
  2086. { (yyval) = NULL; }
  2087. #line 2385 "parser.tab.c" /* yacc.c:1646 */
  2088. break;
  2089. case 93:
  2090. #line 424 "parser.y" /* yacc.c:1646 */
  2091. {
  2092. (yyval) = NEW(identlist_node);
  2093. AS((yyval), identlist_node)->ident = (yyvsp[0]);
  2094. AS((yyval), identlist_node)->next = NULL;
  2095. }
  2096. #line 2395 "parser.tab.c" /* yacc.c:1646 */
  2097. break;
  2098. case 94:
  2099. #line 429 "parser.y" /* yacc.c:1646 */
  2100. { (yyval) = (yyvsp[-1]); }
  2101. #line 2401 "parser.tab.c" /* yacc.c:1646 */
  2102. break;
  2103. case 95:
  2104. #line 430 "parser.y" /* yacc.c:1646 */
  2105. {
  2106. identlist_node *cur = (yyvsp[-1]);
  2107. while(cur->next) cur = cur->next;
  2108. cur->next = NEW(identlist_node);
  2109. cur = cur->next;
  2110. cur->ident = (yyvsp[0]);
  2111. cur->next = NULL;
  2112. (yyval) = (yyvsp[-1]);
  2113. }
  2114. #line 2415 "parser.tab.c" /* yacc.c:1646 */
  2115. break;
  2116. case 96:
  2117. #line 442 "parser.y" /* yacc.c:1646 */
  2118. { (yyval) = NULL; }
  2119. #line 2421 "parser.tab.c" /* yacc.c:1646 */
  2120. break;
  2121. case 97:
  2122. #line 443 "parser.y" /* yacc.c:1646 */
  2123. {
  2124. (yyval) = NEW(assoclist_node);
  2125. AS((yyval), assoclist_node)->item = (yyvsp[0]);
  2126. AS((yyval), assoclist_node)->next = NULL;
  2127. }
  2128. #line 2431 "parser.tab.c" /* yacc.c:1646 */
  2129. break;
  2130. case 98:
  2131. #line 448 "parser.y" /* yacc.c:1646 */
  2132. { (yyval) = (yyvsp[-1]); }
  2133. #line 2437 "parser.tab.c" /* yacc.c:1646 */
  2134. break;
  2135. case 99:
  2136. #line 449 "parser.y" /* yacc.c:1646 */
  2137. {
  2138. assoclist_node *cur = (yyvsp[-1]);
  2139. while(cur->next) cur = cur->next;
  2140. cur->next = NEW(assoclist_node);
  2141. cur = cur->next;
  2142. cur->item = (yyvsp[0]);
  2143. cur->next = NULL;
  2144. (yyval) = (yyvsp[-1]);
  2145. }
  2146. #line 2451 "parser.tab.c" /* yacc.c:1646 */
  2147. break;
  2148. case 100:
  2149. #line 461 "parser.y" /* yacc.c:1646 */
  2150. {
  2151. (yyval) = NEW(associtem_node);
  2152. AS((yyval), associtem_node)->key = (yyvsp[-3]);
  2153. AS((yyval), associtem_node)->value = (yyvsp[0]);
  2154. }
  2155. #line 2461 "parser.tab.c" /* yacc.c:1646 */
  2156. break;
  2157. case 101:
  2158. #line 466 "parser.y" /* yacc.c:1646 */
  2159. {
  2160. (yyval) = NEW(associtem_node);
  2161. AS((yyval), associtem_node)->key = NEW_EX();
  2162. AS((yyval), associtem_node)->key->type = EX_LIT;
  2163. AS((yyval), associtem_node)->key->lit = NEW(lit_node);
  2164. AS((yyval), associtem_node)->key->lit->type = LIT_STRING;
  2165. AS((yyval), associtem_node)->key->lit->str = (yyvsp[-2]);
  2166. AS((yyval), associtem_node)->value = (yyvsp[0]);
  2167. }
  2168. #line 2475 "parser.tab.c" /* yacc.c:1646 */
  2169. break;
  2170. #line 2479 "parser.tab.c" /* yacc.c:1646 */
  2171. default: break;
  2172. }
  2173. /* User semantic actions sometimes alter yychar, and that requires
  2174. that yytoken be updated with the new translation. We take the
  2175. approach of translating immediately before every use of yytoken.
  2176. One alternative is translating here after every semantic action,
  2177. but that translation would be missed if the semantic action invokes
  2178. YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
  2179. if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
  2180. incorrect destructor might then be invoked immediately. In the
  2181. case of YYERROR or YYBACKUP, subsequent parser actions might lead
  2182. to an incorrect destructor call or verbose syntax error message
  2183. before the lookahead is translated. */
  2184. YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
  2185. YYPOPSTACK (yylen);
  2186. yylen = 0;
  2187. YY_STACK_PRINT (yyss, yyssp);
  2188. *++yyvsp = yyval;
  2189. *++yylsp = yyloc;
  2190. /* Now 'shift' the result of the reduction. Determine what state
  2191. that goes to, based on the state we popped back to and the rule
  2192. number reduced by. */
  2193. yyn = yyr1[yyn];
  2194. yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  2195. if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  2196. yystate = yytable[yystate];
  2197. else
  2198. yystate = yydefgoto[yyn - YYNTOKENS];
  2199. goto yynewstate;
  2200. /*--------------------------------------.
  2201. | yyerrlab -- here on detecting error. |
  2202. `--------------------------------------*/
  2203. yyerrlab:
  2204. /* Make sure we have latest lookahead translation. See comments at
  2205. user semantic actions for why this is necessary. */
  2206. yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
  2207. /* If not already recovering from an error, report this error. */
  2208. if (!yyerrstatus)
  2209. {
  2210. ++yynerrs;
  2211. #if ! YYERROR_VERBOSE
  2212. yyerror (&yylloc, program, YY_("syntax error"));
  2213. #else
  2214. # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
  2215. yyssp, yytoken)
  2216. {
  2217. char const *yymsgp = YY_("syntax error");
  2218. int yysyntax_error_status;
  2219. yysyntax_error_status = YYSYNTAX_ERROR;
  2220. if (yysyntax_error_status == 0)
  2221. yymsgp = yymsg;
  2222. else if (yysyntax_error_status == 1)
  2223. {
  2224. if (yymsg != yymsgbuf)
  2225. YYSTACK_FREE (yymsg);
  2226. yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
  2227. if (!yymsg)
  2228. {
  2229. yymsg = yymsgbuf;
  2230. yymsg_alloc = sizeof yymsgbuf;
  2231. yysyntax_error_status = 2;
  2232. }
  2233. else
  2234. {
  2235. yysyntax_error_status = YYSYNTAX_ERROR;
  2236. yymsgp = yymsg;
  2237. }
  2238. }
  2239. yyerror (&yylloc, program, yymsgp);
  2240. if (yysyntax_error_status == 2)
  2241. goto yyexhaustedlab;
  2242. }
  2243. # undef YYSYNTAX_ERROR
  2244. #endif
  2245. }
  2246. yyerror_range[1] = yylloc;
  2247. if (yyerrstatus == 3)
  2248. {
  2249. /* If just tried and failed to reuse lookahead token after an
  2250. error, discard it. */
  2251. if (yychar <= YYEOF)
  2252. {
  2253. /* Return failure if at end of input. */
  2254. if (yychar == YYEOF)
  2255. YYABORT;
  2256. }
  2257. else
  2258. {
  2259. yydestruct ("Error: discarding",
  2260. yytoken, &yylval, &yylloc, program);
  2261. yychar = YYEMPTY;
  2262. }
  2263. }
  2264. /* Else will try to reuse lookahead token after shifting the error
  2265. token. */
  2266. goto yyerrlab1;
  2267. /*---------------------------------------------------.
  2268. | yyerrorlab -- error raised explicitly by YYERROR. |
  2269. `---------------------------------------------------*/
  2270. yyerrorlab:
  2271. /* Pacify compilers like GCC when the user code never invokes
  2272. YYERROR and the label yyerrorlab therefore never appears in user
  2273. code. */
  2274. if (/*CONSTCOND*/ 0)
  2275. goto yyerrorlab;
  2276. yyerror_range[1] = yylsp[1-yylen];
  2277. /* Do not reclaim the symbols of the rule whose action triggered
  2278. this YYERROR. */
  2279. YYPOPSTACK (yylen);
  2280. yylen = 0;
  2281. YY_STACK_PRINT (yyss, yyssp);
  2282. yystate = *yyssp;
  2283. goto yyerrlab1;
  2284. /*-------------------------------------------------------------.
  2285. | yyerrlab1 -- common code for both syntax error and YYERROR. |
  2286. `-------------------------------------------------------------*/
  2287. yyerrlab1:
  2288. yyerrstatus = 3; /* Each real token shifted decrements this. */
  2289. for (;;)
  2290. {
  2291. yyn = yypact[yystate];
  2292. if (!yypact_value_is_default (yyn))
  2293. {
  2294. yyn += YYTERROR;
  2295. if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  2296. {
  2297. yyn = yytable[yyn];
  2298. if (0 < yyn)
  2299. break;
  2300. }
  2301. }
  2302. /* Pop the current state because it cannot handle the error token. */
  2303. if (yyssp == yyss)
  2304. YYABORT;
  2305. yyerror_range[1] = *yylsp;
  2306. yydestruct ("Error: popping",
  2307. yystos[yystate], yyvsp, yylsp, program);
  2308. YYPOPSTACK (1);
  2309. yystate = *yyssp;
  2310. YY_STACK_PRINT (yyss, yyssp);
  2311. }
  2312. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  2313. *++yyvsp = yylval;
  2314. YY_IGNORE_MAYBE_UNINITIALIZED_END
  2315. yyerror_range[2] = yylloc;
  2316. /* Using YYLLOC is tempting, but would change the location of
  2317. the lookahead. YYLOC is available though. */
  2318. YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
  2319. *++yylsp = yyloc;
  2320. /* Shift the error token. */
  2321. YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
  2322. yystate = yyn;
  2323. goto yynewstate;
  2324. /*-------------------------------------.
  2325. | yyacceptlab -- YYACCEPT comes here. |
  2326. `-------------------------------------*/
  2327. yyacceptlab:
  2328. yyresult = 0;
  2329. goto yyreturn;
  2330. /*-----------------------------------.
  2331. | yyabortlab -- YYABORT comes here. |
  2332. `-----------------------------------*/
  2333. yyabortlab:
  2334. yyresult = 1;
  2335. goto yyreturn;
  2336. #if !defined yyoverflow || YYERROR_VERBOSE
  2337. /*-------------------------------------------------.
  2338. | yyexhaustedlab -- memory exhaustion comes here. |
  2339. `-------------------------------------------------*/
  2340. yyexhaustedlab:
  2341. yyerror (&yylloc, program, YY_("memory exhausted"));
  2342. yyresult = 2;
  2343. /* Fall through. */
  2344. #endif
  2345. yyreturn:
  2346. if (yychar != YYEMPTY)
  2347. {
  2348. /* Make sure we have latest lookahead translation. See comments at
  2349. user semantic actions for why this is necessary. */
  2350. yytoken = YYTRANSLATE (yychar);
  2351. yydestruct ("Cleanup: discarding lookahead",
  2352. yytoken, &yylval, &yylloc, program);
  2353. }
  2354. /* Do not reclaim the symbols of the rule whose action triggered
  2355. this YYABORT or YYACCEPT. */
  2356. YYPOPSTACK (yylen);
  2357. YY_STACK_PRINT (yyss, yyssp);
  2358. while (yyssp != yyss)
  2359. {
  2360. yydestruct ("Cleanup: popping",
  2361. yystos[*yyssp], yyvsp, yylsp, program);
  2362. YYPOPSTACK (1);
  2363. }
  2364. #ifndef yyoverflow
  2365. if (yyss != yyssa)
  2366. YYSTACK_FREE (yyss);
  2367. #endif
  2368. #if YYERROR_VERBOSE
  2369. if (yymsg != yymsgbuf)
  2370. YYSTACK_FREE (yymsg);
  2371. #endif
  2372. return yyresult;
  2373. }
  2374. #line 477 "parser.y" /* yacc.c:1906 */
  2375. // TODO