exparse.c 119 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627
  1. /* A Bison parser, made by GNU Bison 3.5.1. */
  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.1"
  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. /* Substitute the type names. */
  49. #define YYSTYPE EX_STYPE
  50. /* Substitute the variable and function names. */
  51. #define yyparse ex_parse
  52. #define yylex ex_lex
  53. #define yyerror ex_error
  54. #define yydebug ex_debug
  55. #define yynerrs ex_nerrs
  56. #define yylval ex_lval
  57. #define yychar ex_char
  58. /* First part of user prologue. */
  59. #line 19 "../../lib/expr/exparse.y"
  60. /*
  61. * Glenn Fowler
  62. * AT&T Research
  63. *
  64. * expression library grammar and compiler
  65. */
  66. #include <assert.h>
  67. #include <cgraph/gv_ctype.h>
  68. #include <expr/exop.h>
  69. #include <stdbool.h>
  70. #include <stdio.h>
  71. #include <stdlib.h>
  72. #include <string.h>
  73. #include <ast/ast.h>
  74. #include <util/streq.h>
  75. #line 99 "exparse.c"
  76. # ifndef YY_CAST
  77. # ifdef __cplusplus
  78. # define YY_CAST(Type, Val) static_cast<Type> (Val)
  79. # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
  80. # else
  81. # define YY_CAST(Type, Val) ((Type) (Val))
  82. # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
  83. # endif
  84. # endif
  85. # ifndef YY_NULLPTR
  86. # if defined __cplusplus
  87. # if 201103L <= __cplusplus
  88. # define YY_NULLPTR nullptr
  89. # else
  90. # define YY_NULLPTR 0
  91. # endif
  92. # else
  93. # define YY_NULLPTR ((void*)0)
  94. # endif
  95. # endif
  96. /* Enabling verbose error messages. */
  97. #ifdef YYERROR_VERBOSE
  98. # undef YYERROR_VERBOSE
  99. # define YYERROR_VERBOSE 1
  100. #else
  101. # define YYERROR_VERBOSE 0
  102. #endif
  103. /* Use api.header.include to #include this header
  104. instead of duplicating it here. */
  105. #ifndef YY_EX_EXPARSE_H_INCLUDED
  106. # define YY_EX_EXPARSE_H_INCLUDED
  107. /* Debug traces. */
  108. #ifndef EX_DEBUG
  109. # if defined YYDEBUG
  110. #if YYDEBUG
  111. # define EX_DEBUG 1
  112. # else
  113. # define EX_DEBUG 0
  114. # endif
  115. # else /* ! defined YYDEBUG */
  116. # define EX_DEBUG 1
  117. # endif /* ! defined YYDEBUG */
  118. #endif /* ! defined EX_DEBUG */
  119. #if EX_DEBUG
  120. extern int ex_debug;
  121. #endif
  122. /* Token type. */
  123. #ifndef EX_TOKENTYPE
  124. # define EX_TOKENTYPE
  125. enum ex_tokentype
  126. {
  127. MINTOKEN = 258,
  128. INTEGER = 259,
  129. UNSIGNED = 260,
  130. CHARACTER = 261,
  131. FLOATING = 262,
  132. STRING = 263,
  133. VOIDTYPE = 264,
  134. ADDRESS = 265,
  135. ARRAY = 266,
  136. BREAK = 267,
  137. CALL = 268,
  138. CASE = 269,
  139. CONSTANT = 270,
  140. CONTINUE = 271,
  141. DECLARE = 272,
  142. DEFAULT = 273,
  143. DYNAMIC = 274,
  144. ELSE = 275,
  145. EXIT = 276,
  146. FOR = 277,
  147. FUNCTION = 278,
  148. GSUB = 279,
  149. ITERATE = 280,
  150. ITERATOR = 281,
  151. ID = 282,
  152. IF = 283,
  153. LABEL = 284,
  154. MEMBER = 285,
  155. NAME = 286,
  156. POS = 287,
  157. PRAGMA = 288,
  158. PRE = 289,
  159. PRINT = 290,
  160. PRINTF = 291,
  161. PROCEDURE = 292,
  162. QUERY = 293,
  163. RAND = 294,
  164. RETURN = 295,
  165. SCANF = 296,
  166. SPLIT = 297,
  167. SPRINTF = 298,
  168. SRAND = 299,
  169. SSCANF = 300,
  170. SUB = 301,
  171. SUBSTR = 302,
  172. SWITCH = 303,
  173. TOKENS = 304,
  174. UNSET = 305,
  175. WHILE = 306,
  176. F2I = 307,
  177. F2S = 308,
  178. I2F = 309,
  179. I2S = 310,
  180. S2B = 311,
  181. S2F = 312,
  182. S2I = 313,
  183. F2X = 314,
  184. I2X = 315,
  185. S2X = 316,
  186. X2F = 317,
  187. X2I = 318,
  188. X2S = 319,
  189. X2X = 320,
  190. XPRINT = 321,
  191. OR = 322,
  192. AND = 323,
  193. EQ = 324,
  194. NE = 325,
  195. LE = 326,
  196. GE = 327,
  197. LSH = 328,
  198. RSH = 329,
  199. IN_OP = 330,
  200. UNARY = 331,
  201. INC = 332,
  202. DEC = 333,
  203. CAST = 334,
  204. MAXTOKEN = 335
  205. };
  206. #endif
  207. /* Tokens. */
  208. #define MINTOKEN 258
  209. #define INTEGER 259
  210. #define UNSIGNED 260
  211. #define CHARACTER 261
  212. #define FLOATING 262
  213. #define STRING 263
  214. #define VOIDTYPE 264
  215. #define ADDRESS 265
  216. #define ARRAY 266
  217. #define BREAK 267
  218. #define CALL 268
  219. #define CASE 269
  220. #define CONSTANT 270
  221. #define CONTINUE 271
  222. #define DECLARE 272
  223. #define DEFAULT 273
  224. #define DYNAMIC 274
  225. #define ELSE 275
  226. #define EXIT 276
  227. #define FOR 277
  228. #define FUNCTION 278
  229. #define GSUB 279
  230. #define ITERATE 280
  231. #define ITERATOR 281
  232. #define ID 282
  233. #define IF 283
  234. #define LABEL 284
  235. #define MEMBER 285
  236. #define NAME 286
  237. #define POS 287
  238. #define PRAGMA 288
  239. #define PRE 289
  240. #define PRINT 290
  241. #define PRINTF 291
  242. #define PROCEDURE 292
  243. #define QUERY 293
  244. #define RAND 294
  245. #define RETURN 295
  246. #define SCANF 296
  247. #define SPLIT 297
  248. #define SPRINTF 298
  249. #define SRAND 299
  250. #define SSCANF 300
  251. #define SUB 301
  252. #define SUBSTR 302
  253. #define SWITCH 303
  254. #define TOKENS 304
  255. #define UNSET 305
  256. #define WHILE 306
  257. #define F2I 307
  258. #define F2S 308
  259. #define I2F 309
  260. #define I2S 310
  261. #define S2B 311
  262. #define S2F 312
  263. #define S2I 313
  264. #define F2X 314
  265. #define I2X 315
  266. #define S2X 316
  267. #define X2F 317
  268. #define X2I 318
  269. #define X2S 319
  270. #define X2X 320
  271. #define XPRINT 321
  272. #define OR 322
  273. #define AND 323
  274. #define EQ 324
  275. #define NE 325
  276. #define LE 326
  277. #define GE 327
  278. #define LSH 328
  279. #define RSH 329
  280. #define IN_OP 330
  281. #define UNARY 331
  282. #define INC 332
  283. #define DEC 333
  284. #define CAST 334
  285. #define MAXTOKEN 335
  286. /* Value type. */
  287. #if ! defined EX_STYPE && ! defined EX_STYPE_IS_DECLARED
  288. union EX_STYPE
  289. {
  290. #line 41 "../../lib/expr/exparse.y"
  291. struct Exnode_s*expr;
  292. double floating;
  293. struct Exref_s* reference;
  294. struct Exid_s* id;
  295. long long integer;
  296. int op;
  297. char* string;
  298. #line 329 "exparse.c"
  299. };
  300. typedef union EX_STYPE EX_STYPE;
  301. # define EX_STYPE_IS_TRIVIAL 1
  302. # define EX_STYPE_IS_DECLARED 1
  303. #endif
  304. extern EX_STYPE ex_lval;
  305. int ex_parse (void);
  306. #endif /* !YY_EX_EXPARSE_H_INCLUDED */
  307. /* Second part of user prologue. */
  308. #line 169 "../../lib/expr/exparse.y"
  309. #include <expr/exgram.h>
  310. void ex_error(const char *message);
  311. #line 353 "exparse.c"
  312. #ifdef short
  313. # undef short
  314. #endif
  315. /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
  316. <limits.h> and (if available) <stdint.h> are included
  317. so that the code can choose integer types of a good width. */
  318. #ifndef __PTRDIFF_MAX__
  319. # include <limits.h> /* INFRINGES ON USER NAME SPACE */
  320. # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
  321. # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
  322. # define YY_STDINT_H
  323. # endif
  324. #endif
  325. /* Narrow types that promote to a signed type and that can represent a
  326. signed or unsigned integer of at least N bits. In tables they can
  327. save space and decrease cache pressure. Promoting to a signed type
  328. helps avoid bugs in integer arithmetic. */
  329. #ifdef __INT_LEAST8_MAX__
  330. typedef __INT_LEAST8_TYPE__ yytype_int8;
  331. #elif defined YY_STDINT_H
  332. typedef int_least8_t yytype_int8;
  333. #else
  334. typedef signed char yytype_int8;
  335. #endif
  336. #ifdef __INT_LEAST16_MAX__
  337. typedef __INT_LEAST16_TYPE__ yytype_int16;
  338. #elif defined YY_STDINT_H
  339. typedef int_least16_t yytype_int16;
  340. #else
  341. typedef short yytype_int16;
  342. #endif
  343. #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
  344. typedef __UINT_LEAST8_TYPE__ yytype_uint8;
  345. #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
  346. && UINT_LEAST8_MAX <= INT_MAX)
  347. typedef uint_least8_t yytype_uint8;
  348. #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
  349. typedef unsigned char yytype_uint8;
  350. #else
  351. typedef short yytype_uint8;
  352. #endif
  353. #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
  354. typedef __UINT_LEAST16_TYPE__ yytype_uint16;
  355. #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
  356. && UINT_LEAST16_MAX <= INT_MAX)
  357. typedef uint_least16_t yytype_uint16;
  358. #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
  359. typedef unsigned short yytype_uint16;
  360. #else
  361. typedef int yytype_uint16;
  362. #endif
  363. #ifndef YYPTRDIFF_T
  364. # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
  365. # define YYPTRDIFF_T __PTRDIFF_TYPE__
  366. # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
  367. # elif defined PTRDIFF_MAX
  368. # ifndef ptrdiff_t
  369. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  370. # endif
  371. # define YYPTRDIFF_T ptrdiff_t
  372. # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
  373. # else
  374. # define YYPTRDIFF_T long
  375. # define YYPTRDIFF_MAXIMUM LONG_MAX
  376. # endif
  377. #endif
  378. #ifndef YYSIZE_T
  379. # ifdef __SIZE_TYPE__
  380. # define YYSIZE_T __SIZE_TYPE__
  381. # elif defined size_t
  382. # define YYSIZE_T size_t
  383. # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
  384. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  385. # define YYSIZE_T size_t
  386. # else
  387. # define YYSIZE_T unsigned
  388. # endif
  389. #endif
  390. #define YYSIZE_MAXIMUM \
  391. YY_CAST (YYPTRDIFF_T, \
  392. (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
  393. ? YYPTRDIFF_MAXIMUM \
  394. : YY_CAST (YYSIZE_T, -1)))
  395. #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
  396. /* Stored state numbers (used for stacks). */
  397. typedef yytype_int16 yy_state_t;
  398. /* State numbers in computations. */
  399. typedef int yy_state_fast_t;
  400. #ifndef YY_
  401. # if defined YYENABLE_NLS && YYENABLE_NLS
  402. # if ENABLE_NLS
  403. # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  404. # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
  405. # endif
  406. # endif
  407. # ifndef YY_
  408. # define YY_(Msgid) Msgid
  409. # endif
  410. #endif
  411. #ifndef YY_ATTRIBUTE_PURE
  412. # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
  413. # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
  414. # else
  415. # define YY_ATTRIBUTE_PURE
  416. # endif
  417. #endif
  418. #ifndef YY_ATTRIBUTE_UNUSED
  419. # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
  420. # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
  421. # else
  422. # define YY_ATTRIBUTE_UNUSED
  423. # endif
  424. #endif
  425. /* Suppress unused-variable warnings by "using" E. */
  426. #if ! defined lint || defined __GNUC__
  427. # define YYUSE(E) ((void) (E))
  428. #else
  429. # define YYUSE(E) /* empty */
  430. #endif
  431. #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
  432. /* Suppress an incorrect diagnostic about yylval being uninitialized. */
  433. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
  434. _Pragma ("GCC diagnostic push") \
  435. _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
  436. _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
  437. # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
  438. _Pragma ("GCC diagnostic pop")
  439. #else
  440. # define YY_INITIAL_VALUE(Value) Value
  441. #endif
  442. #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  443. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  444. # define YY_IGNORE_MAYBE_UNINITIALIZED_END
  445. #endif
  446. #ifndef YY_INITIAL_VALUE
  447. # define YY_INITIAL_VALUE(Value) /* Nothing. */
  448. #endif
  449. #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
  450. # define YY_IGNORE_USELESS_CAST_BEGIN \
  451. _Pragma ("GCC diagnostic push") \
  452. _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
  453. # define YY_IGNORE_USELESS_CAST_END \
  454. _Pragma ("GCC diagnostic pop")
  455. #endif
  456. #ifndef YY_IGNORE_USELESS_CAST_BEGIN
  457. # define YY_IGNORE_USELESS_CAST_BEGIN
  458. # define YY_IGNORE_USELESS_CAST_END
  459. #endif
  460. #define YY_ASSERT(E) ((void) (0 && (E)))
  461. #if ! defined yyoverflow || YYERROR_VERBOSE
  462. /* The parser invokes alloca or malloc; define the necessary symbols. */
  463. # ifdef YYSTACK_USE_ALLOCA
  464. # if YYSTACK_USE_ALLOCA
  465. # ifdef __GNUC__
  466. # define YYSTACK_ALLOC __builtin_alloca
  467. # elif defined __BUILTIN_VA_ARG_INCR
  468. # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  469. # elif defined _AIX
  470. # define YYSTACK_ALLOC __alloca
  471. # elif defined _MSC_VER
  472. # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  473. # define alloca _alloca
  474. # else
  475. # define YYSTACK_ALLOC alloca
  476. # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
  477. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  478. /* Use EXIT_SUCCESS as a witness for stdlib.h. */
  479. # ifndef EXIT_SUCCESS
  480. # define EXIT_SUCCESS 0
  481. # endif
  482. # endif
  483. # endif
  484. # endif
  485. # endif
  486. # ifdef YYSTACK_ALLOC
  487. /* Pacify GCC's 'empty if-body' warning. */
  488. # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
  489. # ifndef YYSTACK_ALLOC_MAXIMUM
  490. /* The OS might guarantee only one guard page at the bottom of the stack,
  491. and a page size can be as small as 4096 bytes. So we cannot safely
  492. invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
  493. to allow for a few compiler-allocated temporary stack slots. */
  494. # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  495. # endif
  496. # else
  497. # define YYSTACK_ALLOC YYMALLOC
  498. # define YYSTACK_FREE YYFREE
  499. # ifndef YYSTACK_ALLOC_MAXIMUM
  500. # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  501. # endif
  502. # if (defined __cplusplus && ! defined EXIT_SUCCESS \
  503. && ! ((defined YYMALLOC || defined malloc) \
  504. && (defined YYFREE || defined free)))
  505. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  506. # ifndef EXIT_SUCCESS
  507. # define EXIT_SUCCESS 0
  508. # endif
  509. # endif
  510. # ifndef YYMALLOC
  511. # define YYMALLOC malloc
  512. # if ! defined malloc && ! defined EXIT_SUCCESS
  513. void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  514. # endif
  515. # endif
  516. # ifndef YYFREE
  517. # define YYFREE free
  518. # if ! defined free && ! defined EXIT_SUCCESS
  519. void free (void *); /* INFRINGES ON USER NAME SPACE */
  520. # endif
  521. # endif
  522. # endif
  523. #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  524. #if (! defined yyoverflow \
  525. && (! defined __cplusplus \
  526. || (defined EX_STYPE_IS_TRIVIAL && EX_STYPE_IS_TRIVIAL)))
  527. /* A type that is properly aligned for any stack member. */
  528. union yyalloc
  529. {
  530. yy_state_t yyss_alloc;
  531. YYSTYPE yyvs_alloc;
  532. };
  533. /* The size of the maximum gap between one aligned stack and the next. */
  534. # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
  535. /* The size of an array large to enough to hold all stacks, each with
  536. N elements. */
  537. # define YYSTACK_BYTES(N) \
  538. ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
  539. + YYSTACK_GAP_MAXIMUM)
  540. # define YYCOPY_NEEDED 1
  541. /* Relocate STACK from its old location to the new one. The
  542. local variables YYSIZE and YYSTACKSIZE give the old and new number of
  543. elements in the stack, and YYPTR gives the new location of the
  544. stack. Advance YYPTR to a properly aligned location for the next
  545. stack. */
  546. # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
  547. do \
  548. { \
  549. YYPTRDIFF_T yynewbytes; \
  550. YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
  551. Stack = &yyptr->Stack_alloc; \
  552. yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
  553. yyptr += yynewbytes / YYSIZEOF (*yyptr); \
  554. } \
  555. while (0)
  556. #endif
  557. #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
  558. /* Copy COUNT objects from SRC to DST. The source and destination do
  559. not overlap. */
  560. # ifndef YYCOPY
  561. # if defined __GNUC__ && 1 < __GNUC__
  562. # define YYCOPY(Dst, Src, Count) \
  563. __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
  564. # else
  565. # define YYCOPY(Dst, Src, Count) \
  566. do \
  567. { \
  568. YYPTRDIFF_T yyi; \
  569. for (yyi = 0; yyi < (Count); yyi++) \
  570. (Dst)[yyi] = (Src)[yyi]; \
  571. } \
  572. while (0)
  573. # endif
  574. # endif
  575. #endif /* !YYCOPY_NEEDED */
  576. /* YYFINAL -- State number of the termination state. */
  577. #define YYFINAL 3
  578. /* YYLAST -- Last index in YYTABLE. */
  579. #define YYLAST 1118
  580. /* YYNTOKENS -- Number of terminals. */
  581. #define YYNTOKENS 106
  582. /* YYNNTS -- Number of nonterminals. */
  583. #define YYNNTS 42
  584. /* YYNRULES -- Number of rules. */
  585. #define YYNRULES 139
  586. /* YYNSTATES -- Number of states. */
  587. #define YYNSTATES 283
  588. #define YYUNDEFTOK 2
  589. #define YYMAXUTOK 335
  590. /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
  591. as returned by yylex, with out-of-bounds checking. */
  592. #define YYTRANSLATE(YYX) \
  593. (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  594. /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
  595. as returned by yylex. */
  596. static const yytype_int8 yytranslate[] =
  597. {
  598. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  599. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  600. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  601. 2, 2, 2, 90, 2, 92, 2, 89, 75, 2,
  602. 97, 102, 87, 84, 67, 85, 105, 88, 2, 2,
  603. 2, 2, 2, 2, 2, 2, 2, 2, 70, 101,
  604. 78, 68, 79, 69, 2, 2, 2, 2, 2, 2,
  605. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  606. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  607. 2, 103, 2, 104, 74, 2, 2, 2, 2, 2,
  608. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  609. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  610. 2, 2, 2, 99, 73, 100, 91, 2, 2, 2,
  611. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  612. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  613. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  614. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  615. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  616. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  617. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  618. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  619. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  620. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  621. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  622. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  623. 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
  624. 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
  625. 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
  626. 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
  627. 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
  628. 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
  629. 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
  630. 65, 66, 71, 72, 76, 77, 80, 81, 82, 83,
  631. 86, 93, 94, 95, 96, 98
  632. };
  633. #if EX_DEBUG
  634. /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
  635. static const yytype_int16 yyrline[] =
  636. {
  637. 0, 179, 179, 199, 200, 203, 203, 240, 243, 258,
  638. 262, 266, 266, 271, 281, 294, 309, 322, 330, 341,
  639. 351, 351, 362, 374, 378, 391, 420, 423, 454, 455,
  640. 458, 477, 483, 484, 491, 491, 539, 540, 541, 542,
  641. 545, 546, 550, 553, 560, 563, 566, 570, 574, 627,
  642. 631, 635, 639, 643, 647, 651, 655, 659, 663, 667,
  643. 671, 675, 679, 683, 687, 700, 704, 714, 714, 714,
  644. 755, 775, 782, 786, 790, 794, 798, 802, 806, 810,
  645. 814, 818, 822, 826, 832, 836, 840, 846, 851, 855,
  646. 880, 916, 936, 944, 952, 963, 967, 971, 974, 975,
  647. 977, 985, 990, 995, 1000, 1007, 1008, 1009, 1012, 1013,
  648. 1016, 1020, 1038, 1051, 1054, 1058, 1072, 1075, 1082, 1085,
  649. 1093, 1098, 1105, 1108, 1114, 1117, 1121, 1132, 1132, 1148,
  650. 1151, 1163, 1183, 1187, 1193, 1196, 1203, 1204, 1216, 1204
  651. };
  652. #endif
  653. #if EX_DEBUG || YYERROR_VERBOSE || 1
  654. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  655. First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  656. static const char *const yytname[] =
  657. {
  658. "$end", "error", "$undefined", "MINTOKEN", "INTEGER", "UNSIGNED",
  659. "CHARACTER", "FLOATING", "STRING", "VOIDTYPE", "ADDRESS", "ARRAY",
  660. "BREAK", "CALL", "CASE", "CONSTANT", "CONTINUE", "DECLARE", "DEFAULT",
  661. "DYNAMIC", "ELSE", "EXIT", "FOR", "FUNCTION", "GSUB", "ITERATE",
  662. "ITERATOR", "ID", "IF", "LABEL", "MEMBER", "NAME", "POS", "PRAGMA",
  663. "PRE", "PRINT", "PRINTF", "PROCEDURE", "QUERY", "RAND", "RETURN",
  664. "SCANF", "SPLIT", "SPRINTF", "SRAND", "SSCANF", "SUB", "SUBSTR",
  665. "SWITCH", "TOKENS", "UNSET", "WHILE", "F2I", "F2S", "I2F", "I2S", "S2B",
  666. "S2F", "S2I", "F2X", "I2X", "S2X", "X2F", "X2I", "X2S", "X2X", "XPRINT",
  667. "','", "'='", "'?'", "':'", "OR", "AND", "'|'", "'^'", "'&'", "EQ", "NE",
  668. "'<'", "'>'", "LE", "GE", "LSH", "RSH", "'+'", "'-'", "IN_OP", "'*'",
  669. "'/'", "'%'", "'!'", "'~'", "'#'", "UNARY", "INC", "DEC", "CAST", "'('",
  670. "MAXTOKEN", "'{'", "'}'", "';'", "')'", "'['", "']'", "'.'", "$accept",
  671. "program", "action_list", "action", "$@1", "statement_list", "statement",
  672. "$@2", "$@3", "switch_list", "switch_item", "case_list", "case_item",
  673. "dcl_list", "dcl_item", "$@4", "dcl_name", "name", "else_opt",
  674. "expr_opt", "expr", "$@5", "$@6", "splitop", "constant", "print", "scan",
  675. "variable", "array", "index", "args", "arg_list", "formals",
  676. "formal_list", "formal_item", "$@7", "members", "member", "assign",
  677. "initialize", "$@8", "$@9", YY_NULLPTR
  678. };
  679. #endif
  680. # ifdef YYPRINT
  681. /* YYTOKNUM[NUM] -- (External) token number corresponding to the
  682. (internal) symbol number NUM (which must be that of a token). */
  683. static const yytype_int16 yytoknum[] =
  684. {
  685. 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  686. 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
  687. 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
  688. 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
  689. 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
  690. 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
  691. 315, 316, 317, 318, 319, 320, 321, 44, 61, 63,
  692. 58, 322, 323, 124, 94, 38, 324, 325, 60, 62,
  693. 326, 327, 328, 329, 43, 45, 330, 42, 47, 37,
  694. 33, 126, 35, 331, 332, 333, 334, 40, 335, 123,
  695. 125, 59, 41, 91, 93, 46
  696. };
  697. # endif
  698. #define YYPACT_NINF (-180)
  699. #define yypact_value_is_default(Yyn) \
  700. ((Yyn) == YYPACT_NINF)
  701. #define YYTABLE_NINF (-124)
  702. #define yytable_value_is_error(Yyn) \
  703. ((Yyn) == YYTABLE_NINF)
  704. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  705. STATE-NUM. */
  706. static const yytype_int16 yypact[] =
  707. {
  708. -180, 29, 229, -180, -180, -180, -180, -180, -63, 711,
  709. -180, 711, -180, -41, -7, -4, 4, 5, 6, 1,
  710. 10, -180, 11, -180, 14, -180, 17, 711, -180, -180,
  711. -180, 20, -180, 23, 24, 25, -180, 27, 30, 28,
  712. 711, 711, 711, 711, 106, 28, 28, 617, -180, 102,
  713. -180, 33, 891, 38, -180, 40, 41, 18, 711, 42,
  714. 44, 68, 711, 1, 711, 711, 711, 711, 28, 8,
  715. -180, -180, 711, 711, 711, 37, 46, 125, 711, 711,
  716. 711, 122, 711, -180, -180, -180, -180, -180, -180, -180,
  717. -180, 52, 312, 327, 72, -180, -180, 711, -180, 711,
  718. 711, 711, 711, 711, 711, 711, 711, 711, 711, 711,
  719. 711, 711, 711, 711, 136, 711, 711, 711, 711, 711,
  720. 711, 711, -180, -180, -180, 935, 53, 91, -180, -180,
  721. -180, -180, -180, -180, -49, -180, -180, 214, -180, 409,
  722. 58, -44, 73, 74, 75, 81, -180, 506, 76, 99,
  723. -180, -180, -180, 598, 100, 101, 891, -57, 692, 711,
  724. -180, -180, -180, 935, 711, 953, 970, 986, 1001, 1015,
  725. 1029, 1029, 110, 110, 110, 110, 96, 96, -73, -73,
  726. -180, -180, -180, -180, 914, 103, 104, 935, -180, 711,
  727. 68, -180, 108, -180, -180, 711, 521, -180, -180, 521,
  728. 61, -180, 521, -180, -180, -180, -180, -180, 116, 711,
  729. -180, 521, -180, -180, 868, 805, -180, -180, 935, -180,
  730. -15, -43, 112, -180, -180, -180, 184, 113, 786, -180,
  731. 229, -180, -54, 117, -180, -180, -180, -180, 711, 521,
  732. -180, -180, -180, 711, 711, -180, -180, 206, 123, -180,
  733. -6, 935, 834, 124, -180, 157, -180, 521, 111, 158,
  734. -180, -180, 82, -180, -180, -10, 127, 218, -180, 161,
  735. -180, 229, -180, -180, -180, -180, 139, -180, -180, -180,
  736. -180, 424, -180
  737. };
  738. /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
  739. Performed when YYTABLE does not specify something else to do. Zero
  740. means the default is an error. */
  741. static const yytype_uint8 yydefact[] =
  742. {
  743. 7, 0, 3, 1, 102, 104, 101, 103, 0, 44,
  744. 100, 44, 11, 116, 0, 0, 0, 0, 0, 129,
  745. 0, 112, 0, 105, 0, 106, 0, 44, 108, 98,
  746. 107, 0, 109, 0, 0, 0, 99, 0, 0, 0,
  747. 0, 0, 0, 0, 0, 0, 0, 0, 7, 2,
  748. 8, 0, 45, 0, 97, 0, 0, 134, 118, 0,
  749. 0, 0, 0, 129, 0, 44, 118, 118, 0, 0,
  750. 110, 130, 0, 118, 118, 0, 0, 0, 118, 118,
  751. 0, 0, 0, 75, 74, 73, 70, 72, 71, 92,
  752. 95, 0, 0, 44, 0, 4, 10, 0, 67, 0,
  753. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  754. 0, 0, 0, 0, 0, 0, 0, 0, 0, 118,
  755. 118, 0, 93, 96, 91, 120, 0, 119, 22, 23,
  756. 37, 39, 38, 36, 0, 32, 34, 0, 111, 0,
  757. 0, 134, 0, 0, 0, 132, 133, 0, 0, 0,
  758. 84, 24, 85, 0, 0, 0, 20, 0, 0, 0,
  759. 46, 9, 5, 66, 0, 65, 64, 61, 62, 60,
  760. 58, 59, 48, 55, 56, 57, 53, 54, 63, 49,
  761. 94, 50, 51, 52, 0, 0, 0, 135, 76, 0,
  762. 0, 12, 113, 117, 83, 44, 44, 77, 78, 44,
  763. 0, 131, 44, 88, 87, 86, 79, 80, 0, 0,
  764. 17, 44, 47, 7, 0, 0, 89, 90, 121, 33,
  765. 0, 134, 0, 14, 16, 132, 42, 0, 0, 19,
  766. 6, 68, 116, 0, 114, 137, 136, 35, 44, 44,
  767. 13, 25, 18, 0, 0, 81, 115, 122, 0, 43,
  768. 0, 69, 0, 127, 138, 124, 125, 44, 0, 0,
  769. 21, 26, 7, 28, 82, 0, 0, 0, 15, 0,
  770. 31, 27, 29, 41, 40, 128, 0, 127, 126, 30,
  771. 7, 44, 139
  772. };
  773. /* YYPGOTO[NTERM-NUM]. */
  774. static const yytype_int16 yypgoto[] =
  775. {
  776. -180, -180, -180, -180, -180, -48, -179, -180, -180, -180,
  777. -180, -180, -23, -180, 57, -180, -180, -180, -180, -8,
  778. -36, -180, -180, -180, -16, -180, -180, -12, -180, -180,
  779. 31, -180, -180, -180, -24, -180, 186, 109, 63, -180,
  780. -180, -180
  781. };
  782. /* YYDEFGOTO[NTERM-NUM]. */
  783. static const yytype_int16 yydefgoto[] =
  784. {
  785. -1, 1, 49, 95, 213, 2, 50, 61, 208, 250,
  786. 261, 262, 263, 134, 135, 192, 136, 275, 240, 51,
  787. 52, 164, 243, 53, 54, 55, 56, 57, 221, 63,
  788. 126, 127, 254, 255, 256, 265, 70, 71, 124, 237,
  789. 247, 266
  790. };
  791. /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
  792. positive, shift that token. If negative, reduce the rule whose
  793. number is the opposite. If YYTABLE_NINF, syntax error. */
  794. static const yytype_int16 yytable[] =
  795. {
  796. 93, 59, 233, 60, 84, 85, 86, 87, 258, 273,
  797. 209, 92, 259, 244, 115, 116, 117, 223, 190, 76,
  798. 224, 274, 125, 226, 121, 121, 137, 83, 139, 3,
  799. 125, 125, 229, 89, 90, 145, 147, 125, 125, 146,
  800. 58, 153, 125, 125, 156, 210, 158, 13, 245, 62,
  801. 122, 123, 191, 141, 235, 19, 144, 140, 196, 21,
  802. 249, 163, 62, 165, 166, 167, 168, 169, 170, 171,
  803. 172, 173, 174, 175, 176, 177, 178, 179, 268, 181,
  804. 182, 183, 184, 125, 125, 187, 121, 130, 225, 234,
  805. 64, 131, 146, 65, 260, 132, 258, 142, 143, 133,
  806. 259, 66, 67, 68, 148, 149, 69, 72, 73, 154,
  807. 155, 74, 122, 123, 75, 4, 5, 77, 6, 7,
  808. 78, 79, 80, 212, 81, 88, 10, 82, 214, 4,
  809. 5, 94, 6, 7, 96, 118, 8, 119, 120, 150,
  810. 10, 157, 162, 128, 13, 129, 14, 151, 16, 17,
  811. 185, 186, 19, 218, 159, 180, 21, 188, 189, 195,
  812. 22, 23, 24, 25, 26, 230, 28, 29, 30, 31,
  813. 32, 33, 34, 228, 36, 197, 198, 199, 203, 163,
  814. 112, 113, 114, 115, 116, 117, 200, 222, -124, -124,
  815. -124, -124, 110, 111, 112, 113, 114, 115, 116, 117,
  816. 39, 204, 206, 207, 239, 216, 217, 251, 252, 40,
  817. 41, 220, 241, 238, 271, 42, 43, 44, 227, 45,
  818. 46, 246, 47, 253, 267, 257, -123, 152, 270, 276,
  819. 248, 279, 281, 4, 5, 277, 6, 7, 280, 272,
  820. 8, 9, 269, 278, 10, 11, 12, 219, 13, 138,
  821. 14, 15, 16, 17, 201, 18, 19, 20, 0, 0,
  822. 21, 0, 0, 0, 22, 23, 24, 25, 26, 27,
  823. 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
  824. 38, 97, 0, 98, 236, 99, 100, 101, 102, 103,
  825. 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
  826. 114, 115, 116, 117, 39, 0, 0, 0, 0, 0,
  827. 0, 0, 0, 40, 41, 0, 0, 0, 193, 42,
  828. 43, 44, 0, 45, 46, 0, 47, 0, 48, 0,
  829. -44, 4, 5, 0, 6, 7, 0, 0, 8, 9,
  830. 0, 0, 10, 11, 12, 0, 13, 0, 14, 15,
  831. 16, 17, 0, 18, 19, 20, 0, 0, 21, 0,
  832. 0, 0, 22, 23, 24, 25, 26, 27, 28, 29,
  833. 30, 31, 32, 33, 34, 35, 36, 37, 38, 97,
  834. 0, 98, 0, 99, 100, 101, 102, 103, 104, 105,
  835. 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
  836. 116, 117, 39, 0, 0, 0, 0, 0, 0, 0,
  837. 0, 40, 41, 0, 160, 0, 0, 42, 43, 44,
  838. 0, 45, 46, 0, 47, 0, 48, 161, 4, 5,
  839. 0, 6, 7, 0, 0, 8, 9, 0, 0, 10,
  840. 11, 12, 0, 13, 0, 14, 15, 16, 17, 0,
  841. 18, 19, 20, 0, 0, 21, 0, 0, 0, 22,
  842. 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
  843. 33, 34, 35, 36, 37, 38, 97, 0, 98, 0,
  844. 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
  845. 109, 110, 111, 112, 113, 114, 115, 116, 117, 39,
  846. 0, 0, 0, 0, 0, 0, 0, 0, 40, 41,
  847. 0, 194, 0, 0, 42, 43, 44, 0, 45, 46,
  848. 0, 47, 0, 48, 282, 4, 5, 0, 6, 7,
  849. 0, 0, 8, 9, 0, 0, 10, 11, 12, 0,
  850. 13, 0, 14, 15, 16, 17, 0, 18, 19, 20,
  851. 0, 0, 21, 0, 0, 0, 22, 23, 24, 25,
  852. 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
  853. 36, 37, 38, 97, 0, 98, 0, 99, 100, 101,
  854. 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  855. 112, 113, 114, 115, 116, 117, 39, 0, 0, 0,
  856. 0, 0, 0, 0, 0, 40, 41, 0, 202, 0,
  857. 0, 42, 43, 44, 0, 45, 46, 0, 47, 0,
  858. 48, 4, 5, 0, 6, 7, 0, 0, 8, 0,
  859. 0, 0, 10, 0, 91, 0, 13, 0, 14, 0,
  860. 16, 17, 0, 0, 19, 0, 0, 0, 21, 0,
  861. 0, 0, 22, 23, 24, 25, 26, 0, 28, 29,
  862. 30, 31, 32, 33, 34, 97, 36, 98, 0, 99,
  863. 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
  864. 110, 111, 112, 113, 114, 115, 116, 117, 0, 0,
  865. 0, 0, 39, 0, 0, 0, 0, 0, 0, 0,
  866. 205, 40, 41, 0, 0, 0, 0, 42, 43, 44,
  867. 0, 45, 46, 0, 47, 4, 5, 0, 6, 7,
  868. 0, 0, 8, 0, 0, 0, 10, 0, 0, 0,
  869. 13, 0, 14, 0, 16, 17, 0, 0, 19, 0,
  870. 0, 0, 21, 0, 0, 0, 22, 23, 24, 25,
  871. 26, 0, 28, 29, 30, 31, 32, 33, 34, 97,
  872. 36, 98, 0, 99, 100, 101, 102, 103, 104, 105,
  873. 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
  874. 116, 117, 0, 0, 0, 0, 39, 0, 0, 0,
  875. 0, 0, 0, 0, 211, 40, 41, 0, 0, 0,
  876. 0, 42, 43, 44, 0, 45, 46, 0, 47, 4,
  877. 5, 0, 6, 7, 0, 0, 8, 0, 0, 0,
  878. 10, 0, 0, 0, 232, 0, 14, 0, 16, 17,
  879. 0, 0, 19, 0, 0, 0, 21, 0, 0, 0,
  880. 22, 23, 24, 25, 26, 0, 28, 29, 30, 31,
  881. 32, 33, 34, 97, 36, 98, 0, 99, 100, 101,
  882. 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  883. 112, 113, 114, 115, 116, 117, 0, 0, 0, 0,
  884. 39, 0, 0, 0, 0, 0, 0, 0, 242, 40,
  885. 41, 0, 0, 0, 0, 42, 43, 44, 0, 45,
  886. 46, 97, 47, 98, 0, 99, 100, 101, 102, 103,
  887. 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
  888. 114, 115, 116, 117, 0, 0, 0, 0, 0, 0,
  889. 0, 0, 0, 0, 0, 97, 264, 98, 231, 99,
  890. 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
  891. 110, 111, 112, 113, 114, 115, 116, 117, 97, 0,
  892. 98, 0, 99, 100, 101, 102, 103, 104, 105, 106,
  893. 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
  894. 117, 215, 0, 98, 0, 99, 100, 101, 102, 103,
  895. 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
  896. 114, 115, 116, 117, 98, 0, 99, 100, 101, 102,
  897. 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
  898. 113, 114, 115, 116, 117, 100, 101, 102, 103, 104,
  899. 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
  900. 115, 116, 117, 101, 102, 103, 104, 105, 106, 107,
  901. 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
  902. 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  903. 112, 113, 114, 115, 116, 117, 103, 104, 105, 106,
  904. 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
  905. 117, 104, 105, 106, 107, 108, 109, 110, 111, 112,
  906. 113, 114, 115, 116, 117, -124, -124, 106, 107, 108,
  907. 109, 110, 111, 112, 113, 114, 115, 116, 117
  908. };
  909. static const yytype_int16 yycheck[] =
  910. {
  911. 48, 9, 17, 11, 40, 41, 42, 43, 14, 19,
  912. 67, 47, 18, 67, 87, 88, 89, 196, 67, 27,
  913. 199, 31, 58, 202, 68, 68, 62, 39, 64, 0,
  914. 66, 67, 211, 45, 46, 27, 72, 73, 74, 31,
  915. 103, 77, 78, 79, 80, 102, 82, 19, 102, 103,
  916. 94, 95, 101, 65, 97, 27, 68, 65, 102, 31,
  917. 239, 97, 103, 99, 100, 101, 102, 103, 104, 105,
  918. 106, 107, 108, 109, 110, 111, 112, 113, 257, 115,
  919. 116, 117, 118, 119, 120, 121, 68, 19, 27, 104,
  920. 97, 23, 31, 97, 100, 27, 14, 66, 67, 31,
  921. 18, 97, 97, 97, 73, 74, 105, 97, 97, 78,
  922. 79, 97, 94, 95, 97, 4, 5, 97, 7, 8,
  923. 97, 97, 97, 159, 97, 19, 15, 97, 164, 4,
  924. 5, 29, 7, 8, 101, 97, 11, 97, 97, 102,
  925. 15, 19, 70, 101, 19, 101, 21, 101, 23, 24,
  926. 119, 120, 27, 189, 102, 19, 31, 104, 67, 101,
  927. 35, 36, 37, 38, 39, 213, 41, 42, 43, 44,
  928. 45, 46, 47, 209, 49, 102, 102, 102, 102, 215,
  929. 84, 85, 86, 87, 88, 89, 105, 195, 78, 79,
  930. 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
  931. 75, 102, 102, 102, 20, 102, 102, 243, 244, 84,
  932. 85, 103, 99, 101, 262, 90, 91, 92, 102, 94,
  933. 95, 104, 97, 17, 67, 102, 102, 102, 70, 102,
  934. 238, 70, 280, 4, 5, 17, 7, 8, 99, 262,
  935. 11, 12, 258, 267, 15, 16, 17, 190, 19, 63,
  936. 21, 22, 23, 24, 145, 26, 27, 28, -1, -1,
  937. 31, -1, -1, -1, 35, 36, 37, 38, 39, 40,
  938. 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
  939. 51, 67, -1, 69, 221, 71, 72, 73, 74, 75,
  940. 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
  941. 86, 87, 88, 89, 75, -1, -1, -1, -1, -1,
  942. -1, -1, -1, 84, 85, -1, -1, -1, 104, 90,
  943. 91, 92, -1, 94, 95, -1, 97, -1, 99, -1,
  944. 101, 4, 5, -1, 7, 8, -1, -1, 11, 12,
  945. -1, -1, 15, 16, 17, -1, 19, -1, 21, 22,
  946. 23, 24, -1, 26, 27, 28, -1, -1, 31, -1,
  947. -1, -1, 35, 36, 37, 38, 39, 40, 41, 42,
  948. 43, 44, 45, 46, 47, 48, 49, 50, 51, 67,
  949. -1, 69, -1, 71, 72, 73, 74, 75, 76, 77,
  950. 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
  951. 88, 89, 75, -1, -1, -1, -1, -1, -1, -1,
  952. -1, 84, 85, -1, 102, -1, -1, 90, 91, 92,
  953. -1, 94, 95, -1, 97, -1, 99, 100, 4, 5,
  954. -1, 7, 8, -1, -1, 11, 12, -1, -1, 15,
  955. 16, 17, -1, 19, -1, 21, 22, 23, 24, -1,
  956. 26, 27, 28, -1, -1, 31, -1, -1, -1, 35,
  957. 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
  958. 46, 47, 48, 49, 50, 51, 67, -1, 69, -1,
  959. 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
  960. 81, 82, 83, 84, 85, 86, 87, 88, 89, 75,
  961. -1, -1, -1, -1, -1, -1, -1, -1, 84, 85,
  962. -1, 102, -1, -1, 90, 91, 92, -1, 94, 95,
  963. -1, 97, -1, 99, 100, 4, 5, -1, 7, 8,
  964. -1, -1, 11, 12, -1, -1, 15, 16, 17, -1,
  965. 19, -1, 21, 22, 23, 24, -1, 26, 27, 28,
  966. -1, -1, 31, -1, -1, -1, 35, 36, 37, 38,
  967. 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
  968. 49, 50, 51, 67, -1, 69, -1, 71, 72, 73,
  969. 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
  970. 84, 85, 86, 87, 88, 89, 75, -1, -1, -1,
  971. -1, -1, -1, -1, -1, 84, 85, -1, 102, -1,
  972. -1, 90, 91, 92, -1, 94, 95, -1, 97, -1,
  973. 99, 4, 5, -1, 7, 8, -1, -1, 11, -1,
  974. -1, -1, 15, -1, 17, -1, 19, -1, 21, -1,
  975. 23, 24, -1, -1, 27, -1, -1, -1, 31, -1,
  976. -1, -1, 35, 36, 37, 38, 39, -1, 41, 42,
  977. 43, 44, 45, 46, 47, 67, 49, 69, -1, 71,
  978. 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
  979. 82, 83, 84, 85, 86, 87, 88, 89, -1, -1,
  980. -1, -1, 75, -1, -1, -1, -1, -1, -1, -1,
  981. 102, 84, 85, -1, -1, -1, -1, 90, 91, 92,
  982. -1, 94, 95, -1, 97, 4, 5, -1, 7, 8,
  983. -1, -1, 11, -1, -1, -1, 15, -1, -1, -1,
  984. 19, -1, 21, -1, 23, 24, -1, -1, 27, -1,
  985. -1, -1, 31, -1, -1, -1, 35, 36, 37, 38,
  986. 39, -1, 41, 42, 43, 44, 45, 46, 47, 67,
  987. 49, 69, -1, 71, 72, 73, 74, 75, 76, 77,
  988. 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
  989. 88, 89, -1, -1, -1, -1, 75, -1, -1, -1,
  990. -1, -1, -1, -1, 102, 84, 85, -1, -1, -1,
  991. -1, 90, 91, 92, -1, 94, 95, -1, 97, 4,
  992. 5, -1, 7, 8, -1, -1, 11, -1, -1, -1,
  993. 15, -1, -1, -1, 19, -1, 21, -1, 23, 24,
  994. -1, -1, 27, -1, -1, -1, 31, -1, -1, -1,
  995. 35, 36, 37, 38, 39, -1, 41, 42, 43, 44,
  996. 45, 46, 47, 67, 49, 69, -1, 71, 72, 73,
  997. 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
  998. 84, 85, 86, 87, 88, 89, -1, -1, -1, -1,
  999. 75, -1, -1, -1, -1, -1, -1, -1, 102, 84,
  1000. 85, -1, -1, -1, -1, 90, 91, 92, -1, 94,
  1001. 95, 67, 97, 69, -1, 71, 72, 73, 74, 75,
  1002. 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
  1003. 86, 87, 88, 89, -1, -1, -1, -1, -1, -1,
  1004. -1, -1, -1, -1, -1, 67, 102, 69, 70, 71,
  1005. 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
  1006. 82, 83, 84, 85, 86, 87, 88, 89, 67, -1,
  1007. 69, -1, 71, 72, 73, 74, 75, 76, 77, 78,
  1008. 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
  1009. 89, 67, -1, 69, -1, 71, 72, 73, 74, 75,
  1010. 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
  1011. 86, 87, 88, 89, 69, -1, 71, 72, 73, 74,
  1012. 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
  1013. 85, 86, 87, 88, 89, 72, 73, 74, 75, 76,
  1014. 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
  1015. 87, 88, 89, 73, 74, 75, 76, 77, 78, 79,
  1016. 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
  1017. 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
  1018. 84, 85, 86, 87, 88, 89, 75, 76, 77, 78,
  1019. 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
  1020. 89, 76, 77, 78, 79, 80, 81, 82, 83, 84,
  1021. 85, 86, 87, 88, 89, 76, 77, 78, 79, 80,
  1022. 81, 82, 83, 84, 85, 86, 87, 88, 89
  1023. };
  1024. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  1025. symbol of state STATE-NUM. */
  1026. static const yytype_uint8 yystos[] =
  1027. {
  1028. 0, 107, 111, 0, 4, 5, 7, 8, 11, 12,
  1029. 15, 16, 17, 19, 21, 22, 23, 24, 26, 27,
  1030. 28, 31, 35, 36, 37, 38, 39, 40, 41, 42,
  1031. 43, 44, 45, 46, 47, 48, 49, 50, 51, 75,
  1032. 84, 85, 90, 91, 92, 94, 95, 97, 99, 108,
  1033. 112, 125, 126, 129, 130, 131, 132, 133, 103, 125,
  1034. 125, 113, 103, 135, 97, 97, 97, 97, 97, 105,
  1035. 142, 143, 97, 97, 97, 97, 125, 97, 97, 97,
  1036. 97, 97, 97, 133, 126, 126, 126, 126, 19, 133,
  1037. 133, 17, 126, 111, 29, 109, 101, 67, 69, 71,
  1038. 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
  1039. 82, 83, 84, 85, 86, 87, 88, 89, 97, 97,
  1040. 97, 68, 94, 95, 144, 126, 136, 137, 101, 101,
  1041. 19, 23, 27, 31, 119, 120, 122, 126, 142, 126,
  1042. 125, 133, 136, 136, 133, 27, 31, 126, 136, 136,
  1043. 102, 101, 102, 126, 136, 136, 126, 19, 126, 102,
  1044. 102, 100, 70, 126, 127, 126, 126, 126, 126, 126,
  1045. 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
  1046. 19, 126, 126, 126, 126, 136, 136, 126, 104, 67,
  1047. 67, 101, 121, 104, 102, 101, 102, 102, 102, 102,
  1048. 105, 143, 102, 102, 102, 102, 102, 102, 114, 67,
  1049. 102, 102, 126, 110, 126, 67, 102, 102, 126, 120,
  1050. 103, 134, 125, 112, 112, 27, 112, 102, 126, 112,
  1051. 111, 70, 19, 17, 104, 97, 144, 145, 101, 20,
  1052. 124, 99, 102, 128, 67, 102, 104, 146, 125, 112,
  1053. 115, 126, 126, 17, 138, 139, 140, 102, 14, 18,
  1054. 100, 116, 117, 118, 102, 141, 147, 67, 112, 130,
  1055. 70, 111, 118, 19, 31, 123, 102, 17, 140, 70,
  1056. 99, 111, 100
  1057. };
  1058. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  1059. static const yytype_uint8 yyr1[] =
  1060. {
  1061. 0, 106, 107, 108, 108, 110, 109, 111, 111, 112,
  1062. 112, 113, 112, 112, 112, 112, 112, 112, 112, 112,
  1063. 114, 112, 112, 112, 112, 115, 115, 116, 117, 117,
  1064. 118, 118, 119, 119, 121, 120, 122, 122, 122, 122,
  1065. 123, 123, 124, 124, 125, 125, 126, 126, 126, 126,
  1066. 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
  1067. 126, 126, 126, 126, 126, 126, 126, 127, 128, 126,
  1068. 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
  1069. 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
  1070. 126, 126, 126, 126, 126, 126, 126, 126, 129, 129,
  1071. 130, 130, 130, 130, 130, 131, 131, 131, 132, 132,
  1072. 133, 133, 133, 134, 134, 134, 135, 135, 136, 136,
  1073. 137, 137, 138, 138, 138, 139, 139, 141, 140, 142,
  1074. 142, 142, 143, 143, 144, 144, 145, 146, 147, 145
  1075. };
  1076. /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
  1077. static const yytype_int8 yyr2[] =
  1078. {
  1079. 0, 2, 2, 0, 2, 0, 4, 0, 2, 3,
  1080. 2, 0, 4, 6, 5, 9, 5, 4, 6, 5,
  1081. 0, 8, 3, 3, 3, 0, 2, 2, 1, 2,
  1082. 3, 2, 1, 3, 0, 4, 1, 1, 1, 1,
  1083. 1, 1, 0, 2, 0, 1, 3, 4, 3, 3,
  1084. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  1085. 3, 3, 3, 3, 3, 3, 3, 0, 0, 7,
  1086. 2, 2, 2, 2, 2, 2, 4, 4, 4, 4,
  1087. 4, 6, 8, 4, 3, 3, 4, 4, 4, 4,
  1088. 4, 2, 2, 2, 3, 2, 2, 1, 1, 1,
  1089. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1090. 2, 3, 1, 0, 2, 3, 0, 3, 0, 1,
  1091. 1, 3, 0, 1, 1, 1, 3, 0, 3, 0,
  1092. 1, 3, 2, 2, 0, 2, 1, 0, 0, 8
  1093. };
  1094. #define yyerrok (yyerrstatus = 0)
  1095. #define yyclearin (yychar = YYEMPTY)
  1096. #define YYEMPTY (-2)
  1097. #define YYEOF 0
  1098. #define YYACCEPT goto yyacceptlab
  1099. #define YYABORT goto yyabortlab
  1100. #define YYERROR goto yyerrorlab
  1101. #define YYRECOVERING() (!!yyerrstatus)
  1102. #define YYBACKUP(Token, Value) \
  1103. do \
  1104. if (yychar == YYEMPTY) \
  1105. { \
  1106. yychar = (Token); \
  1107. yylval = (Value); \
  1108. YYPOPSTACK (yylen); \
  1109. yystate = *yyssp; \
  1110. goto yybackup; \
  1111. } \
  1112. else \
  1113. { \
  1114. yyerror (YY_("syntax error: cannot back up")); \
  1115. YYERROR; \
  1116. } \
  1117. while (0)
  1118. /* Error token number */
  1119. #define YYTERROR 1
  1120. #define YYERRCODE 256
  1121. /* Enable debugging if requested. */
  1122. #if EX_DEBUG
  1123. # ifndef YYFPRINTF
  1124. # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  1125. # define YYFPRINTF fprintf
  1126. # endif
  1127. # define YYDPRINTF(Args) \
  1128. do { \
  1129. if (yydebug) \
  1130. YYFPRINTF Args; \
  1131. } while (0)
  1132. /* This macro is provided for backward compatibility. */
  1133. #ifndef YY_LOCATION_PRINT
  1134. # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  1135. #endif
  1136. # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
  1137. do { \
  1138. if (yydebug) \
  1139. { \
  1140. YYFPRINTF (stderr, "%s ", Title); \
  1141. yy_symbol_print (stderr, \
  1142. Type, Value); \
  1143. YYFPRINTF (stderr, "\n"); \
  1144. } \
  1145. } while (0)
  1146. /*-----------------------------------.
  1147. | Print this symbol's value on YYO. |
  1148. `-----------------------------------*/
  1149. static void
  1150. yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
  1151. {
  1152. FILE *yyoutput = yyo;
  1153. YYUSE (yyoutput);
  1154. if (!yyvaluep)
  1155. return;
  1156. # ifdef YYPRINT
  1157. if (yytype < YYNTOKENS)
  1158. YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
  1159. # endif
  1160. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1161. YYUSE (yytype);
  1162. YY_IGNORE_MAYBE_UNINITIALIZED_END
  1163. }
  1164. /*---------------------------.
  1165. | Print this symbol on YYO. |
  1166. `---------------------------*/
  1167. static void
  1168. yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
  1169. {
  1170. YYFPRINTF (yyo, "%s %s (",
  1171. yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
  1172. yy_symbol_value_print (yyo, yytype, yyvaluep);
  1173. YYFPRINTF (yyo, ")");
  1174. }
  1175. /*------------------------------------------------------------------.
  1176. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  1177. | TOP (included). |
  1178. `------------------------------------------------------------------*/
  1179. static void
  1180. yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
  1181. {
  1182. YYFPRINTF (stderr, "Stack now");
  1183. for (; yybottom <= yytop; yybottom++)
  1184. {
  1185. int yybot = *yybottom;
  1186. YYFPRINTF (stderr, " %d", yybot);
  1187. }
  1188. YYFPRINTF (stderr, "\n");
  1189. }
  1190. # define YY_STACK_PRINT(Bottom, Top) \
  1191. do { \
  1192. if (yydebug) \
  1193. yy_stack_print ((Bottom), (Top)); \
  1194. } while (0)
  1195. /*------------------------------------------------.
  1196. | Report that the YYRULE is going to be reduced. |
  1197. `------------------------------------------------*/
  1198. static void
  1199. yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule)
  1200. {
  1201. int yylno = yyrline[yyrule];
  1202. int yynrhs = yyr2[yyrule];
  1203. int yyi;
  1204. YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
  1205. yyrule - 1, yylno);
  1206. /* The symbols being reduced. */
  1207. for (yyi = 0; yyi < yynrhs; yyi++)
  1208. {
  1209. YYFPRINTF (stderr, " $%d = ", yyi + 1);
  1210. yy_symbol_print (stderr,
  1211. yystos[+yyssp[yyi + 1 - yynrhs]],
  1212. &yyvsp[(yyi + 1) - (yynrhs)]
  1213. );
  1214. YYFPRINTF (stderr, "\n");
  1215. }
  1216. }
  1217. # define YY_REDUCE_PRINT(Rule) \
  1218. do { \
  1219. if (yydebug) \
  1220. yy_reduce_print (yyssp, yyvsp, Rule); \
  1221. } while (0)
  1222. /* Nonzero means print parse trace. It is left uninitialized so that
  1223. multiple parsers can coexist. */
  1224. int yydebug;
  1225. #else /* !EX_DEBUG */
  1226. # define YYDPRINTF(Args)
  1227. # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  1228. # define YY_STACK_PRINT(Bottom, Top)
  1229. # define YY_REDUCE_PRINT(Rule)
  1230. #endif /* !EX_DEBUG */
  1231. /* YYINITDEPTH -- initial size of the parser's stacks. */
  1232. #ifndef YYINITDEPTH
  1233. # define YYINITDEPTH 200
  1234. #endif
  1235. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  1236. if the built-in stack extension method is used).
  1237. Do not make this value too large; the results are undefined if
  1238. YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  1239. evaluated with infinite-precision integer arithmetic. */
  1240. #ifndef YYMAXDEPTH
  1241. # define YYMAXDEPTH 10000
  1242. #endif
  1243. #if YYERROR_VERBOSE
  1244. # ifndef yystrlen
  1245. # if defined __GLIBC__ && defined _STRING_H
  1246. # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
  1247. # else
  1248. /* Return the length of YYSTR. */
  1249. static YYPTRDIFF_T
  1250. yystrlen (const char *yystr)
  1251. {
  1252. YYPTRDIFF_T yylen;
  1253. for (yylen = 0; yystr[yylen]; yylen++)
  1254. continue;
  1255. return yylen;
  1256. }
  1257. # endif
  1258. # endif
  1259. # ifndef yystpcpy
  1260. # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  1261. # define yystpcpy stpcpy
  1262. # else
  1263. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  1264. YYDEST. */
  1265. static char *
  1266. yystpcpy (char *yydest, const char *yysrc)
  1267. {
  1268. char *yyd = yydest;
  1269. const char *yys = yysrc;
  1270. while ((*yyd++ = *yys++) != '\0')
  1271. continue;
  1272. return yyd - 1;
  1273. }
  1274. # endif
  1275. # endif
  1276. # ifndef yytnamerr
  1277. /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
  1278. quotes and backslashes, so that it's suitable for yyerror. The
  1279. heuristic is that double-quoting is unnecessary unless the string
  1280. contains an apostrophe, a comma, or backslash (other than
  1281. backslash-backslash). YYSTR is taken from yytname. If YYRES is
  1282. null, do not copy; instead, return the length of what the result
  1283. would have been. */
  1284. static YYPTRDIFF_T
  1285. yytnamerr (char *yyres, const char *yystr)
  1286. {
  1287. if (*yystr == '"')
  1288. {
  1289. YYPTRDIFF_T yyn = 0;
  1290. char const *yyp = yystr;
  1291. for (;;)
  1292. switch (*++yyp)
  1293. {
  1294. case '\'':
  1295. case ',':
  1296. goto do_not_strip_quotes;
  1297. case '\\':
  1298. if (*++yyp != '\\')
  1299. goto do_not_strip_quotes;
  1300. else
  1301. goto append;
  1302. append:
  1303. default:
  1304. if (yyres)
  1305. yyres[yyn] = *yyp;
  1306. yyn++;
  1307. break;
  1308. case '"':
  1309. if (yyres)
  1310. yyres[yyn] = '\0';
  1311. return yyn;
  1312. }
  1313. do_not_strip_quotes: ;
  1314. }
  1315. if (yyres)
  1316. return yystpcpy (yyres, yystr) - yyres;
  1317. else
  1318. return yystrlen (yystr);
  1319. }
  1320. # endif
  1321. /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
  1322. about the unexpected token YYTOKEN for the state stack whose top is
  1323. YYSSP.
  1324. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
  1325. not large enough to hold the message. In that case, also set
  1326. *YYMSG_ALLOC to the required number of bytes. Return 2 if the
  1327. required number of bytes is too large to store. */
  1328. static int
  1329. yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
  1330. yy_state_t *yyssp, int yytoken)
  1331. {
  1332. enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  1333. /* Internationalized format string. */
  1334. const char *yyformat = YY_NULLPTR;
  1335. /* Arguments of yyformat: reported tokens (one for the "unexpected",
  1336. one per "expected"). */
  1337. char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  1338. /* Actual size of YYARG. */
  1339. int yycount = 0;
  1340. /* Cumulated lengths of YYARG. */
  1341. YYPTRDIFF_T yysize = 0;
  1342. /* There are many possibilities here to consider:
  1343. - If this state is a consistent state with a default action, then
  1344. the only way this function was invoked is if the default action
  1345. is an error action. In that case, don't check for expected
  1346. tokens because there are none.
  1347. - The only way there can be no lookahead present (in yychar) is if
  1348. this state is a consistent state with a default action. Thus,
  1349. detecting the absence of a lookahead is sufficient to determine
  1350. that there is no unexpected or expected token to report. In that
  1351. case, just report a simple "syntax error".
  1352. - Don't assume there isn't a lookahead just because this state is a
  1353. consistent state with a default action. There might have been a
  1354. previous inconsistent state, consistent state with a non-default
  1355. action, or user semantic action that manipulated yychar.
  1356. - Of course, the expected token list depends on states to have
  1357. correct lookahead information, and it depends on the parser not
  1358. to perform extra reductions after fetching a lookahead from the
  1359. scanner and before detecting a syntax error. Thus, state merging
  1360. (from LALR or IELR) and default reductions corrupt the expected
  1361. token list. However, the list is correct for canonical LR with
  1362. one exception: it will still contain any token that will not be
  1363. accepted due to an error action in a later state.
  1364. */
  1365. if (yytoken != YYEMPTY)
  1366. {
  1367. int yyn = yypact[+*yyssp];
  1368. YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
  1369. yysize = yysize0;
  1370. yyarg[yycount++] = yytname[yytoken];
  1371. if (!yypact_value_is_default (yyn))
  1372. {
  1373. /* Start YYX at -YYN if negative to avoid negative indexes in
  1374. YYCHECK. In other words, skip the first -YYN actions for
  1375. this state because they are default actions. */
  1376. int yyxbegin = yyn < 0 ? -yyn : 0;
  1377. /* Stay within bounds of both yycheck and yytname. */
  1378. int yychecklim = YYLAST - yyn + 1;
  1379. int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
  1380. int yyx;
  1381. for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  1382. if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
  1383. && !yytable_value_is_error (yytable[yyx + yyn]))
  1384. {
  1385. if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
  1386. {
  1387. yycount = 1;
  1388. yysize = yysize0;
  1389. break;
  1390. }
  1391. yyarg[yycount++] = yytname[yyx];
  1392. {
  1393. YYPTRDIFF_T yysize1
  1394. = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
  1395. if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
  1396. yysize = yysize1;
  1397. else
  1398. return 2;
  1399. }
  1400. }
  1401. }
  1402. }
  1403. switch (yycount)
  1404. {
  1405. # define YYCASE_(N, S) \
  1406. case N: \
  1407. yyformat = S; \
  1408. break
  1409. default: /* Avoid compiler warnings. */
  1410. YYCASE_(0, YY_("syntax error"));
  1411. YYCASE_(1, YY_("syntax error, unexpected %s"));
  1412. YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
  1413. YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
  1414. YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
  1415. YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
  1416. # undef YYCASE_
  1417. }
  1418. {
  1419. /* Don't count the "%s"s in the final size, but reserve room for
  1420. the terminator. */
  1421. YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
  1422. if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
  1423. yysize = yysize1;
  1424. else
  1425. return 2;
  1426. }
  1427. if (*yymsg_alloc < yysize)
  1428. {
  1429. *yymsg_alloc = 2 * yysize;
  1430. if (! (yysize <= *yymsg_alloc
  1431. && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
  1432. *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
  1433. return 1;
  1434. }
  1435. /* Avoid sprintf, as that infringes on the user's name space.
  1436. Don't have undefined behavior even if the translation
  1437. produced a string with the wrong number of "%s"s. */
  1438. {
  1439. char *yyp = *yymsg;
  1440. int yyi = 0;
  1441. while ((*yyp = *yyformat) != '\0')
  1442. if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
  1443. {
  1444. yyp += yytnamerr (yyp, yyarg[yyi++]);
  1445. yyformat += 2;
  1446. }
  1447. else
  1448. {
  1449. ++yyp;
  1450. ++yyformat;
  1451. }
  1452. }
  1453. return 0;
  1454. }
  1455. #endif /* YYERROR_VERBOSE */
  1456. /*-----------------------------------------------.
  1457. | Release the memory associated to this symbol. |
  1458. `-----------------------------------------------*/
  1459. static void
  1460. yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
  1461. {
  1462. YYUSE (yyvaluep);
  1463. if (!yymsg)
  1464. yymsg = "Deleting";
  1465. YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
  1466. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1467. YYUSE (yytype);
  1468. YY_IGNORE_MAYBE_UNINITIALIZED_END
  1469. }
  1470. /* The lookahead symbol. */
  1471. int yychar;
  1472. /* The semantic value of the lookahead symbol. */
  1473. YYSTYPE yylval;
  1474. /* Number of syntax errors so far. */
  1475. int yynerrs;
  1476. /*----------.
  1477. | yyparse. |
  1478. `----------*/
  1479. int
  1480. yyparse (void)
  1481. {
  1482. yy_state_fast_t yystate;
  1483. /* Number of tokens to shift before error messages enabled. */
  1484. int yyerrstatus;
  1485. /* The stacks and their tools:
  1486. 'yyss': related to states.
  1487. 'yyvs': related to semantic values.
  1488. Refer to the stacks through separate pointers, to allow yyoverflow
  1489. to reallocate them elsewhere. */
  1490. /* The state stack. */
  1491. yy_state_t yyssa[YYINITDEPTH];
  1492. yy_state_t *yyss;
  1493. yy_state_t *yyssp;
  1494. /* The semantic value stack. */
  1495. YYSTYPE yyvsa[YYINITDEPTH];
  1496. YYSTYPE *yyvs;
  1497. YYSTYPE *yyvsp;
  1498. YYPTRDIFF_T yystacksize;
  1499. int yyn;
  1500. int yyresult;
  1501. /* Lookahead token as an internal (translated) token number. */
  1502. int yytoken = 0;
  1503. /* The variables used to return semantic value and location from the
  1504. action routines. */
  1505. YYSTYPE yyval;
  1506. #if YYERROR_VERBOSE
  1507. /* Buffer for error messages, and its allocated size. */
  1508. char yymsgbuf[128];
  1509. char *yymsg = yymsgbuf;
  1510. YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
  1511. #endif
  1512. #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
  1513. /* The number of symbols on the RHS of the reduced rule.
  1514. Keep to zero when no symbol should be popped. */
  1515. int yylen = 0;
  1516. yyssp = yyss = yyssa;
  1517. yyvsp = yyvs = yyvsa;
  1518. yystacksize = YYINITDEPTH;
  1519. YYDPRINTF ((stderr, "Starting parse\n"));
  1520. yystate = 0;
  1521. yyerrstatus = 0;
  1522. yynerrs = 0;
  1523. yychar = YYEMPTY; /* Cause a token to be read. */
  1524. goto yysetstate;
  1525. /*------------------------------------------------------------.
  1526. | yynewstate -- push a new state, which is found in yystate. |
  1527. `------------------------------------------------------------*/
  1528. yynewstate:
  1529. /* In all cases, when you get here, the value and location stacks
  1530. have just been pushed. So pushing a state here evens the stacks. */
  1531. yyssp++;
  1532. /*--------------------------------------------------------------------.
  1533. | yysetstate -- set current state (the top of the stack) to yystate. |
  1534. `--------------------------------------------------------------------*/
  1535. yysetstate:
  1536. YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  1537. YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
  1538. YY_IGNORE_USELESS_CAST_BEGIN
  1539. *yyssp = YY_CAST (yy_state_t, yystate);
  1540. YY_IGNORE_USELESS_CAST_END
  1541. if (yyss + yystacksize - 1 <= yyssp)
  1542. #if !defined yyoverflow && !defined YYSTACK_RELOCATE
  1543. goto yyexhaustedlab;
  1544. #else
  1545. {
  1546. /* Get the current used size of the three stacks, in elements. */
  1547. YYPTRDIFF_T yysize = yyssp - yyss + 1;
  1548. # if defined yyoverflow
  1549. {
  1550. /* Give user a chance to reallocate the stack. Use copies of
  1551. these so that the &'s don't force the real ones into
  1552. memory. */
  1553. yy_state_t *yyss1 = yyss;
  1554. YYSTYPE *yyvs1 = yyvs;
  1555. /* Each stack pointer address is followed by the size of the
  1556. data in use in that stack, in bytes. This used to be a
  1557. conditional around just the two extra args, but that might
  1558. be undefined if yyoverflow is a macro. */
  1559. yyoverflow (YY_("memory exhausted"),
  1560. &yyss1, yysize * YYSIZEOF (*yyssp),
  1561. &yyvs1, yysize * YYSIZEOF (*yyvsp),
  1562. &yystacksize);
  1563. yyss = yyss1;
  1564. yyvs = yyvs1;
  1565. }
  1566. # else /* defined YYSTACK_RELOCATE */
  1567. /* Extend the stack our own way. */
  1568. if (YYMAXDEPTH <= yystacksize)
  1569. goto yyexhaustedlab;
  1570. yystacksize *= 2;
  1571. if (YYMAXDEPTH < yystacksize)
  1572. yystacksize = YYMAXDEPTH;
  1573. {
  1574. yy_state_t *yyss1 = yyss;
  1575. union yyalloc *yyptr =
  1576. YY_CAST (union yyalloc *,
  1577. YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
  1578. if (! yyptr)
  1579. goto yyexhaustedlab;
  1580. YYSTACK_RELOCATE (yyss_alloc, yyss);
  1581. YYSTACK_RELOCATE (yyvs_alloc, yyvs);
  1582. # undef YYSTACK_RELOCATE
  1583. if (yyss1 != yyssa)
  1584. YYSTACK_FREE (yyss1);
  1585. }
  1586. # endif
  1587. yyssp = yyss + yysize - 1;
  1588. yyvsp = yyvs + yysize - 1;
  1589. YY_IGNORE_USELESS_CAST_BEGIN
  1590. YYDPRINTF ((stderr, "Stack size increased to %ld\n",
  1591. YY_CAST (long, yystacksize)));
  1592. YY_IGNORE_USELESS_CAST_END
  1593. if (yyss + yystacksize - 1 <= yyssp)
  1594. YYABORT;
  1595. }
  1596. #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
  1597. if (yystate == YYFINAL)
  1598. YYACCEPT;
  1599. goto yybackup;
  1600. /*-----------.
  1601. | yybackup. |
  1602. `-----------*/
  1603. yybackup:
  1604. /* Do appropriate processing given the current state. Read a
  1605. lookahead token if we need one and don't already have one. */
  1606. /* First try to decide what to do without reference to lookahead token. */
  1607. yyn = yypact[yystate];
  1608. if (yypact_value_is_default (yyn))
  1609. goto yydefault;
  1610. /* Not known => get a lookahead token if don't already have one. */
  1611. /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
  1612. if (yychar == YYEMPTY)
  1613. {
  1614. YYDPRINTF ((stderr, "Reading a token: "));
  1615. yychar = yylex ();
  1616. }
  1617. if (yychar <= YYEOF)
  1618. {
  1619. yychar = yytoken = YYEOF;
  1620. YYDPRINTF ((stderr, "Now at end of input.\n"));
  1621. }
  1622. else
  1623. {
  1624. yytoken = YYTRANSLATE (yychar);
  1625. YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
  1626. }
  1627. /* If the proper action on seeing token YYTOKEN is to reduce or to
  1628. detect an error, take that action. */
  1629. yyn += yytoken;
  1630. if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  1631. goto yydefault;
  1632. yyn = yytable[yyn];
  1633. if (yyn <= 0)
  1634. {
  1635. if (yytable_value_is_error (yyn))
  1636. goto yyerrlab;
  1637. yyn = -yyn;
  1638. goto yyreduce;
  1639. }
  1640. /* Count tokens shifted since error; after three, turn off error
  1641. status. */
  1642. if (yyerrstatus)
  1643. yyerrstatus--;
  1644. /* Shift the lookahead token. */
  1645. YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  1646. yystate = yyn;
  1647. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1648. *++yyvsp = yylval;
  1649. YY_IGNORE_MAYBE_UNINITIALIZED_END
  1650. /* Discard the shifted token. */
  1651. yychar = YYEMPTY;
  1652. goto yynewstate;
  1653. /*-----------------------------------------------------------.
  1654. | yydefault -- do the default action for the current state. |
  1655. `-----------------------------------------------------------*/
  1656. yydefault:
  1657. yyn = yydefact[yystate];
  1658. if (yyn == 0)
  1659. goto yyerrlab;
  1660. goto yyreduce;
  1661. /*-----------------------------.
  1662. | yyreduce -- do a reduction. |
  1663. `-----------------------------*/
  1664. yyreduce:
  1665. /* yyn is the number of a rule to reduce with. */
  1666. yylen = yyr2[yyn];
  1667. /* If YYLEN is nonzero, implement the default value of the action:
  1668. '$$ = $1'.
  1669. Otherwise, the following line sets YYVAL to garbage.
  1670. This behavior is undocumented and Bison
  1671. users should not rely upon it. Assigning to YYVAL
  1672. unconditionally makes the parser a bit smaller, and it avoids a
  1673. GCC warning that YYVAL may be used uninitialized. */
  1674. yyval = yyvsp[1-yylen];
  1675. YY_REDUCE_PRINT (yyn);
  1676. switch (yyn)
  1677. {
  1678. case 2:
  1679. #line 180 "../../lib/expr/exparse.y"
  1680. {
  1681. if ((yyvsp[-1].expr)) {
  1682. if (expr.program->main.value)
  1683. exfreenode(expr.program, expr.program->main.value);
  1684. if ((yyvsp[-1].expr)->op == S2B)
  1685. {
  1686. Exnode_t* x;
  1687. x = (yyvsp[-1].expr);
  1688. (yyvsp[-1].expr) = x->data.operand.left;
  1689. x->data.operand.left = 0;
  1690. exfreenode(expr.program, x);
  1691. }
  1692. expr.program->main.lex = PROCEDURE;
  1693. expr.program->main.value = exnewnode(expr.program, PROCEDURE, true, (yyvsp[-1].expr)->type, NULL, (yyvsp[-1].expr));
  1694. }
  1695. }
  1696. #line 1906 "exparse.c"
  1697. break;
  1698. case 5:
  1699. #line 203 "../../lib/expr/exparse.y"
  1700. {
  1701. if (expr.procedure)
  1702. exerror("no nested function definitions");
  1703. (yyvsp[-1].id)->lex = PROCEDURE;
  1704. expr.procedure = (yyvsp[-1].id)->value = exnewnode(expr.program, PROCEDURE, true, (yyvsp[-1].id)->type, NULL, NULL);
  1705. expr.procedure->type = INTEGER;
  1706. static Dtdisc_t disc = {.key = offsetof(Exid_t, name)};
  1707. if (expr.assigned && !streq((yyvsp[-1].id)->name, "begin"))
  1708. {
  1709. if (!(expr.procedure->data.procedure.frame = dtopen(&disc, Dtset)) ||
  1710. !dtview(expr.procedure->data.procedure.frame, expr.program->symbols))
  1711. exnospace();
  1712. expr.program->symbols = expr.program->frame = expr.procedure->data.procedure.frame;
  1713. }
  1714. }
  1715. #line 1926 "exparse.c"
  1716. break;
  1717. case 6:
  1718. #line 218 "../../lib/expr/exparse.y"
  1719. {
  1720. expr.procedure = 0;
  1721. if (expr.program->frame)
  1722. {
  1723. expr.program->symbols = expr.program->frame->view;
  1724. dtview(expr.program->frame, NULL);
  1725. expr.program->frame = 0;
  1726. }
  1727. if ((yyvsp[0].expr) && (yyvsp[0].expr)->op == S2B)
  1728. {
  1729. Exnode_t* x;
  1730. x = (yyvsp[0].expr);
  1731. (yyvsp[0].expr) = x->data.operand.left;
  1732. x->data.operand.left = 0;
  1733. exfreenode(expr.program, x);
  1734. }
  1735. (yyvsp[-3].id)->value->data.operand.right = excast(expr.program, (yyvsp[0].expr), (yyvsp[-3].id)->type, NULL, 0);
  1736. }
  1737. #line 1950 "exparse.c"
  1738. break;
  1739. case 7:
  1740. #line 240 "../../lib/expr/exparse.y"
  1741. {
  1742. (yyval.expr) = 0;
  1743. }
  1744. #line 1958 "exparse.c"
  1745. break;
  1746. case 8:
  1747. #line 244 "../../lib/expr/exparse.y"
  1748. {
  1749. if (!(yyvsp[-1].expr))
  1750. (yyval.expr) = (yyvsp[0].expr);
  1751. else if (!(yyvsp[0].expr))
  1752. (yyval.expr) = (yyvsp[-1].expr);
  1753. else if ((yyvsp[-1].expr)->op == CONSTANT)
  1754. {
  1755. exfreenode(expr.program, (yyvsp[-1].expr));
  1756. (yyval.expr) = (yyvsp[0].expr);
  1757. }
  1758. else (yyval.expr) = exnewnode(expr.program, ';', true, (yyvsp[0].expr)->type, (yyvsp[-1].expr), (yyvsp[0].expr));
  1759. }
  1760. #line 1975 "exparse.c"
  1761. break;
  1762. case 9:
  1763. #line 259 "../../lib/expr/exparse.y"
  1764. {
  1765. (yyval.expr) = (yyvsp[-1].expr);
  1766. }
  1767. #line 1983 "exparse.c"
  1768. break;
  1769. case 10:
  1770. #line 263 "../../lib/expr/exparse.y"
  1771. {
  1772. (yyval.expr) = ((yyvsp[-1].expr) && (yyvsp[-1].expr)->type == STRING) ? exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[-1].expr), NULL) : (yyvsp[-1].expr);
  1773. }
  1774. #line 1991 "exparse.c"
  1775. break;
  1776. case 11:
  1777. #line 266 "../../lib/expr/exparse.y"
  1778. {expr.declare = (yyvsp[0].id)->type;}
  1779. #line 1997 "exparse.c"
  1780. break;
  1781. case 12:
  1782. #line 267 "../../lib/expr/exparse.y"
  1783. {
  1784. (yyval.expr) = (yyvsp[-1].expr);
  1785. expr.declare = 0;
  1786. }
  1787. #line 2006 "exparse.c"
  1788. break;
  1789. case 13:
  1790. #line 272 "../../lib/expr/exparse.y"
  1791. {
  1792. if (exisAssign ((yyvsp[-3].expr)))
  1793. exwarn ("assignment used as boolean in if statement");
  1794. if ((yyvsp[-3].expr)->type == STRING)
  1795. (yyvsp[-3].expr) = exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[-3].expr), NULL);
  1796. else if (!INTEGRAL((yyvsp[-3].expr)->type))
  1797. (yyvsp[-3].expr) = excast(expr.program, (yyvsp[-3].expr), INTEGER, NULL, 0);
  1798. (yyval.expr) = exnewnode(expr.program, (yyvsp[-5].id)->index, true, INTEGER, (yyvsp[-3].expr), exnewnode(expr.program, ':', true, (yyvsp[-1].expr) ? (yyvsp[-1].expr)->type : 0, (yyvsp[-1].expr), (yyvsp[0].expr)));
  1799. }
  1800. #line 2020 "exparse.c"
  1801. break;
  1802. case 14:
  1803. #line 282 "../../lib/expr/exparse.y"
  1804. {
  1805. (yyval.expr) = exnewnode(expr.program, ITERATE, false, INTEGER, NULL, NULL);
  1806. (yyval.expr)->data.generate.array = (yyvsp[-2].expr);
  1807. if (!(yyvsp[-2].expr)->data.variable.index || (yyvsp[-2].expr)->data.variable.index->op != DYNAMIC)
  1808. exerror("simple index variable expected");
  1809. (yyval.expr)->data.generate.index = (yyvsp[-2].expr)->data.variable.index->data.variable.symbol;
  1810. if ((yyvsp[-2].expr)->op == ID && (yyval.expr)->data.generate.index->type != INTEGER)
  1811. exerror("integer index variable expected");
  1812. exfreenode(expr.program, (yyvsp[-2].expr)->data.variable.index);
  1813. (yyvsp[-2].expr)->data.variable.index = 0;
  1814. (yyval.expr)->data.generate.statement = (yyvsp[0].expr);
  1815. }
  1816. #line 2037 "exparse.c"
  1817. break;
  1818. case 15:
  1819. #line 295 "../../lib/expr/exparse.y"
  1820. {
  1821. if (!(yyvsp[-4].expr))
  1822. {
  1823. (yyvsp[-4].expr) = exnewnode(expr.program, CONSTANT, false, INTEGER, NULL, NULL);
  1824. (yyvsp[-4].expr)->data.constant.value.integer = 1;
  1825. }
  1826. else if ((yyvsp[-4].expr)->type == STRING)
  1827. (yyvsp[-4].expr) = exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[-4].expr), NULL);
  1828. else if (!INTEGRAL((yyvsp[-4].expr)->type))
  1829. (yyvsp[-4].expr) = excast(expr.program, (yyvsp[-4].expr), INTEGER, NULL, 0);
  1830. (yyval.expr) = exnewnode(expr.program, (yyvsp[-8].id)->index, true, INTEGER, (yyvsp[-4].expr), exnewnode(expr.program, ';', 1, 0, (yyvsp[-2].expr), (yyvsp[0].expr)));
  1831. if ((yyvsp[-6].expr))
  1832. (yyval.expr) = exnewnode(expr.program, ';', true, INTEGER, (yyvsp[-6].expr), (yyval.expr));
  1833. }
  1834. #line 2056 "exparse.c"
  1835. break;
  1836. case 16:
  1837. #line 310 "../../lib/expr/exparse.y"
  1838. {
  1839. (yyval.expr) = exnewnode(expr.program, ITERATOR, false, INTEGER, NULL, NULL);
  1840. (yyval.expr)->data.generate.array = (yyvsp[-2].expr);
  1841. if (!(yyvsp[-2].expr)->data.variable.index || (yyvsp[-2].expr)->data.variable.index->op != DYNAMIC)
  1842. exerror("simple index variable expected");
  1843. (yyval.expr)->data.generate.index = (yyvsp[-2].expr)->data.variable.index->data.variable.symbol;
  1844. if ((yyvsp[-2].expr)->op == ID && (yyval.expr)->data.generate.index->type != INTEGER)
  1845. exerror("integer index variable expected");
  1846. exfreenode(expr.program, (yyvsp[-2].expr)->data.variable.index);
  1847. (yyvsp[-2].expr)->data.variable.index = 0;
  1848. (yyval.expr)->data.generate.statement = (yyvsp[0].expr);
  1849. }
  1850. #line 2073 "exparse.c"
  1851. break;
  1852. case 17:
  1853. #line 323 "../../lib/expr/exparse.y"
  1854. {
  1855. if ((yyvsp[-1].id)->local == NULL)
  1856. exerror("cannot apply unset to non-array %s", (yyvsp[-1].id)->name);
  1857. (yyval.expr) = exnewnode(expr.program, UNSET, false, INTEGER, NULL, NULL);
  1858. (yyval.expr)->data.variable.symbol = (yyvsp[-1].id);
  1859. (yyval.expr)->data.variable.index = NULL;
  1860. }
  1861. #line 2085 "exparse.c"
  1862. break;
  1863. case 18:
  1864. #line 331 "../../lib/expr/exparse.y"
  1865. {
  1866. if ((yyvsp[-3].id)->local == NULL)
  1867. exerror("cannot apply unset to non-array %s", (yyvsp[-3].id)->name);
  1868. if (((yyvsp[-3].id)->index_type > 0) && ((yyvsp[-1].expr)->type != (yyvsp[-3].id)->index_type))
  1869. exerror("%s indices must have type %s, not %s",
  1870. (yyvsp[-3].id)->name, extypename(expr.program, (yyvsp[-3].id)->index_type),extypename(expr.program, (yyvsp[-1].expr)->type));
  1871. (yyval.expr) = exnewnode(expr.program, UNSET, false, INTEGER, NULL, NULL);
  1872. (yyval.expr)->data.variable.symbol = (yyvsp[-3].id);
  1873. (yyval.expr)->data.variable.index = (yyvsp[-1].expr);
  1874. }
  1875. #line 2100 "exparse.c"
  1876. break;
  1877. case 19:
  1878. #line 342 "../../lib/expr/exparse.y"
  1879. {
  1880. if (exisAssign ((yyvsp[-2].expr)))
  1881. exwarn ("assignment used as boolean in while statement");
  1882. if ((yyvsp[-2].expr)->type == STRING)
  1883. (yyvsp[-2].expr) = exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[-2].expr), NULL);
  1884. else if (!INTEGRAL((yyvsp[-2].expr)->type))
  1885. (yyvsp[-2].expr) = excast(expr.program, (yyvsp[-2].expr), INTEGER, NULL, 0);
  1886. (yyval.expr) = exnewnode(expr.program, (yyvsp[-4].id)->index, true, INTEGER, (yyvsp[-2].expr), exnewnode(expr.program, ';', true, 0, NULL, (yyvsp[0].expr)));
  1887. }
  1888. #line 2114 "exparse.c"
  1889. break;
  1890. case 20:
  1891. #line 351 "../../lib/expr/exparse.y"
  1892. {expr.declare=(yyvsp[0].expr)->type;}
  1893. #line 2120 "exparse.c"
  1894. break;
  1895. case 21:
  1896. #line 352 "../../lib/expr/exparse.y"
  1897. {
  1898. Switch_t* sw = expr.swstate;
  1899. (yyval.expr) = exnewnode(expr.program, (yyvsp[-7].id)->index, true, INTEGER, (yyvsp[-5].expr), exnewnode(expr.program, DEFAULT, true, 0, sw->defcase, sw->firstcase));
  1900. expr.swstate = expr.swstate->prev;
  1901. free(sw->base);
  1902. if (sw != &swstate)
  1903. free(sw);
  1904. expr.declare = 0;
  1905. }
  1906. #line 2135 "exparse.c"
  1907. break;
  1908. case 22:
  1909. #line 363 "../../lib/expr/exparse.y"
  1910. {
  1911. loopop:
  1912. if (!(yyvsp[-1].expr))
  1913. {
  1914. (yyvsp[-1].expr) = exnewnode(expr.program, CONSTANT, false, INTEGER, NULL, NULL);
  1915. (yyvsp[-1].expr)->data.constant.value.integer = 1;
  1916. }
  1917. else if (!INTEGRAL((yyvsp[-1].expr)->type))
  1918. (yyvsp[-1].expr) = excast(expr.program, (yyvsp[-1].expr), INTEGER, NULL, 0);
  1919. (yyval.expr) = exnewnode(expr.program, (yyvsp[-2].id)->index, true, INTEGER, (yyvsp[-1].expr), NULL);
  1920. }
  1921. #line 2151 "exparse.c"
  1922. break;
  1923. case 23:
  1924. #line 375 "../../lib/expr/exparse.y"
  1925. {
  1926. goto loopop;
  1927. }
  1928. #line 2159 "exparse.c"
  1929. break;
  1930. case 24:
  1931. #line 379 "../../lib/expr/exparse.y"
  1932. {
  1933. if ((yyvsp[-1].expr))
  1934. {
  1935. if (expr.procedure && !expr.procedure->type)
  1936. exerror("return in void function");
  1937. (yyvsp[-1].expr) = excast(expr.program, (yyvsp[-1].expr), expr.procedure ? expr.procedure->type : INTEGER, NULL, 0);
  1938. }
  1939. (yyval.expr) = exnewnode(expr.program, RETURN, true, (yyvsp[-1].expr) ? (yyvsp[-1].expr)->type : 0, (yyvsp[-1].expr), NULL);
  1940. }
  1941. #line 2173 "exparse.c"
  1942. break;
  1943. case 25:
  1944. #line 391 "../../lib/expr/exparse.y"
  1945. {
  1946. Switch_t* sw;
  1947. if (expr.swstate)
  1948. {
  1949. if (!(sw = calloc(1, sizeof(Switch_t))))
  1950. {
  1951. exnospace();
  1952. sw = &swstate;
  1953. }
  1954. sw->prev = expr.swstate;
  1955. }
  1956. else
  1957. sw = &swstate;
  1958. expr.swstate = sw;
  1959. sw->type = expr.declare;
  1960. sw->firstcase = 0;
  1961. sw->lastcase = 0;
  1962. sw->defcase = 0;
  1963. sw->def = 0;
  1964. size_t n = 8;
  1965. if (!(sw->base = calloc(n, sizeof(Extype_t*))))
  1966. {
  1967. exnospace();
  1968. n = 0;
  1969. }
  1970. sw->cur = sw->base;
  1971. sw->last = sw->base + n;
  1972. }
  1973. #line 2207 "exparse.c"
  1974. break;
  1975. case 27:
  1976. #line 424 "../../lib/expr/exparse.y"
  1977. {
  1978. Switch_t* sw = expr.swstate;
  1979. (yyval.expr) = exnewnode(expr.program, CASE, true, 0, (yyvsp[0].expr), NULL);
  1980. if (sw->cur > sw->base)
  1981. {
  1982. if (sw->lastcase)
  1983. sw->lastcase->data.select.next = (yyval.expr);
  1984. else
  1985. sw->firstcase = (yyval.expr);
  1986. sw->lastcase = (yyval.expr);
  1987. size_t n = (size_t)(sw->cur - sw->base);
  1988. sw->cur = sw->base;
  1989. (yyval.expr)->data.select.constant = exalloc(expr.program, (n + 1) * sizeof(Extype_t*));
  1990. memcpy((yyval.expr)->data.select.constant, sw->base, n * sizeof(Extype_t*));
  1991. (yyval.expr)->data.select.constant[n] = 0;
  1992. }
  1993. else
  1994. (yyval.expr)->data.select.constant = 0;
  1995. if (sw->def)
  1996. {
  1997. sw->def = 0;
  1998. if (sw->defcase)
  1999. exerror("duplicate default in switch");
  2000. else
  2001. sw->defcase = (yyvsp[0].expr);
  2002. }
  2003. }
  2004. #line 2240 "exparse.c"
  2005. break;
  2006. case 30:
  2007. #line 459 "../../lib/expr/exparse.y"
  2008. {
  2009. if (expr.swstate->cur >= expr.swstate->last)
  2010. {
  2011. size_t n = (size_t)(expr.swstate->cur - expr.swstate->base);
  2012. if (!(expr.swstate->base = realloc(expr.swstate->base, sizeof(Extype_t*) * 2 * n)))
  2013. {
  2014. exerror("too many case labels for switch");
  2015. n = 0;
  2016. }
  2017. expr.swstate->cur = expr.swstate->base + n;
  2018. expr.swstate->last = expr.swstate->base + 2 * n;
  2019. }
  2020. if (expr.swstate->cur)
  2021. {
  2022. (yyvsp[-1].expr) = excast(expr.program, (yyvsp[-1].expr), expr.swstate->type, NULL, 0);
  2023. *expr.swstate->cur++ = &((yyvsp[-1].expr)->data.constant.value);
  2024. }
  2025. }
  2026. #line 2263 "exparse.c"
  2027. break;
  2028. case 31:
  2029. #line 478 "../../lib/expr/exparse.y"
  2030. {
  2031. expr.swstate->def = 1;
  2032. }
  2033. #line 2271 "exparse.c"
  2034. break;
  2035. case 33:
  2036. #line 485 "../../lib/expr/exparse.y"
  2037. {
  2038. if ((yyvsp[0].expr))
  2039. (yyval.expr) = (yyvsp[-2].expr) ? exnewnode(expr.program, ',', true, (yyvsp[0].expr)->type, (yyvsp[-2].expr), (yyvsp[0].expr)) : (yyvsp[0].expr);
  2040. }
  2041. #line 2280 "exparse.c"
  2042. break;
  2043. case 34:
  2044. #line 491 "../../lib/expr/exparse.y"
  2045. {checkName ((yyvsp[0].id)); expr.id=(yyvsp[0].id);}
  2046. #line 2286 "exparse.c"
  2047. break;
  2048. case 35:
  2049. #line 492 "../../lib/expr/exparse.y"
  2050. {
  2051. (yyval.expr) = 0;
  2052. if (!(yyvsp[-3].id)->type || expr.declare)
  2053. (yyvsp[-3].id)->type = expr.declare;
  2054. if ((yyvsp[0].expr) && (yyvsp[0].expr)->op == PROCEDURE)
  2055. {
  2056. (yyvsp[-3].id)->lex = PROCEDURE;
  2057. (yyvsp[-3].id)->type = (yyvsp[0].expr)->type;
  2058. (yyvsp[-3].id)->value = (yyvsp[0].expr);
  2059. }
  2060. else
  2061. {
  2062. if ((yyvsp[-3].id)->type == 0) {
  2063. exerror("%s: a variable cannot be void typed", (yyvsp[-3].id)->name);
  2064. }
  2065. (yyvsp[-3].id)->lex = DYNAMIC;
  2066. (yyvsp[-3].id)->value = exnewnode(expr.program, 0, false, 0, NULL, NULL);
  2067. if ((yyvsp[-1].integer) && (yyvsp[-3].id)->local == NULL)
  2068. {
  2069. static Dtdisc_t disc_key = {
  2070. .key = offsetof(Exassoc_t, key),
  2071. .size = sizeof(Extype_t),
  2072. .comparf = cmpKey,
  2073. };
  2074. static Dtdisc_t disc_name = {.key = offsetof(Exassoc_t, name)};
  2075. Dtdisc_t *const disc = (yyvsp[-1].integer) == INTEGER ? &disc_key : &disc_name;
  2076. if (!((yyvsp[-3].id)->local = dtopen(disc, Dtoset)))
  2077. exerror("%s: cannot initialize associative array", (yyvsp[-3].id)->name);
  2078. (yyvsp[-3].id)->index_type = (yyvsp[-1].integer); /* -1 indicates no typechecking */
  2079. }
  2080. if ((yyvsp[0].expr))
  2081. {
  2082. if ((yyvsp[0].expr)->type != (yyvsp[-3].id)->type)
  2083. {
  2084. (yyvsp[0].expr)->type = (yyvsp[-3].id)->type;
  2085. (yyvsp[0].expr)->data.operand.right = excast(expr.program, (yyvsp[0].expr)->data.operand.right, (yyvsp[-3].id)->type, NULL, 0);
  2086. }
  2087. (yyvsp[0].expr)->data.operand.left = exnewnode(expr.program, DYNAMIC, false, (yyvsp[-3].id)->type, NULL, NULL);
  2088. (yyvsp[0].expr)->data.operand.left->data.variable.symbol = (yyvsp[-3].id);
  2089. (yyval.expr) = (yyvsp[0].expr);
  2090. }
  2091. else if (!(yyvsp[-1].integer))
  2092. (yyvsp[-3].id)->value->data.value = exzero((yyvsp[-3].id)->type);
  2093. }
  2094. }
  2095. #line 2336 "exparse.c"
  2096. break;
  2097. case 42:
  2098. #line 550 "../../lib/expr/exparse.y"
  2099. {
  2100. (yyval.expr) = 0;
  2101. }
  2102. #line 2344 "exparse.c"
  2103. break;
  2104. case 43:
  2105. #line 554 "../../lib/expr/exparse.y"
  2106. {
  2107. (yyval.expr) = (yyvsp[0].expr);
  2108. }
  2109. #line 2352 "exparse.c"
  2110. break;
  2111. case 44:
  2112. #line 560 "../../lib/expr/exparse.y"
  2113. {
  2114. (yyval.expr) = 0;
  2115. }
  2116. #line 2360 "exparse.c"
  2117. break;
  2118. case 46:
  2119. #line 567 "../../lib/expr/exparse.y"
  2120. {
  2121. (yyval.expr) = (yyvsp[-1].expr);
  2122. }
  2123. #line 2368 "exparse.c"
  2124. break;
  2125. case 47:
  2126. #line 571 "../../lib/expr/exparse.y"
  2127. {
  2128. (yyval.expr) = ((yyvsp[0].expr)->type == (yyvsp[-2].id)->type) ? (yyvsp[0].expr) : excast(expr.program, (yyvsp[0].expr), (yyvsp[-2].id)->type, NULL, 0);
  2129. }
  2130. #line 2376 "exparse.c"
  2131. break;
  2132. case 48:
  2133. #line 575 "../../lib/expr/exparse.y"
  2134. {
  2135. long rel;
  2136. relational:
  2137. rel = INTEGER;
  2138. goto coerce;
  2139. binary:
  2140. rel = 0;
  2141. coerce:
  2142. if (!(yyvsp[-2].expr)->type)
  2143. {
  2144. if (!(yyvsp[0].expr)->type)
  2145. (yyvsp[-2].expr)->type = (yyvsp[0].expr)->type = rel ? STRING : INTEGER;
  2146. else
  2147. (yyvsp[-2].expr)->type = (yyvsp[0].expr)->type;
  2148. }
  2149. else if (!(yyvsp[0].expr)->type)
  2150. (yyvsp[0].expr)->type = (yyvsp[-2].expr)->type;
  2151. if ((yyvsp[-2].expr)->type != (yyvsp[0].expr)->type)
  2152. {
  2153. if ((yyvsp[-2].expr)->type == STRING)
  2154. (yyvsp[-2].expr) = excast(expr.program, (yyvsp[-2].expr), (yyvsp[0].expr)->type, (yyvsp[0].expr), 0);
  2155. else if ((yyvsp[0].expr)->type == STRING)
  2156. (yyvsp[0].expr) = excast(expr.program, (yyvsp[0].expr), (yyvsp[-2].expr)->type, (yyvsp[-2].expr), 0);
  2157. else if ((yyvsp[-2].expr)->type == FLOATING)
  2158. (yyvsp[0].expr) = excast(expr.program, (yyvsp[0].expr), FLOATING, (yyvsp[-2].expr), 0);
  2159. else if ((yyvsp[0].expr)->type == FLOATING)
  2160. (yyvsp[-2].expr) = excast(expr.program, (yyvsp[-2].expr), FLOATING, (yyvsp[0].expr), 0);
  2161. }
  2162. if (!rel)
  2163. rel = ((yyvsp[-2].expr)->type == STRING) ? STRING : (((yyvsp[-2].expr)->type == UNSIGNED) ? UNSIGNED : (yyvsp[0].expr)->type);
  2164. (yyval.expr) = exnewnode(expr.program, (yyvsp[-1].op), true, rel, (yyvsp[-2].expr), (yyvsp[0].expr));
  2165. if (!expr.program->errors && (yyvsp[-2].expr)->op == CONSTANT && (yyvsp[0].expr)->op == CONSTANT)
  2166. {
  2167. (yyval.expr)->data.constant.value = exeval(expr.program, (yyval.expr), NULL);
  2168. /* If a constant string, re-allocate from program heap. This is because the
  2169. * value was constructed from string operators, which create a value in the
  2170. * temporary heap, which is cleared when exeval is called again.
  2171. */
  2172. if ((yyval.expr)->type == STRING) {
  2173. (yyval.expr)->data.constant.value.string =
  2174. vmstrdup(expr.program->vm, (yyval.expr)->data.constant.value.string);
  2175. }
  2176. (yyval.expr)->binary = false;
  2177. (yyval.expr)->op = CONSTANT;
  2178. exfreenode(expr.program, (yyvsp[-2].expr));
  2179. exfreenode(expr.program, (yyvsp[0].expr));
  2180. }
  2181. else if (!BUILTIN((yyvsp[-2].expr)->type) || !BUILTIN((yyvsp[0].expr)->type)) {
  2182. checkBinary(expr.program, (yyvsp[-2].expr), (yyval.expr), (yyvsp[0].expr));
  2183. }
  2184. }
  2185. #line 2433 "exparse.c"
  2186. break;
  2187. case 49:
  2188. #line 628 "../../lib/expr/exparse.y"
  2189. {
  2190. goto binary;
  2191. }
  2192. #line 2441 "exparse.c"
  2193. break;
  2194. case 50:
  2195. #line 632 "../../lib/expr/exparse.y"
  2196. {
  2197. goto binary;
  2198. }
  2199. #line 2449 "exparse.c"
  2200. break;
  2201. case 51:
  2202. #line 636 "../../lib/expr/exparse.y"
  2203. {
  2204. goto binary;
  2205. }
  2206. #line 2457 "exparse.c"
  2207. break;
  2208. case 52:
  2209. #line 640 "../../lib/expr/exparse.y"
  2210. {
  2211. goto binary;
  2212. }
  2213. #line 2465 "exparse.c"
  2214. break;
  2215. case 53:
  2216. #line 644 "../../lib/expr/exparse.y"
  2217. {
  2218. goto binary;
  2219. }
  2220. #line 2473 "exparse.c"
  2221. break;
  2222. case 54:
  2223. #line 648 "../../lib/expr/exparse.y"
  2224. {
  2225. goto binary;
  2226. }
  2227. #line 2481 "exparse.c"
  2228. break;
  2229. case 55:
  2230. #line 652 "../../lib/expr/exparse.y"
  2231. {
  2232. goto relational;
  2233. }
  2234. #line 2489 "exparse.c"
  2235. break;
  2236. case 56:
  2237. #line 656 "../../lib/expr/exparse.y"
  2238. {
  2239. goto relational;
  2240. }
  2241. #line 2497 "exparse.c"
  2242. break;
  2243. case 57:
  2244. #line 660 "../../lib/expr/exparse.y"
  2245. {
  2246. goto relational;
  2247. }
  2248. #line 2505 "exparse.c"
  2249. break;
  2250. case 58:
  2251. #line 664 "../../lib/expr/exparse.y"
  2252. {
  2253. goto relational;
  2254. }
  2255. #line 2513 "exparse.c"
  2256. break;
  2257. case 59:
  2258. #line 668 "../../lib/expr/exparse.y"
  2259. {
  2260. goto relational;
  2261. }
  2262. #line 2521 "exparse.c"
  2263. break;
  2264. case 60:
  2265. #line 672 "../../lib/expr/exparse.y"
  2266. {
  2267. goto binary;
  2268. }
  2269. #line 2529 "exparse.c"
  2270. break;
  2271. case 61:
  2272. #line 676 "../../lib/expr/exparse.y"
  2273. {
  2274. goto binary;
  2275. }
  2276. #line 2537 "exparse.c"
  2277. break;
  2278. case 62:
  2279. #line 680 "../../lib/expr/exparse.y"
  2280. {
  2281. goto binary;
  2282. }
  2283. #line 2545 "exparse.c"
  2284. break;
  2285. case 63:
  2286. #line 684 "../../lib/expr/exparse.y"
  2287. {
  2288. goto binary;
  2289. }
  2290. #line 2553 "exparse.c"
  2291. break;
  2292. case 64:
  2293. #line 688 "../../lib/expr/exparse.y"
  2294. {
  2295. logical:
  2296. if ((yyvsp[-2].expr)->type == STRING)
  2297. (yyvsp[-2].expr) = exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[-2].expr), NULL);
  2298. else if (!BUILTIN((yyvsp[-2].expr)->type))
  2299. (yyvsp[-2].expr) = excast(expr.program, (yyvsp[-2].expr), INTEGER, NULL, 0);
  2300. if ((yyvsp[0].expr)->type == STRING)
  2301. (yyvsp[0].expr) = exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[0].expr), NULL);
  2302. else if (!BUILTIN((yyvsp[0].expr)->type))
  2303. (yyvsp[0].expr) = excast(expr.program, (yyvsp[0].expr), INTEGER, NULL, 0);
  2304. goto binary;
  2305. }
  2306. #line 2570 "exparse.c"
  2307. break;
  2308. case 65:
  2309. #line 701 "../../lib/expr/exparse.y"
  2310. {
  2311. goto logical;
  2312. }
  2313. #line 2578 "exparse.c"
  2314. break;
  2315. case 66:
  2316. #line 705 "../../lib/expr/exparse.y"
  2317. {
  2318. if ((yyvsp[-2].expr)->op == CONSTANT)
  2319. {
  2320. exfreenode(expr.program, (yyvsp[-2].expr));
  2321. (yyval.expr) = (yyvsp[0].expr);
  2322. }
  2323. else
  2324. (yyval.expr) = exnewnode(expr.program, ',', true, (yyvsp[0].expr)->type, (yyvsp[-2].expr), (yyvsp[0].expr));
  2325. }
  2326. #line 2592 "exparse.c"
  2327. break;
  2328. case 67:
  2329. #line 714 "../../lib/expr/exparse.y"
  2330. {expr.nolabel=1;}
  2331. #line 2598 "exparse.c"
  2332. break;
  2333. case 68:
  2334. #line 714 "../../lib/expr/exparse.y"
  2335. {expr.nolabel=0;}
  2336. #line 2604 "exparse.c"
  2337. break;
  2338. case 69:
  2339. #line 715 "../../lib/expr/exparse.y"
  2340. {
  2341. if (!(yyvsp[-3].expr)->type)
  2342. {
  2343. if (!(yyvsp[0].expr)->type)
  2344. (yyvsp[-3].expr)->type = (yyvsp[0].expr)->type = INTEGER;
  2345. else
  2346. (yyvsp[-3].expr)->type = (yyvsp[0].expr)->type;
  2347. }
  2348. else if (!(yyvsp[0].expr)->type)
  2349. (yyvsp[0].expr)->type = (yyvsp[-3].expr)->type;
  2350. if ((yyvsp[-6].expr)->type == STRING)
  2351. (yyvsp[-6].expr) = exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[-6].expr), NULL);
  2352. else if (!INTEGRAL((yyvsp[-6].expr)->type))
  2353. (yyvsp[-6].expr) = excast(expr.program, (yyvsp[-6].expr), INTEGER, NULL, 0);
  2354. if ((yyvsp[-3].expr)->type != (yyvsp[0].expr)->type)
  2355. {
  2356. if ((yyvsp[-3].expr)->type == STRING || (yyvsp[0].expr)->type == STRING)
  2357. exerror("if statement string type mismatch");
  2358. else if ((yyvsp[-3].expr)->type == FLOATING)
  2359. (yyvsp[0].expr) = excast(expr.program, (yyvsp[0].expr), FLOATING, NULL, 0);
  2360. else if ((yyvsp[0].expr)->type == FLOATING)
  2361. (yyvsp[-3].expr) = excast(expr.program, (yyvsp[-3].expr), FLOATING, NULL, 0);
  2362. }
  2363. if ((yyvsp[-6].expr)->op == CONSTANT)
  2364. {
  2365. if ((yyvsp[-6].expr)->data.constant.value.integer)
  2366. {
  2367. (yyval.expr) = (yyvsp[-3].expr);
  2368. exfreenode(expr.program, (yyvsp[0].expr));
  2369. }
  2370. else
  2371. {
  2372. (yyval.expr) = (yyvsp[0].expr);
  2373. exfreenode(expr.program, (yyvsp[-3].expr));
  2374. }
  2375. exfreenode(expr.program, (yyvsp[-6].expr));
  2376. }
  2377. else
  2378. (yyval.expr) = exnewnode(expr.program, '?', true, (yyvsp[-3].expr)->type, (yyvsp[-6].expr), exnewnode(expr.program, ':', true, (yyvsp[-3].expr)->type, (yyvsp[-3].expr), (yyvsp[0].expr)));
  2379. }
  2380. #line 2649 "exparse.c"
  2381. break;
  2382. case 70:
  2383. #line 756 "../../lib/expr/exparse.y"
  2384. {
  2385. iunary:
  2386. if ((yyvsp[0].expr)->type == STRING)
  2387. (yyvsp[0].expr) = exnewnode(expr.program, S2B, true, INTEGER, (yyvsp[0].expr), NULL);
  2388. else if (!INTEGRAL((yyvsp[0].expr)->type))
  2389. (yyvsp[0].expr) = excast(expr.program, (yyvsp[0].expr), INTEGER, NULL, 0);
  2390. unary:
  2391. (yyval.expr) = exnewnode(expr.program, (yyvsp[-1].op), true, (yyvsp[0].expr)->type == UNSIGNED ? INTEGER : (yyvsp[0].expr)->type, (yyvsp[0].expr), NULL);
  2392. if ((yyvsp[0].expr)->op == CONSTANT)
  2393. {
  2394. (yyval.expr)->data.constant.value = exeval(expr.program, (yyval.expr), NULL);
  2395. (yyval.expr)->binary = false;
  2396. (yyval.expr)->op = CONSTANT;
  2397. exfreenode(expr.program, (yyvsp[0].expr));
  2398. }
  2399. else if (!BUILTIN((yyvsp[0].expr)->type)) {
  2400. checkBinary(expr.program, (yyvsp[0].expr), (yyval.expr), 0);
  2401. }
  2402. }
  2403. #line 2673 "exparse.c"
  2404. break;
  2405. case 71:
  2406. #line 776 "../../lib/expr/exparse.y"
  2407. {
  2408. if ((yyvsp[0].id)->local == NULL)
  2409. exerror("cannot apply '#' operator to non-array %s", (yyvsp[0].id)->name);
  2410. (yyval.expr) = exnewnode(expr.program, '#', false, INTEGER, NULL, NULL);
  2411. (yyval.expr)->data.variable.symbol = (yyvsp[0].id);
  2412. }
  2413. #line 2684 "exparse.c"
  2414. break;
  2415. case 72:
  2416. #line 783 "../../lib/expr/exparse.y"
  2417. {
  2418. goto iunary;
  2419. }
  2420. #line 2692 "exparse.c"
  2421. break;
  2422. case 73:
  2423. #line 787 "../../lib/expr/exparse.y"
  2424. {
  2425. goto unary;
  2426. }
  2427. #line 2700 "exparse.c"
  2428. break;
  2429. case 74:
  2430. #line 791 "../../lib/expr/exparse.y"
  2431. {
  2432. (yyval.expr) = (yyvsp[0].expr);
  2433. }
  2434. #line 2708 "exparse.c"
  2435. break;
  2436. case 75:
  2437. #line 795 "../../lib/expr/exparse.y"
  2438. {
  2439. (yyval.expr) = exnewnode(expr.program, ADDRESS, false, T((yyvsp[0].expr)->type), (yyvsp[0].expr), NULL);
  2440. }
  2441. #line 2716 "exparse.c"
  2442. break;
  2443. case 76:
  2444. #line 799 "../../lib/expr/exparse.y"
  2445. {
  2446. (yyval.expr) = exnewnode(expr.program, ARRAY, true, T((yyvsp[-3].id)->type), call(0, (yyvsp[-3].id), (yyvsp[-1].expr)), (yyvsp[-1].expr));
  2447. }
  2448. #line 2724 "exparse.c"
  2449. break;
  2450. case 77:
  2451. #line 803 "../../lib/expr/exparse.y"
  2452. {
  2453. (yyval.expr) = exnewnode(expr.program, FUNCTION, true, T((yyvsp[-3].id)->type), call(0, (yyvsp[-3].id), (yyvsp[-1].expr)), (yyvsp[-1].expr));
  2454. }
  2455. #line 2732 "exparse.c"
  2456. break;
  2457. case 78:
  2458. #line 807 "../../lib/expr/exparse.y"
  2459. {
  2460. (yyval.expr) = exnewsub (expr.program, (yyvsp[-1].expr), GSUB);
  2461. }
  2462. #line 2740 "exparse.c"
  2463. break;
  2464. case 79:
  2465. #line 811 "../../lib/expr/exparse.y"
  2466. {
  2467. (yyval.expr) = exnewsub (expr.program, (yyvsp[-1].expr), SUB);
  2468. }
  2469. #line 2748 "exparse.c"
  2470. break;
  2471. case 80:
  2472. #line 815 "../../lib/expr/exparse.y"
  2473. {
  2474. (yyval.expr) = exnewsubstr (expr.program, (yyvsp[-1].expr));
  2475. }
  2476. #line 2756 "exparse.c"
  2477. break;
  2478. case 81:
  2479. #line 819 "../../lib/expr/exparse.y"
  2480. {
  2481. (yyval.expr) = exnewsplit (expr.program, (yyvsp[-5].id)->index, (yyvsp[-1].id), (yyvsp[-3].expr), NULL);
  2482. }
  2483. #line 2764 "exparse.c"
  2484. break;
  2485. case 82:
  2486. #line 823 "../../lib/expr/exparse.y"
  2487. {
  2488. (yyval.expr) = exnewsplit (expr.program, (yyvsp[-7].id)->index, (yyvsp[-3].id), (yyvsp[-5].expr), (yyvsp[-1].expr));
  2489. }
  2490. #line 2772 "exparse.c"
  2491. break;
  2492. case 83:
  2493. #line 827 "../../lib/expr/exparse.y"
  2494. {
  2495. if (!INTEGRAL((yyvsp[-1].expr)->type))
  2496. (yyvsp[-1].expr) = excast(expr.program, (yyvsp[-1].expr), INTEGER, NULL, 0);
  2497. (yyval.expr) = exnewnode(expr.program, EXIT, true, INTEGER, (yyvsp[-1].expr), NULL);
  2498. }
  2499. #line 2782 "exparse.c"
  2500. break;
  2501. case 84:
  2502. #line 833 "../../lib/expr/exparse.y"
  2503. {
  2504. (yyval.expr) = exnewnode(expr.program, RAND, false, FLOATING, NULL, NULL);
  2505. }
  2506. #line 2790 "exparse.c"
  2507. break;
  2508. case 85:
  2509. #line 837 "../../lib/expr/exparse.y"
  2510. {
  2511. (yyval.expr) = exnewnode(expr.program, SRAND, false, INTEGER, NULL, NULL);
  2512. }
  2513. #line 2798 "exparse.c"
  2514. break;
  2515. case 86:
  2516. #line 841 "../../lib/expr/exparse.y"
  2517. {
  2518. if (!INTEGRAL((yyvsp[-1].expr)->type))
  2519. (yyvsp[-1].expr) = excast(expr.program, (yyvsp[-1].expr), INTEGER, NULL, 0);
  2520. (yyval.expr) = exnewnode(expr.program, SRAND, true, INTEGER, (yyvsp[-1].expr), NULL);
  2521. }
  2522. #line 2808 "exparse.c"
  2523. break;
  2524. case 87:
  2525. #line 847 "../../lib/expr/exparse.y"
  2526. {
  2527. (yyval.expr) = exnewnode(expr.program, CALL, true, (yyvsp[-3].id)->type, NULL, (yyvsp[-1].expr));
  2528. (yyval.expr)->data.call.procedure = (yyvsp[-3].id);
  2529. }
  2530. #line 2817 "exparse.c"
  2531. break;
  2532. case 88:
  2533. #line 852 "../../lib/expr/exparse.y"
  2534. {
  2535. (yyval.expr) = exprint(expr.program, (yyvsp[-3].id), (yyvsp[-1].expr));
  2536. }
  2537. #line 2825 "exparse.c"
  2538. break;
  2539. case 89:
  2540. #line 856 "../../lib/expr/exparse.y"
  2541. {
  2542. (yyval.expr) = exnewnode(expr.program, (yyvsp[-3].id)->index, false, (yyvsp[-3].id)->type, NULL, NULL);
  2543. if ((yyvsp[-1].expr) && (yyvsp[-1].expr)->data.operand.left->type == INTEGER)
  2544. {
  2545. (yyval.expr)->data.print.descriptor = (yyvsp[-1].expr)->data.operand.left;
  2546. (yyvsp[-1].expr) = (yyvsp[-1].expr)->data.operand.right;
  2547. }
  2548. else
  2549. switch ((yyvsp[-3].id)->index)
  2550. {
  2551. case QUERY:
  2552. (yyval.expr)->data.print.descriptor = exnewnode(expr.program, CONSTANT, false, INTEGER, NULL, NULL);
  2553. (yyval.expr)->data.print.descriptor->data.constant.value.integer = 2;
  2554. break;
  2555. case PRINTF:
  2556. (yyval.expr)->data.print.descriptor = exnewnode(expr.program, CONSTANT, false, INTEGER, NULL, NULL);
  2557. (yyval.expr)->data.print.descriptor->data.constant.value.integer = 1;
  2558. break;
  2559. case SPRINTF:
  2560. (yyval.expr)->data.print.descriptor = 0;
  2561. break;
  2562. }
  2563. (yyval.expr)->data.print.args = preprint((yyvsp[-1].expr));
  2564. }
  2565. #line 2854 "exparse.c"
  2566. break;
  2567. case 90:
  2568. #line 881 "../../lib/expr/exparse.y"
  2569. {
  2570. Exnode_t* x;
  2571. (yyval.expr) = exnewnode(expr.program, (yyvsp[-3].id)->index, false, (yyvsp[-3].id)->type, NULL, NULL);
  2572. if ((yyvsp[-1].expr) && (yyvsp[-1].expr)->data.operand.left->type == INTEGER)
  2573. {
  2574. (yyval.expr)->data.scan.descriptor = (yyvsp[-1].expr)->data.operand.left;
  2575. (yyvsp[-1].expr) = (yyvsp[-1].expr)->data.operand.right;
  2576. }
  2577. else
  2578. switch ((yyvsp[-3].id)->index)
  2579. {
  2580. case SCANF:
  2581. (yyval.expr)->data.scan.descriptor = 0;
  2582. break;
  2583. case SSCANF:
  2584. if ((yyvsp[-1].expr) && (yyvsp[-1].expr)->data.operand.left->type == STRING)
  2585. {
  2586. (yyval.expr)->data.scan.descriptor = (yyvsp[-1].expr)->data.operand.left;
  2587. (yyvsp[-1].expr) = (yyvsp[-1].expr)->data.operand.right;
  2588. }
  2589. else
  2590. exerror("%s: string argument expected", (yyvsp[-3].id)->name);
  2591. break;
  2592. }
  2593. if (!(yyvsp[-1].expr) || !(yyvsp[-1].expr)->data.operand.left || (yyvsp[-1].expr)->data.operand.left->type != STRING)
  2594. exerror("%s: format argument expected", (yyvsp[-3].id)->name);
  2595. (yyval.expr)->data.scan.format = (yyvsp[-1].expr)->data.operand.left;
  2596. for (x = (yyval.expr)->data.scan.args = (yyvsp[-1].expr)->data.operand.right; x; x = x->data.operand.right)
  2597. {
  2598. if (x->data.operand.left->op != ADDRESS)
  2599. exerror("%s: address argument expected", (yyvsp[-3].id)->name);
  2600. x->data.operand.left = x->data.operand.left->data.operand.left;
  2601. }
  2602. }
  2603. #line 2894 "exparse.c"
  2604. break;
  2605. case 91:
  2606. #line 917 "../../lib/expr/exparse.y"
  2607. {
  2608. if ((yyvsp[0].expr))
  2609. {
  2610. if ((yyvsp[-1].expr)->op == ID && !expr.program->disc->setf)
  2611. exerror("%s: variable assignment not supported", (yyvsp[-1].expr)->data.variable.symbol->name);
  2612. else
  2613. {
  2614. if (!(yyvsp[-1].expr)->type)
  2615. (yyvsp[-1].expr)->type = (yyvsp[0].expr)->type;
  2616. else if ((yyvsp[0].expr)->type != (yyvsp[-1].expr)->type)
  2617. {
  2618. (yyvsp[0].expr)->type = (yyvsp[-1].expr)->type;
  2619. (yyvsp[0].expr)->data.operand.right = excast(expr.program, (yyvsp[0].expr)->data.operand.right, (yyvsp[-1].expr)->type, NULL, 0);
  2620. }
  2621. (yyvsp[0].expr)->data.operand.left = (yyvsp[-1].expr);
  2622. (yyval.expr) = (yyvsp[0].expr);
  2623. }
  2624. }
  2625. }
  2626. #line 2918 "exparse.c"
  2627. break;
  2628. case 92:
  2629. #line 937 "../../lib/expr/exparse.y"
  2630. {
  2631. pre:
  2632. if ((yyvsp[0].expr)->type == STRING)
  2633. exerror("++ and -- invalid for string variables");
  2634. (yyval.expr) = exnewnode(expr.program, (yyvsp[-1].op), false, (yyvsp[0].expr)->type, (yyvsp[0].expr), NULL);
  2635. (yyval.expr)->subop = PRE;
  2636. }
  2637. #line 2930 "exparse.c"
  2638. break;
  2639. case 93:
  2640. #line 945 "../../lib/expr/exparse.y"
  2641. {
  2642. pos:
  2643. if ((yyvsp[-1].expr)->type == STRING)
  2644. exerror("++ and -- invalid for string variables");
  2645. (yyval.expr) = exnewnode(expr.program, (yyvsp[0].op), false, (yyvsp[-1].expr)->type, (yyvsp[-1].expr), NULL);
  2646. (yyval.expr)->subop = POS;
  2647. }
  2648. #line 2942 "exparse.c"
  2649. break;
  2650. case 94:
  2651. #line 953 "../../lib/expr/exparse.y"
  2652. {
  2653. if ((yyvsp[0].id)->local == NULL)
  2654. exerror("cannot apply IN to non-array %s", (yyvsp[0].id)->name);
  2655. if (((yyvsp[0].id)->index_type > 0) && ((yyvsp[-2].expr)->type != (yyvsp[0].id)->index_type))
  2656. exerror("%s indices must have type %s, not %s",
  2657. (yyvsp[0].id)->name, extypename(expr.program, (yyvsp[0].id)->index_type),extypename(expr.program, (yyvsp[-2].expr)->type));
  2658. (yyval.expr) = exnewnode(expr.program, IN_OP, false, INTEGER, NULL, NULL);
  2659. (yyval.expr)->data.variable.symbol = (yyvsp[0].id);
  2660. (yyval.expr)->data.variable.index = (yyvsp[-2].expr);
  2661. }
  2662. #line 2957 "exparse.c"
  2663. break;
  2664. case 95:
  2665. #line 964 "../../lib/expr/exparse.y"
  2666. {
  2667. goto pre;
  2668. }
  2669. #line 2965 "exparse.c"
  2670. break;
  2671. case 96:
  2672. #line 968 "../../lib/expr/exparse.y"
  2673. {
  2674. goto pos;
  2675. }
  2676. #line 2973 "exparse.c"
  2677. break;
  2678. case 100:
  2679. #line 978 "../../lib/expr/exparse.y"
  2680. {
  2681. (yyval.expr) = exnewnode(expr.program, CONSTANT, false, (yyvsp[0].id)->type, NULL, NULL);
  2682. if (!expr.program->disc->reff)
  2683. exerror("%s: identifier references not supported", (yyvsp[0].id)->name);
  2684. else
  2685. (yyval.expr)->data.constant.value = expr.program->disc->reff(expr.program, (yyval.expr), (yyvsp[0].id), NULL);
  2686. }
  2687. #line 2985 "exparse.c"
  2688. break;
  2689. case 101:
  2690. #line 986 "../../lib/expr/exparse.y"
  2691. {
  2692. (yyval.expr) = exnewnode(expr.program, CONSTANT, false, FLOATING, NULL, NULL);
  2693. (yyval.expr)->data.constant.value.floating = (yyvsp[0].floating);
  2694. }
  2695. #line 2994 "exparse.c"
  2696. break;
  2697. case 102:
  2698. #line 991 "../../lib/expr/exparse.y"
  2699. {
  2700. (yyval.expr) = exnewnode(expr.program, CONSTANT, false, INTEGER, NULL, NULL);
  2701. (yyval.expr)->data.constant.value.integer = (yyvsp[0].integer);
  2702. }
  2703. #line 3003 "exparse.c"
  2704. break;
  2705. case 103:
  2706. #line 996 "../../lib/expr/exparse.y"
  2707. {
  2708. (yyval.expr) = exnewnode(expr.program, CONSTANT, false, STRING, NULL, NULL);
  2709. (yyval.expr)->data.constant.value.string = (yyvsp[0].string);
  2710. }
  2711. #line 3012 "exparse.c"
  2712. break;
  2713. case 104:
  2714. #line 1001 "../../lib/expr/exparse.y"
  2715. {
  2716. (yyval.expr) = exnewnode(expr.program, CONSTANT, false, UNSIGNED, NULL, NULL);
  2717. (yyval.expr)->data.constant.value.integer = (yyvsp[0].integer);
  2718. }
  2719. #line 3021 "exparse.c"
  2720. break;
  2721. case 110:
  2722. #line 1017 "../../lib/expr/exparse.y"
  2723. {
  2724. (yyval.expr) = makeVar(expr.program, (yyvsp[-1].id), 0, 0, (yyvsp[0].reference));
  2725. }
  2726. #line 3029 "exparse.c"
  2727. break;
  2728. case 111:
  2729. #line 1021 "../../lib/expr/exparse.y"
  2730. {
  2731. Exnode_t *n = exnewnode(expr.program, DYNAMIC, false, (yyvsp[-2].id)->type, NULL, NULL);
  2732. n->data.variable.symbol = (yyvsp[-2].id);
  2733. n->data.variable.reference = 0;
  2734. if (((n->data.variable.index = (yyvsp[-1].expr)) == 0) != ((yyvsp[-2].id)->local == NULL))
  2735. exerror("%s: is%s an array", (yyvsp[-2].id)->name, (yyvsp[-2].id)->local != NULL ? "" : " not");
  2736. if ((yyvsp[-2].id)->local != NULL && ((yyvsp[-2].id)->index_type > 0)) {
  2737. if ((yyvsp[-1].expr)->type != (yyvsp[-2].id)->index_type)
  2738. exerror("%s: indices must have type %s, not %s",
  2739. (yyvsp[-2].id)->name, extypename(expr.program, (yyvsp[-2].id)->index_type),extypename(expr.program, (yyvsp[-1].expr)->type));
  2740. }
  2741. if ((yyvsp[0].reference)) {
  2742. n->data.variable.dyna = exnewnode(expr.program, 0, false, 0, NULL, NULL);
  2743. (yyval.expr) = makeVar(expr.program, (yyvsp[-2].id), (yyvsp[-1].expr), n, (yyvsp[0].reference));
  2744. }
  2745. else (yyval.expr) = n;
  2746. }
  2747. #line 3051 "exparse.c"
  2748. break;
  2749. case 112:
  2750. #line 1039 "../../lib/expr/exparse.y"
  2751. {
  2752. (yyval.expr) = exnewnode(expr.program, ID, false, STRING, NULL, NULL);
  2753. (yyval.expr)->data.variable.symbol = (yyvsp[0].id);
  2754. (yyval.expr)->data.variable.reference = 0;
  2755. (yyval.expr)->data.variable.index = 0;
  2756. (yyval.expr)->data.variable.dyna = 0;
  2757. if (!(expr.program->disc->flags & EX_UNDECLARED))
  2758. exerror("unknown identifier");
  2759. }
  2760. #line 3065 "exparse.c"
  2761. break;
  2762. case 113:
  2763. #line 1051 "../../lib/expr/exparse.y"
  2764. {
  2765. (yyval.integer) = 0;
  2766. }
  2767. #line 3073 "exparse.c"
  2768. break;
  2769. case 114:
  2770. #line 1055 "../../lib/expr/exparse.y"
  2771. {
  2772. (yyval.integer) = -1;
  2773. }
  2774. #line 3081 "exparse.c"
  2775. break;
  2776. case 115:
  2777. #line 1059 "../../lib/expr/exparse.y"
  2778. {
  2779. /* If DECLARE is VOID, its type is 0, so this acts like
  2780. * the empty case.
  2781. */
  2782. if (INTEGRAL((yyvsp[-1].id)->type))
  2783. (yyval.integer) = INTEGER;
  2784. else
  2785. (yyval.integer) = (yyvsp[-1].id)->type;
  2786. }
  2787. #line 3096 "exparse.c"
  2788. break;
  2789. case 116:
  2790. #line 1072 "../../lib/expr/exparse.y"
  2791. {
  2792. (yyval.expr) = 0;
  2793. }
  2794. #line 3104 "exparse.c"
  2795. break;
  2796. case 117:
  2797. #line 1076 "../../lib/expr/exparse.y"
  2798. {
  2799. (yyval.expr) = (yyvsp[-1].expr);
  2800. }
  2801. #line 3112 "exparse.c"
  2802. break;
  2803. case 118:
  2804. #line 1082 "../../lib/expr/exparse.y"
  2805. {
  2806. (yyval.expr) = 0;
  2807. }
  2808. #line 3120 "exparse.c"
  2809. break;
  2810. case 119:
  2811. #line 1086 "../../lib/expr/exparse.y"
  2812. {
  2813. (yyval.expr) = (yyvsp[0].expr)->data.operand.left;
  2814. (yyvsp[0].expr)->data.operand.left = (yyvsp[0].expr)->data.operand.right = 0;
  2815. exfreenode(expr.program, (yyvsp[0].expr));
  2816. }
  2817. #line 3130 "exparse.c"
  2818. break;
  2819. case 120:
  2820. #line 1094 "../../lib/expr/exparse.y"
  2821. {
  2822. (yyval.expr) = exnewnode(expr.program, ',', true, 0, exnewnode(expr.program, ',', true, (yyvsp[0].expr)->type, (yyvsp[0].expr), NULL), NULL);
  2823. (yyval.expr)->data.operand.right = (yyval.expr)->data.operand.left;
  2824. }
  2825. #line 3139 "exparse.c"
  2826. break;
  2827. case 121:
  2828. #line 1099 "../../lib/expr/exparse.y"
  2829. {
  2830. (yyvsp[-2].expr)->data.operand.right = (yyvsp[-2].expr)->data.operand.right->data.operand.right = exnewnode(expr.program, ',', true, (yyvsp[-2].expr)->type, (yyvsp[0].expr), NULL);
  2831. }
  2832. #line 3147 "exparse.c"
  2833. break;
  2834. case 122:
  2835. #line 1105 "../../lib/expr/exparse.y"
  2836. {
  2837. (yyval.expr) = 0;
  2838. }
  2839. #line 3155 "exparse.c"
  2840. break;
  2841. case 123:
  2842. #line 1109 "../../lib/expr/exparse.y"
  2843. {
  2844. (yyval.expr) = 0;
  2845. if ((yyvsp[0].id)->type)
  2846. exerror("(void) expected");
  2847. }
  2848. #line 3165 "exparse.c"
  2849. break;
  2850. case 125:
  2851. #line 1118 "../../lib/expr/exparse.y"
  2852. {
  2853. (yyval.expr) = exnewnode(expr.program, ',', true, (yyvsp[0].expr)->type, (yyvsp[0].expr), NULL);
  2854. }
  2855. #line 3173 "exparse.c"
  2856. break;
  2857. case 126:
  2858. #line 1122 "../../lib/expr/exparse.y"
  2859. {
  2860. Exnode_t* x;
  2861. Exnode_t* y;
  2862. (yyval.expr) = (yyvsp[-2].expr);
  2863. for (x = (yyvsp[-2].expr); (y = x->data.operand.right); x = y);
  2864. x->data.operand.right = exnewnode(expr.program, ',', true, (yyvsp[0].expr)->type, (yyvsp[0].expr), NULL);
  2865. }
  2866. #line 3186 "exparse.c"
  2867. break;
  2868. case 127:
  2869. #line 1132 "../../lib/expr/exparse.y"
  2870. {expr.declare=(yyvsp[0].id)->type;}
  2871. #line 3192 "exparse.c"
  2872. break;
  2873. case 128:
  2874. #line 1133 "../../lib/expr/exparse.y"
  2875. {
  2876. if ((yyvsp[-2].id)->type == 0) {
  2877. exerror("%s: parameters to functions cannot be void typed", (yyvsp[0].id)->name);
  2878. }
  2879. (yyval.expr) = exnewnode(expr.program, ID, false, (yyvsp[-2].id)->type, NULL, NULL);
  2880. (yyval.expr)->data.variable.symbol = (yyvsp[0].id);
  2881. (yyvsp[0].id)->lex = DYNAMIC;
  2882. (yyvsp[0].id)->type = (yyvsp[-2].id)->type;
  2883. (yyvsp[0].id)->value = exnewnode(expr.program, 0, false, 0, NULL, NULL);
  2884. expr.procedure->data.procedure.arity++;
  2885. expr.declare = 0;
  2886. }
  2887. #line 3209 "exparse.c"
  2888. break;
  2889. case 129:
  2890. #line 1148 "../../lib/expr/exparse.y"
  2891. {
  2892. (yyval.reference) = expr.refs = 0;
  2893. }
  2894. #line 3217 "exparse.c"
  2895. break;
  2896. case 130:
  2897. #line 1152 "../../lib/expr/exparse.y"
  2898. {
  2899. Exref_t* r;
  2900. r = ALLOCATE(expr.program, Exref_t);
  2901. *r = (Exref_t){0};
  2902. r->symbol = (yyvsp[0].id);
  2903. expr.refs = r;
  2904. r->next = 0;
  2905. r->index = 0;
  2906. (yyval.reference) = expr.refs;
  2907. }
  2908. #line 3233 "exparse.c"
  2909. break;
  2910. case 131:
  2911. #line 1164 "../../lib/expr/exparse.y"
  2912. {
  2913. Exref_t* r;
  2914. Exref_t* l;
  2915. r = ALLOCATE(expr.program, Exref_t);
  2916. *r = (Exref_t){0};
  2917. r->symbol = (yyvsp[0].id);
  2918. r->index = 0;
  2919. r->next = 0;
  2920. l = ALLOCATE(expr.program, Exref_t);
  2921. *l = (Exref_t){0};
  2922. l->symbol = (yyvsp[-1].id);
  2923. l->index = 0;
  2924. l->next = r;
  2925. expr.refs = l;
  2926. (yyval.reference) = expr.refs;
  2927. }
  2928. #line 3255 "exparse.c"
  2929. break;
  2930. case 132:
  2931. #line 1184 "../../lib/expr/exparse.y"
  2932. {
  2933. (yyval.id) = (yyvsp[0].id);
  2934. }
  2935. #line 3263 "exparse.c"
  2936. break;
  2937. case 133:
  2938. #line 1188 "../../lib/expr/exparse.y"
  2939. {
  2940. (yyval.id) = (yyvsp[0].id);
  2941. }
  2942. #line 3271 "exparse.c"
  2943. break;
  2944. case 134:
  2945. #line 1193 "../../lib/expr/exparse.y"
  2946. {
  2947. (yyval.expr) = 0;
  2948. }
  2949. #line 3279 "exparse.c"
  2950. break;
  2951. case 135:
  2952. #line 1197 "../../lib/expr/exparse.y"
  2953. {
  2954. (yyval.expr) = exnewnode(expr.program, '=', true, (yyvsp[0].expr)->type, NULL, (yyvsp[0].expr));
  2955. (yyval.expr)->subop = (yyvsp[-1].op);
  2956. }
  2957. #line 3288 "exparse.c"
  2958. break;
  2959. case 137:
  2960. #line 1204 "../../lib/expr/exparse.y"
  2961. {
  2962. if (expr.procedure)
  2963. exerror("%s: nested function definitions not supported", expr.id->name);
  2964. expr.procedure = exnewnode(expr.program, PROCEDURE, true, expr.declare, NULL, NULL);
  2965. if (!streq(expr.id->name, "begin"))
  2966. {
  2967. static Dtdisc_t disc = {.key = offsetof(Exid_t, name)};
  2968. if (!(expr.procedure->data.procedure.frame = dtopen(&disc, Dtset)) || !dtview(expr.procedure->data.procedure.frame, expr.program->symbols))
  2969. exnospace();
  2970. expr.program->symbols = expr.program->frame = expr.procedure->data.procedure.frame;
  2971. }
  2972. expr.declare = 0;
  2973. }
  2974. #line 3306 "exparse.c"
  2975. break;
  2976. case 138:
  2977. #line 1216 "../../lib/expr/exparse.y"
  2978. {
  2979. expr.id->lex = PROCEDURE;
  2980. expr.id->type = expr.procedure->type;
  2981. expr.declare = 0;
  2982. }
  2983. #line 3316 "exparse.c"
  2984. break;
  2985. case 139:
  2986. #line 1221 "../../lib/expr/exparse.y"
  2987. {
  2988. (yyval.expr) = expr.procedure;
  2989. expr.procedure = 0;
  2990. if (expr.program->frame)
  2991. {
  2992. expr.program->symbols = expr.program->frame->view;
  2993. dtview(expr.program->frame, NULL);
  2994. expr.program->frame = 0;
  2995. }
  2996. (yyval.expr)->data.operand.left = (yyvsp[-5].expr);
  2997. (yyval.expr)->data.operand.right = excast(expr.program, (yyvsp[-1].expr), (yyval.expr)->type, NULL, 0);
  2998. /*
  2999. * NOTE: procedure definition was slipped into the
  3000. * declaration initializer statement production,
  3001. * therefore requiring the statement terminator
  3002. */
  3003. exunlex(expr.program, ';');
  3004. }
  3005. #line 3341 "exparse.c"
  3006. break;
  3007. #line 3345 "exparse.c"
  3008. default: break;
  3009. }
  3010. /* User semantic actions sometimes alter yychar, and that requires
  3011. that yytoken be updated with the new translation. We take the
  3012. approach of translating immediately before every use of yytoken.
  3013. One alternative is translating here after every semantic action,
  3014. but that translation would be missed if the semantic action invokes
  3015. YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
  3016. if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
  3017. incorrect destructor might then be invoked immediately. In the
  3018. case of YYERROR or YYBACKUP, subsequent parser actions might lead
  3019. to an incorrect destructor call or verbose syntax error message
  3020. before the lookahead is translated. */
  3021. YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
  3022. YYPOPSTACK (yylen);
  3023. yylen = 0;
  3024. YY_STACK_PRINT (yyss, yyssp);
  3025. *++yyvsp = yyval;
  3026. /* Now 'shift' the result of the reduction. Determine what state
  3027. that goes to, based on the state we popped back to and the rule
  3028. number reduced by. */
  3029. {
  3030. const int yylhs = yyr1[yyn] - YYNTOKENS;
  3031. const int yyi = yypgoto[yylhs] + *yyssp;
  3032. yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
  3033. ? yytable[yyi]
  3034. : yydefgoto[yylhs]);
  3035. }
  3036. goto yynewstate;
  3037. /*--------------------------------------.
  3038. | yyerrlab -- here on detecting error. |
  3039. `--------------------------------------*/
  3040. yyerrlab:
  3041. /* Make sure we have latest lookahead translation. See comments at
  3042. user semantic actions for why this is necessary. */
  3043. yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
  3044. /* If not already recovering from an error, report this error. */
  3045. if (!yyerrstatus)
  3046. {
  3047. ++yynerrs;
  3048. #if ! YYERROR_VERBOSE
  3049. yyerror (YY_("syntax error"));
  3050. #else
  3051. # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
  3052. yyssp, yytoken)
  3053. {
  3054. char const *yymsgp = YY_("syntax error");
  3055. int yysyntax_error_status;
  3056. yysyntax_error_status = YYSYNTAX_ERROR;
  3057. if (yysyntax_error_status == 0)
  3058. yymsgp = yymsg;
  3059. else if (yysyntax_error_status == 1)
  3060. {
  3061. if (yymsg != yymsgbuf)
  3062. YYSTACK_FREE (yymsg);
  3063. yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
  3064. if (!yymsg)
  3065. {
  3066. yymsg = yymsgbuf;
  3067. yymsg_alloc = sizeof yymsgbuf;
  3068. yysyntax_error_status = 2;
  3069. }
  3070. else
  3071. {
  3072. yysyntax_error_status = YYSYNTAX_ERROR;
  3073. yymsgp = yymsg;
  3074. }
  3075. }
  3076. yyerror (yymsgp);
  3077. if (yysyntax_error_status == 2)
  3078. goto yyexhaustedlab;
  3079. }
  3080. # undef YYSYNTAX_ERROR
  3081. #endif
  3082. }
  3083. if (yyerrstatus == 3)
  3084. {
  3085. /* If just tried and failed to reuse lookahead token after an
  3086. error, discard it. */
  3087. if (yychar <= YYEOF)
  3088. {
  3089. /* Return failure if at end of input. */
  3090. if (yychar == YYEOF)
  3091. YYABORT;
  3092. }
  3093. else
  3094. {
  3095. yydestruct ("Error: discarding",
  3096. yytoken, &yylval);
  3097. yychar = YYEMPTY;
  3098. }
  3099. }
  3100. /* Else will try to reuse lookahead token after shifting the error
  3101. token. */
  3102. goto yyerrlab1;
  3103. /*---------------------------------------------------.
  3104. | yyerrorlab -- error raised explicitly by YYERROR. |
  3105. `---------------------------------------------------*/
  3106. yyerrorlab:
  3107. /* Pacify compilers when the user code never invokes YYERROR and the
  3108. label yyerrorlab therefore never appears in user code. */
  3109. if (0)
  3110. YYERROR;
  3111. /* Do not reclaim the symbols of the rule whose action triggered
  3112. this YYERROR. */
  3113. YYPOPSTACK (yylen);
  3114. yylen = 0;
  3115. YY_STACK_PRINT (yyss, yyssp);
  3116. yystate = *yyssp;
  3117. goto yyerrlab1;
  3118. /*-------------------------------------------------------------.
  3119. | yyerrlab1 -- common code for both syntax error and YYERROR. |
  3120. `-------------------------------------------------------------*/
  3121. yyerrlab1:
  3122. yyerrstatus = 3; /* Each real token shifted decrements this. */
  3123. for (;;)
  3124. {
  3125. yyn = yypact[yystate];
  3126. if (!yypact_value_is_default (yyn))
  3127. {
  3128. yyn += YYTERROR;
  3129. if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  3130. {
  3131. yyn = yytable[yyn];
  3132. if (0 < yyn)
  3133. break;
  3134. }
  3135. }
  3136. /* Pop the current state because it cannot handle the error token. */
  3137. if (yyssp == yyss)
  3138. YYABORT;
  3139. yydestruct ("Error: popping",
  3140. yystos[yystate], yyvsp);
  3141. YYPOPSTACK (1);
  3142. yystate = *yyssp;
  3143. YY_STACK_PRINT (yyss, yyssp);
  3144. }
  3145. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  3146. *++yyvsp = yylval;
  3147. YY_IGNORE_MAYBE_UNINITIALIZED_END
  3148. /* Shift the error token. */
  3149. YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
  3150. yystate = yyn;
  3151. goto yynewstate;
  3152. /*-------------------------------------.
  3153. | yyacceptlab -- YYACCEPT comes here. |
  3154. `-------------------------------------*/
  3155. yyacceptlab:
  3156. yyresult = 0;
  3157. goto yyreturn;
  3158. /*-----------------------------------.
  3159. | yyabortlab -- YYABORT comes here. |
  3160. `-----------------------------------*/
  3161. yyabortlab:
  3162. yyresult = 1;
  3163. goto yyreturn;
  3164. #if !defined yyoverflow || YYERROR_VERBOSE
  3165. /*-------------------------------------------------.
  3166. | yyexhaustedlab -- memory exhaustion comes here. |
  3167. `-------------------------------------------------*/
  3168. yyexhaustedlab:
  3169. yyerror (YY_("memory exhausted"));
  3170. yyresult = 2;
  3171. /* Fall through. */
  3172. #endif
  3173. /*-----------------------------------------------------.
  3174. | yyreturn -- parsing is finished, return the result. |
  3175. `-----------------------------------------------------*/
  3176. yyreturn:
  3177. if (yychar != YYEMPTY)
  3178. {
  3179. /* Make sure we have latest lookahead translation. See comments at
  3180. user semantic actions for why this is necessary. */
  3181. yytoken = YYTRANSLATE (yychar);
  3182. yydestruct ("Cleanup: discarding lookahead",
  3183. yytoken, &yylval);
  3184. }
  3185. /* Do not reclaim the symbols of the rule whose action triggered
  3186. this YYABORT or YYACCEPT. */
  3187. YYPOPSTACK (yylen);
  3188. YY_STACK_PRINT (yyss, yyssp);
  3189. while (yyssp != yyss)
  3190. {
  3191. yydestruct ("Cleanup: popping",
  3192. yystos[+*yyssp], yyvsp);
  3193. YYPOPSTACK (1);
  3194. }
  3195. #ifndef yyoverflow
  3196. if (yyss != yyssa)
  3197. YYSTACK_FREE (yyss);
  3198. #endif
  3199. #if YYERROR_VERBOSE
  3200. if (yymsg != yymsgbuf)
  3201. YYSTACK_FREE (yymsg);
  3202. #endif
  3203. return yyresult;
  3204. }
  3205. #line 1243 "../../lib/expr/exparse.y"
  3206. const char *exop(size_t index) {
  3207. /* yytname is generated by the %token-table directive */
  3208. /* find the index of MINTOKEN */
  3209. size_t minid;
  3210. for (minid = 0; yytname[minid] != NULL; ++minid) {
  3211. if (strcmp(yytname[minid], "MINTOKEN") == 0) {
  3212. break;
  3213. }
  3214. }
  3215. assert(yytname[minid] != NULL
  3216. && "failed to find MINTOKEN; incorrect token list in exparse.y?");
  3217. /* find the requested token */
  3218. {
  3219. size_t i, j;
  3220. for (i = j = minid; yytname[i] != NULL; ++i) {
  3221. /* if this token is not a word, skip it */
  3222. {
  3223. size_t k;
  3224. for (k = 0; yytname[i][k] != '\0'; ++k) {
  3225. if (yytname[i][k] != '_' && !gv_isalnum(yytname[i][k])) {
  3226. break;
  3227. }
  3228. }
  3229. if (yytname[i][k] != '\0') {
  3230. continue;
  3231. }
  3232. }
  3233. if (j == index + minid) {
  3234. return yytname[i];
  3235. }
  3236. ++j;
  3237. }
  3238. }
  3239. /* failed to find the requested token */
  3240. return NULL;
  3241. }
  3242. void ex_error(const char *message) {
  3243. exerror("%s", message);
  3244. }
  3245. #include <expr/exgram.h>