1
0

y.tab.c 93 KB

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