main.351fa5be475052d189cc.js 1.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["ivprogCore"] = factory();
  8. else
  9. root["ivprogCore"] = factory();
  10. })(self, function() {
  11. return /******/ (() => { // webpackBootstrap
  12. /******/ var __webpack_modules__ = ({
  13. /***/ "./i18n/error.csv":
  14. /*!************************!*\
  15. !*** ./i18n/error.csv ***!
  16. \************************/
  17. /***/ ((module) => {
  18. module.exports = {"pt":{"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 declarada na linha $2 deve retornar $1.","invalid_var_declaration":"Erro na linha $0: variáveis só podem ser declaradas no corpo principal da função e nas primeiras linhas, antes de qualquer comando.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do laço de repetição deve ser do tipo lógico","loop_condition_type":"A condição $0 do laço de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do comando se...senao deve ser do tipo lógico","if_condition_type":"A condição $0 do comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: O número de elementos $1 é inválido para a vetor $2 que possui $3 elementos.","vector_line_outbounds":"O número de elementos $1 é inválido para a vetor $2 que possui $3 elementos.","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$0 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: a expressão $1 é inválida, pois o operador $2 não pode ser aplicado aos tipos $3 e $4","invalid_infix_op":"A expressão $0 é inválida, pois o operador $1 não pode ser aplicado aos tipos $2 e $3","invalid_unary_op_full":"Erro na linha $0: a expressão $1 é inválida, pois o operador $2 não pode ser aplicado ao tipo $3","invalid_unary_op":"A expressão $0 é inválida, pois o operador $1 não pode ser aplicado ao tipo $2","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões do arranjo (vetor ou matriz) na linha $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um arranjo (vetor ou matriz) devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões do arranjo (vetor ou matriz) na linha $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um arranjo (vetor ou matriz) devem ser valores positivos.","incompatible_types_full":"Era esperado um $0 mas a expressão $1 na linha $2 resulta em $3.","incompatible_types":"Era esperado um $0 mas a expressão $1 resulta em $2.","incompatible_types_array_full":"A expressão $0 na linha $2 é incompatível com o tipo $1.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um comando de devolução acessível. Toda função deve ter ao menos um comando 'devolva' no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.","test_case_few_reads":"Caso de teste $0 falhou: ainda restam entradas!","test_case_failed":"<div class='assessment-div-detail' onClick='ivprogCore.openAssessmentDetail(event)' data-page=\"$1\"> <span>Caso de teste $0 não executou com sucesso.</span></div>","test_case_failed_exception":"<div class='assessment-div-detail' onClick='ivprogCore.openAssessmentDetail(event)' data-page=\"$2\"> <span>Caso de teste $0 falhou</span>: $1","test_case_exception":"Ocorreu uma exceção no caso de teste $0: $1","invalid_type_conversion":"O valor $0 não pode ser convertido para o tipo $1","invalid_read_type":"Erro na linha $0: A entrada \"$1\" não é do tipo $2, que é o tipo da variável <span class='ivprog-error-varname'>$3</span>.","invalid_read_type_array":"Erro na linha $0: A entrada \"$1\" não é do tipo $2, que é o tipo aceito pela variável <span class='ivprog-error-varname'>$3</span> que é um $4.","inform_valid_identifier":"Informe um nome válido! O nome não pode ser uma palavra reservadas e deve começar com letras ou _ e conter apenas letras, números e _.","inform_valid_global_duplicated":"Já existe uma variável global com o nome <span class='ivprog-error-varname'>$0</span>, você precisa de nomes distintos.","inform_valid_variable_duplicated":"Já existe uma variável com o nome <span class='ivprog-error-varname'>$0</span> na função <span class='ivprog-error-varname'>$1</span>, você precisa de nomes distintos.","inform_valid_function_duplicated":"Já existe uma função com o nome <span class='ivprog-error-varname'>$0</span>, você precisa de nomes distintos.","inform_valid_param_duplicated":"Já existe um parâmetro com o nome <span class='ivprog-error-varname'>$0</span> na função <span class='ivprog-error-varname'>$1</span>, você precisa de nomes distintos.","invalid_character":"O caractere $0 na linha $1 não pode ser utilizado neste contexto.","invalid_syntax":"O iVProg não reconhece o texto $0 na linha $1. Certifique-se que não há erro de digitação ou caractere inválido.","annonymous_array_literal":"Erro na linha $0: a notação de vetor/matriz só permitida durante a inicialização de uma variável desse tipo. Ex: inteiro vec[3] ← {1,2,3}.","invalid_matrix_literal_line":"A expressão $0 na linha $1 não possui um número de elementos igual a linha anterior. Todas as linhas de uma matriz devem ter a mesma quantidade de elementos.","cannot_infer_matrix_line":"Não é possível inferir o número de linhas da matriz $0 na linha $1. É necessário que ela seja inicializada ou que o valor seja informado de forma explícita.","cannot_infer_matrix_column":"Não é possível inferir o número de colunas da matriz $0 na linha $1. É necessário que ela seja inicializada ou que o valor seja informado de forma explícita.","cannot_infer_vector_size":"Não é possível inferir o número de elementos do vetor $0 na linha $1. É necessário que ele seja inicializado ou que o valor seja informado de forma explícita","matrix_to_vector_literal_attr":"Erro na linha $0: A expressão $1 representa uma matriz e não pode ser atribuída ao vetor $2.","vector_to_matrix_literal_attr":"Erro na linha $0: A expressão $1 representa um vetor e não pode ser atribuído a matriz $2.","invalid_const_ref_full":"A variável $0 fornecida como parâmetro para a função $1 na linha $2 é uma constante e não pode ser usada neste contexto. Use uma variável ou posição de vetor.","invalid_const_ref":"A variável $0 fornecida como parâmetro para a função $1 é uma constante e não pode ser usada neste contexto. Use uma variável ou posição de vetor.","invalid_const_assignment_full":"Erro na linha $0: $1 é uma constante e portanto não pode ter seu valor alterado","invalid_const_assignment":"$0 é uma constante e portanto não pode ter seu valor alterado","array_init_not_literal":"Erro na linha $0: Vetor/Matriz só pode ser inicializado por literal. Ex: real vetor[] <- {1,2,3}","array_exceeds_2d":"Erro na linha $0: O número máximo de dimensões que um arranjo pode ter é 2. Elemento de 3 ou mais dimensões encontrado!","invalid_matrix_id_dimension":"Erro na linha $0: Você deve definir todas as dimensões da matriz quando uma delas é definida por uma variável! Ex: real mat1[var][5], mat2[5][var]","invalid_vector_init":"Erro na linha $0: Não se pode inicializar um vetor que teve seu tamanho declarado utilizando uma variável! Utilize uma atribuição de vetores ou use um laço de repetição.","invalid_matrix_init":"Erro na linha $0: Não se pode inicializar uma matrix que teve ao menos uma das suas dimensões declaradas utilizando uma variável! Utilize uma atribuição de matrizes ou use um laço de repetição.","invalid_vector_assignment_full":"Erro na linha $0: Só se pode atribuir um vetor a outro desde que eles comportem o mesmo número de elementos. $1 comporta $2 e $3 comporta $4!","invalid_vector_assignment":"Só se pode atribuir um vetor a outro desde que eles comportem o mesmo número de elementos. $0 comporta $1 e $2 comporta $3!","invalid_matrix_assignment_full":"Erro na linha $0: Só se pode atribuir uma matriz a outra desde que ambas possuam dimensões de mesmo tamanho. $1 tem $2 linhas e $3 colunas, enquanto $4 possui $5 linhas e $6 colunas!","invalid_matrix_assignment":"Só se pode atribuir uma matriz a outra desde que ambas possuam dimensões de mesmo tamanho. $0 tem $1 linhas e $2 colunas, enquanto $3 possui $4 linhas e $5 colunas!","matrix_to_vector_attr":"Erro na linha $0: $1 representa uma matriz e não pode ser atribuída ao vetor $2.","vector_to_matrix_attr":"Erro na linha $0: $1 representa um vetor e não pode ser atribuído a matriz $2.","invalid_matrix_index_assign_full":"Erro na linha $0: A posição $1 da matriz $2 aceita apenas vetores de tamanho $3, mas $4 tem tamanho $5","invalid_matrix_index_assign":"A linha $0 da matriz $1 aceita apenas vetores de tamanho $2, mas $3 tem tamanho $4","invalid_number_elements_vector":"Esperava-se por $0 elementos na linha $1 mas a expressão $2 possui $3 elementos.","invalid_number_lines_matrix":"Esperava-se por uma matriz com $0 linhas na linha $1 mas a expressão $2 possui $3 linhas","divsion_by_zero_full":"Erro na linha $0: A expressão $1 resulta em uma divisão por 0.","divsion_by_zero":"A expressão $0 resulta em uma divisão por 0.","undefined_tanget_value":"Erro na linha $0: A tangente de $1° não é indefinida.","negative_log_value":"Erro na linha $0: Não se pode calcular o log de um valor negativo.","invalid_string_index":"Erro na linha $0 durante a execução da função $1: $2 é um índice inválido para a cadeia de texto $3. Os valores válidos vão de 0 à $4","negative_sqrt_value":"Erro na linha $0: Não é permitido calcular a raiz quadrada de um número negativo.","exceeded_recursive_calls":"Erro na execução da linha $0: Número de chamadas recursivas execedeu o limite máximo definido!","invalid_for_variable":"Erro na linha $0: A variavel $1 utilizada no comando repita_para deve ser do tipo inteiro.","invalid_for_from":"Erro na linha $0: O valor $1 passado para o parâmetro 'de' do comando repita_para deve ser do tipo inteiro.","invalid_for_to":"Erro na linha $0: O valor $1 passado para o parâmetro 'para' do comando repita_para deve ser do tipo inteiro.","invalid_for_pass":"Erro na linha $0: O valor $1 passado para o parâmetro 'passo' do comando repita_para deve ser do tipo inteiro.","exceed_max_instructions":"Número de instruções excedeu o limite definido. Certifique-se que seu código não possui laços infinitos ou muitas chamadas de funções recursivas."},"en":{"token_missing_one":"Syntax error: Expected $0 but found $1 at line:$2, column:$3","token_missing_two":"Syntax error: Expected $0 or $1 but found $2 at line:$3, column: $4","eos_missing":"A new line or a ‘;’ is missing at line: $0, column: $1","invalid_type":"$0 at line: $1, column: $2 is a invalid type. The valid types are: $3","invalid_array_dimension":"Invalid dimension at line: $0, column: $1. Insert a $2 or a valid identifier of the same type.","invalid_array_size":"The array at line $0 exceeds the maximum size of 2.","extra_lines":"No text is allowed after '}' in 'program { … }'","invalid_main_return":"The function $0 declared at line $2 must return $1.","invalid_var_declaration":"Error at line $0: Variables can only be declared in the main body of a function and at the first lines, before any command.","invalid_break_command":"Error at line $0. The command $1 cannot be used outside a loop command or ‘switch ...case’ structure.","invalid_terminal":"It is not possible to use $0 in the expression at line: $1, column: $2. Try a numeric value, variable or function call.","const_not_init":"Error at line: $0, column: $1. A variable declared as const must be initialized.","id_missing":"Expected an identifier but found $0 at line: $1, column: $2.","invalid_id_format":"$0 at line: $1, column: $2 is not a valid identifier. The symbol '.' is not permitted in this context.","main_missing":"The main function was not found. You need to declare a function of return type void named main.","invalid_global_var":"Critical Error: Invalid call of the function IVProgProcessor.initGlobal outside the BASE context.","not_implemented":"Critial internal error: The system defined function $0 was not found.","function_missing":"The function $0 was not found.","function_missing_full":"The function $0 at line: $1, column: $2 was not found.","invalid_parameters_size_full":"Error at line $0: The number of parameters provided to the function $1 is incorrect. It expected $2 but found $3.","invalid_parameters_size":"The number of parameters provided to the function $0 is incorrect. It expected $1 but found $2.","invalid_ref_full":"The expression $0 provided as a parameter to the function $1 at line $2 is not valid in this context. Use a variable or a position of a vector.","invalid_ref":"The expression $0 provided as a parameter to the function $1 is not valid in this context. Use a variable or a position of a vector.","invalid_parameter_type_full":"The expression $0 provided as a parameter to the function $1 at line $2 is not of the expected type.","invalid_parameter_type":"The expression $0 provided as a parameter to the function $1 is not of the expected type.","unknown_command_full":"Internal error: an unknown command found at line $0.","unknown_command":"Internal error: an unknown command found.","loop_condition_type_full":"Error at line: $0, column $1: the condition $2 of the loop must be of type bool (true or false).","loop_condition_type":"The condition $0 of the loop must be of type bool (true or false).","endless_loop_full":"Possible infinite loop detected in your code. Check line $0.","endless_loop":"Possible infinite loop detected in your code.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Error at line: $0, column $1: the condition $2 in the if … else command must result in a bool (true or false).","if_condition_type":"The condition $0 in the if … else command must result in a bool (true or false).","invalid_return_type_full":"Error at line $0: The expression doest not result in a type compatible with the function $1. Expected type: $2.","invalid_return_type":"The expression doest not result in a type compatible with the function $0. Expected type: $1.","invalid_void_return_full":"Error at line $0: The function $1 cannot return an empty expression, use an expression that results in a $2","invalid_void_return":"The function $0 cannot return an empty expression, use an expression that results in a $1","unexpected_break_command_full":"Critical error at line $0: a break command was found outside a valid context: loop or switch … case structure.","unexpected_break_command":"Critical error: a break command was found outside a valid context: loop or switch … case structure.","invalid_dimension":"Array (vector or matrix) dimensions must be of type int.","void_in_expression_full":"Error at line: $0, column: $1: The function $2 cannot be used inside an expression since its return type is void.","void_in_expression":"The function $0 cannot be used inside an expression since its return type is void.","invalid_array_access_full":"Identifier $0 at line: $1, column: $2 does not identify a valid vector or matrix.","invalid_array_access":"Identifier $0 does not identify a valid vector or matrix.","invalid_matrix_access_full":"Identifier $0 at line: $1, column: $2 does not identify a valid matrix.","invalid_matrix_access":"Identifier $0 does not identify a valid matrix.","matrix_column_outbounds_full":"Error at line $0: The number of columns $1 is invalid for the matrix $2 which has $3 columns.","matrix_column_outbounds":"The number of columns $0 is invalid for the matrix $1 which has $2 columns.","matrix_line_outbounds_full":"Error at line $0: The number of lines $1 is invalid for matrix $2 which has $3 lines.","matrix_line_outbounds":"The number of lines $0 is invalid for matrix $1 which has $2 lines.","vector_line_outbounds_full":"Error at line $0: The number of elements $1 is invalid for vector $2 which has $3 elements.","vector_line_outbounds":"Error at line $0: The number of elements $1 is invalid for vector $2 which has $3 elements.","vector_not_matrix_full":"Error at line $0: $1 is not a matrix.","vector_not_matrix":"$0 is not a matrix.","invalid_infix_op_full":"Error at line $0: The expression $1 is not valid because the operator $2 cannot be applied to the types $3 and $4.","invalid_infix_op":"The expression $0 is not valid because the operator $1 cannot be applied to the types $2 and $3.","invalid_unary_op_full":"Error at line $0: The expression $1 is not valid because the operator $2 cannot be applied to the type $3.","invalid_unary_op":"The expression $0 is not valid because the operator $1 cannot be applied to the type $2.","unknown_op":"Critical error: Unknown operator $0.","duplicate_function":"The function $0 at line: $1, column: $2 has already been declared.","duplicate_variable":"The variable $0 at line: $1, column: $2 has already been declared.","main_parameters":"The main function cannot have parameters.","symbol_not_found_full":"The variable $0 at line: $1, column: $2 has not been declared.","symbol_not_found":"The variable $0 has not been declared.","array_dimension_not_int_full":"The array (vector or matrix) dimensions at line $0 must be of type int.","array_dimension_not_int":"An array (vector or matrix) dimensions must be of type int.","array_dimension_not_positive_full":"The array (vector or matrix) dimensions at line $0 must be positive.","array_dimension_not_positive":"An array (vector or matrix) dimensions must be positive.","incompatible_types_full":"It expected $0 but the expression $1 at line $2 results in $3.","incompatible_types":"It expected $0 but the expression $1 results in $2.","incompatible_types_array_full":"The expression $0 at line $2 is not compatible with type $1.","incompatible_types_array":"The expression $0 is not compatible with type $1.","invalid_case_type_full":"The case expression $0 at line $1 is not compatible with type $2.","invalid_case_type":"The case expression $0 is not compatible with type $1.","function_no_return":"The function $0 does not have a reacheable return command. Every function must have at least one return command in its main body.","invalid_array_literal_type_full":"Error at line $0: the expression $1 does not result in a compatible type.","invalid_array_literal_type":"The expression $0 does not result in a compatible type.","invalid_array_literal_line_full":"Error at line $0: it expected $1 lines but found $2.","invalid_array_literal_line":"It expected $0 lines but found $1.","invalid_array_literal_column_full":"Error at line $0: it expected $1 column but found $2.","invalid_array_literal_column":"It expected $0 column but found $1.","exceeded_input_request":"The amount of reads requested exceeded the amount of inputs available.","test_case_few_reads":"Teste case $0 failed: there are available inputs remaining.","test_case_failed":"<div class='assessment-div-detail' onClick='ivprogCore.openAssessmentDetail(event)' data-page=\"$1\"> <span>Test case $0 did not executed successfully.</span></div>","test_case_failed_exception":"<div class='assessment-div-detail' onClick='ivprogCore.openAssessmentDetail(event)' data-page=\"$2\"> <span>Test case $0 failed</span>: $1","test_case_exception":"An exception has ocurred during the execution of test case $0: $1","invalid_type_conversion":"The value $0 cannot be converted to type $1.","invalid_read_type":"Error at line $0: The input \"$1\" is not of type $2 which is the type of the variable <span class='ivprog-error-varname'>$3</span>.","invalid_read_type_array":"Error at line $0: The input \"$1\" is not of type $2 which is the type accepted by the variable <span class='ivprog-error-varname'>$3</span> of type $4.","inform_valid_identifier":"Enter a valid identifier! The identifier cannot be a reserved word and it must begin with a letter or _, followed by numbers, letters and _ only.","inform_valid_global_duplicated":"A global variable named <span class='ivprog-error-varname'>$0</span> already exists, you need distinct names for each gloval variable.","inform_valid_variable_duplicated":"A variable named <span class='ivprog-error-varname'>$0</span> already exists, you need distinct names for each variable.","inform_valid_function_duplicated":"A function named <span class='ivprog-error-varname'>$0</span> already exists, you need distinct names for each function.","inform_valid_param_duplicated":"A parameter named <span class='ivprog-error-varname'>$0</span> already exists in function <span class='ivprog-error-varname'>$1</span>, you need distinc names for each parameter.","invalid_character":"The character $0 at line $1 cannot be used in this context.","invalid_syntax":"iVProg does not recognize the text $0 at line $1. Check for typos or invalid character.","annonymous_array_literal":"Error at line $0: the array notation is only permitted during initialization of an array variable. i. e.: int vec[3] ← {1, 2, 3}.","invalid_matrix_literal_line":"The expression $0 at line $1 does not have the same number of elements as the last line. All lines of a matrix must have the same number of elements.","cannot_infer_matrix_line":"It is not possible to infer the number of lines of matrix $0 at line $1. It must be initialized or have its lines explicitly declared.","cannot_infer_matrix_column":"It is not possible to infer the number of columns of matrix $0 at line $1. It must be initialized or have its columns explicitly declared.","cannot_infer_vector_size":"It is not possible to infer the number of elements of vector $0 at line $1. It must be initialized or have its size explicitly declard.","matrix_to_vector_literal_attr":"Error at line $0: The expression $1 represents a matrix and cannot be assigned to the vector $2.","vector_to_matrix_literal_attr":"Error at line $0: The expression $1 represents a vector and cannot be assigned to the matrix $2.","invalid_const_ref_full":"The variable $0 provided as a parameter to the function $1 at line $2 is a constant and cannot be used in this context. Use a non-constant variable or vector position.","invalid_const_ref":"The variable $0 provided as a parameter to the function $1 is a constant and cannot be used in this context. Use a non-constant variable or vector position.","invalid_const_assignment_full":"Error at line $0: $1 is a constant e therefore cannot have its value changed.","invalid_const_assignment":"$0 is a constant e therefore cannot have its value changed.","array_init_not_literal":"Error at line $0: An array (vector or matrix) can only be initialized by an array literal. i.e : real vector[] <- {1,2,3}","array_exceeds_2d":"Error at line $0: The maximum number of dimensions an array can have is 2. An element of 3 or dimensions was found.","invalid_matrix_id_dimension":"Error at line $0: You must define all dimensions of the matrix when one of them is defined by a variable! i.e: real mat1[var][5], mat2[5][var]","invalid_vector_init":"Error at line $0: You cannot initialize a vector when its size is defined by a variable. Use a vector assignment or loop command.","invalid_matrix_init":"Error at line $0: You cannot initialize a matrix when one of its dimensions is defined by a variable. Use a matrix assignment or loop command.","invalid_vector_assignment_full":"Error at line $0: You can only assign a vector to another when both have the same number of elements. $1 has $2 and $3 has $4 elements!","invalid_vector_assignment":"You can only assign a vector to another when both have the same number of elements. $0 has $1 and $2 has $3 elements!","invalid_matrix_assignment_full":"Error at line $0: You can only assign a matrix to another when both have dimensions of the same size. $1 has $2 lines e $3 columns while $4 has $5 lines and $6 columns!","invalid_matrix_assignment":"You can only assign a matrix to another when both have dimensions of the same size. $0 has $1 lines e $2 columns while $3 has $4 lines and $5 columns!","matrix_to_vector_attr":"Error at line $0: $1 represents a matrix and cannot be assigned to the vector $2.","vector_to_matrix_attr":"Error at line $0: $1 represents a vector and cannot be assigned to the matrix $2.","invalid_matrix_index_assign_full":"Error at line $0: The position $1 of the matrix $2 only accepts vectors of size $3 but $4 has size $5.","invalid_matrix_index_assign":"The position $0 of the matrix $1 only accepts vectors of size $2 but $3 has size $4.","invalid_number_elements_vector":"It expected $0 elements at line $1 but the expression $2 has $3 elements.","invalid_number_lines_matrix":"It expected a matrix with $0 lines at line $1 but the expression $2 has $3 lines.","divsion_by_zero_full":"Error at line $0: The expression $1 resuts in a division by zero.","divsion_by_zero":"The expression $0 resuts in a division by zero.","undefined_tanget_value":"Error at line $0: The tangent of $1° is undefined.","negative_log_value":"Error at line $0: You cannot calculate the logarithm of a negative value.","invalid_string_index":"Error at line $0 during the execution of the function $1: $2 is an invalid index for the text string $3. The valid indexes go from 0 to $4.","negative_sqrt_value":"Error at line $0: It is not allowd to calculate the square root of a negative number.","exceeded_recursive_calls":"Error during the execution of line $0: The number of recursive calls exceeded the allowed number of calls.","invalid_for_variable":"Error at line $0: The variable $1 used in the repeat_for command must be of type int.","invalid_for_from":"Error at line $0: The value $1 passed to the parameter 'from' of the repeat_for command must be of type int.","invalid_for_to":"Error at line $0: The value $1 passed to the parameter 'to' of the repeat_for command must be of type int.","invalid_for_pass":"Error at line $0: The value $1 passed to the parameter 'pass' of the repeat_for command must be of type int.","exceed_max_instructions":"The number of instructions executed by your program exceed the defined limit. Check your code for infinite loops or excessive recursive functions calls."},"es":{"token_missing_one":"Syntax error: Expected $0 but found $1 at line:$2, column:$3","token_missing_two":"Syntax error: Expected $0 or $1 but found $2 at line:$3, column: $4","eos_missing":"A new line or a ‘;’ is missing at line: $0, column: $1","invalid_type":"$0 at line: $1, column: $2 is a invalid type. The valid types are: $3","invalid_array_dimension":"Invalid dimension at line: $0, column: $1. Insert a $2 or a valid identifier of the same type.","invalid_array_size":"The array at line $0 exceeds the maximum size of 2.","extra_lines":"No text is allowed after '}' in 'program { … }'","invalid_main_return":"The function $0 declared at line $2 must return $1.","invalid_var_declaration":"Error at line $0: Variables can only be declared in the main body of a function and at the first lines, before any command.","invalid_break_command":"Error at line $0. The command $1 cannot be used outside a loop command or ‘switch ...case’ structure.","invalid_terminal":"It is not possible to use $0 in the expression at line: $1, column: $2. Try a numeric value, variable or function call.","const_not_init":"Error at line: $0, column: $1. A variable declared as const must be initialized.","id_missing":"Expected an identifier but found $0 at line: $1, column: $2.","invalid_id_format":"$0 at line: $1, column: $2 is not a valid identifier. The symbol '.' is not permitted in this context.","main_missing":"The main function was not found. You need to declare a function of return type void named main.","invalid_global_var":"Critical Error: Invalid call of the function IVProgProcessor.initGlobal outside the BASE context.","not_implemented":"Critial internal error: The system defined function $0 was not found.","function_missing":"The function $0 was not found.","function_missing_full":"The function $0 at line: $1, column: $2 was not found.","invalid_parameters_size_full":"Error at line $0: The number of parameters provided to the function $1 is incorrect. It expected $2 but found $3.","invalid_parameters_size":"The number of parameters provided to the function $0 is incorrect. It expected $1 but found $2.","invalid_ref_full":"The expression $0 provided as a parameter to the function $1 at line $2 is not valid in this context. Use a variable or a position of a vector.","invalid_ref":"The expression $0 provided as a parameter to the function $1 is not valid in this context. Use a variable or a position of a vector.","invalid_parameter_type_full":"The expression $0 provided as a parameter to the function $1 at line $2 is not of the expected type.","invalid_parameter_type":"The expression $0 provided as a parameter to the function $1 is not of the expected type.","unknown_command_full":"Internal error: an unknown command found at line $0.","unknown_command":"Internal error: an unknown command found.","loop_condition_type_full":"Error at line: $0, column $1: the condition $2 of the loop must be of type bool (true or false).","loop_condition_type":"The condition $0 of the loop must be of type bool (true or false).","endless_loop_full":"Possible infinite loop detected in your code. Check line $0.","endless_loop":"Possible infinite loop detected in your code.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Error at line: $0, column $1: the condition $2 in the if … else command must result in a bool (true or false).","if_condition_type":"The condition $0 in the if … else command must result in a bool (true or false).","invalid_return_type_full":"Error at line $0: The expression doest not result in a type compatible with the function $1. Expected type: $2.","invalid_return_type":"The expression doest not result in a type compatible with the function $0. Expected type: $1.","invalid_void_return_full":"Error at line $0: The function $1 cannot return an empty expression, use an expression that results in a $2","invalid_void_return":"The function $0 cannot return an empty expression, use an expression that results in a $1","unexpected_break_command_full":"Critical error at line $0: a break command was found outside a valid context: loop or switch … case structure.","unexpected_break_command":"Critical error: a break command was found outside a valid context: loop or switch … case structure.","invalid_dimension":"Array (vector or matrix) dimensions must be of type int.","void_in_expression_full":"Error at line: $0, column: $1: The function $2 cannot be used inside an expression since its return type is void.","void_in_expression":"The function $0 cannot be used inside an expression since its return type is void.","invalid_array_access_full":"Identifier $0 at line: $1, column: $2 does not identify a valid vector or matrix.","invalid_array_access":"Identifier $0 does not identify a valid vector or matrix.","invalid_matrix_access_full":"Identifier $0 at line: $1, column: $2 does not identify a valid matrix.","invalid_matrix_access":"Identifier $0 does not identify a valid matrix.","matrix_column_outbounds_full":"Error at line $0: The number of columns $1 is invalid for the matrix $2 which has $3 columns.","matrix_column_outbounds":"The number of columns $0 is invalid for the matrix $1 which has $2 columns.","matrix_line_outbounds_full":"Error at line $0: The number of lines $1 is invalid for matrix $2 which has $3 lines.","matrix_line_outbounds":"The number of lines $0 is invalid for matrix $1 which has $2 lines.","vector_line_outbounds_full":"Error at line $0: The number of elements $1 is invalid for vector $2 which has $3 elements.","vector_line_outbounds":"Error at line $0: The number of elements $1 is invalid for vector $2 which has $3 elements.","vector_not_matrix_full":"Error at line $0: $1 is not a matrix.","vector_not_matrix":"$0 is not a matrix.","invalid_infix_op_full":"Error at line $0: The expression $1 is not valid because the operator $2 cannot be applied to the types $3 and $4.","invalid_infix_op":"The expression $0 is not valid because the operator $1 cannot be applied to the types $2 and $3.","invalid_unary_op_full":"Error at line $0: The expression $1 is not valid because the operator $2 cannot be applied to the type $3.","invalid_unary_op":"The expression $0 is not valid because the operator $1 cannot be applied to the type $2.","unknown_op":"Critical error: Unknown operator $0.","duplicate_function":"The function $0 at line: $1, column: $2 has already been declared.","duplicate_variable":"The variable $0 at line: $1, column: $2 has already been declared.","main_parameters":"The main function cannot have parameters.","symbol_not_found_full":"The variable $0 at line: $1, column: $2 has not been declared.","symbol_not_found":"The variable $0 has not been declared.","array_dimension_not_int_full":"The array (vector or matrix) dimensions at line $0 must be of type int.","array_dimension_not_int":"An array (vector or matrix) dimensions must be of type int.","array_dimension_not_positive_full":"The array (vector or matrix) dimensions at line $0 must be positive.","array_dimension_not_positive":"An array (vector or matrix) dimensions must be positive.","incompatible_types_full":"It expected $0 but the expression $1 at line $2 results in $3.","incompatible_types":"It expected $0 but the expression $1 results in $2.","incompatible_types_array_full":"The expression $0 at line $2 is not compatible with type $1.","incompatible_types_array":"The expression $0 is not compatible with type $1.","invalid_case_type_full":"The case expression $0 at line $1 is not compatible with type $2.","invalid_case_type":"The case expression $0 is not compatible with type $1.","function_no_return":"The function $0 does not have a reacheable return command. Every function must have at least one return command in its main body.","invalid_array_literal_type_full":"Error at line $0: the expression $1 does not result in a compatible type.","invalid_array_literal_type":"The expression $0 does not result in a compatible type.","invalid_array_literal_line_full":"Error at line $0: it expected $1 lines but found $2.","invalid_array_literal_line":"It expected $0 lines but found $1.","invalid_array_literal_column_full":"Error at line $0: it expected $1 column but found $2.","invalid_array_literal_column":"It expected $0 column but found $1.","exceeded_input_request":"The amount of reads requested exceeded the amount of inputs available.","test_case_few_reads":"Teste case $0 failed: there are available inputs remaining.","test_case_failed":"<div class='assessment-div-detail' onClick='ivprogCore.openAssessmentDetail(event)' data-page=\"$1\"> <span>Test case $0 did not executed successfully.</span></div>","test_case_failed_exception":"<div class='assessment-div-detail' onClick='ivprogCore.openAssessmentDetail(event)' data-page=\"$2\"> <span>Test case $0 failed</span>: $1","test_case_exception":"An exception has ocurred during the execution of test case $0: $1","invalid_type_conversion":"The value $0 cannot be converted to type $1.","invalid_read_type":"Error at line $0: The input \"$1\" is not of type $2 which is the type of the variable <span class='ivprog-error-varname'>$3</span>.","invalid_read_type_array":"Error at line $0: The input \"$1\" is not of type $2 which is the type accepted by the variable <span class='ivprog-error-varname'>$3</span> of type $4.","inform_valid_identifier":"Enter a valid identifier! The identifier cannot be a reserved word and it must begin with a letter or _, followed by numbers, letters and _ only.","inform_valid_global_duplicated":"A global variable named <span class='ivprog-error-varname'>$0</span> already exists, you need distinct names for each gloval variable.","inform_valid_variable_duplicated":"A variable named <span class='ivprog-error-varname'>$0</span> already exists, you need distinct names for each variable.","inform_valid_function_duplicated":"A function named <span class='ivprog-error-varname'>$0</span> already exists, you need distinct names for each function.","inform_valid_param_duplicated":"A parameter named <span class='ivprog-error-varname'>$0</span> already exists in function <span class='ivprog-error-varname'>$1</span>, you need distinc names for each parameter.","invalid_character":"The character $0 at line $1 cannot be used in this context.","invalid_syntax":"iVProg does not recognize the text $0 at line $1. Check for typos or invalid character.","annonymous_array_literal":"Error at line $0: the array notation is only permitted during initialization of an array variable. i. e.: int vec[3] ← {1, 2, 3}.","invalid_matrix_literal_line":"The expression $0 at line $1 does not have the same number of elements as the last line. All lines of a matrix must have the same number of elements.","cannot_infer_matrix_line":"It is not possible to infer the number of lines of matrix $0 at line $1. It must be initialized or have its lines explicitly declared.","cannot_infer_matrix_column":"It is not possible to infer the number of columns of matrix $0 at line $1. It must be initialized or have its columns explicitly declared.","cannot_infer_vector_size":"It is not possible to infer the number of elements of vector $0 at line $1. It must be initialized or have its size explicitly declard.","matrix_to_vector_literal_attr":"Error at line $0: The expression $1 represents a matrix and cannot be assigned to the vector $2.","vector_to_matrix_literal_attr":"Error at line $0: The expression $1 represents a vector and cannot be assigned to the matrix $2.","invalid_const_ref_full":"The variable $0 provided as a parameter to the function $1 at line $2 is a constant and cannot be used in this context. Use a non-constant variable or vector position.","invalid_const_ref":"The variable $0 provided as a parameter to the function $1 is a constant and cannot be used in this context. Use a non-constant variable or vector position.","invalid_const_assignment_full":"Error at line $0: $1 is a constant e therefore cannot have its value changed.","invalid_const_assignment":"$0 is a constant e therefore cannot have its value changed.","array_init_not_literal":"Error at line $0: An array (vector or matrix) can only be initialized by an array literal. i.e : real vector[] <- {1,2,3}","array_exceeds_2d":"Error at line $0: The maximum number of dimensions an array can have is 2. An element of 3 or dimensions was found.","invalid_matrix_id_dimension":"Error at line $0: You must define all dimensions of the matrix when one of them is defined by a variable! i.e: real mat1[var][5], mat2[5][var]","invalid_vector_init":"Error at line $0: You cannot initialize a vector when its size is defined by a variable. Use a vector assignment or loop command.","invalid_matrix_init":"Error at line $0: You cannot initialize a matrix when one of its dimensions is defined by a variable. Use a matrix assignment or loop command.","invalid_vector_assignment_full":"Error at line $0: You can only assign a vector to another when both have the same number of elements. $1 has $2 and $3 has $4 elements!","invalid_vector_assignment":"You can only assign a vector to another when both have the same number of elements. $0 has $1 and $2 has $3 elements!","invalid_matrix_assignment_full":"Error at line $0: You can only assign a matrix to another when both have dimensions of the same size. $1 has $2 lines e $3 columns while $4 has $5 lines and $6 columns!","invalid_matrix_assignment":"You can only assign a matrix to another when both have dimensions of the same size. $0 has $1 lines e $2 columns while $3 has $4 lines and $5 columns!","matrix_to_vector_attr":"Error at line $0: $1 represents a matrix and cannot be assigned to the vector $2.","vector_to_matrix_attr":"Error at line $0: $1 represents a vector and cannot be assigned to the matrix $2.","invalid_matrix_index_assign_full":"Error at line $0: The position $1 of the matrix $2 only accepts vectors of size $3 but $4 has size $5.","invalid_matrix_index_assign":"The position $0 of the matrix $1 only accepts vectors of size $2 but $3 has size $4.","invalid_number_elements_vector":"It expected $0 elements at line $1 but the expression $2 has $3 elements.","invalid_number_lines_matrix":"It expected a matrix with $0 lines at line $1 but the expression $2 has $3 lines.","divsion_by_zero_full":"Error at line $0: The expression $1 resuts in a division by zero.","divsion_by_zero":"The expression $0 resuts in a division by zero.","undefined_tanget_value":"Error at line $0: The tangent of $1° is undefined.","negative_log_value":"Error at line $0: You cannot calculate the logarithm of a negative value.","invalid_string_index":"Error at line $0 during the execution of the function $1: $2 is an invalid index for the text string $3. The valid indexes go from 0 to $4.","negative_sqrt_value":"Error at line $0: It is not allowd to calculate the square root of a negative number.","exceeded_recursive_calls":"Error during the execution of line $0: The number of recursive calls exceeded the allowed number of calls.","invalid_for_variable":"Error at line $0: The variable $1 used in the repeat_for command must be of type int.","invalid_for_from":"Error at line $0: The value $1 passed to the parameter 'from' of the repeat_for command must be of type int.","invalid_for_to":"Error at line $0: The value $1 passed to the parameter 'to' of the repeat_for command must be of type int.","invalid_for_pass":"Error at line $0: The value $1 passed to the parameter 'pass' of the repeat_for command must be of type int.","exceed_max_instructions":"The number of instructions executed by your program exceed the defined limit. Check your code for infinite loops or excessive recursive functions calls."}}
  19. /***/ }),
  20. /***/ "./i18n/message.csv":
  21. /*!**************************!*\
  22. !*** ./i18n/message.csv ***!
  23. \**************************/
  24. /***/ ((module) => {
  25. module.exports = {"pt":{"test_case_success":"<div class='assessment-div-detail' onClick='ivprogCore.openAssessmentDetail(event)' data-page=\"$1\"><span>Caso de teste $0</span>: OK</div>","test_case_duration":"Levou $0ms","test_suite_grade":"A sua solução alcançou $0% da nota.","awaiting_input_message":"O seu programa está em execução e aguardando uma entrada! Digite algo e pressione ENTER...","assessment-empty-expected-tooltip":"A saída gerada foi além do esperado","assessment-empty-generated-tooltip":"O programa não gerou saídas suficientes","testcase_autogen_unused_input":"A solução submetida não lê todas entradas disponíveis no caso de teste 1","testcase_autogen_empty":"Sua solução não gerou qualquer saída para o caso de teste $0.","success_execution":"Execução do programa finalizada!","aborted_execution":"A execução do programa foi interrompida!","unexpected_execution_error":"Erro inesperado durante a execução do programa."},"en":{"test_case_success":"<div class='assessment-div-detail' onClick='ivprogCore.openAssessmentDetail(event)' data-page=\"$1\"><span>Test case $0</span>: OK</div>","test_case_duration":"Took $0ms","test_suite_grade":"Your solution scored $0% of the grade.","awaiting_input_message":"Your program is running and awaiting for an input. Type something and press ENTER…","assessment-empty-expected-tooltip":"The generated output was beyond the amount expected","assessment-empty-generated-tooltip":"The program did not generate enough outputs","testcase_autogen_unused_input":"The submitted solution does not read all inputs available in the test case $0","testcase_autogen_empty":"Your solution did not generate any output for test case $0.","success_execution":"Program execution finished!","aborted_execution":"Program execution was aborted!","unexpected_execution_error":"Unexpected error during program execution."},"es":{"test_case_success":"<div class='assessment-div-detail' onClick='ivprogCore.openAssessmentDetail(event)' data-page=\"$1\"><span>Test case $0</span>: OK</div>","test_case_duration":"Tardó $0ms","test_suite_grade":"Su solución obtuvo $0% de la calificación.","awaiting_input_message":"Su programa se está ejecutando y esperando una entrada. Escriba algo y presione ENTER ...","assessment-empty-expected-tooltip":"The generated output was beyond the amount expected","assessment-empty-generated-tooltip":"El programa no generó suficientes resultados.","testcase_autogen_unused_input":"La solución presentada no lee todas las entradas disponibles en el caso de prueba 1","testcase_autogen_empty":"Su solución no generó ningún resultado para el caso de prueba de $ 0.","success_execution":"¡Ejecución del programa terminada!","aborted_execution":"¡La ejecución del programa fue abortada!","unexpected_execution_error":"Error inesperado durante la ejecución del programa."}}
  26. /***/ }),
  27. /***/ "./i18n/ui.csv":
  28. /*!*********************!*\
  29. !*** ./i18n/ui.csv ***!
  30. \*********************/
  31. /***/ ((module) => {
  32. module.exports = {"pt":{"function":"funcao","btn_clear":"Limpar","btn_function":"Função","btn_arithmetic_plus":"Adição","btn_arithmetic_minus":"Subtração","btn_arithmetic_multiplication":"Multiplicação","btn_arithmetic_division":"Divisão","btn_arithmetic_module":"Módulo","btn_break":"Pare","btn_case":"Caso","btn_add_var":"Adicionar variável","btn_drag_and_drop_function":"Mover função","btn_delete_function":"Excluir função","expression_invalid":"Expressão inválida. Verifique a sintáxe antes de continuar.","expression_undelcared_variable":"Variáveis não declaradas:","expression_undeclared_function":"Funções não definidas:","start":"inicio","type_void":"vazio","type_integer":"inteiro","logic_operator_and":"E","logic_operator_or":"OU","logic_operator_not":"nao","type_real":"real","program":"programa","type_text":"cadeia","textvar_default_value":"texto","type_boolean":"logico","logic_value_true":"verdadeiro","logic_value_false":"falso","variable":"Variável","command":"Comando","new_parameter":"parametro","new_variable":"variavel","new_global":"global","new_function":"nova_funcao","matrix":"matriz","vector":"vetor","text_lock_expression":"Bloquear expressão","text_unlock_expression":"Desbloquear expressão","text_edit_expression":"Editar expressão manualmente","text_edit_expression_confirm":"Confirmar edição","text_edit_expression_cancel":"Cancelar edição","text_add_function":"Adicionar uma nova função ao programa","text_move_command":"Mover comando","text_add_parameters":"Adicionar um novo parâmetro","text_parameter_reference":"Definir parâmetro como passagem por referência","text_parameter_copy":"Definir parâmetro como passagem por cópia","text_comment_start":"Comentário inicial da função...","text_comment_main":"Esta é a função principal...","text_read_var":"Entrada/Leitura de dados","text_write_var":"Saída/Escrita de dados","text_command_read":"leia","text_command_write":"escreva","text_return":"devolva","text_btn_return":"Devolver","text_comment":"Comentário","string_join_or":"ou","matrix_info_string":"matriz de $0","vector_info_string":"vetor de $0","text_attribution":"Atribuição","text_if":"se","text_break":"pare","text_else":"senao","text_for":"repita_para","text_code_while":"repita_enquanto","text_code_do":"repita","text_code_do_until":"ate_que","text_command_do":"repita","text_command_while":"repita enquanto","text_command_do_until":"até que","text_code_switch":"escolha","text_code_case":"caso","text_config_programming":"Programação","text_config_programming_both":"Visual e textual","text_config_programming_textual":"Textual","text_config_programming_visual":"Visual","text_logic_expression":"Lógicos","text_arithmetic_expression":"Aritméticos","text_iftrue":"Se condição senão","text_message_error_activity_file":"Aconteceu um erro ao processar a atividade. <br> Recarregue a página para tentar novamente.","text_message_error_upload_file":"Não foi possível carregar o arquivo.<br>Verifique o conteúdo do arquivo e tente novamente.","text_message_error_upload_close":"Fechar","text_message_error_activity_reload":"Recarregar","text_repeatNtimes":"Repita N vezes","text_receives":"recebe","text_whiletrue":"Enquanto verdadeiro","text_dowhiletrue":"Repita até que verdadeiro","text_switch":"Escolha","text_functioncall":"Chamada de função","text_value":"Valor","text_operator":"Operador","text_parentheses":"Parênteses","text_change":"Alterar","text_teacher_algorithm":"Algoritmo","text_teacher_algorithm_include":"Incluir o algoritmo abaixo no exercício","text_teacher_test_case":"Casos de teste","text_teacher_config":"Configurações","text_teacher_data_types":"Tipos de dados","text_teacher_commands":"Comandos","text_teacher_functions":"Funções","text_teacher_create_functions":"Criar novas funções","text_teacher_create_movement_functions":"Movimentar funções","text_teacher_test_case_input":"Entrada","text_teacher_test_case_output":"Saída","text_teacher_test_case_actions":"Ações","text_teacher_test_case_add":"Adicionar caso de teste","text_header_ivprog_functions":"Funções do iVProg","text_menu_functions_math":"Matemática","text_menu_functions_text":"Texto","text_menu_functions_array":"Arranjo","text_menu_functions_conversion":"Conversão","text_no_variable":"Nenhuma variável declarada","text_no_variable_instruction":"Antes de utilizar uma variável, é necessário criá-la","text_ivprog_description":"Programação Visual interativa na Internet","tooltip_visual":"Programação visual","tooltip_textual":"Programação textual","tooltip_upload":"Upload de código fonte","tooltip_download":"Download do código fonte","tooltip_undo":"Desfazer","tooltip_redo":"Refazer","tooltip_run":"Executar o programa","tooltip_evaluate":"Avaliar o programa","tooltip_help":"Ajuda","tooltip_add_global":"Adicionar variável global","tooltip_hide_function":"Ocultar os elementos da função","var_menu_select_var":"Selecione uma variável","var_menu_select_all":"Selecione","var_menu_select_function":"Selecione uma função","expression_menu_select":"Construir uma expressão lógica","inform_valid_content":"Informe o conteúdo!","inform_valid_expression":"Construa uma expressão lógica!","tooltip_terminal_clear":"Limpa o terminal removendo todos os textos já escritos e os pendentes.","tooltip_terminal_show":"Exibe o terminal caso esteja escondido","tooltip_terminal_hide":"Esconde o terminal caso não esteja escondido","tooltip_menu_read":"Comando para receber dados pelo teclado","tooltip_menu_write":"Comando para apresentar conteúdo ao usuário","tooltip_menu_comments":"Bloco para comentários internos do programador","tooltip_menu_attribution":"Comando para atribuir uma expressão a uma variável","tooltip_menu_call_function":"Comando para realizar a chamada de uma função","tooltip_menu_if_else":"Estrutura para que os comandos só sejam executados de acordo com as condições estabelecidas","tooltip_menu_repeat_n_times":"Estrutura para executar um bloco de comandos repetidamente","tooltip_menu_repeat_whiletrue":"Estrutura para repetir um bloco de comandos enquanto a condição for verdadeira","tooltip_menu_repeat_dowhiletrue":"Estrutura que executa um bloco e o repete enquanto a condição for verdadeira","tooltip_menu_repeat_switch":"Estrutura de escolha do bloco a ser executado","tooltip_menu_repeat_return":"Comando para devolver o resultado e finalizar a função","tooltip_move_var":"Mover variável","tooltip_remove_var":"Excluir variável","text_ivprog_version":"Versão","text_teacher_filter":"Filtro","text_teacher_filter_active":"Ativado","text_teacher_filter_help":"Ao ativar o filtro, as modificações do iVProg estarão bloqueadas.","text_join_assessment_outputs":" ; ","assessment-detail-time-label":"Duração","assessment-detail-grade-label":"Nota","assessment-detail-input-label":"Entradas","assessment-detail-output-label":"Saídas","assessment-detail-expected-label":"Esperava","assessment-detail-generated-label":"Gerou","assessment-detail-result-label":"Resultado","assessment-detail-title":"Caso de Teste $0","text_teacher_generate_outputs":"Gerar saídas","text_teacher_generate_outputs_algorithm":"Antes de gerar as saídas, elabore um algoritmo!","text_code_for_from":"de","text_code_for_to":"ate","text_code_for_pass":"passo","text_for_from":"de","text_for_to":"até","text_for_pass":"passo","text_relational_expression":"Relacionais","write_command_newline_on":"Quebra de linha ativada","write_command_newline_off":" Quebra de linha desativada","write_seprator_menu_text":"Espaço","initial_program_code":"programa {\\n\\n\\t\\tfuncao vazio inicio () {\\n\\t\\t\\t// Inicie seu codigo aqui!\\n\\t\\t}\\n}","type_char":"caractere","charvar_default_value":"A","write_seprator_menu_tooltip":"Separador para imprimir mais valores/variáveis"},"en":{"function":"function","btn_clear":"Clean","btn_function":"Function","btn_arithmetic_plus":"Addition","btn_arithmetic_minus":"Subtraction","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Remainder","btn_break":"break","btn_case":"Case","btn_add_var":"Add a variable","btn_drag_and_drop_function":"Move function","btn_delete_function":"Delete function","expression_invalid":"Invalid expression. Check the syntax before proceeding.","expression_undelcared_variable":"Undeclared variables:","expression_undeclared_function":"Undefined functions:","start":"main","type_void":"void","type_integer":"int","logic_operator_and":"AND","logic_operator_or":"OR","logic_operator_not":"not","type_real":"real","program":"program","type_text":"string","textvar_default_value":"text","type_boolean":"bool","logic_value_true":"true","logic_value_false":"false","variable":"Variable","command":"Command","new_parameter":"parameter","new_variable":"variable","new_global":"global","new_function":"new_function","matrix":"matrix","vector":"vector","text_lock_expression":"Block expression","text_unlock_expression":"Unlock expression","text_edit_expression":"Edit expression manually","text_edit_expression_confirm":"Confirm edition","text_edit_expression_cancel":"Cancel edition","text_add_function":"Add a new function to the program","text_move_command":"Move command","text_add_parameters":"Add a new parameter","text_parameter_reference":"Define parameter passed by reference","text_parameter_copy":"Define parameter passed by copy","text_comment_start":"Function initial comment","text_comment_main":"This is the main funcion","text_read_var":"Input/Read data","text_write_var":"Output/Write data","text_command_read":"read","text_command_write":"write","text_return":"return","text_btn_return":"Return","text_comment":"Comment","string_join_or":"or","matrix_info_string":"matrix of $0","vector_info_string":"vector of $0","text_attribution":"Assignment","text_if":"if","text_break":"break","text_else":"else","text_for":"repeat_for","text_code_while":"repeat_while","text_code_do":"repeat","text_code_do_until":"until","text_command_do":"repeat","text_command_while":"repeat while","text_command_do_until":"until","text_code_switch":"switch","text_code_case":"case","text_config_programming":"Programming","text_config_programming_both":"Visual & Textual","text_config_programming_textual":"Textual","text_config_programming_visual":"Visual","text_logic_expression":"Logic","text_arithmetic_expression":"Arithmetics","text_iftrue":"If condition else","text_message_error_activity_file":"There was an error processing the activity.<br> Reload the page to try again.","text_message_error_upload_file":"It was not possible upload the file.<br>Verify the file's content and try again.","text_message_error_upload_close":"Close","text_message_error_activity_reload":"Reload","text_repeatNtimes":"Repeat N times","text_receives":"receives","text_whiletrue":"While true","text_dowhiletrue":"Repeat until true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Modify","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the algorithm below in the activity","text_teacher_test_case":"Test cases","text_teacher_config":"Configurations","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test case","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Math","text_menu_functions_text":"Text","text_menu_functions_array":"Array","text_menu_functions_conversion":"Conversion","text_no_variable":"No variable declared","text_no_variable_instruction":"Before using a variable, you need to create it","text_ivprog_description":"Interactive and Visual Programming on the Internet","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload source code","tooltip_download":"Download source code","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run the program","tooltip_evaluate":"Evaluate the program","tooltip_help":"Help","tooltip_add_global":"Add a global variable","tooltip_hide_function":"Hide function elements","var_menu_select_var":"Select a variable","var_menu_select_all":"Select","var_menu_select_function":"Select a function","expression_menu_select":"Construct a logic expression","inform_valid_content":"Provide some data","inform_valid_expression":"Construct a logic expression","tooltip_terminal_clear":"Clears the terminal by removing all wrriten and pending text.","tooltip_terminal_show":"Shows the terminal if it is hidden","tooltip_terminal_hide":"Hides the terminal if it is not on display","tooltip_menu_read":"Command to input data from keyboard","tooltip_menu_write":"Command to present content to user","tooltip_menu_comments":"Block to comments from developer","tooltip_menu_attribution":"Command to assign an expression to a variable","tooltip_menu_call_function":"Command to execute a function call","tooltip_menu_if_else":"Structure in which command only run when the conditions are satisfied","tooltip_menu_repeat_n_times":"Structure to execute a block of commands repeatedly","tooltip_menu_repeat_whiletrue":"Structure to execute a block repeatdly while condition is true","tooltip_menu_repeat_dowhiletrue":"Structure that executes a block and repeat while the condition is true","tooltip_menu_repeat_switch":"Structure that choices the block to be executed","tooltip_menu_repeat_return":"Command to return the result and finish the function","tooltip_move_var":"Move variable","tooltip_remove_var":"Delete variable","text_ivprog_version":"Version","text_teacher_filter":"Filter","text_teacher_filter_active":"Activated","text_teacher_filter_help":"By activating the filter modifications in iVProg will be blocked","text_join_assessment_outputs":" ; ","assessment-detail-time-label":"Duration","assessment-detail-grade-label":"Grade","assessment-detail-input-label":"Inputs","assessment-detail-output-label":"Outputs","assessment-detail-expected-label":"Expected","assessment-detail-generated-label":"Generated","assessment-detail-result-label":"Result","assessment-detail-title":"Test Case $0","text_teacher_generate_outputs":"Generate outputs","text_teacher_generate_outputs_algorithm":"Before generating the outputs you need to create an algorithm","text_code_for_from":"from","text_code_for_to":"to","text_code_for_pass":"pass","text_for_from":"from","text_for_to":"to","text_for_pass":"pass","text_relational_expression":"Relational","write_command_newline_on":" Line break is on","write_command_newline_off":" Line break is off","write_seprator_menu_text":"Spacer","initial_program_code":"program {\\n\\n\\t\\tfunction void main () {\\n\\t\\t\\t// Start your code here!\\n\\t\\t}\\n}","type_char":"char","charvar_default_value":"A","write_seprator_menu_tooltip":"Separator used to print more values/variables"},"es":{"function":"function","btn_clear":"Limpiar","btn_function":"Funcíon","btn_arithmetic_plus":"Adición","btn_arithmetic_minus":"Sustracción","btn_arithmetic_multiplication":"Multiplicación","btn_arithmetic_division":"División","btn_arithmetic_module":"Resto","btn_break":"break","btn_case":"Caso","btn_add_var":"Add a variable","btn_drag_and_drop_function":"Mover función ","btn_delete_function":"Borrar función ","expression_invalid":"Expresión no válida. Verifique la sintaxis antes de continuar.","expression_undelcared_variable":"Variables no declaradas:","expression_undeclared_function":"Funcíon no declaradas:","start":"main","type_void":"void","type_integer":"int","logic_operator_and":"AND","logic_operator_or":"OR","logic_operator_not":"not","type_real":"real","program":"program","type_text":"string","textvar_default_value":"texto","type_boolean":"bool","logic_value_true":"true","logic_value_false":"false","variable":"Variable","command":"Comando","new_parameter":"parametro","new_variable":"variable","new_global":"global","new_function":"nueva_función","matrix":"matriz","vector":"vector","text_lock_expression":"Expresión de bloque ","text_unlock_expression":"Desbloquear expresión ","text_edit_expression":"Editar expresión manualmente ","text_edit_expression_confirm":"Confirmar edición","text_edit_expression_cancel":"Cancelar edición","text_add_function":"Agregar una nueva función al programa","text_move_command":"Mover comando","text_add_parameters":"Agregar un nuevo parámetro","text_parameter_reference":"Define parameter passed by reference","text_parameter_copy":"Define parameter passed by copy","text_comment_start":"Comentario inicial de la función","text_comment_main":"Esta es la función principal","text_read_var":"Entrada/Lectura de dados","text_write_var":"Salida/Escribir datos","text_command_read":"read","text_command_write":"write","text_return":"return","text_btn_return":"Devolución","text_comment":"Comentario","string_join_or":"or","matrix_info_string":"matriz de $0","vector_info_string":"vector de $0","text_attribution":"Asignación","text_if":"if","text_break":"break","text_else":"else","text_for":"repeat_for","text_code_while":"repeat_while","text_code_do":"repeat","text_code_do_until":"until","text_command_do":"repeat","text_command_while":"repeat while","text_command_do_until":"until","text_code_switch":"switch","text_code_case":"case","text_config_programming":"Programación","text_config_programming_both":"Visual & Textual","text_config_programming_textual":"Textual","text_config_programming_visual":"Visual","text_logic_expression":"Lógicos","text_arithmetic_expression":"Aritmética","text_iftrue":"Si condicion sino","text_message_error_activity_file":"Se produjo un error al procesar la actividad.<br> Recargar la página para volver a intentarlo.","text_message_error_upload_file":"text_message_error_upload_file","text_message_error_upload_close":"Close","text_message_error_activity_reload":"Recargar","text_repeatNtimes":"Repetir N veces","text_receives":"receives","text_whiletrue":"Mientras verdad","text_dowhiletrue":"Repita hasta verdad","text_switch":"Switch","text_functioncall":"Llamada de función","text_value":"Valor","text_operator":"Operador","text_parentheses":"Paréntesis","text_change":"Modify","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Incluir el algoritmo en la actividad.","text_teacher_test_case":"Test cases","text_teacher_config":"Configuraciones","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Funciones","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test case","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Math","text_menu_functions_text":"Text","text_menu_functions_array":"Array","text_menu_functions_conversion":"Conversion","text_no_variable":"No variable declared","text_no_variable_instruction":"Antes de usar una variable, debe crearla","text_ivprog_description":"Interactive and Visual Programming on the Internet","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload source code","tooltip_download":"Download source code","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run the program","tooltip_evaluate":"Evaluate the program","tooltip_help":"Help","tooltip_add_global":"Add a global variable","tooltip_hide_function":"Hide function elements","var_menu_select_var":"Select a variable","var_menu_select_all":"Select","var_menu_select_function":"Select a function","expression_menu_select":"Construct a logic expression","inform_valid_content":"Proporcionar algunos datos","inform_valid_expression":"Construct a logic expression","tooltip_terminal_clear":"Borra el terminal eliminando todo el texto escrito y pendiente.","tooltip_terminal_show":"Muestra el terminal si está oculto.","tooltip_terminal_hide":"Oculta el terminal si no está en exhibición","tooltip_menu_read":"Command to input data from keyboard","tooltip_menu_write":"Command to present content to user","tooltip_menu_comments":"Block to comments from developer","tooltip_menu_attribution":"Command to assign an expression to a variable","tooltip_menu_call_function":"Command to execute a function call","tooltip_menu_if_else":"Structure in which command only run when the conditions are satisfied","tooltip_menu_repeat_n_times":"Structure to execute a block of commands repeatedly","tooltip_menu_repeat_whiletrue":"Structure to execute a block repeatdly while condition is true","tooltip_menu_repeat_dowhiletrue":"Structure that executes a block and repeat while the condition is true","tooltip_menu_repeat_switch":"Structure that choices the block to be executed","tooltip_menu_repeat_return":"Command to return the result and finish the function","tooltip_move_var":"Move variable","tooltip_remove_var":"Delete variable","text_ivprog_version":"Version","text_teacher_filter":"Filter","text_teacher_filter_active":"Activated","text_teacher_filter_help":"Al activar el filtro, las modificaciones en iVProg serán bloqueadas","text_join_assessment_outputs":" ;","assessment-detail-time-label":"Duration","assessment-detail-grade-label":"Grade","assessment-detail-input-label":"Inputs","assessment-detail-output-label":"Outputs","assessment-detail-expected-label":"Expected","assessment-detail-generated-label":"Generated","assessment-detail-result-label":"Result","assessment-detail-title":"Test Case $0","text_teacher_generate_outputs":"Generate outputs","text_teacher_generate_outputs_algorithm":"Antes de generar las salidas necesita crear un algoritmo","text_code_for_from":"from","text_code_for_to":"to","text_code_for_pass":"pass","text_for_from":"from","text_for_to":"to","text_for_pass":"pass","text_relational_expression":"Relational","write_command_newline_on":"El salto de línea está activado","write_command_newline_off":"El salto de línea está desactivado","write_seprator_menu_text":"Spacer","initial_program_code":"program {\\n\\n\\t\\tfunction void main () {\\n\\t\\t\\t// Start your code here!\\n\\t\\t}\\n}","type_char":"char","charvar_default_value":"A","write_seprator_menu_tooltip":"Separator used to print more values/variables"}}
  33. /***/ }),
  34. /***/ "./js/assessment/ivprogAssessment.js":
  35. /*!*******************************************!*\
  36. !*** ./js/assessment/ivprogAssessment.js ***!
  37. \*******************************************/
  38. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  39. "use strict";
  40. __webpack_require__.r(__webpack_exports__);
  41. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  42. /* harmony export */ "IVProgAssessment": () => (/* binding */ IVProgAssessment)
  43. /* harmony export */ });
  44. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  45. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  46. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  47. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  48. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  49. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  50. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  51. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  52. /* harmony import */ var _output_matching_output_matching__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./output_matching/output_matching */ "./js/assessment/output_matching/output_matching.js");
  53. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../util/config */ "./js/util/config.ts");
  54. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_5__.getInstance();
  55. var StringTypes = line_i18n__WEBPACK_IMPORTED_MODULE_2__["default"].StringTypes;
  56. var AssessmentConfig = {
  57. max_instruction_count: 350250,
  58. suspend_threshold: 200
  59. };
  60. var IVProgAssessment = /*#__PURE__*/function () {
  61. function IVProgAssessment(ast_code, testCases, domConsole) {
  62. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, IVProgAssessment);
  63. this.ast_code = ast_code;
  64. this.testCases = testCases;
  65. this.domConsole = domConsole;
  66. this.old_config = JSON.parse(JSON.stringify(_util_config__WEBPACK_IMPORTED_MODULE_7__.Config));
  67. _util_config__WEBPACK_IMPORTED_MODULE_7__.Config.setConfig(AssessmentConfig);
  68. }
  69. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(IVProgAssessment, [{
  70. key: "runTest",
  71. value: function runTest() {
  72. var _this = this;
  73. try {
  74. // loop test cases and show messages through domconsole
  75. var partialTests = this.testCases.map(function (t, name) {
  76. return new _output_matching_output_matching__WEBPACK_IMPORTED_MODULE_6__.OutputMatching(new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_3__.IVProgProcessor(_this.ast_code), t.input, t.output, name);
  77. });
  78. var testResult = partialTests.map(function (om) {
  79. return om.eval();
  80. });
  81. return Promise.all(testResult).then(function (results) {
  82. var grade = 0;
  83. for (var i = 0; i < results.length; i += 1) {
  84. var result = results[i];
  85. grade += result.grade;
  86. if (result.grade == 1) {
  87. _this.writeToConsole(_io_domConsole__WEBPACK_IMPORTED_MODULE_4__.DOMConsole.INFO, StringTypes.MESSAGE, 'test_case_success', result.name + 1, result.generateOutput());
  88. } else if (result.status == 1) {
  89. _this.writeToConsole(_io_domConsole__WEBPACK_IMPORTED_MODULE_4__.DOMConsole.ERR, StringTypes.ERROR, 'test_case_failed_exception', result.name + 1, result.error_msg, result.generateOutput());
  90. } else {
  91. _this.writeToConsole(_io_domConsole__WEBPACK_IMPORTED_MODULE_4__.DOMConsole.ERR, StringTypes.ERROR, 'test_case_failed', result.name + 1, result.generateOutput());
  92. }
  93. }
  94. grade /= results.length;
  95. var channel = grade == 1 ? _io_domConsole__WEBPACK_IMPORTED_MODULE_4__.DOMConsole.INFO : _io_domConsole__WEBPACK_IMPORTED_MODULE_4__.DOMConsole.ERR;
  96. _this.writeToConsole(channel, StringTypes.MESSAGE, "test_suite_grade", (grade * 100).toFixed(2));
  97. return grade;
  98. }); // return testResult.then(function (total) {
  99. // const grade = total / this.testCases.length;
  100. // const channel = grade == 1 ? DOMConsole.INFO : DOMConsole.ERR;
  101. // this.writeToConsole(channel, StringTypes.MESSAGE, "test_suite_grade", (grade * 100).toFixed(2));
  102. // return Promise.resolve(grade)
  103. // }).catch(err => {
  104. // this.domConsole.err("Erro inesperado durante o cálculo da nota.");// try and show error messages through domconsole
  105. // this.domConsole.err(err.message);
  106. // return Promise.resolve(0);
  107. // });
  108. } catch (error) {
  109. this.showErrorMessage(_io_domConsole__WEBPACK_IMPORTED_MODULE_4__.DOMConsole.ERR, StringTypes.MESSAGE, "unexpected_execution_error");
  110. this.domConsole.err(error.message);
  111. return Promise.resolve(0);
  112. } finally {
  113. _util_config__WEBPACK_IMPORTED_MODULE_7__.Config.setConfig(this.old_config);
  114. }
  115. }
  116. }, {
  117. key: "showErrorMessage",
  118. value: function showErrorMessage(errorID) {
  119. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  120. args[_key - 1] = arguments[_key];
  121. }
  122. this.domConsole.err(LocalizedStrings.getError(errorID, args));
  123. }
  124. }, {
  125. key: "showInfoMessage",
  126. value: function showInfoMessage(msgID) {
  127. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  128. args[_key2 - 1] = arguments[_key2];
  129. }
  130. this.domConsole.info(LocalizedStrings.getMessage(msgID, args));
  131. }
  132. }, {
  133. key: "writeToConsole",
  134. value: function writeToConsole(channel, msgType, msgID) {
  135. var msg = LocalizedStrings.getString(msgID, msgType);
  136. for (var _len3 = arguments.length, args = new Array(_len3 > 3 ? _len3 - 3 : 0), _key3 = 3; _key3 < _len3; _key3++) {
  137. args[_key3 - 3] = arguments[_key3];
  138. }
  139. msg = LocalizedStrings.processString(msg, args);
  140. this.domConsole.writeRawHTML(msg, channel);
  141. }
  142. }]);
  143. return IVProgAssessment;
  144. }();
  145. /***/ }),
  146. /***/ "./js/assessment/output_matching/assessment_result.js":
  147. /*!************************************************************!*\
  148. !*** ./js/assessment/output_matching/assessment_result.js ***!
  149. \************************************************************/
  150. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  151. "use strict";
  152. __webpack_require__.r(__webpack_exports__);
  153. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  154. /* harmony export */ "OutputAssessmentResult": () => (/* binding */ OutputAssessmentResult)
  155. /* harmony export */ });
  156. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  157. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  158. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  159. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  160. /* harmony import */ var _util_string_diff__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../util/string_diff */ "./js/util/string_diff.js");
  161. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  162. var OutputAssessmentResult = /*#__PURE__*/function () {
  163. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(OutputAssessmentResult, null, [{
  164. key: "PAGE_TEMPLATE",
  165. get: function get() {
  166. return "<!DOCTYPE html>\n <html>\n <head>\n <meta http-equiv='content-type' content='text/html; charset=UTF-8'>\n <link rel='stylesheet' href='css/ivprog-assessment.css' type='text/css'/>\n </head>\n <body>\n :assessment-result:\n </body>\n </html>";
  167. }
  168. }, {
  169. key: "DETAIL_TEMPLATE",
  170. get: function get() {
  171. return "<div class='details-body'>\n <div class='details-header'>\n <h2>:test-name:</h2>\n <p>:time-label:: <span>:time:ms</span></p>\n <p>:grade-label:: <span>:grade:%</span></p>\n </div>\n <div>\n <h3>:input-label:</h3>\n <ul>\n <li>:input-list:</li>\n </ul>\n </div>\n <div>\n <h3>:output-label:</h3>\n :output-result:\n </div>\n </div>";
  172. }
  173. }, {
  174. key: "OUPUT_TABLE_TEMPLATE",
  175. get: function get() {
  176. return "<div class='detaisl-div-table'>\n <table class='assessment-output-table'>\n <tr>\n <th>:expected-label:</th>\n <th>:generated-label:</th>\n <th>:result-label:</th>\n </tr>\n :results:\n </table>\n </div>";
  177. }
  178. }, {
  179. key: "OUTPUT_TEMPLATE",
  180. get: function get() {
  181. return "<tr><td class=':class-expected:'>$0</td>\n <td class=':class-generated:'>$1</td>\n <td class=':class-result:'>$2</td></tr>";
  182. }
  183. }, {
  184. key: "EMPTY_OUTPUT_TEMPLATE",
  185. get: function get() {
  186. return "<div class='assessment-popup'><img class='assessment-empty-output' src='img/empty.svg'>\n <span class='assessment-popuptext'>$0</span></div>";
  187. }
  188. }, {
  189. key: "FAILED_TEMPLATE",
  190. get: function get() {
  191. return "<p class='assessment-failed-execution'><span class='assessment-failed-case'>\u2717</span>$0</p>";
  192. }
  193. }, {
  194. key: "INPUT_INFO_TEMPLATE",
  195. get: function get() {
  196. return "<span class='$0'>$1</span>";
  197. } // Status code - it is not grade related!
  198. // 0 - Succesful execution
  199. // 1 - failed execution
  200. }]);
  201. function OutputAssessmentResult(name, status, inputs, result, store, time) {
  202. var error_msg = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
  203. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, OutputAssessmentResult);
  204. this.name = name;
  205. this.status = status;
  206. this.inputs = inputs;
  207. this.results = result;
  208. this.store = store;
  209. this.time = time;
  210. this.error_msg = error_msg;
  211. }
  212. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(OutputAssessmentResult, [{
  213. key: "prepareResults",
  214. value: function prepareResults() {
  215. var _this = this;
  216. var template = OutputAssessmentResult.DETAIL_TEMPLATE;
  217. var grade = (this.grade * 100).toFixed(2);
  218. var time = this.time || "-";
  219. template = template.replace(':test-name:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-title', [this.name + 1]));
  220. template = template.replace(':time-label:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-time-label'));
  221. template = template.replace(':time:', time);
  222. template = template.replace(':grade-label:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-grade-label'));
  223. template = template.replace(':grade:', grade);
  224. var input_spans = this.prepareInputList(this.inputs);
  225. template = template.replace(':input-label:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-input-label'));
  226. template = template.replace(':input-list:', input_spans);
  227. template = template.replace(':output-label:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-output-label'));
  228. if (this.status == 0) {
  229. var output_rows = this.results.map(function (result) {
  230. if (result.type == "string") {
  231. return _this.formatString(result);
  232. } else if (result.type == "number") {
  233. return _this.formatNumber(result);
  234. } else {
  235. return _this.formatBool(result);
  236. }
  237. }, this);
  238. template = template.replace(':output-result:', this.prepareOutputTable(output_rows));
  239. } else {
  240. var failed_text = OutputAssessmentResult.FAILED_TEMPLATE;
  241. failed_text = failed_text.replace("$0", this.error_msg);
  242. template = template.replace(":output-result:", failed_text);
  243. }
  244. return template;
  245. }
  246. }, {
  247. key: "prepareInputList",
  248. value: function prepareInputList(input_list) {
  249. var list = input_list.map(function (input) {
  250. var template = OutputAssessmentResult.INPUT_INFO_TEMPLATE;
  251. template = template.replace("$1", input.value);
  252. if (input.read) {
  253. template = template.replace("$0", "assessment-input-read");
  254. } else {
  255. template = template.replace("$0", "assessment-input-unread");
  256. }
  257. return template;
  258. }, this);
  259. return list.join(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('text_join_assessment_outputs'));
  260. }
  261. }, {
  262. key: "prepareOutputTable",
  263. value: function prepareOutputTable(output_rows) {
  264. var template = OutputAssessmentResult.OUPUT_TABLE_TEMPLATE;
  265. template = template.replace(':expected-label:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-expected-label'));
  266. template = template.replace(':generated-label:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-generated-label'));
  267. template = template.replace(':result-label:', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('assessment-detail-result-label'));
  268. template = template.replace(':results:', output_rows.join(''));
  269. return template;
  270. }
  271. }, {
  272. key: "generateOutput",
  273. value: function generateOutput() {
  274. var assessment_result = this.prepareResults();
  275. var page = OutputAssessmentResult.PAGE_TEMPLATE;
  276. page = page.replace(':assessment-result:', assessment_result);
  277. page = page.replace(/(\r|\n|\t)/gm, '').replace(/> *</g, '><');
  278. return page;
  279. }
  280. }, {
  281. key: "formatNumber",
  282. value: function formatNumber(result) {
  283. var result_class = result.grade == 1 ? 'assessment-number-result' : 'assessment-number-result-failed';
  284. var template = this.formatOutput('assessment-number-expected', 'assessment-number-generated', result_class, result);
  285. return template;
  286. }
  287. }, {
  288. key: "formatBool",
  289. value: function formatBool(result) {
  290. var result_class = result.grade == 1 ? 'assessment-bool-result' : 'assessment-bool-result-failed';
  291. var template = this.formatOutput('assessment-bool-expected', 'assessment-bool-generated', result_class, result);
  292. return template;
  293. }
  294. }, {
  295. key: "formatOutput",
  296. value: function formatOutput(expected_class, generated_class, result_class, result) {
  297. var template = OutputAssessmentResult.OUTPUT_TEMPLATE;
  298. template = template.replace(":class-expected:", expected_class);
  299. template = template.replace(":class-generated:", generated_class);
  300. template = template.replace(":class-result:", result_class);
  301. var expected_tmpl = result.expected;
  302. var generated_tmpl = result.generated;
  303. if (expected_tmpl == null) {
  304. expected_tmpl = OutputAssessmentResult.EMPTY_OUTPUT_TEMPLATE.replace('$0', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getMessage('assessment-empty-expected-tooltip'));
  305. } else if (generated_tmpl == null) {
  306. generated_tmpl = OutputAssessmentResult.EMPTY_OUTPUT_TEMPLATE.replace('$0', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getMessage('assessment-empty-generated-tooltip'));
  307. }
  308. template = template.replace("$0", expected_tmpl);
  309. template = template.replace("$1", generated_tmpl);
  310. var final_result = result.grade == 1 ? "✓" : "✗";
  311. template = template.replace("$2", final_result);
  312. return template;
  313. }
  314. }, {
  315. key: "formatString",
  316. value: function formatString(result) {
  317. var _this2 = this;
  318. var expected_class = 'assessment-string-expected';
  319. var generated_class = 'assessment-string-generated'; //const result_class = 'assessment-string-result';
  320. var template = OutputAssessmentResult.OUTPUT_TEMPLATE;
  321. template = template.replace(":class-expected:", expected_class);
  322. template = template.replace(":class-generated:", generated_class); //template = template.replace(":class-result:", result_class);
  323. var g_string = result.generated || "";
  324. var e_string = result.expected || ""; // console.log("generated: ", g_string,"expected: ", e_string);
  325. var g_string_tmpl = g_string;
  326. var e_string_tmpl = e_string;
  327. if (result.generated == null) {
  328. g_string_tmpl = OutputAssessmentResult.EMPTY_OUTPUT_TEMPLATE.replace('$0', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getMessage('assessment-empty-generated-tooltip'));
  329. } else if (result.expected == null) {
  330. e_string_tmpl = OutputAssessmentResult.EMPTY_OUTPUT_TEMPLATE.replace('$0', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getMessage('assessment-empty-expected-tooltip'));
  331. }
  332. template = template.replace("$0", e_string_tmpl);
  333. template = template.replace("$1", g_string_tmpl);
  334. if (result.grade == 1) {
  335. template = template.replace("$2", "✓");
  336. template = template.replace(":class-result:", 'assessment-string-result');
  337. } else {
  338. var diff = (0,_util_string_diff__WEBPACK_IMPORTED_MODULE_2__["default"])(g_string, e_string); // console.log(diff);
  339. var diff_vec = diff.map(function (part) {
  340. return _this2.getDiffStringStyle(part[1], part[0]);
  341. }, this);
  342. var diff_string = diff_vec.reduce(function (prev, actual) {
  343. return prev + actual;
  344. }, "");
  345. template = template.replace("$2", "<span class='assessment-failed-case'>✗</span>" + diff_string);
  346. template = template.replace(":class-result:", "assessment-string-diff");
  347. }
  348. return template;
  349. }
  350. }, {
  351. key: "getDiffStringStyle",
  352. value: function getDiffStringStyle(text, action) {
  353. var template = "<span class='$0'>$1</span>"; // Fix missing whitespace when its a single element
  354. text = text.replace(/\s/g, "&#160;");
  355. switch (action) {
  356. case _util_string_diff__WEBPACK_IMPORTED_MODULE_2__["default"].INSERT:
  357. return template.replace("$0", "stringdiff-insert").replace("$1", text);
  358. case _util_string_diff__WEBPACK_IMPORTED_MODULE_2__["default"].DELETE:
  359. return template.replace("$0", "stringdiff-delete").replace("$1", text);
  360. case _util_string_diff__WEBPACK_IMPORTED_MODULE_2__["default"].EQUAL:
  361. return template.replace("$0", "stringdiff-equal").replace("$1", text);
  362. }
  363. }
  364. }, {
  365. key: "grade",
  366. get: function get() {
  367. if (this.results == null) {
  368. return 0;
  369. }
  370. return this.results.reduce(function (prev, val) {
  371. return prev + val.grade;
  372. }, 0) / this.results.length;
  373. }
  374. }]);
  375. return OutputAssessmentResult;
  376. }();
  377. /***/ }),
  378. /***/ "./js/assessment/output_matching/output_matching.js":
  379. /*!**********************************************************!*\
  380. !*** ./js/assessment/output_matching/output_matching.js ***!
  381. \**********************************************************/
  382. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  383. "use strict";
  384. __webpack_require__.r(__webpack_exports__);
  385. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  386. /* harmony export */ "OutputMatching": () => (/* binding */ OutputMatching)
  387. /* harmony export */ });
  388. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  389. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  390. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  391. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  392. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  393. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_2__);
  394. /* harmony import */ var _util_input_assessment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../util/input_assessment */ "./js/util/input_assessment.js");
  395. /* harmony import */ var _util_outputTest__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../util/outputTest */ "./js/util/outputTest.js");
  396. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../util/config */ "./js/util/config.ts");
  397. /* harmony import */ var _util_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../util/utils */ "./js/util/utils.js");
  398. /* harmony import */ var _assessment_result__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./assessment_result */ "./js/assessment/output_matching/assessment_result.js");
  399. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  400. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  401. /* harmony import */ var _output_result__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./output_result */ "./js/assessment/output_matching/output_result.js");
  402. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_9__.getInstance();
  403. var OutputMatching = /*#__PURE__*/function () {
  404. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(OutputMatching, null, [{
  405. key: "NUM_REGEX",
  406. get: function get() {
  407. return /^[+-]?([0-9]+([.][0-9]*)?(e[+-]?[0-9]+)?)$/;
  408. }
  409. }, {
  410. key: "NUM_IN_STRING_REGEX",
  411. get: function get() {
  412. return /[+-]?([0-9]+([.][0-9]*)?(e[+-]?[0-9]+)?)/g;
  413. }
  414. }, {
  415. key: "BOOLEAN_REGEX",
  416. get: function get() {
  417. var str = "^(".concat(LocalizedStrings.getUI("logic_value_true"), "|").concat(LocalizedStrings.getUI("logic_value_false"), ")$");
  418. return new RegExp(str);
  419. }
  420. }, {
  421. key: "BOOLEAN_IN_STRING_REGEX",
  422. get: function get() {
  423. var str = "(".concat(LocalizedStrings.getUI("logic_value_true"), "|").concat(LocalizedStrings.getUI("logic_value_false"), ")");
  424. return new RegExp(str, 'g');
  425. }
  426. }]);
  427. function OutputMatching(program, input_list, expected_output, test_name) {
  428. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, OutputMatching);
  429. this.program = program;
  430. this.name = test_name;
  431. this.input_list = input_list;
  432. this.expected_output = expected_output;
  433. }
  434. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(OutputMatching, [{
  435. key: "eval",
  436. value: function _eval() {
  437. var _this = this;
  438. var refThis = this;
  439. var input = new _util_input_assessment__WEBPACK_IMPORTED_MODULE_3__.InputAssessment(this.input_list);
  440. var gen_output = new _util_outputTest__WEBPACK_IMPORTED_MODULE_4__.OutputTest();
  441. this.program.registerInput(input);
  442. this.program.registerOutput(gen_output);
  443. var start_time = Date.now();
  444. return this.program.interpretAST().then(function (sto) {
  445. var final_time = Date.now() - start_time;
  446. if (input.isInputAvailable()) {
  447. return new _assessment_result__WEBPACK_IMPORTED_MODULE_7__.OutputAssessmentResult(_this.name, 1, input.input_list, null, sto, final_time, refThis.getErrorMessage('test_case_few_reads', _this.name + 1));
  448. }
  449. var result = gen_output.list.map(function (g_out, i) {
  450. if (i >= _this.expected_output.length) {
  451. return new _output_result__WEBPACK_IMPORTED_MODULE_10__.OutputMatchResult(null, g_out, 0, _this.getPotentialOutputType(g_out));
  452. }
  453. return _this.outputMatch(g_out, _this.expected_output[i]);
  454. }, _this);
  455. if (_this.expected_output.length > gen_output.list.length) {
  456. console.log("Saída insuficientes!", _this.expected_output.length, gen_output.list.length);
  457. for (var i = gen_output.list.length; i < _this.expected_output.length; ++i) {
  458. var e_out = _this.expected_output[i];
  459. result.push(new _output_result__WEBPACK_IMPORTED_MODULE_10__.OutputMatchResult(e_out, null, 0, _this.getPotentialOutputType(e_out)));
  460. }
  461. } else if (_this.expected_output.length == 0 && _this.expected_output.length == gen_output.list.length) {
  462. // no output expected....
  463. result.push(new _output_result__WEBPACK_IMPORTED_MODULE_10__.OutputMatchResult("", "", 1, "string"));
  464. }
  465. return new _assessment_result__WEBPACK_IMPORTED_MODULE_7__.OutputAssessmentResult(_this.name, 0, input.input_list, result, sto, final_time);
  466. })["catch"](function (error) {
  467. return new _assessment_result__WEBPACK_IMPORTED_MODULE_7__.OutputAssessmentResult(_this.name, 1, input.input_list, null, null, null, refThis.getErrorMessage('test_case_exception', _this.name + 1, error.message));
  468. });
  469. }
  470. }, {
  471. key: "getPotentialOutputType",
  472. value: function getPotentialOutputType(output) {
  473. if (OutputMatching.NUM_REGEX.test(output)) {
  474. return "number";
  475. } else if (OutputMatching.BOOLEAN_REGEX.test(output)) {
  476. return "bool";
  477. } else {
  478. return "string";
  479. }
  480. }
  481. }, {
  482. key: "outputMatch",
  483. value: function outputMatch(g_output, e_output) {
  484. if (OutputMatching.NUM_REGEX.test(e_output)) {
  485. if (!OutputMatching.NUM_REGEX.test(g_output)) {
  486. return this.checkStrings(g_output, e_output);
  487. }
  488. var g_num = new decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal(g_output);
  489. var e_num = new decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal(e_output);
  490. return this.checkNumbers(g_num, e_num);
  491. } else if (OutputMatching.BOOLEAN_REGEX.test(e_output)) {
  492. if (!OutputMatching.BOOLEAN_REGEX.test(g_output)) {
  493. return this.checkStrings(g_output, e_output);
  494. }
  495. var g_bool = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_8__.toBool(g_output);
  496. var e_bool = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_8__.toBool(e_output);
  497. return this.checkBoolean(g_bool, e_bool);
  498. } else {
  499. return this.checkStrings(g_output, e_output);
  500. }
  501. }
  502. }, {
  503. key: "checkNumbers",
  504. value: function checkNumbers(g_num, e_num) {
  505. var decimalPlaces = Math.min(e_num.dp(), _util_config__WEBPACK_IMPORTED_MODULE_5__.Config.decimalPlaces);
  506. g_num = new decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal(g_num.toFixed(decimalPlaces, decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal.ROUND_FLOOR));
  507. e_num = new decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal(e_num.toFixed(decimalPlaces, decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal.ROUND_FLOOR));
  508. var result = g_num.eq(e_num);
  509. var grade = result ? 1 : 0;
  510. return _output_result__WEBPACK_IMPORTED_MODULE_10__.createNumberResult(e_num.toNumber(), g_num.toNumber(), grade);
  511. }
  512. }, {
  513. key: "checkBoolean",
  514. value: function checkBoolean(g_bool, e_bool) {
  515. var grade = g_bool == e_bool ? 1 : 0;
  516. var g_bool_text = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_8__.convertBoolToString(g_bool);
  517. var e_bool_text = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_8__.convertBoolToString(e_bool);
  518. return _output_result__WEBPACK_IMPORTED_MODULE_10__.createBoolResult(e_bool_text, g_bool_text, grade);
  519. }
  520. }, {
  521. key: "checkStrings",
  522. value: function checkStrings(g_output, e_ouput) {
  523. var _this2 = this;
  524. var assessmentList = [];
  525. var e_output_clean = e_ouput.trim();
  526. var g_output_clean = g_output.trim();
  527. if (OutputMatching.NUM_IN_STRING_REGEX.test(e_ouput)) {
  528. var expected_numbers = e_ouput.match(OutputMatching.NUM_IN_STRING_REGEX);
  529. var generated_numbers = g_output.match(OutputMatching.NUM_IN_STRING_REGEX) || [];
  530. var result = generated_numbers.map(function (val, i) {
  531. if (i >= expected_numbers.length) {
  532. return _output_result__WEBPACK_IMPORTED_MODULE_10__.createNumberResult(null, val, 0);
  533. }
  534. var g_val = new decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal(val);
  535. var e_val = new decimal_js__WEBPACK_IMPORTED_MODULE_2__.Decimal(expected_numbers[i]);
  536. return _this2.checkNumbers(g_val, e_val);
  537. }, this);
  538. if (expected_numbers.length > generated_numbers.length) {
  539. for (var i = generated_numbers.length; i < expected_numbers.length; ++i) {
  540. result.push(_output_result__WEBPACK_IMPORTED_MODULE_10__.createNumberResult(expected_numbers[i], null, 0));
  541. }
  542. }
  543. e_output_clean = e_output_clean.replace(OutputMatching.NUM_IN_STRING_REGEX, '');
  544. g_output_clean = g_output_clean.replace(OutputMatching.NUM_IN_STRING_REGEX, '');
  545. var numberGrade = result.reduce(function (prev, r) {
  546. return prev + r.grade;
  547. }, 0) / result.length;
  548. assessmentList.push(numberGrade);
  549. }
  550. if (OutputMatching.BOOLEAN_IN_STRING_REGEX.test(e_ouput)) {
  551. var expected_bools = e_ouput.match(OutputMatching.BOOLEAN_IN_STRING_REGEX);
  552. var generated_bools = g_output.match(OutputMatching.BOOLEAN_IN_STRING_REGEX) || [];
  553. var _result = generated_bools.map(function (val, i) {
  554. if (i >= expected_bools.length) {
  555. return _output_result__WEBPACK_IMPORTED_MODULE_10__.createBoolResult(null, val, 0);
  556. }
  557. var g_bool = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_8__.toBool(val);
  558. var e_bool = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_8__.toBool(expected_bools[i]);
  559. return _this2.checkBoolean(g_bool, e_bool);
  560. }, this);
  561. if (expected_bools.length > generated_bools.length) {
  562. for (var _i = generated_bools.length; _i < expected_bools.length; ++_i) {
  563. _result.push(_output_result__WEBPACK_IMPORTED_MODULE_10__.createBoolResult(expected_bools[_i], null, 0));
  564. }
  565. }
  566. e_output_clean = e_output_clean.replace(OutputMatching.BOOLEAN_IN_STRING_REGEX, '');
  567. g_output_clean = g_output_clean.replace(OutputMatching.BOOLEAN_IN_STRING_REGEX, '');
  568. var boolGrade = _result.reduce(function (prev, r) {
  569. return prev + r.grade;
  570. }, 0) / _result.length;
  571. assessmentList.push(boolGrade);
  572. }
  573. var dist = (0,_util_utils__WEBPACK_IMPORTED_MODULE_6__.levenshteinDistance)(g_output_clean, e_output_clean);
  574. var gradeDiff = Math.max(0, e_output_clean.length - dist) / e_output_clean.length;
  575. gradeDiff = Number.isNaN(gradeDiff) ? 0 : gradeDiff;
  576. var assessment_size = assessmentList.length + 1;
  577. var gradeAcc = assessmentList.reduce(function (prev, val) {
  578. return prev + val / assessment_size;
  579. }, 0);
  580. var finalGrade = 1 * (gradeDiff / assessment_size + gradeAcc);
  581. return _output_result__WEBPACK_IMPORTED_MODULE_10__.createStringResult(e_ouput, g_output, finalGrade);
  582. }
  583. }, {
  584. key: "getErrorMessage",
  585. value: function getErrorMessage(errorID) {
  586. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  587. args[_key - 1] = arguments[_key];
  588. }
  589. return LocalizedStrings.getError(errorID, args);
  590. }
  591. }]);
  592. return OutputMatching;
  593. }();
  594. /***/ }),
  595. /***/ "./js/assessment/output_matching/output_result.js":
  596. /*!********************************************************!*\
  597. !*** ./js/assessment/output_matching/output_result.js ***!
  598. \********************************************************/
  599. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  600. "use strict";
  601. __webpack_require__.r(__webpack_exports__);
  602. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  603. /* harmony export */ "createNumberResult": () => (/* binding */ createNumberResult),
  604. /* harmony export */ "createBoolResult": () => (/* binding */ createBoolResult),
  605. /* harmony export */ "createStringResult": () => (/* binding */ createStringResult),
  606. /* harmony export */ "OutputMatchResult": () => (/* binding */ OutputMatchResult)
  607. /* harmony export */ });
  608. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  609. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  610. function createNumberResult(expected, generated, grade) {
  611. return new OutputMatchResult(expected, generated, grade, "number");
  612. }
  613. function createBoolResult(expected, generated, grade) {
  614. return new OutputMatchResult(expected, generated, grade, "bool");
  615. }
  616. function createStringResult(expected, generated, grade) {
  617. return new OutputMatchResult(expected, generated, grade, "string");
  618. }
  619. var OutputMatchResult = function OutputMatchResult(expected, generated, grade, type) {
  620. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, OutputMatchResult);
  621. this.expected = expected;
  622. this.generated = generated;
  623. this.grade = grade;
  624. this.type = type;
  625. };
  626. /***/ }),
  627. /***/ "./js/ast/commands/arrayAssign.js":
  628. /*!****************************************!*\
  629. !*** ./js/ast/commands/arrayAssign.js ***!
  630. \****************************************/
  631. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  632. "use strict";
  633. __webpack_require__.r(__webpack_exports__);
  634. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  635. /* harmony export */ "ArrayIndexAssign": () => (/* binding */ ArrayIndexAssign)
  636. /* harmony export */ });
  637. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  638. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  639. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  640. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
  641. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  642. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
  643. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  644. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
  645. /* harmony import */ var _assign__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  646. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default()(this, result); }; }
  647. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  648. var ArrayIndexAssign = /*#__PURE__*/function (_Assign) {
  649. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(ArrayIndexAssign, _Assign);
  650. var _super = _createSuper(ArrayIndexAssign);
  651. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  652. var _this;
  653. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, ArrayIndexAssign);
  654. _this = _super.call(this, id, expression);
  655. _this.line = lineExpression;
  656. _this.column = columnExpression;
  657. return _this;
  658. }
  659. return ArrayIndexAssign;
  660. }(_assign__WEBPACK_IMPORTED_MODULE_4__.Assign);
  661. /***/ }),
  662. /***/ "./js/ast/commands/arrayDeclaration.js":
  663. /*!*********************************************!*\
  664. !*** ./js/ast/commands/arrayDeclaration.js ***!
  665. \*********************************************/
  666. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  667. "use strict";
  668. __webpack_require__.r(__webpack_exports__);
  669. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  670. /* harmony export */ "ArrayDeclaration": () => (/* binding */ ArrayDeclaration)
  671. /* harmony export */ });
  672. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  673. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  674. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  675. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  676. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  677. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  678. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  679. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  680. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  681. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  682. /* harmony import */ var _declaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  683. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  684. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  685. var ArrayDeclaration = /*#__PURE__*/function (_Declaration) {
  686. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(ArrayDeclaration, _Declaration);
  687. var _super = _createSuper(ArrayDeclaration);
  688. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  689. var _this;
  690. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, ArrayDeclaration);
  691. _this = _super.call(this, id, type, initial, isConst);
  692. _this.lines = lines;
  693. _this.columns = columns;
  694. return _this;
  695. }
  696. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(ArrayDeclaration, [{
  697. key: "isVector",
  698. get: function get() {
  699. return this.columns == null;
  700. }
  701. }]);
  702. return ArrayDeclaration;
  703. }(_declaration__WEBPACK_IMPORTED_MODULE_5__.Declaration);
  704. /***/ }),
  705. /***/ "./js/ast/commands/assign.js":
  706. /*!***********************************!*\
  707. !*** ./js/ast/commands/assign.js ***!
  708. \***********************************/
  709. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  710. "use strict";
  711. __webpack_require__.r(__webpack_exports__);
  712. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  713. /* harmony export */ "Assign": () => (/* binding */ Assign)
  714. /* harmony export */ });
  715. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  716. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  717. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  718. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
  719. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  720. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
  721. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  722. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
  723. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  724. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default()(this, result); }; }
  725. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  726. var Assign = /*#__PURE__*/function (_Command) {
  727. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(Assign, _Command);
  728. var _super = _createSuper(Assign);
  729. function Assign(id, expression) {
  730. var _this;
  731. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Assign);
  732. _this = _super.call(this);
  733. _this.id = id;
  734. _this.expression = expression;
  735. return _this;
  736. }
  737. return Assign;
  738. }(_command__WEBPACK_IMPORTED_MODULE_4__.Command);
  739. /***/ }),
  740. /***/ "./js/ast/commands/break.js":
  741. /*!**********************************!*\
  742. !*** ./js/ast/commands/break.js ***!
  743. \**********************************/
  744. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  745. "use strict";
  746. __webpack_require__.r(__webpack_exports__);
  747. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  748. /* harmony export */ "Break": () => (/* binding */ Break)
  749. /* harmony export */ });
  750. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  751. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  752. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  753. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
  754. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  755. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
  756. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  757. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
  758. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  759. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default()(this, result); }; }
  760. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  761. var Break = /*#__PURE__*/function (_Command) {
  762. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(Break, _Command);
  763. var _super = _createSuper(Break);
  764. function Break() {
  765. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Break);
  766. return _super.call(this);
  767. }
  768. return Break;
  769. }(_command__WEBPACK_IMPORTED_MODULE_4__.Command);
  770. /***/ }),
  771. /***/ "./js/ast/commands/case.js":
  772. /*!*********************************!*\
  773. !*** ./js/ast/commands/case.js ***!
  774. \*********************************/
  775. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  776. "use strict";
  777. __webpack_require__.r(__webpack_exports__);
  778. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  779. /* harmony export */ "Case": () => (/* binding */ Case)
  780. /* harmony export */ });
  781. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  782. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  783. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  784. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  785. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  786. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  787. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  788. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  789. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  790. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  791. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  792. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  793. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  794. var Case = /*#__PURE__*/function (_Command) {
  795. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(Case, _Command);
  796. var _super = _createSuper(Case);
  797. function Case(expression) {
  798. var _this;
  799. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Case);
  800. _this = _super.call(this);
  801. _this.expression = expression;
  802. /**
  803. * @type {Command[]}
  804. */
  805. _this.commands = [];
  806. return _this;
  807. }
  808. /**
  809. *
  810. * @param {Command[]} commands
  811. */
  812. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(Case, [{
  813. key: "setCommands",
  814. value: function setCommands(commands) {
  815. this.commands = commands;
  816. }
  817. }, {
  818. key: "isDefault",
  819. get: function get() {
  820. return this.expression === null;
  821. }
  822. }]);
  823. return Case;
  824. }(_command__WEBPACK_IMPORTED_MODULE_5__.Command);
  825. /***/ }),
  826. /***/ "./js/ast/commands/command.js":
  827. /*!************************************!*\
  828. !*** ./js/ast/commands/command.js ***!
  829. \************************************/
  830. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  831. "use strict";
  832. __webpack_require__.r(__webpack_exports__);
  833. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  834. /* harmony export */ "Command": () => (/* binding */ Command)
  835. /* harmony export */ });
  836. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  837. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  838. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  839. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  840. var Command = /*#__PURE__*/function () {
  841. function Command() {
  842. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Command);
  843. this._sourceInfo = null;
  844. }
  845. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(Command, [{
  846. key: "sourceInfo",
  847. set: function set(sourceInfo) {
  848. this._sourceInfo = sourceInfo;
  849. },
  850. get: function get() {
  851. return this._sourceInfo;
  852. }
  853. }]);
  854. return Command;
  855. }();
  856. /***/ }),
  857. /***/ "./js/ast/commands/commandBlock.js":
  858. /*!*****************************************!*\
  859. !*** ./js/ast/commands/commandBlock.js ***!
  860. \*****************************************/
  861. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  862. "use strict";
  863. __webpack_require__.r(__webpack_exports__);
  864. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  865. /* harmony export */ "CommandBlock": () => (/* binding */ CommandBlock)
  866. /* harmony export */ });
  867. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  868. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  869. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  870. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  871. var CommandBlock = /*#__PURE__*/function () {
  872. function CommandBlock(variables, commands) {
  873. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CommandBlock);
  874. this.variables = variables;
  875. this.commands = commands;
  876. this._sourceInfo = null;
  877. }
  878. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(CommandBlock, [{
  879. key: "sourceInfo",
  880. set: function set(sourceInfo) {
  881. this._sourceInfo = sourceInfo;
  882. },
  883. get: function get() {
  884. return this._sourceInfo;
  885. }
  886. }]);
  887. return CommandBlock;
  888. }();
  889. /***/ }),
  890. /***/ "./js/ast/commands/declaration.js":
  891. /*!****************************************!*\
  892. !*** ./js/ast/commands/declaration.js ***!
  893. \****************************************/
  894. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  895. "use strict";
  896. __webpack_require__.r(__webpack_exports__);
  897. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  898. /* harmony export */ "Declaration": () => (/* binding */ Declaration)
  899. /* harmony export */ });
  900. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  901. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  902. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  903. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
  904. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  905. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
  906. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  907. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
  908. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  909. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default()(this, result); }; }
  910. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  911. var Declaration = /*#__PURE__*/function (_Command) {
  912. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(Declaration, _Command);
  913. var _super = _createSuper(Declaration);
  914. function Declaration(id, type, initial, isConst) {
  915. var _this;
  916. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Declaration);
  917. _this = _super.call(this);
  918. _this.id = id;
  919. _this.type = type;
  920. _this.initial = initial;
  921. _this.isConst = isConst;
  922. return _this;
  923. }
  924. return Declaration;
  925. }(_command__WEBPACK_IMPORTED_MODULE_4__.Command);
  926. /***/ }),
  927. /***/ "./js/ast/commands/for.js":
  928. /*!********************************!*\
  929. !*** ./js/ast/commands/for.js ***!
  930. \********************************/
  931. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  932. "use strict";
  933. __webpack_require__.r(__webpack_exports__);
  934. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  935. /* harmony export */ "For": () => (/* binding */ For)
  936. /* harmony export */ });
  937. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  938. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  939. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  940. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  941. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  942. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  943. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  944. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  945. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  946. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  947. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  948. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  949. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  950. var For = /*#__PURE__*/function (_Command) {
  951. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(For, _Command);
  952. var _super = _createSuper(For);
  953. function For(for_id, for_from, for_to, for_pass, commandBlock) {
  954. var _this;
  955. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, For);
  956. _this = _super.call(this);
  957. _this.for_id = for_id;
  958. _this.for_from = for_from;
  959. _this.for_to = for_to;
  960. _this.for_pass = for_pass;
  961. _this.commandBlock = commandBlock;
  962. return _this;
  963. }
  964. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(For, [{
  965. key: "commands",
  966. get: function get() {
  967. return this.commandBlock.commands;
  968. }
  969. }]);
  970. return For;
  971. }(_command__WEBPACK_IMPORTED_MODULE_5__.Command);
  972. /***/ }),
  973. /***/ "./js/ast/commands/formalParameter.js":
  974. /*!********************************************!*\
  975. !*** ./js/ast/commands/formalParameter.js ***!
  976. \********************************************/
  977. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  978. "use strict";
  979. __webpack_require__.r(__webpack_exports__);
  980. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  981. /* harmony export */ "FormalParameter": () => (/* binding */ FormalParameter)
  982. /* harmony export */ });
  983. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  984. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  985. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  986. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  987. var FormalParameter = /*#__PURE__*/function () {
  988. function FormalParameter(type, id) {
  989. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  990. var variadic = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  991. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, FormalParameter);
  992. this.type = type;
  993. this.id = id;
  994. this.byRef = byRef;
  995. this.variadic = variadic;
  996. this._sourceInfo = null;
  997. }
  998. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(FormalParameter, [{
  999. key: "sourceInfo",
  1000. set: function set(sourceInfo) {
  1001. this._sourceInfo = sourceInfo;
  1002. },
  1003. get: function get() {
  1004. return this._sourceInfo;
  1005. }
  1006. }]);
  1007. return FormalParameter;
  1008. }();
  1009. /***/ }),
  1010. /***/ "./js/ast/commands/function.js":
  1011. /*!*************************************!*\
  1012. !*** ./js/ast/commands/function.js ***!
  1013. \*************************************/
  1014. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1015. "use strict";
  1016. __webpack_require__.r(__webpack_exports__);
  1017. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1018. /* harmony export */ "Function": () => (/* binding */ Function)
  1019. /* harmony export */ });
  1020. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  1021. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  1022. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  1023. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  1024. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
  1025. var Function = /*#__PURE__*/function () {
  1026. /**
  1027. *
  1028. * @param {string} name
  1029. * @param {import('./../../typeSystem/itype').IType} returnType
  1030. * @param {import('./formalParameter').FormalParameter[]} formalParameters
  1031. * @param {import('./commandBlock').CommandBlock} commandBlock
  1032. */
  1033. function Function(name, returnType, formalParameters, commandBlock) {
  1034. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Function);
  1035. this.name = name;
  1036. this.returnType = returnType;
  1037. this.formalParameters = formalParameters;
  1038. this.commandBlock = commandBlock;
  1039. this._sourceInfo = null;
  1040. }
  1041. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(Function, [{
  1042. key: "hasVariadic",
  1043. value: function hasVariadic() {
  1044. return this.formalParameters.some(function (p) {
  1045. return p.variadic;
  1046. });
  1047. }
  1048. }, {
  1049. key: "isMain",
  1050. get: function get() {
  1051. return this.name === null && this.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__.Types.VOID);
  1052. }
  1053. }, {
  1054. key: "commands",
  1055. get: function get() {
  1056. return this.commandBlock.commands;
  1057. }
  1058. }, {
  1059. key: "variablesDeclarations",
  1060. get: function get() {
  1061. return this.commandBlock.variables;
  1062. }
  1063. }, {
  1064. key: "sourceInfo",
  1065. set: function set(sourceInfo) {
  1066. this._sourceInfo = sourceInfo;
  1067. },
  1068. get: function get() {
  1069. return this._sourceInfo;
  1070. }
  1071. }]);
  1072. return Function;
  1073. }();
  1074. /***/ }),
  1075. /***/ "./js/ast/commands/ifThenElse.js":
  1076. /*!***************************************!*\
  1077. !*** ./js/ast/commands/ifThenElse.js ***!
  1078. \***************************************/
  1079. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1080. "use strict";
  1081. __webpack_require__.r(__webpack_exports__);
  1082. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1083. /* harmony export */ "IfThenElse": () => (/* binding */ IfThenElse)
  1084. /* harmony export */ });
  1085. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  1086. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  1087. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  1088. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
  1089. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  1090. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
  1091. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  1092. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
  1093. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  1094. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default()(this, result); }; }
  1095. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  1096. var IfThenElse = /*#__PURE__*/function (_Command) {
  1097. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(IfThenElse, _Command);
  1098. var _super = _createSuper(IfThenElse);
  1099. function IfThenElse(condition, ifTrue, ifFalse) {
  1100. var _this;
  1101. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, IfThenElse);
  1102. _this = _super.call(this);
  1103. _this.condition = condition;
  1104. _this.ifTrue = ifTrue;
  1105. _this.ifFalse = ifFalse;
  1106. return _this;
  1107. }
  1108. return IfThenElse;
  1109. }(_command__WEBPACK_IMPORTED_MODULE_4__.Command);
  1110. /***/ }),
  1111. /***/ "./js/ast/commands/index.js":
  1112. /*!**********************************!*\
  1113. !*** ./js/ast/commands/index.js ***!
  1114. \**********************************/
  1115. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1116. "use strict";
  1117. __webpack_require__.r(__webpack_exports__);
  1118. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1119. /* harmony export */ "Break": () => (/* reexport safe */ _break__WEBPACK_IMPORTED_MODULE_0__.Break),
  1120. /* harmony export */ "Return": () => (/* reexport safe */ _return__WEBPACK_IMPORTED_MODULE_1__.Return),
  1121. /* harmony export */ "Assign": () => (/* reexport safe */ _assign__WEBPACK_IMPORTED_MODULE_2__.Assign),
  1122. /* harmony export */ "ArrayIndexAssign": () => (/* reexport safe */ _arrayAssign__WEBPACK_IMPORTED_MODULE_3__.ArrayIndexAssign),
  1123. /* harmony export */ "Declaration": () => (/* reexport safe */ _declaration__WEBPACK_IMPORTED_MODULE_4__.Declaration),
  1124. /* harmony export */ "ArrayDeclaration": () => (/* reexport safe */ _arrayDeclaration__WEBPACK_IMPORTED_MODULE_5__.ArrayDeclaration),
  1125. /* harmony export */ "While": () => (/* reexport safe */ _while__WEBPACK_IMPORTED_MODULE_6__.While),
  1126. /* harmony export */ "For": () => (/* reexport safe */ _for__WEBPACK_IMPORTED_MODULE_7__.For),
  1127. /* harmony export */ "Function": () => (/* reexport safe */ _function__WEBPACK_IMPORTED_MODULE_8__.Function),
  1128. /* harmony export */ "IfThenElse": () => (/* reexport safe */ _ifThenElse__WEBPACK_IMPORTED_MODULE_9__.IfThenElse),
  1129. /* harmony export */ "CommandBlock": () => (/* reexport safe */ _commandBlock__WEBPACK_IMPORTED_MODULE_10__.CommandBlock),
  1130. /* harmony export */ "RepeatUntil": () => (/* reexport safe */ _repeatUntil__WEBPACK_IMPORTED_MODULE_11__.RepeatUntil),
  1131. /* harmony export */ "Switch": () => (/* reexport safe */ _switch__WEBPACK_IMPORTED_MODULE_12__.Switch),
  1132. /* harmony export */ "Case": () => (/* reexport safe */ _case__WEBPACK_IMPORTED_MODULE_13__.Case),
  1133. /* harmony export */ "SysCall": () => (/* reexport safe */ _sysCall__WEBPACK_IMPORTED_MODULE_14__.SysCall),
  1134. /* harmony export */ "FormalParameter": () => (/* reexport safe */ _formalParameter__WEBPACK_IMPORTED_MODULE_15__.FormalParameter),
  1135. /* harmony export */ "FunctionCall": () => (/* reexport safe */ _expressions_functionCall__WEBPACK_IMPORTED_MODULE_16__.FunctionCall)
  1136. /* harmony export */ });
  1137. /* harmony import */ var _break__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  1138. /* harmony import */ var _return__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  1139. /* harmony import */ var _assign__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  1140. /* harmony import */ var _arrayAssign__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  1141. /* harmony import */ var _declaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  1142. /* harmony import */ var _arrayDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  1143. /* harmony import */ var _while__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  1144. /* harmony import */ var _for__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  1145. /* harmony import */ var _function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  1146. /* harmony import */ var _ifThenElse__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  1147. /* harmony import */ var _commandBlock__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  1148. /* harmony import */ var _repeatUntil__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./repeatUntil */ "./js/ast/commands/repeatUntil.js");
  1149. /* harmony import */ var _switch__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  1150. /* harmony import */ var _case__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  1151. /* harmony import */ var _sysCall__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  1152. /* harmony import */ var _formalParameter__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  1153. /* harmony import */ var _expressions_functionCall__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  1154. //Proxy to expression since they do exatcly the same thing
  1155. /***/ }),
  1156. /***/ "./js/ast/commands/repeatUntil.js":
  1157. /*!****************************************!*\
  1158. !*** ./js/ast/commands/repeatUntil.js ***!
  1159. \****************************************/
  1160. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1161. "use strict";
  1162. __webpack_require__.r(__webpack_exports__);
  1163. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1164. /* harmony export */ "RepeatUntil": () => (/* binding */ RepeatUntil)
  1165. /* harmony export */ });
  1166. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  1167. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  1168. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  1169. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  1170. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  1171. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  1172. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  1173. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  1174. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  1175. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  1176. /* harmony import */ var _while__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  1177. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  1178. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  1179. var RepeatUntil = /*#__PURE__*/function (_While) {
  1180. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(RepeatUntil, _While);
  1181. var _super = _createSuper(RepeatUntil);
  1182. function RepeatUntil(condition, commandBlock) {
  1183. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, RepeatUntil);
  1184. return _super.call(this, condition, commandBlock);
  1185. }
  1186. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(RepeatUntil, [{
  1187. key: "testFirst",
  1188. get: function get() {
  1189. return false;
  1190. }
  1191. }]);
  1192. return RepeatUntil;
  1193. }(_while__WEBPACK_IMPORTED_MODULE_5__.While);
  1194. /***/ }),
  1195. /***/ "./js/ast/commands/return.js":
  1196. /*!***********************************!*\
  1197. !*** ./js/ast/commands/return.js ***!
  1198. \***********************************/
  1199. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1200. "use strict";
  1201. __webpack_require__.r(__webpack_exports__);
  1202. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1203. /* harmony export */ "Return": () => (/* binding */ Return)
  1204. /* harmony export */ });
  1205. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  1206. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  1207. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  1208. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
  1209. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  1210. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
  1211. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  1212. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
  1213. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  1214. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default()(this, result); }; }
  1215. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  1216. var Return = /*#__PURE__*/function (_Command) {
  1217. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(Return, _Command);
  1218. var _super = _createSuper(Return);
  1219. function Return(expression) {
  1220. var _this;
  1221. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Return);
  1222. _this = _super.call(this);
  1223. _this.expression = expression;
  1224. return _this;
  1225. }
  1226. return Return;
  1227. }(_command__WEBPACK_IMPORTED_MODULE_4__.Command);
  1228. /***/ }),
  1229. /***/ "./js/ast/commands/switch.js":
  1230. /*!***********************************!*\
  1231. !*** ./js/ast/commands/switch.js ***!
  1232. \***********************************/
  1233. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1234. "use strict";
  1235. __webpack_require__.r(__webpack_exports__);
  1236. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1237. /* harmony export */ "Switch": () => (/* binding */ Switch)
  1238. /* harmony export */ });
  1239. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  1240. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  1241. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  1242. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
  1243. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  1244. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
  1245. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  1246. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
  1247. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  1248. /* harmony import */ var _expressions_expression__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../expressions/expression */ "./js/ast/expressions/expression.js");
  1249. /* harmony import */ var ___WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! . */ "./js/ast/commands/index.js");
  1250. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default()(this, result); }; }
  1251. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  1252. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  1253. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  1254. var Switch = /*#__PURE__*/function (_Command) {
  1255. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(Switch, _Command);
  1256. var _super = _createSuper(Switch);
  1257. /**
  1258. *
  1259. * @param {Expression} expression
  1260. * @param {Case[]} cases
  1261. */
  1262. function Switch(expression, cases) {
  1263. var _this;
  1264. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Switch);
  1265. _this = _super.call(this);
  1266. _this.expression = expression;
  1267. _this.cases = cases;
  1268. return _this;
  1269. }
  1270. return Switch;
  1271. }(_command__WEBPACK_IMPORTED_MODULE_4__.Command);
  1272. /***/ }),
  1273. /***/ "./js/ast/commands/sysCall.js":
  1274. /*!************************************!*\
  1275. !*** ./js/ast/commands/sysCall.js ***!
  1276. \************************************/
  1277. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1278. "use strict";
  1279. __webpack_require__.r(__webpack_exports__);
  1280. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1281. /* harmony export */ "SysCall": () => (/* binding */ SysCall)
  1282. /* harmony export */ });
  1283. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  1284. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  1285. /**
  1286. * This class represents all the language defined functions.
  1287. * The language processor uses the id provided here to properly execute the desired function.
  1288. * The function is actually implemented inside the language processor.
  1289. * All the functions can be found at: js/processor/definedFunctions.js
  1290. */
  1291. var SysCall = function SysCall(langFunc) {
  1292. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, SysCall);
  1293. this.langFunc = langFunc;
  1294. };
  1295. /***/ }),
  1296. /***/ "./js/ast/commands/while.js":
  1297. /*!**********************************!*\
  1298. !*** ./js/ast/commands/while.js ***!
  1299. \**********************************/
  1300. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1301. "use strict";
  1302. __webpack_require__.r(__webpack_exports__);
  1303. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1304. /* harmony export */ "While": () => (/* binding */ While)
  1305. /* harmony export */ });
  1306. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  1307. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  1308. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  1309. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  1310. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  1311. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  1312. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  1313. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  1314. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  1315. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  1316. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  1317. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  1318. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  1319. var While = /*#__PURE__*/function (_Command) {
  1320. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(While, _Command);
  1321. var _super = _createSuper(While);
  1322. function While(expression, commandBlock) {
  1323. var _this;
  1324. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, While);
  1325. _this = _super.call(this);
  1326. _this.expression = expression;
  1327. _this.commandBlock = commandBlock;
  1328. return _this;
  1329. }
  1330. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(While, [{
  1331. key: "commands",
  1332. get: function get() {
  1333. return this.commandBlock.commands;
  1334. }
  1335. }, {
  1336. key: "testFirst",
  1337. get: function get() {
  1338. return true;
  1339. }
  1340. }]);
  1341. return While;
  1342. }(_command__WEBPACK_IMPORTED_MODULE_5__.Command);
  1343. /***/ }),
  1344. /***/ "./js/ast/error/syntaxError.js":
  1345. /*!*************************************!*\
  1346. !*** ./js/ast/error/syntaxError.js ***!
  1347. \*************************************/
  1348. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1349. "use strict";
  1350. __webpack_require__.r(__webpack_exports__);
  1351. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1352. /* harmony export */ "SyntaxError": () => (/* binding */ SyntaxError)
  1353. /* harmony export */ });
  1354. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  1355. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  1356. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  1357. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  1358. /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js");
  1359. /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__);
  1360. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  1361. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__);
  1362. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  1363. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__);
  1364. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  1365. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__);
  1366. /* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ "./node_modules/@babel/runtime/helpers/wrapNativeSuper.js");
  1367. /* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6__);
  1368. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, result); }; }
  1369. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  1370. var SyntaxError = /*#__PURE__*/function (_Error) {
  1371. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default()(SyntaxError, _Error);
  1372. var _super = _createSuper(SyntaxError);
  1373. function SyntaxError(msg, id) {
  1374. var _this;
  1375. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, SyntaxError);
  1376. _this = _super.call(this, msg);
  1377. _this.id = id;
  1378. _this._context = {};
  1379. if (Error.captureStackTrace) Error.captureStackTrace(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), SyntaxError);
  1380. return _this;
  1381. }
  1382. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(SyntaxError, [{
  1383. key: "context",
  1384. get: function get() {
  1385. return this._context;
  1386. },
  1387. set: function set(contextObj) {
  1388. this._context = contextObj;
  1389. }
  1390. }]);
  1391. return SyntaxError;
  1392. }( /*#__PURE__*/_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6___default()(Error));
  1393. /***/ }),
  1394. /***/ "./js/ast/error/syntaxErrorFactory.js":
  1395. /*!********************************************!*\
  1396. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  1397. \********************************************/
  1398. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1399. "use strict";
  1400. __webpack_require__.r(__webpack_exports__);
  1401. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1402. /* harmony export */ "SyntaxErrorFactory": () => (/* binding */ SyntaxErrorFactory)
  1403. /* harmony export */ });
  1404. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  1405. /* harmony import */ var _syntaxError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  1406. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.getInstance();
  1407. function createError(message_id) {
  1408. var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  1409. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__.SyntaxError(LocalizedStrings.getError(message_id, context), message_id);
  1410. }
  1411. var SyntaxErrorFactory = Object.freeze({
  1412. extra_lines: function extra_lines() {
  1413. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__.SyntaxError(LocalizedStrings.getError("extra_lines"));
  1414. },
  1415. token_missing_one: function token_missing_one(expected, token) {
  1416. var context = [expected, token.text, token.line, token.col];
  1417. var error = createError("token_missing_one", context);
  1418. error.context = {
  1419. line: token.line,
  1420. column: token.col
  1421. };
  1422. return error;
  1423. },
  1424. token_missing_list: function token_missing_list(expectedList, token) {
  1425. var line = expectedList.join(LocalizedStrings.getOR());
  1426. var error = SyntaxErrorFactory.token_missing_one(line, token);
  1427. error.context = {
  1428. line: token.line,
  1429. column: token.col
  1430. };
  1431. return error;
  1432. },
  1433. id_missing: function id_missing(token) {
  1434. var context = [token.text, token.line, token.col];
  1435. var error = createError("id_missing", context);
  1436. error.context = {
  1437. line: token.line,
  1438. column: token.col
  1439. };
  1440. return error;
  1441. },
  1442. eos_missing: function eos_missing(token) {
  1443. var context = [token.line, token.col];
  1444. var error = createError("eos_missing", context);
  1445. error.context = {
  1446. line: token.line,
  1447. column: token.col
  1448. };
  1449. return error;
  1450. },
  1451. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  1452. var context = [token.line, token.col, typeName];
  1453. var error = createError("invalid_array_dimension", context);
  1454. error.context = {
  1455. line: token.line,
  1456. column: token.col
  1457. };
  1458. return error;
  1459. },
  1460. invalid_array_size: function invalid_array_size(token) {
  1461. var context = [token.line];
  1462. var error = createError("invalid_array_size", context);
  1463. error.context = {
  1464. line: token.line,
  1465. column: token.col
  1466. };
  1467. return error;
  1468. },
  1469. invalid_main_return: function invalid_main_return(name, typeName, token) {
  1470. var context = [name, typeName, token.line];
  1471. var error = createError("invalid_main_return", context);
  1472. error.context = {
  1473. line: token.line,
  1474. column: token.col
  1475. };
  1476. return error;
  1477. },
  1478. invalid_var_declaration: function invalid_var_declaration(token) {
  1479. var context = [token.line];
  1480. var error = createError("invalid_var_declaration", context);
  1481. error.context = {
  1482. line: token.line,
  1483. column: token.col
  1484. };
  1485. return error;
  1486. },
  1487. invalid_break_command: function invalid_break_command(cmdName, token) {
  1488. var context = [token.line, cmdName];
  1489. var error = createError("invalid_break_command", context);
  1490. error.context = {
  1491. line: token.line,
  1492. column: token.col
  1493. };
  1494. return error;
  1495. },
  1496. invalid_terminal: function invalid_terminal(token) {
  1497. var context = [token.text, token.line, token.col];
  1498. var error = createError("invalid_terminal", context);
  1499. error.context = {
  1500. line: token.line,
  1501. column: token.col
  1502. };
  1503. return error;
  1504. },
  1505. invalid_type: function invalid_type(list, token) {
  1506. var line = list.join(LocalizedStrings.getOR());
  1507. var context = [token.text, token.line, token.col, line];
  1508. var error = createError("invalid_type", context);
  1509. error.context = {
  1510. line: token.line,
  1511. column: token.col
  1512. };
  1513. return error;
  1514. },
  1515. const_not_init: function const_not_init(token) {
  1516. var context = [token.line, token.col];
  1517. var error = createError("const_not_init", context);
  1518. error.context = {
  1519. line: token.line,
  1520. column: token.col
  1521. };
  1522. return error;
  1523. },
  1524. invalid_id_format: function invalid_id_format(token) {
  1525. var context = [token.text, token.line, token.col];
  1526. var error = createError("invalid_id_format", context);
  1527. error.context = {
  1528. line: token.line,
  1529. column: token.col
  1530. };
  1531. return error;
  1532. },
  1533. duplicate_function: function duplicate_function(token) {
  1534. var context = [token.text, token.line, token.col];
  1535. var error = createError("duplicate_function", context);
  1536. error.context = {
  1537. line: token.line,
  1538. column: token.col
  1539. };
  1540. return error;
  1541. },
  1542. main_parameters: function main_parameters() {
  1543. return createError("main_parameters");
  1544. },
  1545. duplicate_variable: function duplicate_variable(token) {
  1546. var context = [token.text, token.line, token.col];
  1547. var error = createError("duplicate_variable", context);
  1548. error.context = {
  1549. line: token.line,
  1550. column: token.col
  1551. };
  1552. return error;
  1553. },
  1554. invalid_character: function invalid_character(text, line, column) {
  1555. var context = [text, line];
  1556. var error = createError("invalid_character", context);
  1557. error.context = {
  1558. line: line,
  1559. column: column
  1560. };
  1561. return error;
  1562. },
  1563. annonymous_array_literal: function annonymous_array_literal(token) {
  1564. var context = [token.line];
  1565. var error = createError("annonymous_array_literal", context);
  1566. error.context = {
  1567. line: token.line,
  1568. column: token.col
  1569. };
  1570. return error;
  1571. },
  1572. invalid_matrix_literal_line: function invalid_matrix_literal_line(exp, sourceInfo) {
  1573. var context = [exp, sourceInfo.line];
  1574. var error = createError("invalid_matrix_literal_line", context);
  1575. error.context = {
  1576. line: sourceInfo.line,
  1577. column: sourceInfo.column
  1578. };
  1579. return error;
  1580. },
  1581. cannot_infer_matrix_line: function cannot_infer_matrix_line(name, sourceInfo) {
  1582. var context = [name, sourceInfo.line];
  1583. var error = createError("cannot_infer_matrix_line", context);
  1584. error.context = {
  1585. line: sourceInfo.line,
  1586. column: sourceInfo.column
  1587. };
  1588. return error;
  1589. },
  1590. cannot_infer_matrix_column: function cannot_infer_matrix_column(name, sourceInfo) {
  1591. var context = [name, sourceInfo.line];
  1592. var error = createError("cannot_infer_matrix_column", context);
  1593. error.context = {
  1594. line: sourceInfo.line,
  1595. column: sourceInfo.column
  1596. };
  1597. return error;
  1598. },
  1599. cannot_infer_vector_size: function cannot_infer_vector_size(name, sourceInfo) {
  1600. var context = [name, sourceInfo.line];
  1601. var error = createError("cannot_infer_vector_size", context);
  1602. error.context = {
  1603. line: sourceInfo.line,
  1604. column: sourceInfo.column
  1605. };
  1606. return error;
  1607. },
  1608. matrix_to_vector_literal_attr: function matrix_to_vector_literal_attr(name, exp, sourceInfo) {
  1609. var context = [sourceInfo.line, exp, name];
  1610. var error = createError("matrix_to_vector_literal_attr", context);
  1611. error.context = {
  1612. line: sourceInfo.line,
  1613. column: sourceInfo.column
  1614. };
  1615. return error;
  1616. },
  1617. vector_to_matrix_literal_attr: function vector_to_matrix_literal_attr(name, exp, sourceInfo) {
  1618. var context = [sourceInfo.line, exp, name];
  1619. var error = createError("vector_to_matrix_literal_attr", context);
  1620. error.context = {
  1621. line: sourceInfo.line,
  1622. column: sourceInfo.column
  1623. };
  1624. return error;
  1625. },
  1626. array_init_not_literal: function array_init_not_literal(sourceInfo) {
  1627. var context = [sourceInfo.line];
  1628. var error = createError("array_init_not_literal", context);
  1629. error.context = {
  1630. line: sourceInfo.line,
  1631. column: sourceInfo.column
  1632. };
  1633. return error;
  1634. },
  1635. array_exceeds_2d: function array_exceeds_2d(sourceInfo) {
  1636. var context = [sourceInfo.line];
  1637. var error = createError("array_exceeds_2d", context);
  1638. error.context = {
  1639. line: sourceInfo.line,
  1640. column: sourceInfo.column
  1641. };
  1642. return error;
  1643. },
  1644. invalid_matrix_id_dimension: function invalid_matrix_id_dimension(sourceInfo) {
  1645. var context = [sourceInfo.line];
  1646. var error = createError("invalid_matrix_id_dimension", context);
  1647. error.context = {
  1648. line: sourceInfo.line,
  1649. column: sourceInfo.column
  1650. };
  1651. return error;
  1652. },
  1653. invalid_vector_init: function invalid_vector_init(sourceInfo) {
  1654. var context = [sourceInfo.line];
  1655. var error = createError("invalid_vector_init", context);
  1656. error.context = {
  1657. line: sourceInfo.line,
  1658. column: sourceInfo.column
  1659. };
  1660. return error;
  1661. },
  1662. invalid_matrix_init: function invalid_matrix_init(sourceInfo) {
  1663. var context = [sourceInfo.line];
  1664. var error = createError("invalid_matrix_init", context);
  1665. error.context = {
  1666. line: sourceInfo.line,
  1667. column: sourceInfo.column
  1668. };
  1669. return error;
  1670. },
  1671. invalid_syntax: function invalid_syntax(text, line, column) {
  1672. var context = [text, line];
  1673. var error = createError("invalid_syntax", context);
  1674. error.context = {
  1675. line: line,
  1676. column: column
  1677. };
  1678. return error;
  1679. }
  1680. });
  1681. /***/ }),
  1682. /***/ "./js/ast/expressions/arrayAccess.js":
  1683. /*!*******************************************!*\
  1684. !*** ./js/ast/expressions/arrayAccess.js ***!
  1685. \*******************************************/
  1686. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1687. "use strict";
  1688. __webpack_require__.r(__webpack_exports__);
  1689. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1690. /* harmony export */ "ArrayAccess": () => (/* binding */ ArrayAccess)
  1691. /* harmony export */ });
  1692. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  1693. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  1694. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  1695. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  1696. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  1697. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  1698. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  1699. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  1700. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  1701. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  1702. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  1703. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  1704. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  1705. var ArrayAccess = /*#__PURE__*/function (_Expression) {
  1706. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(ArrayAccess, _Expression);
  1707. var _super = _createSuper(ArrayAccess);
  1708. function ArrayAccess(id, line, column) {
  1709. var _this;
  1710. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, ArrayAccess);
  1711. _this = _super.call(this);
  1712. _this.id = id;
  1713. _this.line = line;
  1714. _this.column = column;
  1715. return _this;
  1716. }
  1717. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(ArrayAccess, [{
  1718. key: "toString",
  1719. value: function toString() {
  1720. var strLine = this.line.toString();
  1721. var strColumn = null;
  1722. if (this.column) {
  1723. strColumn = this.column.toString();
  1724. }
  1725. var text = null;
  1726. if (strColumn) {
  1727. text = "".concat(this.id, "[").concat(strLine, "][").concat(strColumn, "]");
  1728. } else {
  1729. text = "".concat(this.id, "[").concat(strLine, "]");
  1730. }
  1731. if (this.parenthesis) {
  1732. return "(".concat(text, ")");
  1733. } else {
  1734. return text;
  1735. }
  1736. }
  1737. }]);
  1738. return ArrayAccess;
  1739. }(_expression__WEBPACK_IMPORTED_MODULE_5__.Expression);
  1740. /***/ }),
  1741. /***/ "./js/ast/expressions/arrayLiteral.js":
  1742. /*!********************************************!*\
  1743. !*** ./js/ast/expressions/arrayLiteral.js ***!
  1744. \********************************************/
  1745. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1746. "use strict";
  1747. __webpack_require__.r(__webpack_exports__);
  1748. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1749. /* harmony export */ "ArrayLiteral": () => (/* binding */ ArrayLiteral)
  1750. /* harmony export */ });
  1751. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  1752. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  1753. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  1754. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  1755. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  1756. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  1757. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  1758. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  1759. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  1760. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  1761. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  1762. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  1763. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  1764. var ArrayLiteral = /*#__PURE__*/function (_Literal) {
  1765. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(ArrayLiteral, _Literal);
  1766. var _super = _createSuper(ArrayLiteral);
  1767. /**
  1768. *
  1769. * @param {import('../../typeSystem/itype').IType} type
  1770. * @param {import('./expression').Expression[]} value
  1771. */
  1772. function ArrayLiteral(type, value) {
  1773. var _this;
  1774. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, ArrayLiteral);
  1775. _this = _super.call(this, type);
  1776. _this.value = value;
  1777. return _this;
  1778. }
  1779. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(ArrayLiteral, [{
  1780. key: "validateType",
  1781. value: function validateType() {
  1782. var valid = true; // const subtype = this.subtype;
  1783. // if(this.columns !== null) {
  1784. // const len = this.lines;
  1785. // const len2 = this.columns;
  1786. // for (let i = len - 1; i >= 0 && valid; --i) {
  1787. // for (let j = len2 - 1; j >= 0 && valid; --j) {
  1788. // if(!this.value[i].value[j].type.isCompatilbe(subtype)) {
  1789. // valid = false;
  1790. // break;
  1791. // }
  1792. // }
  1793. // }
  1794. // } else {
  1795. // const len = this.lines;
  1796. // for (var i = len - 1; i >= 0 && valid; i--) {
  1797. // if(!this.value[i].type.isCompatilbe(subtype)) {
  1798. // valid = false;
  1799. // break;
  1800. // }
  1801. // }
  1802. // }
  1803. // Cannot validate type since no information on variables literals are available
  1804. return valid;
  1805. }
  1806. }, {
  1807. key: "validateSize",
  1808. value: function validateSize() {
  1809. var valid = true; // if(this.columns !== null) {
  1810. // const equalityTest = this.value.map(v => v.value.length)
  1811. // .reduce((old, next) => {
  1812. // console.log(next);
  1813. // if (old == null) {
  1814. // return next;
  1815. // } else if (old === next) {
  1816. // return old
  1817. // } else {
  1818. // return -1;
  1819. // }
  1820. // }, null);
  1821. // valid = equalityTest !== -1;
  1822. // }
  1823. // check is now made inside IVProgParser.parseVectorList(...)
  1824. return valid;
  1825. }
  1826. }, {
  1827. key: "toString",
  1828. value: function toString() {
  1829. var strList = this.value.map(function (arrayLiteral) {
  1830. return arrayLiteral.toString();
  1831. });
  1832. var text = "{" + strList.join(',') + "}";
  1833. if (this.parenthesis) {
  1834. return "(".concat(text, ")");
  1835. } else {
  1836. return text;
  1837. }
  1838. }
  1839. }, {
  1840. key: "subtype",
  1841. get: function get() {
  1842. var element = this.value[0];
  1843. if (element instanceof ArrayLiteral) {
  1844. return element.value[0].type;
  1845. } else {
  1846. return element.type;
  1847. }
  1848. }
  1849. }, {
  1850. key: "lines",
  1851. get: function get() {
  1852. return this.value.length;
  1853. }
  1854. }, {
  1855. key: "columns",
  1856. get: function get() {
  1857. var element = this.value[0];
  1858. if (!(element instanceof ArrayLiteral)) {
  1859. return null;
  1860. } else {
  1861. return element.value.length;
  1862. }
  1863. }
  1864. }, {
  1865. key: "isVector",
  1866. get: function get() {
  1867. return this.columns === null;
  1868. }
  1869. }, {
  1870. key: "isValid",
  1871. get: function get() {
  1872. return this.validateSize() && this.validateType();
  1873. }
  1874. }]);
  1875. return ArrayLiteral;
  1876. }(_literal__WEBPACK_IMPORTED_MODULE_5__.Literal);
  1877. /***/ }),
  1878. /***/ "./js/ast/expressions/boolLiteral.js":
  1879. /*!*******************************************!*\
  1880. !*** ./js/ast/expressions/boolLiteral.js ***!
  1881. \*******************************************/
  1882. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1883. "use strict";
  1884. __webpack_require__.r(__webpack_exports__);
  1885. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1886. /* harmony export */ "BoolLiteral": () => (/* binding */ BoolLiteral)
  1887. /* harmony export */ });
  1888. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  1889. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  1890. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  1891. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  1892. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  1893. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  1894. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  1895. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  1896. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  1897. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  1898. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  1899. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
  1900. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  1901. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  1902. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  1903. var BoolLiteral = /*#__PURE__*/function (_Literal) {
  1904. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(BoolLiteral, _Literal);
  1905. var _super = _createSuper(BoolLiteral);
  1906. function BoolLiteral(value) {
  1907. var _this;
  1908. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, BoolLiteral);
  1909. _this = _super.call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.BOOLEAN);
  1910. _this.value = value;
  1911. return _this;
  1912. }
  1913. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(BoolLiteral, [{
  1914. key: "toString",
  1915. value: function toString() {
  1916. var text = (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_7__.convertBoolToString)(this.value);
  1917. if (this.parenthesis) {
  1918. return "(".concat(text, ")");
  1919. } else {
  1920. return text;
  1921. }
  1922. }
  1923. }]);
  1924. return BoolLiteral;
  1925. }(_literal__WEBPACK_IMPORTED_MODULE_5__.Literal);
  1926. /***/ }),
  1927. /***/ "./js/ast/expressions/charLiteral.js":
  1928. /*!*******************************************!*\
  1929. !*** ./js/ast/expressions/charLiteral.js ***!
  1930. \*******************************************/
  1931. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1932. "use strict";
  1933. __webpack_require__.r(__webpack_exports__);
  1934. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1935. /* harmony export */ "CharLiteral": () => (/* binding */ CharLiteral)
  1936. /* harmony export */ });
  1937. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  1938. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  1939. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  1940. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  1941. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  1942. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  1943. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  1944. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  1945. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  1946. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  1947. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  1948. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
  1949. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  1950. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  1951. var CharLiteral = /*#__PURE__*/function (_Literal) {
  1952. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(CharLiteral, _Literal);
  1953. var _super = _createSuper(CharLiteral);
  1954. function CharLiteral(value) {
  1955. var _this;
  1956. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CharLiteral);
  1957. _this = _super.call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.CHAR);
  1958. _this.value = value;
  1959. return _this;
  1960. }
  1961. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(CharLiteral, [{
  1962. key: "toString",
  1963. value: function toString() {
  1964. var text = "'".concat(this.value, "'");
  1965. if (this.parenthesis) {
  1966. return "(".concat(text, ")");
  1967. } else {
  1968. return text;
  1969. }
  1970. }
  1971. }]);
  1972. return CharLiteral;
  1973. }(_literal__WEBPACK_IMPORTED_MODULE_5__.Literal);
  1974. /***/ }),
  1975. /***/ "./js/ast/expressions/expression.js":
  1976. /*!******************************************!*\
  1977. !*** ./js/ast/expressions/expression.js ***!
  1978. \******************************************/
  1979. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1980. "use strict";
  1981. __webpack_require__.r(__webpack_exports__);
  1982. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1983. /* harmony export */ "Expression": () => (/* binding */ Expression)
  1984. /* harmony export */ });
  1985. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  1986. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  1987. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  1988. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  1989. var Expression = /*#__PURE__*/function () {
  1990. function Expression() {
  1991. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Expression);
  1992. this._sourceInfo = null;
  1993. this._parenthesis = false;
  1994. }
  1995. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(Expression, [{
  1996. key: "sourceInfo",
  1997. set: function set(sourceInfo) {
  1998. this._sourceInfo = sourceInfo;
  1999. },
  2000. get: function get() {
  2001. return this._sourceInfo;
  2002. }
  2003. }, {
  2004. key: "parenthesis",
  2005. set: function set(flag) {
  2006. this._parenthesis = flag;
  2007. },
  2008. get: function get() {
  2009. return this._parenthesis;
  2010. }
  2011. }]);
  2012. return Expression;
  2013. }();
  2014. /***/ }),
  2015. /***/ "./js/ast/expressions/functionCall.js":
  2016. /*!********************************************!*\
  2017. !*** ./js/ast/expressions/functionCall.js ***!
  2018. \********************************************/
  2019. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  2020. "use strict";
  2021. __webpack_require__.r(__webpack_exports__);
  2022. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  2023. /* harmony export */ "FunctionCall": () => (/* binding */ FunctionCall)
  2024. /* harmony export */ });
  2025. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  2026. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  2027. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  2028. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  2029. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  2030. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  2031. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  2032. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  2033. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  2034. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  2035. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  2036. /* harmony import */ var _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  2037. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  2038. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  2039. var FunctionCall = /*#__PURE__*/function (_Expression) {
  2040. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(FunctionCall, _Expression);
  2041. var _super = _createSuper(FunctionCall);
  2042. /**
  2043. *
  2044. * @param {string} id
  2045. * @param {Expression[]} actualParameters
  2046. */
  2047. function FunctionCall(id, actualParameters) {
  2048. var _this;
  2049. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, FunctionCall);
  2050. _this = _super.call(this);
  2051. _this.id = id;
  2052. _this.actualParameters = actualParameters;
  2053. return _this;
  2054. }
  2055. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(FunctionCall, [{
  2056. key: "toString",
  2057. value: function toString() {
  2058. var name = null;
  2059. if (this.isMainCall) {
  2060. name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_6__.LanguageDefinedFunction.getMainFunctionName();
  2061. } else {
  2062. name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_6__.LanguageDefinedFunction.getLocalName(this.id);
  2063. }
  2064. var params = null;
  2065. if (this.actualParameters.length == 0) {
  2066. params = "()";
  2067. } else {
  2068. var strParams = this.actualParameters.map(function (v) {
  2069. return v.toString();
  2070. });
  2071. params = "(" + strParams.join(",") + ")";
  2072. }
  2073. if (this.parenthesis) {
  2074. return "(".concat(name + params, ")");
  2075. } else {
  2076. return name + params;
  2077. }
  2078. }
  2079. }, {
  2080. key: "isMainCall",
  2081. get: function get() {
  2082. return this.id === null;
  2083. }
  2084. }, {
  2085. key: "parametersSize",
  2086. get: function get() {
  2087. return this.actualParameters.length;
  2088. }
  2089. }]);
  2090. return FunctionCall;
  2091. }(_expression__WEBPACK_IMPORTED_MODULE_5__.Expression);
  2092. /***/ }),
  2093. /***/ "./js/ast/expressions/index.js":
  2094. /*!*************************************!*\
  2095. !*** ./js/ast/expressions/index.js ***!
  2096. \*************************************/
  2097. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  2098. "use strict";
  2099. __webpack_require__.r(__webpack_exports__);
  2100. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  2101. /* harmony export */ "ArrayAccess": () => (/* reexport safe */ _arrayAccess__WEBPACK_IMPORTED_MODULE_0__.ArrayAccess),
  2102. /* harmony export */ "FunctionCall": () => (/* reexport safe */ _functionCall__WEBPACK_IMPORTED_MODULE_1__.FunctionCall),
  2103. /* harmony export */ "IntLiteral": () => (/* reexport safe */ _intLiteral__WEBPACK_IMPORTED_MODULE_2__.IntLiteral),
  2104. /* harmony export */ "RealLiteral": () => (/* reexport safe */ _realLiteral__WEBPACK_IMPORTED_MODULE_3__.RealLiteral),
  2105. /* harmony export */ "BoolLiteral": () => (/* reexport safe */ _boolLiteral__WEBPACK_IMPORTED_MODULE_4__.BoolLiteral),
  2106. /* harmony export */ "CharLiteral": () => (/* reexport safe */ _charLiteral__WEBPACK_IMPORTED_MODULE_5__.CharLiteral),
  2107. /* harmony export */ "StringLiteral": () => (/* reexport safe */ _stringLiteral__WEBPACK_IMPORTED_MODULE_6__.StringLiteral),
  2108. /* harmony export */ "ArrayLiteral": () => (/* reexport safe */ _arrayLiteral__WEBPACK_IMPORTED_MODULE_7__.ArrayLiteral),
  2109. /* harmony export */ "VariableLiteral": () => (/* reexport safe */ _variableLiteral__WEBPACK_IMPORTED_MODULE_8__.VariableLiteral),
  2110. /* harmony export */ "InfixApp": () => (/* reexport safe */ _infixApp__WEBPACK_IMPORTED_MODULE_9__.InfixApp),
  2111. /* harmony export */ "UnaryApp": () => (/* reexport safe */ _unaryApp__WEBPACK_IMPORTED_MODULE_10__.UnaryApp)
  2112. /* harmony export */ });
  2113. /* harmony import */ var _arrayAccess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  2114. /* harmony import */ var _functionCall__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  2115. /* harmony import */ var _intLiteral__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  2116. /* harmony import */ var _realLiteral__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  2117. /* harmony import */ var _boolLiteral__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  2118. /* harmony import */ var _charLiteral__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./charLiteral */ "./js/ast/expressions/charLiteral.js");
  2119. /* harmony import */ var _stringLiteral__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  2120. /* harmony import */ var _arrayLiteral__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  2121. /* harmony import */ var _variableLiteral__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  2122. /* harmony import */ var _infixApp__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  2123. /* harmony import */ var _unaryApp__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  2124. /***/ }),
  2125. /***/ "./js/ast/expressions/infixApp.js":
  2126. /*!****************************************!*\
  2127. !*** ./js/ast/expressions/infixApp.js ***!
  2128. \****************************************/
  2129. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  2130. "use strict";
  2131. __webpack_require__.r(__webpack_exports__);
  2132. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  2133. /* harmony export */ "InfixApp": () => (/* binding */ InfixApp)
  2134. /* harmony export */ });
  2135. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  2136. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  2137. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  2138. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  2139. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  2140. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  2141. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  2142. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  2143. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  2144. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  2145. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  2146. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  2147. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  2148. var InfixApp = /*#__PURE__*/function (_Expression) {
  2149. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(InfixApp, _Expression);
  2150. var _super = _createSuper(InfixApp);
  2151. function InfixApp(op, left, right) {
  2152. var _this;
  2153. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, InfixApp);
  2154. _this = _super.call(this);
  2155. _this.op = op;
  2156. _this.left = left;
  2157. _this.right = right;
  2158. return _this;
  2159. }
  2160. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(InfixApp, [{
  2161. key: "toString",
  2162. value: function toString() {
  2163. var l = this.left.toString();
  2164. var op = this.op.value;
  2165. var r = this.right.toString();
  2166. if (this.parenthesis) {
  2167. return "(".concat(l + op + r, ")");
  2168. } else {
  2169. return l + op + r;
  2170. }
  2171. }
  2172. }]);
  2173. return InfixApp;
  2174. }(_expression__WEBPACK_IMPORTED_MODULE_5__.Expression);
  2175. /***/ }),
  2176. /***/ "./js/ast/expressions/intLiteral.js":
  2177. /*!******************************************!*\
  2178. !*** ./js/ast/expressions/intLiteral.js ***!
  2179. \******************************************/
  2180. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  2181. "use strict";
  2182. __webpack_require__.r(__webpack_exports__);
  2183. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  2184. /* harmony export */ "IntLiteral": () => (/* binding */ IntLiteral)
  2185. /* harmony export */ });
  2186. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  2187. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  2188. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  2189. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  2190. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  2191. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  2192. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  2193. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  2194. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  2195. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  2196. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  2197. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
  2198. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  2199. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  2200. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  2201. var IntLiteral = /*#__PURE__*/function (_Literal) {
  2202. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(IntLiteral, _Literal);
  2203. var _super = _createSuper(IntLiteral);
  2204. function IntLiteral(value) {
  2205. var _this;
  2206. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, IntLiteral);
  2207. _this = _super.call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.INTEGER);
  2208. _this.value = value;
  2209. return _this;
  2210. }
  2211. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(IntLiteral, [{
  2212. key: "toString",
  2213. value: function toString() {
  2214. var text = (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_7__.convertToString)(this.value, this.type);
  2215. if (this.parenthesis) {
  2216. return "(".concat(text, ")");
  2217. } else {
  2218. return text;
  2219. }
  2220. }
  2221. }]);
  2222. return IntLiteral;
  2223. }(_literal__WEBPACK_IMPORTED_MODULE_5__.Literal);
  2224. /***/ }),
  2225. /***/ "./js/ast/expressions/literal.js":
  2226. /*!***************************************!*\
  2227. !*** ./js/ast/expressions/literal.js ***!
  2228. \***************************************/
  2229. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  2230. "use strict";
  2231. __webpack_require__.r(__webpack_exports__);
  2232. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  2233. /* harmony export */ "Literal": () => (/* binding */ Literal)
  2234. /* harmony export */ });
  2235. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  2236. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  2237. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  2238. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);
  2239. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  2240. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);
  2241. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  2242. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);
  2243. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  2244. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default()(this, result); }; }
  2245. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  2246. var Literal = /*#__PURE__*/function (_Expression) {
  2247. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(Literal, _Expression);
  2248. var _super = _createSuper(Literal);
  2249. function Literal(type) {
  2250. var _this;
  2251. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Literal);
  2252. _this = _super.call(this);
  2253. _this.type = type;
  2254. return _this;
  2255. }
  2256. return Literal;
  2257. }(_expression__WEBPACK_IMPORTED_MODULE_4__.Expression);
  2258. /***/ }),
  2259. /***/ "./js/ast/expressions/realLiteral.js":
  2260. /*!*******************************************!*\
  2261. !*** ./js/ast/expressions/realLiteral.js ***!
  2262. \*******************************************/
  2263. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  2264. "use strict";
  2265. __webpack_require__.r(__webpack_exports__);
  2266. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  2267. /* harmony export */ "RealLiteral": () => (/* binding */ RealLiteral)
  2268. /* harmony export */ });
  2269. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  2270. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  2271. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  2272. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  2273. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  2274. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  2275. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  2276. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  2277. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  2278. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  2279. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  2280. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
  2281. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  2282. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  2283. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  2284. var RealLiteral = /*#__PURE__*/function (_Literal) {
  2285. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(RealLiteral, _Literal);
  2286. var _super = _createSuper(RealLiteral);
  2287. function RealLiteral(value) {
  2288. var _this;
  2289. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, RealLiteral);
  2290. _this = _super.call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.REAL);
  2291. _this.value = value;
  2292. return _this;
  2293. }
  2294. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(RealLiteral, [{
  2295. key: "toString",
  2296. value: function toString() {
  2297. var text = (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_7__.convertToString)(this.value, this.type);
  2298. if (this.parenthesis) {
  2299. return "(".concat(text, ")");
  2300. } else {
  2301. return text;
  2302. }
  2303. }
  2304. }]);
  2305. return RealLiteral;
  2306. }(_literal__WEBPACK_IMPORTED_MODULE_5__.Literal);
  2307. /***/ }),
  2308. /***/ "./js/ast/expressions/stringLiteral.js":
  2309. /*!*********************************************!*\
  2310. !*** ./js/ast/expressions/stringLiteral.js ***!
  2311. \*********************************************/
  2312. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  2313. "use strict";
  2314. __webpack_require__.r(__webpack_exports__);
  2315. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  2316. /* harmony export */ "StringLiteral": () => (/* binding */ StringLiteral)
  2317. /* harmony export */ });
  2318. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  2319. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  2320. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  2321. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  2322. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  2323. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  2324. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  2325. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  2326. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  2327. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  2328. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  2329. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
  2330. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  2331. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  2332. var StringLiteral = /*#__PURE__*/function (_Literal) {
  2333. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(StringLiteral, _Literal);
  2334. var _super = _createSuper(StringLiteral);
  2335. function StringLiteral(value) {
  2336. var _this;
  2337. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, StringLiteral);
  2338. _this = _super.call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.STRING);
  2339. _this.value = value;
  2340. return _this;
  2341. }
  2342. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(StringLiteral, [{
  2343. key: "toString",
  2344. value: function toString() {
  2345. var text = '"' + this.value + '"';
  2346. if (this.parenthesis) {
  2347. return "(".concat(text, ")");
  2348. } else {
  2349. return text;
  2350. }
  2351. }
  2352. }]);
  2353. return StringLiteral;
  2354. }(_literal__WEBPACK_IMPORTED_MODULE_5__.Literal);
  2355. /***/ }),
  2356. /***/ "./js/ast/expressions/unaryApp.js":
  2357. /*!****************************************!*\
  2358. !*** ./js/ast/expressions/unaryApp.js ***!
  2359. \****************************************/
  2360. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  2361. "use strict";
  2362. __webpack_require__.r(__webpack_exports__);
  2363. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  2364. /* harmony export */ "UnaryApp": () => (/* binding */ UnaryApp)
  2365. /* harmony export */ });
  2366. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  2367. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  2368. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  2369. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  2370. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  2371. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  2372. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  2373. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  2374. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  2375. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  2376. /* harmony import */ var _infixApp__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  2377. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  2378. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  2379. var UnaryApp = /*#__PURE__*/function (_InfixApp) {
  2380. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(UnaryApp, _InfixApp);
  2381. var _super = _createSuper(UnaryApp);
  2382. function UnaryApp(op, left) {
  2383. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, UnaryApp);
  2384. return _super.call(this, op, left, null);
  2385. }
  2386. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(UnaryApp, [{
  2387. key: "toString",
  2388. value: function toString() {
  2389. var l = this.left.toString();
  2390. var op = this.op.value;
  2391. if (this.parenthesis) {
  2392. return "(".concat(op + l, ")");
  2393. } else {
  2394. return op + l;
  2395. }
  2396. }
  2397. }]);
  2398. return UnaryApp;
  2399. }(_infixApp__WEBPACK_IMPORTED_MODULE_5__.InfixApp);
  2400. /***/ }),
  2401. /***/ "./js/ast/expressions/variableLiteral.js":
  2402. /*!***********************************************!*\
  2403. !*** ./js/ast/expressions/variableLiteral.js ***!
  2404. \***********************************************/
  2405. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  2406. "use strict";
  2407. __webpack_require__.r(__webpack_exports__);
  2408. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  2409. /* harmony export */ "VariableLiteral": () => (/* binding */ VariableLiteral)
  2410. /* harmony export */ });
  2411. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  2412. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  2413. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  2414. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  2415. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  2416. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  2417. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  2418. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  2419. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  2420. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  2421. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  2422. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
  2423. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  2424. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  2425. var VariableLiteral = /*#__PURE__*/function (_Literal) {
  2426. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(VariableLiteral, _Literal);
  2427. var _super = _createSuper(VariableLiteral);
  2428. function VariableLiteral(id) {
  2429. var _this;
  2430. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, VariableLiteral);
  2431. _this = _super.call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.UNDEFINED);
  2432. _this.id = id;
  2433. return _this;
  2434. }
  2435. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(VariableLiteral, [{
  2436. key: "toString",
  2437. value: function toString() {
  2438. if (this.parenthesis) {
  2439. return "(".concat(this.id, ")");
  2440. } else {
  2441. return this.id;
  2442. }
  2443. }
  2444. }]);
  2445. return VariableLiteral;
  2446. }(_literal__WEBPACK_IMPORTED_MODULE_5__.Literal);
  2447. /***/ }),
  2448. /***/ "./js/ast/ivprogParser.js":
  2449. /*!********************************!*\
  2450. !*** ./js/ast/ivprogParser.js ***!
  2451. \********************************/
  2452. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  2453. "use strict";
  2454. __webpack_require__.r(__webpack_exports__);
  2455. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  2456. /* harmony export */ "IVProgParser": () => (/* binding */ IVProgParser)
  2457. /* harmony export */ });
  2458. /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js");
  2459. /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__);
  2460. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  2461. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
  2462. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  2463. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__);
  2464. /* harmony import */ var _expressions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./expressions */ "./js/ast/expressions/index.js");
  2465. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./commands */ "./js/ast/commands/index.js");
  2466. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  2467. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../typeSystem/types */ "./js/typeSystem/types.ts");
  2468. /* harmony import */ var _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
  2469. /* harmony import */ var _sourceInfo__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  2470. /* harmony import */ var _operators__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./operators */ "./js/ast/operators.ts");
  2471. /* harmony import */ var _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  2472. /* harmony import */ var _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  2473. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.ts");
  2474. var IVProgParser = /*#__PURE__*/function () {
  2475. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(IVProgParser, null, [{
  2476. key: "createParser",
  2477. value: function createParser(input) {
  2478. var fill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  2479. var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_12__.LanguageService.getCurrentLexer();
  2480. var parser = new IVProgParser(input, lexer);
  2481. if (fill) {
  2482. parser.fill();
  2483. }
  2484. return parser;
  2485. } // <BEGIN scope consts>
  2486. }, {
  2487. key: "BASE",
  2488. get: function get() {
  2489. return 0;
  2490. }
  2491. }, {
  2492. key: "FUNCTION",
  2493. get: function get() {
  2494. return 1;
  2495. }
  2496. }, {
  2497. key: "COMMAND",
  2498. get: function get() {
  2499. return 2;
  2500. }
  2501. }, {
  2502. key: "BREAKABLE",
  2503. get: function get() {
  2504. return 4;
  2505. } // </ END scope consts>
  2506. //
  2507. }, {
  2508. key: "EOF_TOKEN",
  2509. get: function get() {
  2510. return {
  2511. text: null,
  2512. line: -1,
  2513. col: -1,
  2514. value: null,
  2515. offset: -1,
  2516. lineBreaks: false,
  2517. type: "EOF"
  2518. };
  2519. }
  2520. /**
  2521. * @param {string} input
  2522. * @param {IVProgLexer} ivprogLexer
  2523. **/
  2524. }]);
  2525. function IVProgParser(input, ivprogLexer) {
  2526. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, IVProgParser);
  2527. this.ivprogLexer = ivprogLexer;
  2528. this.inputStream = input;
  2529. this.lexer = ivprogLexer.lexer;
  2530. this.tokenStream = [];
  2531. this.pos = 0;
  2532. this.ruleNames = ivprogLexer.getRules();
  2533. this.variableTypes = Object.entries(this.ivprogLexer.getTypeKeys()).map(function (_ref) {
  2534. var _ref2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_ref, 2),
  2535. key = _ref2[0],
  2536. _ = _ref2[1];
  2537. return key;
  2538. });
  2539. this.functionTypes = this.variableTypes.concat(this.ruleNames.RK_VOID);
  2540. this.parsingArrayDimension = 0;
  2541. this.scope = [];
  2542. this.langFuncs = this.ivprogLexer.getLangFuncs();
  2543. this.definedFuncsNameList = [];
  2544. this.definedVariablesStack = [];
  2545. }
  2546. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(IVProgParser, [{
  2547. key: "fill",
  2548. value: function fill() {
  2549. var _this = this;
  2550. var stream = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  2551. if (stream) {
  2552. this.tokenStream = stream;
  2553. return;
  2554. }
  2555. this.tokenStream = Array.from(this.lexer.reset(this.inputStream));
  2556. this.tokenStream = this.tokenStream.filter(function (token) {
  2557. // Throws an exception in case of invalid syntax
  2558. if (token.type === _this.ruleNames.ERROR) {
  2559. var text = token.text;
  2560. var line = token.line;
  2561. var column = token.col;
  2562. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_syntax(text, line, column);
  2563. } // remove all whitespaces token and comments
  2564. return token.type !== _this.ruleNames.WHITESPACE && token.type !== _this.ruleNames.COMMENTS;
  2565. });
  2566. }
  2567. }, {
  2568. key: "parseTree",
  2569. value: function parseTree() {
  2570. return this.parseProgram();
  2571. }
  2572. /**
  2573. * @param {number} index
  2574. * @return {moo.Token}
  2575. * */
  2576. }, {
  2577. key: "getToken",
  2578. value: function getToken() {
  2579. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  2580. // if(index === null)
  2581. // index = this.pos;
  2582. if (index >= this.tokenStream.length) {
  2583. return IVProgParser.EOF_TOKEN;
  2584. }
  2585. return this.tokenStream[index];
  2586. }
  2587. }, {
  2588. key: "insideScope",
  2589. value: function insideScope(scope) {
  2590. if (this.scope.length <= 0) {
  2591. return IVProgParser.BASE === scope;
  2592. } else {
  2593. return this.scope[this.scope.length - 1] === scope;
  2594. }
  2595. }
  2596. }, {
  2597. key: "pushScope",
  2598. value: function pushScope(scope) {
  2599. this.scope.push(scope);
  2600. }
  2601. }, {
  2602. key: "pushVariableStack",
  2603. value: function pushVariableStack() {
  2604. this.definedVariablesStack.push([]);
  2605. }
  2606. }, {
  2607. key: "popScope",
  2608. value: function popScope() {
  2609. return this.scope.pop();
  2610. }
  2611. }, {
  2612. key: "popVariableStack",
  2613. value: function popVariableStack() {
  2614. return this.definedVariablesStack.pop();
  2615. }
  2616. }, {
  2617. key: "getCurrentVariableStack",
  2618. value: function getCurrentVariableStack() {
  2619. return this.definedVariablesStack[this.definedVariablesStack.length - 1];
  2620. }
  2621. }, {
  2622. key: "isEOF",
  2623. value: function isEOF() {
  2624. return this.getToken(this.pos).type === IVProgParser.EOF_TOKEN.type;
  2625. }
  2626. }, {
  2627. key: "parseProgram",
  2628. value: function parseProgram() {
  2629. this.consumeNewLines();
  2630. var token = this.getToken();
  2631. var globalVars = [];
  2632. var functions = [];
  2633. if (this.ruleNames.RK_PROGRAM === token.type) {
  2634. this.pos++;
  2635. this.consumeNewLines();
  2636. this.checkOpenCurly();
  2637. this.pos++;
  2638. this.pushVariableStack();
  2639. for (;;) {
  2640. this.consumeNewLines();
  2641. var _token = this.getToken();
  2642. if (_token.type === this.ruleNames.RK_CONST || this.isVariableType(_token)) {
  2643. globalVars = globalVars.concat(this.parseGlobalVariables());
  2644. } else if (_token.type === this.ruleNames.RK_FUNCTION) {
  2645. this.pushVariableStack();
  2646. functions = functions.concat(this.parseFunction());
  2647. this.popVariableStack();
  2648. } else {
  2649. break;
  2650. }
  2651. }
  2652. this.consumeNewLines();
  2653. this.checkCloseCurly();
  2654. this.pos++;
  2655. this.consumeNewLines();
  2656. if (!this.isEOF()) {
  2657. console.log(this.getToken());
  2658. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.extra_lines();
  2659. }
  2660. this.popVariableStack();
  2661. return {
  2662. global: globalVars,
  2663. functions: functions
  2664. };
  2665. } else {
  2666. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one(this.ivprogLexer.getReservedKeys()[this.ruleNames.RK_PROGRAM], token);
  2667. }
  2668. }
  2669. }, {
  2670. key: "checkOpenCurly",
  2671. value: function checkOpenCurly() {
  2672. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  2673. var token = this.getToken();
  2674. if (this.ruleNames.OPEN_CURLY !== token.type) {
  2675. if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one("{", token);else return false;
  2676. }
  2677. return true;
  2678. }
  2679. }, {
  2680. key: "checkCloseCurly",
  2681. value: function checkCloseCurly() {
  2682. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  2683. var token = this.getToken();
  2684. if (this.ruleNames.CLOSE_CURLY !== token.type) {
  2685. if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one("}", token);else return false;
  2686. }
  2687. return true;
  2688. }
  2689. /* It checks if the current token at position pos is a ']'.
  2690. * As a check function it doesn't increment pos.
  2691. *
  2692. * @params bool:attempt, indicates that the token is optional. Defaults: false
  2693. *
  2694. * @returns true if the attempt is true and current token is '[',
  2695. * false is attempt is true and current token is not '['
  2696. **/
  2697. }, {
  2698. key: "checkOpenBrace",
  2699. value: function checkOpenBrace() {
  2700. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  2701. var token = this.getToken();
  2702. if (this.ruleNames.OPEN_BRACE !== token.type) {
  2703. if (!attempt) {
  2704. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one("[", token);
  2705. } else {
  2706. return false;
  2707. }
  2708. }
  2709. return true;
  2710. }
  2711. }, {
  2712. key: "checkCloseBrace",
  2713. value: function checkCloseBrace() {
  2714. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  2715. var token = this.getToken();
  2716. if (this.ruleNames.CLOSE_BRACE !== token.type) {
  2717. if (!attempt) {
  2718. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one("]", token);
  2719. } else {
  2720. return false;
  2721. }
  2722. }
  2723. return true;
  2724. }
  2725. }, {
  2726. key: "checkOpenParenthesis",
  2727. value: function checkOpenParenthesis() {
  2728. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  2729. var token = this.getToken();
  2730. if (this.ruleNames.OPEN_PARENTHESIS !== token.type) {
  2731. if (!attempt) {
  2732. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one("(", token);
  2733. } else {
  2734. return false;
  2735. }
  2736. }
  2737. return true;
  2738. }
  2739. }, {
  2740. key: "checkCloseParenthesis",
  2741. value: function checkCloseParenthesis() {
  2742. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  2743. var token = this.getToken();
  2744. if (this.ruleNames.CLOSE_PARENTHESIS !== token.type) {
  2745. if (!attempt) {
  2746. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one(")", token);
  2747. } else {
  2748. return false;
  2749. }
  2750. }
  2751. return true;
  2752. }
  2753. }, {
  2754. key: "checkEOS",
  2755. value: function checkEOS() {
  2756. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  2757. var eosToken = this.getToken();
  2758. if (eosToken.type !== this.ruleNames.EOS) {
  2759. if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.eos_missing(eosToken);else return false;
  2760. }
  2761. return true;
  2762. }
  2763. }, {
  2764. key: "checkFunctionDuplicate",
  2765. value: function checkFunctionDuplicate(functionID, funcIDToken) {
  2766. var id = functionID === null ? "$main" : functionID;
  2767. var index = this.definedFuncsNameList.indexOf(id);
  2768. if (index !== -1) {
  2769. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.duplicate_function(funcIDToken);
  2770. }
  2771. this.definedFuncsNameList.push(id);
  2772. }
  2773. }, {
  2774. key: "checkVariableDuplicate",
  2775. value: function checkVariableDuplicate(variableID, sourceInfo) {
  2776. var index = this.getCurrentVariableStack().indexOf(variableID);
  2777. if (index !== -1) {
  2778. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.duplicate_variable(sourceInfo);
  2779. }
  2780. this.getCurrentVariableStack().push(variableID);
  2781. }
  2782. }, {
  2783. key: "consumeForSemiColon",
  2784. value: function consumeForSemiColon() {
  2785. var eosToken = this.getToken();
  2786. if (eosToken.type === this.ruleNames.EOS && eosToken.text.match("^;$")) {
  2787. this.pos++;
  2788. return;
  2789. }
  2790. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one(";", eosToken);
  2791. }
  2792. }, {
  2793. key: "parseGlobalVariables",
  2794. value: function parseGlobalVariables() {
  2795. var decl = this.parseMaybeConst();
  2796. this.checkEOS();
  2797. this.pos++;
  2798. return decl;
  2799. }
  2800. /*
  2801. * Checks if the next token is PR_CONST. It's only available
  2802. * at global variables declaration level
  2803. * @returns Declararion(const, type, id, initVal?)
  2804. **/
  2805. }, {
  2806. key: "parseMaybeConst",
  2807. value: function parseMaybeConst() {
  2808. var constToken = this.getToken();
  2809. if (constToken.type === this.ruleNames.RK_CONST) {
  2810. this.pos++;
  2811. var typeString = this.parseType();
  2812. return this.parseDeclaration(typeString, true);
  2813. } else if (this.isVariableType(constToken)) {
  2814. var _typeString = this.parseType();
  2815. return this.parseDeclaration(_typeString);
  2816. } else {
  2817. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_list([this.ivprogLexer.getReservedKeys()[this.ruleNames.RK_CONST]].concat(this.getTypeArray()), constToken);
  2818. }
  2819. }
  2820. /**
  2821. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  2822. * @return {Commands.Declartion[]} a list of Declararion(const, type, id, initVal?)
  2823. **/
  2824. }, {
  2825. key: "parseDeclaration",
  2826. value: function parseDeclaration(typeString) {
  2827. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2828. var initial = null;
  2829. var dim1 = null;
  2830. var dim2 = null;
  2831. var dimensions = 0;
  2832. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(this.getToken());
  2833. var idString = this.parseID();
  2834. this.checkVariableDuplicate(idString, sourceInfo); // Check for array or vector
  2835. // ID[int/IDi?][int/IDj?]
  2836. if (this.checkOpenBrace(true)) {
  2837. this.pos += 1;
  2838. this.consumeNewLines();
  2839. dim1 = this.parseArrayDimension();
  2840. this.consumeNewLines();
  2841. this.checkCloseBrace();
  2842. this.pos += 1;
  2843. dimensions += 1;
  2844. if (this.checkOpenBrace(true)) {
  2845. this.pos += 1;
  2846. this.consumeNewLines();
  2847. dim2 = this.parseArrayDimension();
  2848. this.consumeNewLines();
  2849. this.checkCloseBrace();
  2850. this.pos += 1;
  2851. dimensions += 1;
  2852. }
  2853. return this.parseArrayDeclaration(typeString, isConst, idString, sourceInfo, dimensions, dim1, dim2);
  2854. } else {
  2855. var assignmentToken = this.getToken();
  2856. if (isConst && assignmentToken.type !== this.ruleNames.ASSIGNMENT) {
  2857. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.const_not_init(sourceInfo);
  2858. }
  2859. if (assignmentToken.type === this.ruleNames.ASSIGNMENT) {
  2860. this.pos++;
  2861. initial = this.parseExpressionOR();
  2862. }
  2863. var declaration = new _commands__WEBPACK_IMPORTED_MODULE_4__.Declaration(idString, typeString, initial, isConst);
  2864. declaration.sourceInfo = sourceInfo;
  2865. var commaToken = this.getToken();
  2866. if (commaToken.type === this.ruleNames.COMMA) {
  2867. this.pos++;
  2868. this.consumeNewLines();
  2869. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  2870. } else {
  2871. return [declaration];
  2872. }
  2873. }
  2874. }
  2875. }, {
  2876. key: "parseArrayDeclaration",
  2877. value: function parseArrayDeclaration(typeString, isConst, idString, sourceInfo, dimensions, dim1, dim2) {
  2878. var assignmentToken = this.getToken();
  2879. var n_lines = dim1;
  2880. var n_columns = dim2;
  2881. var initial = null;
  2882. var dim_is_id = false;
  2883. if (dim1 instanceof _expressions__WEBPACK_IMPORTED_MODULE_3__.VariableLiteral || dim2 instanceof _expressions__WEBPACK_IMPORTED_MODULE_3__.VariableLiteral) {
  2884. dim_is_id = true;
  2885. if (dimensions > 1 && (dim1 == null || dim2 == null)) {
  2886. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_matrix_id_dimension(_sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(assignmentToken));
  2887. }
  2888. }
  2889. if (isConst && assignmentToken.type !== this.ruleNames.ASSIGNMENT) {
  2890. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.const_not_init(sourceInfo);
  2891. }
  2892. if (assignmentToken.type === this.ruleNames.ASSIGNMENT) {
  2893. if (dim_is_id) {
  2894. if (dimensions == 1) {
  2895. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_vector_init(_sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(assignmentToken));
  2896. } else {
  2897. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_matrix_init(_sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(assignmentToken));
  2898. }
  2899. }
  2900. this.pos += 1;
  2901. initial = this.parseArrayLiteral(typeString);
  2902. }
  2903. if (initial == null && dim1 == null) {
  2904. if (dimensions > 1) {
  2905. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.cannot_infer_matrix_line(idString, sourceInfo);
  2906. }
  2907. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.cannot_infer_vector_size(idString, sourceInfo);
  2908. }
  2909. if (dimensions > 1) {
  2910. if (initial == null && dim2 == null) {
  2911. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.cannot_infer_matrix_column(idString, sourceInfo);
  2912. }
  2913. }
  2914. if (dimensions === 1 && initial != null && !initial.isVector) {
  2915. var expString = initial.toString();
  2916. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.matrix_to_vector_literal_attr(idString, expString, initial.sourceInfo);
  2917. } else if (dimensions > 1 && initial != null && initial.isVector) {
  2918. var _expString = initial.toString();
  2919. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.vector_to_matrix_literal_attr(idString, _expString, initial.sourceInfo);
  2920. }
  2921. if (dim1 == null) {
  2922. n_lines = new _expressions__WEBPACK_IMPORTED_MODULE_3__.IntLiteral(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toInt(initial.lines));
  2923. n_lines.sourceInfo = sourceInfo;
  2924. }
  2925. if (dimensions > 1) {
  2926. if (dim2 == null) {
  2927. n_columns = new _expressions__WEBPACK_IMPORTED_MODULE_3__.IntLiteral(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toInt(initial.columns));
  2928. n_columns.sourceInfo = sourceInfo;
  2929. }
  2930. }
  2931. var declaration = new _commands__WEBPACK_IMPORTED_MODULE_4__.ArrayDeclaration(idString, new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_7__.ArrayType(typeString, dimensions), n_lines, n_columns, initial, isConst);
  2932. declaration.sourceInfo = sourceInfo;
  2933. var commaToken = this.getToken();
  2934. if (commaToken.type === this.ruleNames.COMMA) {
  2935. this.pos++;
  2936. this.consumeNewLines();
  2937. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  2938. } else {
  2939. return [declaration];
  2940. }
  2941. }
  2942. }, {
  2943. key: "consumeNewLines",
  2944. value: function consumeNewLines() {
  2945. var token = this.getToken();
  2946. while (token && token.type === this.ruleNames.EOS && token.text.match("^[\r\n]+$")) {
  2947. this.pos++;
  2948. token = this.getToken();
  2949. }
  2950. }
  2951. }, {
  2952. key: "isVariableType",
  2953. value: function isVariableType(token) {
  2954. return this.variableTypes.find(function (v) {
  2955. return v === token.type;
  2956. });
  2957. }
  2958. /**
  2959. * Reads the next token of the stream to check if it is a Integer or an ID.
  2960. * @returns Integer | ID
  2961. **/
  2962. }, {
  2963. key: "parseArrayDimension",
  2964. value: function parseArrayDimension() {
  2965. var dimToken = this.getToken();
  2966. if (dimToken.type === this.ruleNames.INTEGER) {
  2967. //parse as int literal
  2968. this.pos++;
  2969. return this.getIntLiteral(dimToken);
  2970. } else if (dimToken.type === this.ruleNames.ID) {
  2971. //parse as variable
  2972. this.pos++;
  2973. return this.parseVariable(dimToken);
  2974. } else if (dimToken.type === this.ruleNames.CLOSE_BRACE) {
  2975. return null;
  2976. } else {
  2977. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_array_dimension(this.ivprogLexer.getReservedKeys()[this.ruleNames.RK_INTEGER], dimToken);
  2978. }
  2979. }
  2980. /**
  2981. * Returns an object {type: 'int', value: value}.
  2982. * It checks for binary and hexadecimal integers.
  2983. * @param {moo.Token} token
  2984. * @return {Object} object with fields type and value
  2985. **/
  2986. }, {
  2987. key: "getIntLiteral",
  2988. value: function getIntLiteral(token) {
  2989. var text = token.text;
  2990. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  2991. var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.IntLiteral(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toInt(text));
  2992. exp.sourceInfo = sourceInfo;
  2993. return exp;
  2994. }
  2995. }, {
  2996. key: "getRealLiteral",
  2997. value: function getRealLiteral(token) {
  2998. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  2999. var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.RealLiteral(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toReal(token.text));
  3000. exp.sourceInfo = sourceInfo;
  3001. return exp;
  3002. }
  3003. }, {
  3004. key: "getStringLiteral",
  3005. value: function getStringLiteral(token) {
  3006. var text = token.text;
  3007. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  3008. var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.StringLiteral(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toString(text));
  3009. exp.sourceInfo = sourceInfo;
  3010. return exp;
  3011. }
  3012. }, {
  3013. key: "getCharLiteral",
  3014. value: function getCharLiteral(token) {
  3015. var text = token.text;
  3016. var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.CharLiteral(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toChar(text));
  3017. exp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  3018. return exp;
  3019. }
  3020. }, {
  3021. key: "getBoolLiteral",
  3022. value: function getBoolLiteral(token) {
  3023. var val = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toBool(token.text);
  3024. var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.BoolLiteral(val);
  3025. exp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  3026. return exp;
  3027. }
  3028. }, {
  3029. key: "parseArrayLiteral",
  3030. value: function parseArrayLiteral(typeString) {
  3031. var openCurly = this.checkOpenCurly(true);
  3032. if (!openCurly) {
  3033. var invalid_token = this.getToken();
  3034. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.array_init_not_literal(_sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(invalid_token));
  3035. }
  3036. var beginArray = this.getToken();
  3037. if (this.parsingArrayDimension >= 2) {
  3038. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.array_exceeds_2d(_sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(beginArray));
  3039. }
  3040. this.pos += 1;
  3041. this.parsingArrayDimension += 1;
  3042. this.consumeNewLines();
  3043. var data = null;
  3044. var maybeCurlyOpen = this.checkOpenCurly(true);
  3045. if (maybeCurlyOpen) {
  3046. // This is potentially a list of vectors
  3047. data = this.parseVectorList(typeString);
  3048. } else {
  3049. data = this.parseExpressionList();
  3050. }
  3051. this.consumeNewLines();
  3052. this.checkCloseCurly();
  3053. var endArray = this.getToken();
  3054. this.pos += 1;
  3055. this.parsingArrayDimension -= 1;
  3056. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfoFromList(beginArray, endArray);
  3057. var dataDim = 1;
  3058. if (data[0] instanceof _expressions__WEBPACK_IMPORTED_MODULE_3__.ArrayLiteral) {
  3059. dataDim += 1;
  3060. } else if (data.length == 1) {
  3061. console.log("Talvez uma variável seja uma melhor opção");
  3062. }
  3063. var type = new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_7__.ArrayType(typeString, dataDim);
  3064. var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.ArrayLiteral(type, data);
  3065. exp.sourceInfo = sourceInfo;
  3066. return exp;
  3067. }
  3068. /**
  3069. * Returns a list of ArrayLiterals. Helper function for parsing matrices
  3070. */
  3071. }, {
  3072. key: "parseVectorList",
  3073. value: function parseVectorList(typeString) {
  3074. var list = [];
  3075. var lastSize = null;
  3076. for (;;) {
  3077. this.checkOpenCurly();
  3078. var beginArray = this.getToken();
  3079. if (this.parsingArrayDimension >= 2) {
  3080. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.array_exceeds_2d(_sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(beginArray));
  3081. }
  3082. this.pos += 1;
  3083. this.parsingArrayDimension += 1;
  3084. this.consumeNewLines();
  3085. var data = this.parseExpressionList();
  3086. this.consumeNewLines();
  3087. this.checkCloseCurly();
  3088. var endArray = this.getToken();
  3089. this.pos += 1;
  3090. this.parsingArrayDimension -= 1;
  3091. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfoFromList(beginArray, endArray);
  3092. if (lastSize == null) {
  3093. lastSize = data.length;
  3094. } else if (lastSize !== data.length) {
  3095. var expString = this.inputStream.substring(beginArray.offset, endArray.offset + endArray.text.length);
  3096. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_matrix_literal_line(expString, sourceInfo);
  3097. }
  3098. var type = new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_7__.ArrayType(typeString, 1);
  3099. var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.ArrayLiteral(type, data);
  3100. exp.sourceInfo = sourceInfo;
  3101. list.push(exp);
  3102. var commaToken = this.getToken();
  3103. if (commaToken.type !== this.ruleNames.COMMA) {
  3104. break;
  3105. }
  3106. this.pos += 1;
  3107. this.consumeNewLines();
  3108. }
  3109. if (list.length == 1) {
  3110. console.log("Talvez um vetor seja uma melhor opção");
  3111. }
  3112. return list;
  3113. }
  3114. /*
  3115. * Returns an object {type: 'variable', value: value}.
  3116. * @returns object with fields type and value
  3117. **/
  3118. }, {
  3119. key: "parseVariable",
  3120. value: function parseVariable(token) {
  3121. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  3122. var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.VariableLiteral(token.text);
  3123. exp.sourceInfo = sourceInfo;
  3124. return exp;
  3125. }
  3126. /*
  3127. * Returns an object representing a function. It has
  3128. * four attributes: returnType, id, formalParams and block.
  3129. * The block object has two attributes: declarations and commands
  3130. **/
  3131. }, {
  3132. key: "parseFunction",
  3133. value: function parseFunction() {
  3134. this.pushScope(IVProgParser.FUNCTION);
  3135. var formalParams = [];
  3136. var token = this.getToken();
  3137. if (token.type !== this.ruleNames.RK_FUNCTION) {
  3138. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  3139. return null;
  3140. }
  3141. this.pos++;
  3142. var funType = this.parseType();
  3143. var dimensions = 0;
  3144. if (this.checkOpenBrace(true)) {
  3145. this.pos++;
  3146. this.checkCloseBrace();
  3147. this.pos++;
  3148. dimensions++;
  3149. if (this.checkOpenBrace(true)) {
  3150. this.pos++;
  3151. this.checkCloseBrace();
  3152. this.pos++;
  3153. dimensions++;
  3154. }
  3155. }
  3156. var funcIDToken = this.getToken();
  3157. var functionID = this.parseID();
  3158. this.checkFunctionDuplicate(functionID, funcIDToken);
  3159. this.checkOpenParenthesis();
  3160. this.pos++;
  3161. this.consumeNewLines();
  3162. if (!this.checkCloseParenthesis(true)) {
  3163. formalParams = this.parseFormalParameters(); // formal parameters
  3164. this.consumeNewLines();
  3165. this.checkCloseParenthesis();
  3166. this.pos++;
  3167. } else {
  3168. this.pos++;
  3169. }
  3170. this.consumeNewLines();
  3171. var commandsBlock = this.parseCommandBlock();
  3172. var returnType = funType;
  3173. if (dimensions > 0) {
  3174. returnType = new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_7__.ArrayType(funType, dimensions);
  3175. }
  3176. var func = new _commands__WEBPACK_IMPORTED_MODULE_4__.Function(functionID, returnType, formalParams, commandsBlock);
  3177. if (functionID === null && !func.isMain) {
  3178. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_main_return(_processor_definedFunctions__WEBPACK_IMPORTED_MODULE_11__.LanguageDefinedFunction.getMainFunctionName(), this.ivprogLexer.getReservedKeys()[this.ruleNames.RK_VOID], token.line);
  3179. } else if (func.isMain && formalParams.length !== 0) {
  3180. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.main_parameters();
  3181. }
  3182. this.popScope();
  3183. func.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(funcIDToken);
  3184. return func;
  3185. }
  3186. /*
  3187. * Parse the formal parameters of a function.
  3188. * @returns a list of objects with the following attributes: type, id and dimensions.
  3189. **/
  3190. }, {
  3191. key: "parseFormalParameters",
  3192. value: function parseFormalParameters() {
  3193. var list = [];
  3194. for (;;) {
  3195. var dimensions = 0;
  3196. var reference = false;
  3197. var typeString = this.parseType();
  3198. var maybeIDToken = this.getToken();
  3199. if (maybeIDToken.type === this.ruleNames.RK_REFERENCE) {
  3200. reference = true;
  3201. this.pos += 1;
  3202. maybeIDToken = this.getToken();
  3203. }
  3204. var idString = this.parseID();
  3205. this.checkVariableDuplicate(idString, maybeIDToken);
  3206. if (this.checkOpenBrace(true)) {
  3207. this.pos += 1;
  3208. dimensions += 1;
  3209. this.checkCloseBrace();
  3210. this.pos += 1;
  3211. if (this.checkOpenBrace(true)) {
  3212. this.pos += 1;
  3213. dimensions += 1;
  3214. this.checkCloseBrace();
  3215. this.pos += 1;
  3216. }
  3217. }
  3218. var type = null;
  3219. if (dimensions > 0) {
  3220. type = new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_7__.ArrayType(typeString, dimensions);
  3221. } else {
  3222. type = typeString;
  3223. }
  3224. var parameter = new _commands__WEBPACK_IMPORTED_MODULE_4__.FormalParameter(type, idString, reference);
  3225. parameter.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(maybeIDToken);
  3226. list.push(parameter);
  3227. var commaToken = this.getToken();
  3228. if (commaToken.type !== this.ruleNames.COMMA) break;
  3229. this.pos++;
  3230. this.consumeNewLines();
  3231. }
  3232. return list;
  3233. }
  3234. }, {
  3235. key: "parseID",
  3236. value: function parseID() {
  3237. var token = this.getToken();
  3238. if (token.type !== this.ruleNames.ID) {
  3239. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.id_missing(token);
  3240. }
  3241. this.pos++;
  3242. if (this.insideScope(IVProgParser.FUNCTION)) {
  3243. if (token.text === _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_11__.LanguageDefinedFunction.getMainFunctionName()) {
  3244. return null;
  3245. }
  3246. }
  3247. return token.text;
  3248. }
  3249. /**
  3250. * @return {string}
  3251. **/
  3252. }, {
  3253. key: "parseMaybeLibID",
  3254. value: function parseMaybeLibID() {
  3255. var token = this.getToken();
  3256. if (token.type !== this.ruleNames.ID) {
  3257. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.id_missing(token);
  3258. }
  3259. var maybeDOT = this.getToken(this.pos + 1);
  3260. if (maybeDOT.type === this.ruleNames.DOT) {
  3261. this.pos += 2;
  3262. var anotherID = this.getToken();
  3263. if (anotherID.type !== this.ruleNames.ID) {
  3264. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.id_missing(anotherID);
  3265. }
  3266. this.pos++;
  3267. return "".concat(token.text, ".").concat(anotherID.text);
  3268. }
  3269. this.pos++;
  3270. return token.text;
  3271. }
  3272. }, {
  3273. key: "parseType",
  3274. value: function parseType() {
  3275. var token = this.getToken();
  3276. if (token.type === this.ruleNames.ID && this.insideScope(IVProgParser.FUNCTION)) {
  3277. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.VOID;
  3278. } else if (token.type === this.ruleNames.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  3279. this.pos++;
  3280. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.VOID;
  3281. } else if (this.isVariableType(token)) {
  3282. this.pos++;
  3283. switch (token.type) {
  3284. case this.ruleNames.RK_INTEGER:
  3285. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.INTEGER;
  3286. case this.ruleNames.RK_BOOLEAN:
  3287. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.BOOLEAN;
  3288. case this.ruleNames.RK_REAL:
  3289. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.REAL;
  3290. case this.ruleNames.RK_STRING:
  3291. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.STRING;
  3292. case this.ruleNames.RK_CHARACTER:
  3293. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__.Types.CHAR;
  3294. default:
  3295. break;
  3296. }
  3297. }
  3298. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_type(this.getTypeArray(), token);
  3299. }
  3300. }, {
  3301. key: "parseCommandBlock",
  3302. value: function parseCommandBlock() {
  3303. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3304. var variablesDecl = [];
  3305. var commands = [];
  3306. var hasOpen = false;
  3307. if (this.checkOpenCurly(optionalCurly)) {
  3308. this.pos++;
  3309. hasOpen = true;
  3310. }
  3311. this.consumeNewLines();
  3312. var parsedCommand = false;
  3313. for (;;) {
  3314. var cmd = this.parseCommand();
  3315. if (cmd === null) break;
  3316. if (cmd !== -1) {
  3317. if (cmd instanceof Array) {
  3318. if (parsedCommand) {
  3319. var lastToken = this.getToken(this.pos - 1);
  3320. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_var_declaration(lastToken);
  3321. }
  3322. variablesDecl = variablesDecl.concat(cmd);
  3323. } else {
  3324. parsedCommand = true;
  3325. commands.push(cmd);
  3326. }
  3327. }
  3328. }
  3329. this.consumeNewLines();
  3330. if (hasOpen) {
  3331. this.checkCloseCurly();
  3332. this.pos++;
  3333. this.consumeNewLines();
  3334. }
  3335. return new _commands__WEBPACK_IMPORTED_MODULE_4__.CommandBlock(variablesDecl, commands);
  3336. }
  3337. }, {
  3338. key: "parseCommand",
  3339. value: function parseCommand() {
  3340. var token = this.getToken();
  3341. if (this.isVariableType(token)) {
  3342. if (!this.insideScope(IVProgParser.FUNCTION)) {
  3343. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_var_declaration(token);
  3344. }
  3345. this.pushScope(IVProgParser.BASE);
  3346. var varType = this.parseType();
  3347. this.popScope();
  3348. var cmd = this.parseDeclaration(varType);
  3349. this.checkEOS();
  3350. this.pos++;
  3351. return cmd;
  3352. } else if (token.type === this.ruleNames.ID) {
  3353. return this.parseIDCommand();
  3354. } else if (token.type === this.ruleNames.DOT) {
  3355. // TODO Check if this is relevant since DOT is a replacement for antlr4 LIB_ID :=> ID . ID
  3356. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_syntax(token.text, token.line, token.col);
  3357. } else if (token.type === this.ruleNames.RK_RETURN) {
  3358. return this.parseReturn();
  3359. } else if (token.type === this.ruleNames.RK_WHILE || token.type === this.ruleNames.RK_WHILE_ALT) {
  3360. return this.parseWhile();
  3361. } else if (token.type === this.ruleNames.RK_FOR || token.type === this.ruleNames.RK_FOR_ALT) {
  3362. return this.parseFor();
  3363. } else if (token.type === this.ruleNames.RK_BREAK) {
  3364. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  3365. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_break_command(this.ivprogLexer.getReservedKeys()[this.ruleNames.RK_BREAK], token);
  3366. }
  3367. return this.parseBreak();
  3368. } else if (token.type === this.ruleNames.RK_SWITCH) {
  3369. return this.parseSwitchCase();
  3370. } else if (token.type === this.ruleNames.RK_DO) {
  3371. return this.parseRepeatUntil();
  3372. } else if (token.type === this.ruleNames.RK_IF) {
  3373. return this.parseIfThenElse();
  3374. } else if (this.checkEOS(true)) {
  3375. this.pos++;
  3376. return -1;
  3377. } else {
  3378. return null;
  3379. }
  3380. }
  3381. }, {
  3382. key: "parseSwitchCase",
  3383. value: function parseSwitchCase() {
  3384. var token = this.getToken();
  3385. this.pushScope(IVProgParser.BREAKABLE);
  3386. this.pos++;
  3387. this.checkOpenParenthesis();
  3388. this.pos++;
  3389. this.consumeNewLines();
  3390. var exp = this.parseExpressionOR();
  3391. this.consumeNewLines();
  3392. this.checkCloseParenthesis();
  3393. this.pos++;
  3394. this.consumeNewLines();
  3395. this.checkOpenCurly();
  3396. this.pos++;
  3397. this.consumeNewLines();
  3398. var casesList = this.parseCases();
  3399. this.consumeNewLines();
  3400. this.checkCloseCurly();
  3401. this.pos++;
  3402. this.consumeNewLines();
  3403. this.popScope();
  3404. var command = new _commands__WEBPACK_IMPORTED_MODULE_4__.Switch(exp, casesList);
  3405. command.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  3406. return command;
  3407. }
  3408. }, {
  3409. key: "parseRepeatUntil",
  3410. value: function parseRepeatUntil() {
  3411. var token = this.getToken();
  3412. this.pos++;
  3413. this.consumeNewLines();
  3414. this.pushScope(IVProgParser.BREAKABLE);
  3415. var commandsBlock = this.parseCommandBlock();
  3416. this.consumeNewLines(); //Maybe not...
  3417. var whileToken = this.getToken();
  3418. if (whileToken.type !== this.ruleNames.RK_DO_UNTIL) {
  3419. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one(this.ivprogLexer.getReservedKeys()[this.ruleNames.RK_DO_UNTIL], whileToken);
  3420. }
  3421. this.pos++;
  3422. this.checkOpenParenthesis();
  3423. this.pos++;
  3424. this.consumeNewLines();
  3425. var condition = this.parseExpressionOR();
  3426. this.consumeNewLines();
  3427. this.checkCloseParenthesis();
  3428. this.pos++;
  3429. this.checkEOS();
  3430. this.popScope();
  3431. var command = new _commands__WEBPACK_IMPORTED_MODULE_4__.RepeatUntil(condition, commandsBlock);
  3432. command.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  3433. return command;
  3434. }
  3435. }, {
  3436. key: "parseIfThenElse",
  3437. value: function parseIfThenElse() {
  3438. if (this.insideScope(IVProgParser.BREAKABLE)) {
  3439. this.pushScope(IVProgParser.BREAKABLE);
  3440. } else {
  3441. this.pushScope(IVProgParser.COMMAND);
  3442. }
  3443. var token = this.getToken();
  3444. this.pos++;
  3445. this.checkOpenParenthesis();
  3446. this.pos++;
  3447. this.consumeNewLines();
  3448. var logicalExpression = this.parseExpressionOR();
  3449. this.consumeNewLines();
  3450. this.checkCloseParenthesis();
  3451. this.pos++;
  3452. this.consumeNewLines();
  3453. var cmdBlocks = this.parseCommandBlock();
  3454. var maybeElse = this.getToken();
  3455. if (maybeElse.type === this.ruleNames.RK_ELSE) {
  3456. this.pos++;
  3457. this.consumeNewLines();
  3458. var maybeIf = this.getToken();
  3459. var elseBlock = null;
  3460. if (this.checkOpenCurly(true)) {
  3461. elseBlock = this.parseCommandBlock();
  3462. } else if (maybeIf.type === this.ruleNames.RK_IF) {
  3463. elseBlock = this.parseIfThenElse();
  3464. } else {
  3465. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_list([this.ivprogLexer.getReservedKeys()[this.ruleNames.RK_IF], "{"], maybeIf);
  3466. }
  3467. this.popScope();
  3468. var _cmd = new _commands__WEBPACK_IMPORTED_MODULE_4__.IfThenElse(logicalExpression, cmdBlocks, elseBlock);
  3469. _cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  3470. return _cmd;
  3471. }
  3472. this.popScope();
  3473. var cmd = new _commands__WEBPACK_IMPORTED_MODULE_4__.IfThenElse(logicalExpression, cmdBlocks, null);
  3474. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  3475. return cmd;
  3476. }
  3477. }, {
  3478. key: "parseFor",
  3479. value: function parseFor() {
  3480. this.pushScope(IVProgParser.BREAKABLE);
  3481. var for_token = this.getToken();
  3482. this.pos += 1; // parse ID
  3483. var id_token = this.getToken();
  3484. var id = this.parseID();
  3485. var for_id = new _expressions__WEBPACK_IMPORTED_MODULE_3__.VariableLiteral(id);
  3486. for_id.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(id_token); // END parse ID
  3487. var for_from = this.parseForParameters(this.ruleNames.RK_FOR_FROM);
  3488. var for_to = this.parseForParameters(this.ruleNames.RK_FOR_TO);
  3489. var maybePass = this.parseForParameters(this.ruleNames.RK_FOR_PASS);
  3490. this.consumeNewLines();
  3491. var commandsBlock = this.parseCommandBlock();
  3492. this.popScope();
  3493. var cmd = new _commands__WEBPACK_IMPORTED_MODULE_4__.For(for_id, for_from, for_to, maybePass, commandsBlock);
  3494. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(for_token);
  3495. return cmd;
  3496. }
  3497. }, {
  3498. key: "parseWhile",
  3499. value: function parseWhile() {
  3500. this.pushScope(IVProgParser.BREAKABLE);
  3501. var token = this.getToken();
  3502. this.pos++;
  3503. this.checkOpenParenthesis();
  3504. this.pos++;
  3505. this.consumeNewLines();
  3506. var logicalExpression = this.parseExpressionOR();
  3507. this.consumeNewLines();
  3508. this.checkCloseParenthesis();
  3509. this.pos++;
  3510. this.consumeNewLines();
  3511. var cmdBlocks = this.parseCommandBlock();
  3512. this.popScope();
  3513. var cmd = new _commands__WEBPACK_IMPORTED_MODULE_4__.While(logicalExpression, cmdBlocks);
  3514. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  3515. return cmd;
  3516. }
  3517. }, {
  3518. key: "parseBreak",
  3519. value: function parseBreak() {
  3520. var token = this.getToken();
  3521. this.pos++;
  3522. this.checkEOS();
  3523. this.pos++;
  3524. var command = new _commands__WEBPACK_IMPORTED_MODULE_4__.Break();
  3525. command.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  3526. return command;
  3527. }
  3528. }, {
  3529. key: "parseReturn",
  3530. value: function parseReturn() {
  3531. var token = this.getToken();
  3532. this.pos++;
  3533. var exp = null;
  3534. if (!this.checkEOS(true)) {
  3535. exp = this.parseExpressionOR();
  3536. this.checkEOS();
  3537. }
  3538. this.pos++;
  3539. var returnCommand = new _commands__WEBPACK_IMPORTED_MODULE_4__.Return(exp);
  3540. returnCommand.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  3541. return returnCommand;
  3542. }
  3543. }, {
  3544. key: "parseIDCommand",
  3545. value: function parseIDCommand() {
  3546. var refToken = this.getToken();
  3547. var id = this.parseMaybeLibID();
  3548. var isID = id.indexOf(".") === -1;
  3549. if (this.checkOpenBrace(true)) {
  3550. this.pos++;
  3551. var lineExpression = null;
  3552. var columnExpression = null;
  3553. this.consumeNewLines();
  3554. lineExpression = this.parseExpression();
  3555. this.consumeNewLines();
  3556. this.checkCloseBrace();
  3557. this.pos++;
  3558. if (this.checkOpenBrace(true)) {
  3559. this.pos++;
  3560. this.consumeNewLines();
  3561. columnExpression = this.parseExpression();
  3562. this.consumeNewLines();
  3563. this.checkCloseBrace();
  3564. this.pos++;
  3565. }
  3566. var assignmentToken = this.getToken();
  3567. if (assignmentToken.type !== this.ruleNames.ASSIGNMENT) {
  3568. // TODO BETTER MESSAGE
  3569. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one("<-", assignmentToken);
  3570. }
  3571. this.pos++;
  3572. var exp = this.parseExpressionOR();
  3573. this.checkEOS();
  3574. this.pos++;
  3575. var cmd = new _commands__WEBPACK_IMPORTED_MODULE_4__.ArrayIndexAssign(id, lineExpression, columnExpression, exp);
  3576. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(assignmentToken);
  3577. return cmd;
  3578. }
  3579. var assignmentOrParenthesis = this.getToken();
  3580. if (isID && assignmentOrParenthesis.type === this.ruleNames.ASSIGNMENT) {
  3581. this.pos++;
  3582. var _exp = this.parseExpressionOR();
  3583. this.checkEOS();
  3584. this.pos++;
  3585. var _cmd2 = new _commands__WEBPACK_IMPORTED_MODULE_4__.Assign(id, _exp);
  3586. _cmd2.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(assignmentOrParenthesis);
  3587. return _cmd2;
  3588. } else if (assignmentOrParenthesis.type === this.ruleNames.OPEN_PARENTHESIS) {
  3589. var funcCall = this.parseFunctionCallCommand(id);
  3590. this.checkEOS();
  3591. this.pos++;
  3592. return funcCall;
  3593. } else if (isID) {
  3594. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_list(["<-", "("], assignmentOrParenthesis);
  3595. } else {
  3596. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_id_format(refToken);
  3597. }
  3598. }
  3599. }, {
  3600. key: "parseForParameters",
  3601. value: function parseForParameters(keyword_code) {
  3602. if (keyword_code === this.ruleNames.RK_FOR_PASS) {
  3603. if (this.checkOpenCurly(true)) {
  3604. return null;
  3605. }
  3606. }
  3607. var from_token = this.getToken();
  3608. if (from_token.type !== keyword_code) {
  3609. // TODO better error message
  3610. var keyword = this.ivprogLexer.getReservedKeys()[keyword_code];
  3611. throw new Error("Error de sintaxe no comando repita_para: esperava-se " + keyword + " mas encontrou " + from_token.text);
  3612. }
  3613. this.pos += 1;
  3614. var int_or_id = this.getToken();
  3615. var is_unary_op = false;
  3616. var op = null;
  3617. if (int_or_id.type === this.ruleNames.SUM_OP) {
  3618. is_unary_op = true;
  3619. op = int_or_id.text;
  3620. this.pos += 1;
  3621. int_or_id = this.getToken();
  3622. }
  3623. var for_from = null;
  3624. if (int_or_id.type === this.ruleNames.ID) {
  3625. for_from = new _expressions__WEBPACK_IMPORTED_MODULE_3__.VariableLiteral(this.parseID());
  3626. for_from.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(int_or_id);
  3627. } else if (int_or_id.type === this.ruleNames.INTEGER) {
  3628. this.pos += 1;
  3629. for_from = this.getIntLiteral(int_or_id);
  3630. }
  3631. if (for_from == null) {
  3632. // TODO better error message
  3633. var _keyword = this.ivprogLexer.getReservedKeys()[keyword_code];
  3634. throw new Error("Error de sintaxe no comando repeita_para: " + int_or_id.text + " não é compativel com o esperado para o paramentro " + _keyword + ". O valor deve ser um inteiro ou variável.");
  3635. }
  3636. if (is_unary_op) {
  3637. for_from = new _expressions__WEBPACK_IMPORTED_MODULE_3__.UnaryApp((0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)(op), for_from);
  3638. }
  3639. return for_from;
  3640. }
  3641. }, {
  3642. key: "parseCases",
  3643. value: function parseCases() {
  3644. var token = this.getToken();
  3645. if (token.type !== this.ruleNames.RK_CASE) {
  3646. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one(this.ivprogLexer.getReservedKeys()[this.ruleNames.RK_CASE], token);
  3647. }
  3648. this.pos++;
  3649. var nextToken = this.getToken();
  3650. if (nextToken.type === this.ruleNames.RK_DEFAULT) {
  3651. this.pos++;
  3652. var colonToken = this.getToken();
  3653. if (colonToken.type !== this.ruleNames.COLON) {
  3654. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one(":", colonToken);
  3655. }
  3656. this.pos++;
  3657. this.consumeNewLines();
  3658. var block = this.parseCommandBlock(true);
  3659. var defaultCase = new _commands__WEBPACK_IMPORTED_MODULE_4__.Case(null);
  3660. defaultCase.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  3661. defaultCase.setCommands(block.commands);
  3662. return [defaultCase];
  3663. } else {
  3664. var exp = this.parseExpressionOR();
  3665. var _colonToken = this.getToken();
  3666. if (_colonToken.type !== this.ruleNames.COLON) {
  3667. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.token_missing_one(":", _colonToken);
  3668. }
  3669. this.pos++;
  3670. this.consumeNewLines();
  3671. var _block = this.parseCommandBlock(true);
  3672. var aCase = new _commands__WEBPACK_IMPORTED_MODULE_4__.Case(exp);
  3673. aCase.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  3674. aCase.setCommands(_block.commands);
  3675. var caseToken = this.getToken();
  3676. if (caseToken.type === this.ruleNames.RK_CASE) {
  3677. return [aCase].concat(this.parseCases());
  3678. } else {
  3679. return [aCase];
  3680. }
  3681. }
  3682. }
  3683. /*
  3684. * Parses an Expression following the structure:
  3685. *
  3686. * EOR => EAnd ( 'or' EOR)? #expression and
  3687. *
  3688. * EAnd => ENot ('and' EAnd)? #expression or
  3689. *
  3690. * ENot => 'not'? ER #expression not
  3691. *
  3692. * ER => E ((>=, <=, ==, >, <) ER)? #expression relational
  3693. *
  3694. * E => factor ((+, -) E)? #expression
  3695. *
  3696. * factor=> term ((*, /, %) factor)?
  3697. *
  3698. * term => literal || arrayAccess || FuncCall || ID || '('EOR')'
  3699. **/
  3700. }, {
  3701. key: "parseExpressionOR",
  3702. value: function parseExpressionOR() {
  3703. var exp1 = this.parseExpressionAND();
  3704. while (this.getToken().type === this.ruleNames.OR_OPERATOR) {
  3705. var opToken = this.getToken();
  3706. this.pos++;
  3707. var or = (0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)("or");
  3708. this.consumeNewLines();
  3709. var exp2 = this.parseExpressionAND();
  3710. var finalExp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.InfixApp(or, exp1, exp2);
  3711. finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(opToken);
  3712. exp1 = finalExp;
  3713. }
  3714. return exp1;
  3715. }
  3716. }, {
  3717. key: "parseExpressionAND",
  3718. value: function parseExpressionAND() {
  3719. var exp1 = this.parseExpressionNot();
  3720. while (this.getToken().type === this.ruleNames.AND_OPERATOR) {
  3721. var opToken = this.getToken();
  3722. this.pos++;
  3723. var and = (0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)("and");
  3724. this.consumeNewLines();
  3725. var exp2 = this.parseExpressionNot();
  3726. var finalExp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.InfixApp(and, exp1, exp2);
  3727. finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(opToken);
  3728. exp1 = finalExp;
  3729. }
  3730. return exp1;
  3731. }
  3732. }, {
  3733. key: "parseExpressionNot",
  3734. value: function parseExpressionNot() {
  3735. var maybeNotToken = this.getToken();
  3736. if (maybeNotToken.type === this.ruleNames.NOT_OPERATOR) {
  3737. var opToken = this.getToken();
  3738. this.pos++;
  3739. var not = (0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)("not");
  3740. var exp1 = this.parseExpressionRel();
  3741. var finalExp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.UnaryApp(not, exp1);
  3742. finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(opToken);
  3743. return finalExp;
  3744. } else {
  3745. return this.parseExpressionRel();
  3746. }
  3747. }
  3748. }, {
  3749. key: "parseExpressionRel",
  3750. value: function parseExpressionRel() {
  3751. var exp1 = this.parseExpression();
  3752. while (this.getToken().type === this.ruleNames.RELATIONAL_OPERATOR) {
  3753. var relToken = this.getToken();
  3754. this.pos++;
  3755. var rel = (0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)(relToken.text);
  3756. var exp2 = this.parseExpression();
  3757. var finalExp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.InfixApp(rel, exp1, exp2);
  3758. finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(relToken);
  3759. exp1 = finalExp;
  3760. }
  3761. return exp1;
  3762. }
  3763. }, {
  3764. key: "parseExpression",
  3765. value: function parseExpression() {
  3766. var factor = this.parseFactor();
  3767. while (this.getToken().type === this.ruleNames.SUM_OP) {
  3768. var sumOpToken = this.getToken();
  3769. this.pos++;
  3770. var op = (0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)(sumOpToken.text);
  3771. var factor2 = this.parseFactor();
  3772. var finalExp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.InfixApp(op, factor, factor2);
  3773. finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(sumOpToken);
  3774. factor = finalExp;
  3775. }
  3776. return factor;
  3777. }
  3778. }, {
  3779. key: "parseFactor",
  3780. value: function parseFactor() {
  3781. var term = this.parseTerm();
  3782. while (this.getToken().type === this.ruleNames.MULTI_OP) {
  3783. var multOpToken = this.getToken();
  3784. this.pos++;
  3785. var op = (0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)(multOpToken.text);
  3786. var term2 = this.parseTerm();
  3787. var finalExp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.InfixApp(op, term, term2);
  3788. finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(multOpToken);
  3789. term = finalExp;
  3790. }
  3791. return term;
  3792. }
  3793. }, {
  3794. key: "parseTerm",
  3795. value: function parseTerm() {
  3796. var token = this.getToken();
  3797. var sourceInfo = null;
  3798. var exp = null;
  3799. switch (token.type) {
  3800. case this.ruleNames.SUM_OP:
  3801. this.pos++;
  3802. sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(token);
  3803. exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.UnaryApp((0,_operators__WEBPACK_IMPORTED_MODULE_9__.convertFromString)(token.text), this.parseTerm());
  3804. exp.sourceInfo = sourceInfo;
  3805. return exp;
  3806. case this.ruleNames.INTEGER:
  3807. this.pos++;
  3808. return this.getIntLiteral(token);
  3809. case this.ruleNames.REAL:
  3810. this.pos++;
  3811. return this.getRealLiteral(token);
  3812. case this.ruleNames.STRING:
  3813. this.pos++;
  3814. return this.getStringLiteral(token);
  3815. case this.ruleNames.CHARACTER:
  3816. this.pos++;
  3817. return this.getCharLiteral(token);
  3818. case this.ruleNames.RK_TRUE:
  3819. case this.ruleNames.RK_FALSE:
  3820. this.pos++;
  3821. return this.getBoolLiteral(token);
  3822. case this.ruleNames.OPEN_CURLY:
  3823. // No more annonymous array
  3824. // return this.parseArrayLiteral();
  3825. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.annonymous_array_literal(token);
  3826. case this.ruleNames.ID:
  3827. return this.parseIDTerm();
  3828. case this.ruleNames.OPEN_PARENTHESIS:
  3829. return this.parseParenthesisExp();
  3830. default:
  3831. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_terminal(token);
  3832. }
  3833. }
  3834. }, {
  3835. key: "parseIDTerm",
  3836. value: function parseIDTerm() {
  3837. var tokenA = this.getToken();
  3838. var id = this.parseMaybeLibID();
  3839. var isID = id.indexOf(".") === -1;
  3840. if (isID && this.checkOpenBrace(true)) {
  3841. var tokenB = null;
  3842. this.pos++;
  3843. var firstIndex = this.parseExpression();
  3844. var secondIndex = null;
  3845. this.consumeNewLines();
  3846. this.checkCloseBrace();
  3847. tokenB = this.getToken();
  3848. this.pos++;
  3849. if (this.checkOpenBrace(true)) {
  3850. this.pos++;
  3851. secondIndex = this.parseExpression();
  3852. this.consumeNewLines();
  3853. this.checkCloseBrace();
  3854. tokenB = this.getToken();
  3855. this.pos++;
  3856. }
  3857. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  3858. var exp = new _expressions__WEBPACK_IMPORTED_MODULE_3__.ArrayAccess(id, firstIndex, secondIndex);
  3859. exp.sourceInfo = sourceInfo;
  3860. return exp;
  3861. } else if (this.checkOpenParenthesis(true)) {
  3862. return this.parseFunctionCallExpression(id);
  3863. } else if (isID) {
  3864. var _sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfo(tokenA);
  3865. var _exp2 = new _expressions__WEBPACK_IMPORTED_MODULE_3__.VariableLiteral(id);
  3866. _exp2.sourceInfo = _sourceInfo;
  3867. return _exp2;
  3868. } else {
  3869. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_10__.SyntaxErrorFactory.invalid_id_format(tokenA);
  3870. }
  3871. }
  3872. }, {
  3873. key: "getFunctionName",
  3874. value: function getFunctionName(id) {
  3875. var name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_11__.LanguageDefinedFunction.getInternalName(id);
  3876. if (name === null) {
  3877. if (id === _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_11__.LanguageDefinedFunction.getMainFunctionName()) {
  3878. return null;
  3879. }
  3880. return id;
  3881. } else {
  3882. return name;
  3883. }
  3884. }
  3885. }, {
  3886. key: "parseFunctionCallExpression",
  3887. value: function parseFunctionCallExpression(id) {
  3888. var stepBack = id.indexOf(".") === -1 ? 1 : 3;
  3889. var tokenA = this.getToken(this.pos - stepBack);
  3890. var actualParameters = this.parseActualParameters();
  3891. var tokenB = this.getToken(this.pos - 1);
  3892. var funcName = this.getFunctionName(id);
  3893. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  3894. var cmd = new _expressions__WEBPACK_IMPORTED_MODULE_3__.FunctionCall(funcName, actualParameters);
  3895. cmd.sourceInfo = sourceInfo;
  3896. return cmd;
  3897. }
  3898. }, {
  3899. key: "parseFunctionCallCommand",
  3900. value: function parseFunctionCallCommand(id) {
  3901. return this.parseFunctionCallExpression(id);
  3902. }
  3903. }, {
  3904. key: "parseParenthesisExp",
  3905. value: function parseParenthesisExp() {
  3906. this.checkOpenParenthesis();
  3907. var tokenA = this.getToken();
  3908. this.consumeNewLines();
  3909. var exp = this.parseExpressionOR();
  3910. this.consumeNewLines();
  3911. this.checkCloseParenthesis();
  3912. var tokenB = this.getToken();
  3913. this.pos += 1;
  3914. exp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_8__.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  3915. exp.parenthesis = true;
  3916. return exp;
  3917. }
  3918. }, {
  3919. key: "parseActualParameters",
  3920. value: function parseActualParameters() {
  3921. this.checkOpenParenthesis();
  3922. this.pos++;
  3923. if (this.checkCloseParenthesis(true)) {
  3924. this.pos++;
  3925. return [];
  3926. }
  3927. this.consumeNewLines();
  3928. var list = this.parseExpressionList();
  3929. this.consumeNewLines();
  3930. this.checkCloseParenthesis();
  3931. this.pos++;
  3932. return list;
  3933. }
  3934. }, {
  3935. key: "parseExpressionList",
  3936. value: function parseExpressionList() {
  3937. var list = [];
  3938. for (;;) {
  3939. var exp = this.parseExpressionOR();
  3940. list.push(exp);
  3941. var maybeToken = this.getToken();
  3942. if (maybeToken.type !== this.ruleNames.COMMA) {
  3943. break;
  3944. } else {
  3945. this.pos++;
  3946. this.consumeNewLines();
  3947. }
  3948. }
  3949. return list;
  3950. }
  3951. }, {
  3952. key: "getTypeArray",
  3953. value: function getTypeArray() {
  3954. var _this2 = this;
  3955. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  3956. return types.map(function (x) {
  3957. return _this2.lexer.literalNames[x];
  3958. });
  3959. }
  3960. }]);
  3961. return IVProgParser;
  3962. }();
  3963. /***/ }),
  3964. /***/ "./js/ast/sourceInfo.js":
  3965. /*!******************************!*\
  3966. !*** ./js/ast/sourceInfo.js ***!
  3967. \******************************/
  3968. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  3969. "use strict";
  3970. __webpack_require__.r(__webpack_exports__);
  3971. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  3972. /* harmony export */ "SourceInfo": () => (/* binding */ SourceInfo)
  3973. /* harmony export */ });
  3974. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  3975. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  3976. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  3977. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  3978. var SourceInfo = /*#__PURE__*/function () {
  3979. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(SourceInfo, null, [{
  3980. key: "createSourceInfo",
  3981. /**
  3982. * @param {moo.Token} token
  3983. *
  3984. * @return {SourceInfo}
  3985. * **/
  3986. value: function createSourceInfo(token) {
  3987. return new SourceInfo(token.line, token.col, token.text, token.text.length);
  3988. }
  3989. /**
  3990. * @param {moo.Token} tokenA
  3991. * @param {moo.Token} tokenB
  3992. *
  3993. * @return {SourceInfo}
  3994. * **/
  3995. }, {
  3996. key: "createSourceInfoFromList",
  3997. value: function createSourceInfoFromList(tokenA, tokenB) {
  3998. var line = tokenA.line;
  3999. var column = tokenA.col; // adapted from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  4000. // No idea why...
  4001. var size = tokenB.offset + 1 - tokenA.offset;
  4002. return new SourceInfo(line, column, "", size);
  4003. }
  4004. /**
  4005. * @param {number} line
  4006. * @param {number} column
  4007. * @param {string} text
  4008. * @param {number} size
  4009. * **/
  4010. }]);
  4011. function SourceInfo(line, column, text, size) {
  4012. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, SourceInfo);
  4013. this.line = line;
  4014. this.column = column;
  4015. this.text = text;
  4016. this.size = size;
  4017. }
  4018. return SourceInfo;
  4019. }();
  4020. /***/ }),
  4021. /***/ "./js/io/domConsole.js":
  4022. /*!*****************************!*\
  4023. !*** ./js/io/domConsole.js ***!
  4024. \*****************************/
  4025. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  4026. "use strict";
  4027. __webpack_require__.r(__webpack_exports__);
  4028. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  4029. /* harmony export */ "DOMConsole": () => (/* binding */ DOMConsole)
  4030. /* harmony export */ });
  4031. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
  4032. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
  4033. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
  4034. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
  4035. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  4036. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__);
  4037. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  4038. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__);
  4039. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  4040. /* harmony import */ var _util_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../util/utils */ "./js/util/utils.js");
  4041. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../util/config */ "./js/util/config.ts");
  4042. var DOMConsole = /*#__PURE__*/function () {
  4043. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(DOMConsole, null, [{
  4044. key: "BASH_TEMPLATE",
  4045. get: function get() {
  4046. return "\n <div class=\"bash-title\">\n <i id=\"ivprog-console-clearbtn\" class=\"icon eraser\" style=\"float:left;padding-left: 5px\"></i>\n <span>Terminal</span>\n <i id=\"ivprog-console-showbtn\" class=\"icon window maximize outline\" style=\"float:right\"></i>\n <i id=\"ivprog-console-hidebtn\" class=\"icon window minimize outline\" style=\"float:right\"></i>\n </div>\n <div id='ivprog-term' class=\"bash-body\"></div>";
  4047. }
  4048. }, {
  4049. key: "INPUT_CARET_TEMPLATE",
  4050. get: function get() {
  4051. return "\n <div id=\"cmd\">\n <span></span>\n <div id=\"cursor\"></div>\n </div>";
  4052. }
  4053. }, {
  4054. key: "USER",
  4055. get: function get() {
  4056. return 0;
  4057. }
  4058. }, {
  4059. key: "INFO",
  4060. get: function get() {
  4061. return 1;
  4062. }
  4063. }, {
  4064. key: "ERR",
  4065. get: function get() {
  4066. return 2;
  4067. }
  4068. }, {
  4069. key: "INPUT",
  4070. get: function get() {
  4071. return 3;
  4072. }
  4073. }]);
  4074. function DOMConsole(elementID) {
  4075. var disableMarginTop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4076. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, DOMConsole);
  4077. this.disableMarginTop = disableMarginTop;
  4078. this.input = null;
  4079. this.cursorInterval = null;
  4080. this.idleInterval = null;
  4081. this.inputDiv = null;
  4082. this.inputCMD = null;
  4083. this.inputSpan = null;
  4084. this.cursorRef = null;
  4085. this.needInput = false;
  4086. this.clearBtn = null;
  4087. this.hideBtn = null;
  4088. this.showBtn = null;
  4089. this.termDiv = null;
  4090. this.anyKey = false;
  4091. var actualID = elementID;
  4092. if (elementID[0] === "#") {
  4093. actualID = elementID.substring(1);
  4094. }
  4095. this.parent = document.getElementById(actualID);
  4096. this.setup();
  4097. this.inputListeners = [];
  4098. this.hideInput();
  4099. this.pending_writes = [];
  4100. this.last_clear = -1;
  4101. }
  4102. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(DOMConsole, [{
  4103. key: "setup",
  4104. value: function setup() {
  4105. this._setupDom();
  4106. this._setupEvents();
  4107. }
  4108. }, {
  4109. key: "_setupEvents",
  4110. value: function _setupEvents() {
  4111. this.input.addEventListener("keydown", this.registerInput.bind(this));
  4112. this.clearBtn.addEventListener("click", this.clearBtnClick.bind(this));
  4113. this.hideBtn.addEventListener("click", this.hideBtnClick.bind(this));
  4114. this.showBtn.addEventListener("click", this.showBtnClick.bind(this));
  4115. }
  4116. }, {
  4117. key: "registerInput",
  4118. value: function registerInput(event) {
  4119. if (!this.needInput) {
  4120. return;
  4121. }
  4122. var keyCode = event.which;
  4123. if (keyCode === 13 || this.anyKey) {
  4124. if (this.idleInterval != null) {
  4125. clearInterval(this.idleInterval);
  4126. this.idleInterval = null;
  4127. }
  4128. var text = this.input.value;
  4129. text = text.replace("[\n\r]+", "");
  4130. this.notifyListeners(text);
  4131. this._appendUserInput(text);
  4132. this.input.value = "";
  4133. this.inputSpan.innerHTML = "";
  4134. this.currentLine = null;
  4135. }
  4136. }
  4137. }, {
  4138. key: "_setupDom",
  4139. value: function _setupDom() {
  4140. var bashNode = document.createElement("div");
  4141. bashNode.classList.add("bash");
  4142. bashNode.innerHTML = DOMConsole.BASH_TEMPLATE;
  4143. this.termDiv = bashNode.querySelector("#ivprog-term");
  4144. this.termDiv.classList.add("ivprog-term-div");
  4145. this.inputDiv = document.createElement("div");
  4146. this.inputDiv.id = "ivprog-terminal-inputdiv";
  4147. this.inputDiv.innerHTML = DOMConsole.INPUT_CARET_TEMPLATE;
  4148. this.input = document.createElement("input");
  4149. this.input.setAttribute("name", "command");
  4150. this.input.setAttribute("value", "");
  4151. this.input.setAttribute("type", "text");
  4152. this.input.setAttribute("autocomplete", "off");
  4153. this.inputDiv.append(this.input);
  4154. this.termDiv.append(this.inputDiv);
  4155. bashNode.append(this.termDiv);
  4156. this.parent.append(bashNode);
  4157. this.inputCMD = this.inputDiv.querySelector("#cmd");
  4158. this.cursorRef = this.inputCMD.querySelector("#cursor");
  4159. this.inputSpan = this.inputCMD.querySelector("span");
  4160. this.clearBtn = bashNode.querySelector("#ivprog-console-clearbtn");
  4161. this.hideBtn = bashNode.querySelector("#ivprog-console-hidebtn");
  4162. this.showBtn = bashNode.querySelector("#ivprog-console-showbtn");
  4163. this._setupCursor(); //Jquery tooltips....
  4164. window.$(this.clearBtn).popup({
  4165. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__.LocalizedStrings.getUI("tooltip_terminal_clear")
  4166. });
  4167. window.$(this.showBtn).popup({
  4168. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__.LocalizedStrings.getUI("tooltip_terminal_show")
  4169. });
  4170. window.$(this.hideBtn).popup({
  4171. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__.LocalizedStrings.getUI("tooltip_terminal_hide")
  4172. });
  4173. }
  4174. }, {
  4175. key: "_setupCursor",
  4176. value: function _setupCursor() {
  4177. this.inputCMD.addEventListener("click", this.blinkCaretAndFocus.bind(this)); //this.inputCMD.click();
  4178. this.input.addEventListener("keyup", this.updateSpanText.bind(this));
  4179. this.input.addEventListener("blur", this.stopBlinkCaret.bind(this));
  4180. }
  4181. }, {
  4182. key: "blinkCaretAndFocus",
  4183. value: function blinkCaretAndFocus() {
  4184. var _this = this;
  4185. if (this.cursorInterval != null) {
  4186. return;
  4187. }
  4188. this.input.focus();
  4189. this.cursorInterval = window.setInterval(function () {
  4190. if (_this.cursorRef.style.visibility === "visible") {
  4191. _this.cursorRef.style.visibility = "hidden";
  4192. } else {
  4193. _this.cursorRef.style.visibility = "visible";
  4194. }
  4195. }, 500);
  4196. }
  4197. }, {
  4198. key: "updateSpanText",
  4199. value: function updateSpanText() {
  4200. this.inputSpan.innerHTML = this.input.value;
  4201. if (this.idleInterval != null) window.clearInterval(this.idleInterval);
  4202. this.scheduleNotify();
  4203. }
  4204. }, {
  4205. key: "stopBlinkCaret",
  4206. value: function stopBlinkCaret() {
  4207. clearInterval(this.cursorInterval);
  4208. this.cursorInterval = null;
  4209. this.cursorRef.style.visibility = "visible";
  4210. }
  4211. }, {
  4212. key: "notifyListeners",
  4213. value: function notifyListeners(text) {
  4214. this.inputListeners.forEach(function (resolve) {
  4215. return resolve(text);
  4216. });
  4217. this.inputListeners.splice(0, this.inputListeners.length);
  4218. this.hideInput();
  4219. this.anyKey = false;
  4220. }
  4221. }, {
  4222. key: "writeRawHTML",
  4223. value: function writeRawHTML(text, channel) {
  4224. this._appendTextLn(text, channel, false);
  4225. }
  4226. }, {
  4227. key: "write",
  4228. value: function write(text) {
  4229. var newLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4230. this._appendText(text, DOMConsole.USER, newLine);
  4231. }
  4232. }, {
  4233. key: "info",
  4234. value: function info(text) {
  4235. this._appendTextLn(text, DOMConsole.INFO);
  4236. }
  4237. }, {
  4238. key: "err",
  4239. value: function err(text) {
  4240. this._appendTextLn(text, DOMConsole.ERR);
  4241. }
  4242. }, {
  4243. key: "_appendText",
  4244. value: function () {
  4245. var _appendText2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(text, type) {
  4246. var newLine,
  4247. write_time,
  4248. divClass,
  4249. textDiv,
  4250. _args = arguments;
  4251. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
  4252. while (1) {
  4253. switch (_context.prev = _context.next) {
  4254. case 0:
  4255. newLine = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
  4256. // console.debug("Caling appendText");
  4257. write_time = Date.now();
  4258. this.pending_writes.push(0);
  4259. _context.next = 5;
  4260. return _util_utils__WEBPACK_IMPORTED_MODULE_5__.sleep(3);
  4261. case 5:
  4262. this.pending_writes.pop();
  4263. if (!(this.last_clear >= write_time)) {
  4264. _context.next = 8;
  4265. break;
  4266. }
  4267. return _context.abrupt("return");
  4268. case 8:
  4269. if (this.currentLine == null) {
  4270. divClass = this.getClassForType(type);
  4271. textDiv = document.createElement("div");
  4272. textDiv.classList.add(divClass);
  4273. this.termDiv.insertBefore(textDiv, this.inputDiv);
  4274. this.currentLine = textDiv;
  4275. }
  4276. this.currentLine.innerHTML += this.getOutputText(text);
  4277. if (newLine) {
  4278. // console.debug("append newline");
  4279. this.currentLine = null;
  4280. }
  4281. this.scrollTerm();
  4282. case 12:
  4283. case "end":
  4284. return _context.stop();
  4285. }
  4286. }
  4287. }, _callee, this);
  4288. }));
  4289. function _appendText(_x, _x2) {
  4290. return _appendText2.apply(this, arguments);
  4291. }
  4292. return _appendText;
  4293. }()
  4294. }, {
  4295. key: "_appendTextLn",
  4296. value: function () {
  4297. var _appendTextLn2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2(text, type) {
  4298. var filter,
  4299. write_time,
  4300. divClass,
  4301. textDiv,
  4302. _args2 = arguments;
  4303. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) {
  4304. while (1) {
  4305. switch (_context2.prev = _context2.next) {
  4306. case 0:
  4307. filter = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : true;
  4308. write_time = Date.now();
  4309. this.pending_writes.push(0);
  4310. _context2.next = 5;
  4311. return _util_utils__WEBPACK_IMPORTED_MODULE_5__.sleep(3);
  4312. case 5:
  4313. this.pending_writes.pop();
  4314. if (!(this.last_clear >= write_time)) {
  4315. _context2.next = 8;
  4316. break;
  4317. }
  4318. return _context2.abrupt("return");
  4319. case 8:
  4320. divClass = this.getClassForType(type);
  4321. textDiv = document.createElement("div");
  4322. textDiv.classList.add(divClass);
  4323. if (filter) textDiv.innerHTML = this.getOutputText(text);else textDiv.innerHTML = "<span>".concat(text, "</span>");
  4324. if (this.currentLine != null && this.currentLine.innerHTML.length === 0) {
  4325. this.termDiv.removeChild(this.currentLine);
  4326. }
  4327. this.termDiv.insertBefore(textDiv, this.inputDiv);
  4328. this.currentLine = null;
  4329. this.scrollTerm();
  4330. case 16:
  4331. case "end":
  4332. return _context2.stop();
  4333. }
  4334. }
  4335. }, _callee2, this);
  4336. }));
  4337. function _appendTextLn(_x3, _x4) {
  4338. return _appendTextLn2.apply(this, arguments);
  4339. }
  4340. return _appendTextLn;
  4341. }()
  4342. }, {
  4343. key: "_appendUserInput",
  4344. value: function () {
  4345. var _appendUserInput2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee3(text) {
  4346. var write_time, divClass, textDiv;
  4347. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee3$(_context3) {
  4348. while (1) {
  4349. switch (_context3.prev = _context3.next) {
  4350. case 0:
  4351. write_time = Date.now();
  4352. this.pending_writes.push(0);
  4353. _context3.next = 4;
  4354. return _util_utils__WEBPACK_IMPORTED_MODULE_5__.sleep(3);
  4355. case 4:
  4356. this.pending_writes.pop();
  4357. if (!(this.last_clear >= write_time)) {
  4358. _context3.next = 7;
  4359. break;
  4360. }
  4361. return _context3.abrupt("return");
  4362. case 7:
  4363. divClass = this.getClassForType(DOMConsole.INPUT);
  4364. textDiv = document.createElement("div");
  4365. textDiv.innerHTML = this.getUserInputText(text);
  4366. textDiv.classList.add(divClass);
  4367. this.termDiv.insertBefore(textDiv, this.inputDiv);
  4368. this.currentLine = null;
  4369. this.scrollTerm();
  4370. case 14:
  4371. case "end":
  4372. return _context3.stop();
  4373. }
  4374. }
  4375. }, _callee3, this);
  4376. }));
  4377. function _appendUserInput(_x5) {
  4378. return _appendUserInput2.apply(this, arguments);
  4379. }
  4380. return _appendUserInput;
  4381. }()
  4382. }, {
  4383. key: "getOutputText",
  4384. value: function getOutputText(text) {
  4385. text = text.replace(/\s/g, "&#160;");
  4386. return "<span>".concat(text, "</span>");
  4387. }
  4388. }, {
  4389. key: "getUserInputText",
  4390. value: function getUserInputText(text) {
  4391. if (text.trim().length == 0) {
  4392. text = "&nbsp;";
  4393. }
  4394. return "<i class=\"icon keyboard outline\" style=\"float:left\"></i><span>".concat(text, "</span>");
  4395. }
  4396. }, {
  4397. key: "scrollTerm",
  4398. value: function scrollTerm() {
  4399. //scrollIt(this.inputDiv.previousSibling,200);
  4400. this.termDiv.scrollTop = this.termDiv.scrollHeight;
  4401. }
  4402. }, {
  4403. key: "focus",
  4404. value: function focus() {
  4405. this.termDiv.style.display = "block"; // Is in draggable mode?
  4406. if (!this.disableMarginTop && this.parent.style.top.length == 0) {
  4407. this.parent.style.marginTop = "-160px";
  4408. }
  4409. if (this.needInput) {
  4410. this.showInput();
  4411. this.scheduleNotify();
  4412. }
  4413. if (!_util_utils__WEBPACK_IMPORTED_MODULE_5__.isElementInViewport(this.termDiv)) this.termDiv.scrollIntoView(false);
  4414. this.scrollTerm();
  4415. }
  4416. }, {
  4417. key: "hide",
  4418. value: function hide() {
  4419. if (this.needInput) {
  4420. clearInterval(this.idleInterval);
  4421. this.hideInput();
  4422. this.needInput = true;
  4423. } // Is in draggable mode?
  4424. if (!this.disableMarginTop && this.parent.style.top.length == 0) {
  4425. this.parent.style.marginTop = "0";
  4426. }
  4427. this.termDiv.style.display = "none";
  4428. }
  4429. }, {
  4430. key: "getClassForType",
  4431. value: function getClassForType(type) {
  4432. switch (type) {
  4433. case DOMConsole.INPUT:
  4434. return "ivprog-term-userInput";
  4435. case DOMConsole.USER:
  4436. return "ivprog-term-userText";
  4437. case DOMConsole.INFO:
  4438. return "ivprog-term-info";
  4439. case DOMConsole.ERR:
  4440. return "ivprog-term-error";
  4441. }
  4442. }
  4443. }, {
  4444. key: "dispose",
  4445. value: function dispose() {
  4446. this.input.removeEventListener("keyup", this.updateSpanText.bind(this));
  4447. this.input.removeEventListener("blur", this.stopBlinkCaret.bind(this));
  4448. this.input.removeEventListener("keydown", this.registerInput.bind(this));
  4449. this.inputCMD.removeEventListener("click", this.blinkCaretAndFocus.bind(this));
  4450. this.clearBtn.removeEventListener("click", this.clearBtnClick.bind(this));
  4451. this.hideBtn.removeEventListener("click", this.hideBtnClick.bind(this));
  4452. this.showBtn.removeEventListener("click", this.showBtnClick.bind(this));
  4453. this.input = null;
  4454. this.inputCMD = null;
  4455. this.inputDiv = null;
  4456. this.termDiv = null;
  4457. this.inputSpan = null;
  4458. this.cursorRef = null;
  4459. this.clearBtn = null;
  4460. this.hideBtn = null;
  4461. this.showBtn = null;
  4462. this.currentLine = null;
  4463. var cNode = this.parent.cloneNode(false);
  4464. this.parent.parentNode.replaceChild(cNode, this.parent);
  4465. if (this.cursorInterval != null) {
  4466. clearInterval(this.cursorInterval);
  4467. }
  4468. if (this.idleInterval != null) {
  4469. clearInterval(this.idleInterval);
  4470. }
  4471. }
  4472. }, {
  4473. key: "showInput",
  4474. value: function showInput() {
  4475. this.needInput = true;
  4476. this.inputDiv.style.display = "block";
  4477. this.inputCMD.click(); //this.inputCMD.scrollIntoView();
  4478. this.scrollTerm();
  4479. }
  4480. }, {
  4481. key: "hideInput",
  4482. value: function hideInput() {
  4483. this.needInput = false;
  4484. this.inputDiv.style.display = " none";
  4485. clearInterval(this.cursorInterval);
  4486. this.cursorInterval = null;
  4487. }
  4488. }, {
  4489. key: "requestInput",
  4490. value: function requestInput() {
  4491. var _this2 = this;
  4492. var anyKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4493. var promise = new Promise(function (resolve, _) {
  4494. _this2.inputListeners.push(resolve);
  4495. _this2.anyKey = anyKey;
  4496. if (_this2.idleInterval == null) _this2.scheduleNotify();
  4497. _this2.showInput();
  4498. });
  4499. return promise;
  4500. }
  4501. }, {
  4502. key: "sendOutput",
  4503. value: function sendOutput(text) {
  4504. //console.debug(text);
  4505. var output = "" + text;
  4506. if (output.indexOf("\n") !== -1) {
  4507. //console.debug("newline");
  4508. var outputList = output.split("\n");
  4509. var i = 0;
  4510. for (; i < outputList.length - 1; i += 1) {
  4511. //console.debug("newline write");
  4512. var _t = outputList[i];
  4513. _t = _t.replace(/\t/g, "&#x0020;&#x0020;");
  4514. _t = _t.replace(/\s/g, "&#x0020;");
  4515. if (_t.length !== 0) {
  4516. this.write(_t);
  4517. }
  4518. this.write("", true);
  4519. }
  4520. var t = outputList[i];
  4521. t = t.replace(/\t/g, "&#x0020;&#x0020;");
  4522. t = t.replace(/\s/g, "&#x0020;");
  4523. if (t.length != 0) this.write(t);
  4524. } else {
  4525. // console.debug("no newline");
  4526. output = output.replace(/\t/g, "&#x0020;&#x0020;");
  4527. output = output.replace(/\s/g, "&#x0020;");
  4528. if (output.length != 0) this.write(output);
  4529. }
  4530. }
  4531. }, {
  4532. key: "clearPendingWrites",
  4533. value: function clearPendingWrites() {
  4534. this.last_clear = Date.now();
  4535. }
  4536. }, {
  4537. key: "clear",
  4538. value: function clear() {
  4539. this.clearPendingWrites();
  4540. while (this.inputDiv.parentElement.childNodes.length > 1) {
  4541. this.inputDiv.parentElement.removeChild(this.inputDiv.parentElement.firstChild);
  4542. }
  4543. this.input.value = "";
  4544. this.inputSpan.innerHTML = "";
  4545. this.currentLine = null;
  4546. }
  4547. }, {
  4548. key: "clearBtnClick",
  4549. value: function clearBtnClick() {
  4550. this.clear();
  4551. }
  4552. }, {
  4553. key: "showBtnClick",
  4554. value: function showBtnClick() {
  4555. this.focus();
  4556. }
  4557. }, {
  4558. key: "hideBtnClick",
  4559. value: function hideBtnClick() {
  4560. this.hide();
  4561. }
  4562. }, {
  4563. key: "notifyIdle",
  4564. value: function notifyIdle() {
  4565. this.info(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__.LocalizedStrings.getMessage("awaiting_input_message"));
  4566. this.inputCMD.click();
  4567. }
  4568. }, {
  4569. key: "scheduleNotify",
  4570. value: function scheduleNotify() {
  4571. this.idleInterval = window.setInterval(this.notifyIdle.bind(this), _util_config__WEBPACK_IMPORTED_MODULE_6__.Config.idle_input_interval);
  4572. }
  4573. }, {
  4574. key: "cancelPendingInputRequests",
  4575. value: function cancelPendingInputRequests() {
  4576. this.inputListeners.forEach(function (resolve) {
  4577. return resolve("");
  4578. });
  4579. this.inputListeners.splice(0, this.inputListeners.length);
  4580. if (this.idleInterval != null) {
  4581. clearInterval(this.idleInterval);
  4582. this.idleInterval = null;
  4583. }
  4584. this.input.value = "";
  4585. this.inputSpan.innerHTML = "";
  4586. this.currentLine = null;
  4587. this.hideInput();
  4588. this.anyKey = false;
  4589. }
  4590. }]);
  4591. return DOMConsole;
  4592. }();
  4593. /***/ }),
  4594. /***/ "./js/io/input.js":
  4595. /*!************************!*\
  4596. !*** ./js/io/input.js ***!
  4597. \************************/
  4598. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  4599. "use strict";
  4600. __webpack_require__.r(__webpack_exports__);
  4601. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  4602. /* harmony export */ "Input": () => (/* binding */ Input)
  4603. /* harmony export */ });
  4604. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  4605. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  4606. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  4607. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  4608. var Input = /*#__PURE__*/function () {
  4609. function Input() {
  4610. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Input);
  4611. }
  4612. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(Input, [{
  4613. key: "requestInput",
  4614. value: function requestInput() {
  4615. throw new Error("Must be implemented");
  4616. }
  4617. }, {
  4618. key: "cancelPendingInputRequests",
  4619. value: function cancelPendingInputRequests() {
  4620. throw new Error("Must be implemented");
  4621. }
  4622. }]);
  4623. return Input;
  4624. }();
  4625. /***/ }),
  4626. /***/ "./js/io/output.js":
  4627. /*!*************************!*\
  4628. !*** ./js/io/output.js ***!
  4629. \*************************/
  4630. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  4631. "use strict";
  4632. __webpack_require__.r(__webpack_exports__);
  4633. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  4634. /* harmony export */ "Output": () => (/* binding */ Output)
  4635. /* harmony export */ });
  4636. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  4637. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  4638. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  4639. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  4640. var Output = /*#__PURE__*/function () {
  4641. function Output() {
  4642. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Output);
  4643. }
  4644. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(Output, [{
  4645. key: "sendOutput",
  4646. value: function sendOutput(text) {
  4647. throw new Error("Must be implemented");
  4648. }
  4649. }]);
  4650. return Output;
  4651. }();
  4652. /***/ }),
  4653. /***/ "./js/main.js":
  4654. /*!********************!*\
  4655. !*** ./js/main.js ***!
  4656. \********************/
  4657. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  4658. "use strict";
  4659. __webpack_require__.r(__webpack_exports__);
  4660. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  4661. /* harmony export */ "runner": () => (/* reexport safe */ _runner__WEBPACK_IMPORTED_MODULE_0__.runner),
  4662. /* harmony export */ "initVisualUI": () => (/* reexport safe */ _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__.initVisualUI),
  4663. /* harmony export */ "addFunctionChangeListener": () => (/* reexport safe */ _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__.addFunctionChangeListener),
  4664. /* harmony export */ "addGlobalChangeListener": () => (/* reexport safe */ _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__.addGlobalChangeListener),
  4665. /* harmony export */ "removeFunctionListener": () => (/* reexport safe */ _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__.removeFunctionListener),
  4666. /* harmony export */ "removeGlobalListener": () => (/* reexport safe */ _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__.removeGlobalListener),
  4667. /* harmony export */ "getTestCases": () => (/* reexport safe */ _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__.getTestCases),
  4668. /* harmony export */ "autoEval": () => (/* reexport safe */ _util_iassignHelpers__WEBPACK_IMPORTED_MODULE_5__.autoEval),
  4669. /* harmony export */ "prepareActivityToStudentHelper": () => (/* reexport safe */ _util_iassignHelpers__WEBPACK_IMPORTED_MODULE_5__.prepareActivityToStudentHelper),
  4670. /* harmony export */ "prepareActivityToStudentHelperJSON": () => (/* reexport safe */ _util_iassignHelpers__WEBPACK_IMPORTED_MODULE_5__.prepareActivityToStudentHelperJSON),
  4671. /* harmony export */ "LocalizedStrings": () => (/* binding */ LocalizedStrings),
  4672. /* harmony export */ "i18n": () => (/* binding */ i18n),
  4673. /* harmony export */ "getLogs": () => (/* reexport safe */ _services_userLog__WEBPACK_IMPORTED_MODULE_4__.getLogs),
  4674. /* harmony export */ "getLogsAsString": () => (/* reexport safe */ _services_userLog__WEBPACK_IMPORTED_MODULE_4__.getLogsAsString),
  4675. /* harmony export */ "registerClick": () => (/* reexport safe */ _services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerClick),
  4676. /* harmony export */ "registerUserEvent": () => (/* reexport safe */ _services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent),
  4677. /* harmony export */ "parseLogs": () => (/* reexport safe */ _services_userLog__WEBPACK_IMPORTED_MODULE_4__.parseLogs),
  4678. /* harmony export */ "ActionTypes": () => (/* reexport safe */ _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes),
  4679. /* harmony export */ "CodeEditor": () => (/* binding */ CodeEditor),
  4680. /* harmony export */ "openAssessmentDetail": () => (/* reexport safe */ _util_utils__WEBPACK_IMPORTED_MODULE_6__.openAssessmentDetail),
  4681. /* harmony export */ "autoGenerateTestCaseOutput": () => (/* reexport safe */ _util_auto_gen_output__WEBPACK_IMPORTED_MODULE_11__.autoGenerateTestCaseOutput),
  4682. /* harmony export */ "Config": () => (/* reexport safe */ _util_config__WEBPACK_IMPORTED_MODULE_7__.Config),
  4683. /* harmony export */ "parseExpression": () => (/* reexport safe */ _util_parseFromVisual__WEBPACK_IMPORTED_MODULE_9__.parseExpression),
  4684. /* harmony export */ "parseCode": () => (/* reexport safe */ _util_parseFromVisual__WEBPACK_IMPORTED_MODULE_9__.parseCode),
  4685. /* harmony export */ "generateCode": () => (/* reexport safe */ _visualUI_code_generator__WEBPACK_IMPORTED_MODULE_12__.generate),
  4686. /* harmony export */ "levenshteinDistance": () => (/* reexport safe */ _util_utils__WEBPACK_IMPORTED_MODULE_6__.levenshteinDistance),
  4687. /* harmony export */ "processData": () => (/* reexport safe */ _util_dataProcess__WEBPACK_IMPORTED_MODULE_8__.processData),
  4688. /* harmony export */ "Settings": () => (/* binding */ Settings),
  4689. /* harmony export */ "setPreviousAlgorithm": () => (/* reexport safe */ _util_iassignHelpers__WEBPACK_IMPORTED_MODULE_5__.setPreviousAlgorithm)
  4690. /* harmony export */ });
  4691. /* harmony import */ var _runner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./runner */ "./js/runner.js");
  4692. /* harmony import */ var _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js");
  4693. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  4694. /* harmony import */ var _services_i18nHelper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./services/i18nHelper */ "./js/services/i18nHelper.js");
  4695. /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./services/userLog */ "./js/services/userLog.js");
  4696. /* harmony import */ var _util_iassignHelpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./util/iassignHelpers */ "./js/util/iassignHelpers.js");
  4697. /* harmony import */ var _util_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util/utils */ "./js/util/utils.js");
  4698. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./util/config */ "./js/util/config.ts");
  4699. /* harmony import */ var _util_dataProcess__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./util/dataProcess */ "./js/util/dataProcess.js");
  4700. /* harmony import */ var _util_parseFromVisual__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./util/parseFromVisual */ "./js/util/parseFromVisual.js");
  4701. /* harmony import */ var _visualUI_text_editor__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./visualUI/text_editor */ "./js/visualUI/text_editor.js");
  4702. /* harmony import */ var _util_auto_gen_output__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./util/auto_gen_output */ "./js/util/auto_gen_output.js");
  4703. /* harmony import */ var _visualUI_code_generator__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./visualUI/code_generator */ "./js/visualUI/code_generator.js");
  4704. var CodeEditor = {
  4705. initTextEditor: _visualUI_text_editor__WEBPACK_IMPORTED_MODULE_10__.initTextEditor,
  4706. setCode: _visualUI_text_editor__WEBPACK_IMPORTED_MODULE_10__.setCode,
  4707. getCode: _visualUI_text_editor__WEBPACK_IMPORTED_MODULE_10__.getCode,
  4708. updateEditor: _visualUI_text_editor__WEBPACK_IMPORTED_MODULE_10__.updateEditor,
  4709. disable: _visualUI_text_editor__WEBPACK_IMPORTED_MODULE_10__.disable
  4710. };
  4711. var Settings = {
  4712. programming: [],
  4713. functions: [],
  4714. datatypes: [],
  4715. commands: [],
  4716. filter: []
  4717. };
  4718. var i18n = _services_i18nHelper__WEBPACK_IMPORTED_MODULE_3__.i18nHelper.i18n;
  4719. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.getInstance();
  4720. /***/ }),
  4721. /***/ "./js/processor/definedFunctions.js":
  4722. /*!******************************************!*\
  4723. !*** ./js/processor/definedFunctions.js ***!
  4724. \******************************************/
  4725. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  4726. "use strict";
  4727. __webpack_require__.r(__webpack_exports__);
  4728. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  4729. /* harmony export */ "LanguageDefinedFunction": () => (/* binding */ LanguageDefinedFunction)
  4730. /* harmony export */ });
  4731. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.ts");
  4732. /* harmony import */ var _lib_io__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  4733. /* harmony import */ var _lib_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  4734. /* harmony import */ var _lib_arrays__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  4735. /* harmony import */ var _lib_lang__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  4736. /* harmony import */ var _lib_math__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  4737. function valueToKey(value, object) {
  4738. for (var key in object) {
  4739. if (Object.prototype.hasOwnProperty.call(object, key)) {
  4740. if (object[key] === value) {
  4741. return key;
  4742. }
  4743. }
  4744. }
  4745. return null;
  4746. }
  4747. function concatObjects() {
  4748. var result = {};
  4749. for (var i = 0; i < arguments.length; i++) {
  4750. var obj = i < 0 || arguments.length <= i ? undefined : arguments[i];
  4751. for (var key in obj) {
  4752. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  4753. result[key] = obj[key];
  4754. }
  4755. }
  4756. }
  4757. return result;
  4758. }
  4759. var libsObject = {
  4760. $mathLib: {
  4761. $sin: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createSinFun)(),
  4762. $cos: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createCosFun)(),
  4763. $tan: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createTanFun)(),
  4764. $sqrt: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createSqrtFun)(),
  4765. $pow: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createPowFun)(),
  4766. $log: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createLogFun)(),
  4767. $abs: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createAbsFun)(),
  4768. $negate: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createNegateFun)(),
  4769. $invert: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createInvertFun)(),
  4770. $max: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createMaxFun)(),
  4771. $min: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createMinFun)(),
  4772. $rand: (0,_lib_math__WEBPACK_IMPORTED_MODULE_5__.createRandFun)()
  4773. },
  4774. $ioLib: {
  4775. $read: (0,_lib_io__WEBPACK_IMPORTED_MODULE_1__.createInputFun)(),
  4776. $write: (0,_lib_io__WEBPACK_IMPORTED_MODULE_1__.createOutputFun)()
  4777. },
  4778. $strLib: {
  4779. $substring: (0,_lib_strings__WEBPACK_IMPORTED_MODULE_2__.createSubstringFun)(),
  4780. $length: (0,_lib_strings__WEBPACK_IMPORTED_MODULE_2__.createLengthFun)(),
  4781. $uppercase: (0,_lib_strings__WEBPACK_IMPORTED_MODULE_2__.createUppercaseFun)(),
  4782. $lowercase: (0,_lib_strings__WEBPACK_IMPORTED_MODULE_2__.createLowercaseFun)(),
  4783. $charAt: (0,_lib_strings__WEBPACK_IMPORTED_MODULE_2__.createrCharAtFun)()
  4784. },
  4785. $arrayLib: {
  4786. $numElements: (0,_lib_arrays__WEBPACK_IMPORTED_MODULE_3__.createNumElementsFun)(),
  4787. $matrixLines: (0,_lib_arrays__WEBPACK_IMPORTED_MODULE_3__.createMatrixLinesFun)(),
  4788. $matrixColumns: (0,_lib_arrays__WEBPACK_IMPORTED_MODULE_3__.createMatrixColumnsFun)()
  4789. },
  4790. $langLib: {
  4791. $isReal: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createIsRealFun)(),
  4792. $isInt: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createIsIntFun)(),
  4793. $isBool: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createIsBoolFun)(),
  4794. $castReal: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createCastRealFun)(),
  4795. $castInt: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createCastIntFun)(),
  4796. $castBool: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createCastBoolFun)(),
  4797. $castString: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createCastStringFun)(),
  4798. $castChar: (0,_lib_lang__WEBPACK_IMPORTED_MODULE_4__.createCastCharFun)()
  4799. }
  4800. };
  4801. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  4802. var LanguageDefinedFunction = Object.freeze({
  4803. getMainFunctionName: function getMainFunctionName() {
  4804. return _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangFuncs().main_function;
  4805. },
  4806. getInternalName: function getInternalName(localName) {
  4807. if (localName.indexOf(".") !== -1) {
  4808. var names = localName.split(".");
  4809. var lib = valueToKey(names[0], _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangLibs());
  4810. var internalName = valueToKey(names[1], _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangFuncs());
  4811. if (lib === null || internalName === null) {
  4812. return null;
  4813. }
  4814. return lib + "." + internalName;
  4815. }
  4816. var funcName = valueToKey(localName, _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangFuncs());
  4817. if (funcName !== null) {
  4818. if (funcsObject[funcName]) {
  4819. return funcName;
  4820. }
  4821. }
  4822. return null;
  4823. },
  4824. getFunction: function getFunction(internalName) {
  4825. if (internalName.indexOf(".") !== -1) {
  4826. var names = internalName.split(".");
  4827. var libName = names[0];
  4828. var funName = names[1];
  4829. return libsObject[libName][funName];
  4830. }
  4831. return funcsObject[internalName];
  4832. },
  4833. getLocalName: function getLocalName(internalName) {
  4834. if (internalName.indexOf(".") !== -1) {
  4835. var names = internalName.split(".");
  4836. var libName = _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangLibs()[names[0]];
  4837. var funName = _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangFuncs()[names[1]];
  4838. return "".concat(libName, ".").concat(funName);
  4839. } else if (_services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangFuncs()[internalName]) {
  4840. return _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLangFuncs()[internalName];
  4841. } else {
  4842. return internalName;
  4843. }
  4844. }
  4845. });
  4846. /***/ }),
  4847. /***/ "./js/processor/error/processorErrorFactory.js":
  4848. /*!*****************************************************!*\
  4849. !*** ./js/processor/error/processorErrorFactory.js ***!
  4850. \*****************************************************/
  4851. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  4852. "use strict";
  4853. __webpack_require__.r(__webpack_exports__);
  4854. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  4855. /* harmony export */ "ProcessorErrorFactory": () => (/* binding */ ProcessorErrorFactory)
  4856. /* harmony export */ });
  4857. /* harmony import */ var _runtimeError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  4858. /* harmony import */ var _semanticError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  4859. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  4860. /* harmony import */ var _definedFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../definedFunctions */ "./js/processor/definedFunctions.js");
  4861. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.getInstance();
  4862. function createRuntimeError(i18n_id) {
  4863. var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  4864. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__.RuntimeError(LocalizedStrings.getError(i18n_id, context), i18n_id);
  4865. }
  4866. function createSemanticError(i18n_id) {
  4867. var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  4868. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__.SemanticError(LocalizedStrings.getError(i18n_id, context), i18n_id);
  4869. }
  4870. var ProcessorErrorFactory = Object.freeze({
  4871. symbol_not_found_full: function symbol_not_found_full(id, sourceInfo) {
  4872. if (sourceInfo) {
  4873. var context = [id, sourceInfo.line, sourceInfo.column];
  4874. var error = createSemanticError("symbol_not_found_full", context);
  4875. error.context = {
  4876. line: sourceInfo.line,
  4877. column: sourceInfo.column
  4878. };
  4879. return error;
  4880. } else {
  4881. return ProcessorErrorFactory.symbol_not_found(id);
  4882. }
  4883. },
  4884. symbol_not_found: function symbol_not_found(id) {
  4885. var context = [id];
  4886. return createSemanticError("symbol_not_found", context);
  4887. },
  4888. function_missing_full: function function_missing_full(id, sourceInfo) {
  4889. if (sourceInfo) {
  4890. var context = [id, sourceInfo.line, sourceInfo.column];
  4891. var error = createSemanticError("function_missing_full", context);
  4892. error.context = {
  4893. line: sourceInfo.line,
  4894. column: sourceInfo.column
  4895. };
  4896. return error;
  4897. } else {
  4898. return ProcessorErrorFactory.function_missing(id);
  4899. }
  4900. },
  4901. function_missing: function function_missing(id) {
  4902. var context = [id];
  4903. return createSemanticError("function_missing", context);
  4904. },
  4905. main_missing: function main_missing() {
  4906. return createSemanticError("main_missing");
  4907. },
  4908. array_dimension_not_int_full: function array_dimension_not_int_full(sourceInfo) {
  4909. if (sourceInfo) {
  4910. var context = [sourceInfo.line];
  4911. var error = createSemanticError("array_dimension_not_int_full", context);
  4912. error.context = {
  4913. line: sourceInfo.line,
  4914. column: sourceInfo.column
  4915. };
  4916. return error;
  4917. } else {
  4918. return ProcessorErrorFactory.array_dimension_not_int();
  4919. }
  4920. },
  4921. array_dimension_not_int: function array_dimension_not_int() {
  4922. return createSemanticError("array_dimension_not_int");
  4923. },
  4924. unknown_command_full: function unknown_command_full(sourceInfo) {
  4925. if (sourceInfo) {
  4926. var context = [sourceInfo.line];
  4927. var error = createRuntimeError("unknown_command_full", context);
  4928. error.context = {
  4929. line: sourceInfo.line,
  4930. column: sourceInfo.column
  4931. };
  4932. return error;
  4933. } else {
  4934. return ProcessorErrorFactory.unknown_command();
  4935. }
  4936. },
  4937. unknown_command: function unknown_command() {
  4938. return createRuntimeError("unknown_command");
  4939. },
  4940. incompatible_types_full: function incompatible_types_full(left_type, left_dim, right_type, right_dim, exp, source_info) {
  4941. if (source_info) {
  4942. var context = [LocalizedStrings.translateType(left_type, left_dim), exp, source_info.line, LocalizedStrings.translateType(right_type, right_dim)];
  4943. var error = createSemanticError("incompatible_types_full", context);
  4944. error.context = {
  4945. line: source_info.line,
  4946. column: source_info.column
  4947. };
  4948. return error;
  4949. } else {
  4950. return ProcessorErrorFactory.incompatible_types(left_type, left_dim, right_type, right_dim, exp);
  4951. }
  4952. },
  4953. incompatible_types: function incompatible_types(left_type, left_dim, right_type, right_dim, exp) {
  4954. var context = [LocalizedStrings.translateType(left_type, left_dim), exp, LocalizedStrings.translateType(right_type, right_dim)];
  4955. return createSemanticError("incompatible_types", context);
  4956. },
  4957. incompatible_types_array_full: function incompatible_types_array_full(exp, type, dim, sourceInfo) {
  4958. if (sourceInfo) {
  4959. var context = [exp, LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
  4960. var error = createSemanticError("incompatible_types_array_full", context);
  4961. error.context = {
  4962. line: sourceInfo.line,
  4963. column: sourceInfo.column
  4964. };
  4965. return error;
  4966. } else {
  4967. return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
  4968. }
  4969. },
  4970. incompatible_types_array: function incompatible_types_array(exp, type, dim) {
  4971. var context = [exp, LocalizedStrings.translateType(type, dim)];
  4972. return createSemanticError("incompatible_types_array", context);
  4973. },
  4974. loop_condition_type_full: function loop_condition_type_full(exp, sourceInfo) {
  4975. if (sourceInfo) {
  4976. var context = [sourceInfo.line, sourceInfo.column, exp];
  4977. var error = createSemanticError("loop_condition_type_full", context);
  4978. error.context = {
  4979. line: sourceInfo.line,
  4980. column: sourceInfo.column
  4981. };
  4982. return error;
  4983. } else {
  4984. return ProcessorErrorFactory.loop_condition_type(exp);
  4985. }
  4986. },
  4987. loop_condition_type: function loop_condition_type(exp) {
  4988. var context = [exp];
  4989. return createSemanticError("loop_condition_type", context);
  4990. },
  4991. /**
  4992. * @deprecated 01/10/2019
  4993. */
  4994. endless_loop_full: function endless_loop_full(sourceInfo) {
  4995. if (sourceInfo) {
  4996. var context = [sourceInfo.line];
  4997. var error = createSemanticError("endless_loop_full", context);
  4998. error.context = {
  4999. line: sourceInfo.line,
  5000. column: sourceInfo.column
  5001. };
  5002. return error;
  5003. } else {
  5004. return ProcessorErrorFactory.endless_loop();
  5005. }
  5006. },
  5007. endless_loop: function endless_loop() {
  5008. return createSemanticError("endless_loop");
  5009. },
  5010. if_condition_type_full: function if_condition_type_full(exp, sourceInfo) {
  5011. if (sourceInfo) {
  5012. var context = [sourceInfo.line, sourceInfo.column, exp];
  5013. var error = createSemanticError("if_condition_type_full", context);
  5014. error.context = {
  5015. line: sourceInfo.line,
  5016. column: sourceInfo.column
  5017. };
  5018. return error;
  5019. } else {
  5020. return ProcessorErrorFactory.if_condition_type(exp);
  5021. }
  5022. },
  5023. if_condition_type: function if_condition_type(exp) {
  5024. var context = [exp];
  5025. return createSemanticError("if_condition_type", context);
  5026. },
  5027. invalid_global_var: function invalid_global_var() {
  5028. return createRuntimeError("invalid_global_var");
  5029. },
  5030. not_implemented: function not_implemented(id) {
  5031. var context = [id];
  5032. return createRuntimeError("not_implemented", context);
  5033. },
  5034. invalid_case_type_full: function invalid_case_type_full(exp, type, dim, sourceInfo) {
  5035. if (sourceInfo) {
  5036. var context = [exp, LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
  5037. var error = createSemanticError("invalid_case_type_full", context);
  5038. error.context = {
  5039. line: sourceInfo.line,
  5040. column: sourceInfo.column
  5041. };
  5042. return error;
  5043. } else {
  5044. return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
  5045. }
  5046. },
  5047. invalid_case_type: function invalid_case_type(exp, type, dim) {
  5048. var context = [exp, LocalizedStrings.translateType(type, dim)];
  5049. return createSemanticError("invalid_case_type", context);
  5050. },
  5051. void_in_expression_full: function void_in_expression_full(id, sourceInfo) {
  5052. if (sourceInfo) {
  5053. var context = [sourceInfo.line, sourceInfo.column, id];
  5054. var error = createSemanticError("void_in_expression_full", context);
  5055. error.context = {
  5056. line: sourceInfo.line,
  5057. column: sourceInfo.column
  5058. };
  5059. return error;
  5060. } else {
  5061. return ProcessorErrorFactory.void_in_expression(id);
  5062. }
  5063. },
  5064. void_in_expression: function void_in_expression(id) {
  5065. var context = [id];
  5066. return createSemanticError("void_in_expression", context);
  5067. },
  5068. invalid_array_access_full: function invalid_array_access_full(id, sourceInfo) {
  5069. if (sourceInfo) {
  5070. var context = [id, sourceInfo.line, sourceInfo.column];
  5071. var error = createSemanticError("invalid_array_access_full", context);
  5072. error.context = {
  5073. line: sourceInfo.line,
  5074. column: sourceInfo.column
  5075. };
  5076. return error;
  5077. } else {
  5078. return ProcessorErrorFactory.invalid_array_access(id);
  5079. }
  5080. },
  5081. invalid_array_access: function invalid_array_access(id) {
  5082. var context = [id];
  5083. return createSemanticError("invalid_array_access", context);
  5084. },
  5085. invalid_matrix_access_full: function invalid_matrix_access_full(id, sourceInfo) {
  5086. if (sourceInfo) {
  5087. var context = [id, sourceInfo.line, sourceInfo.column];
  5088. var error = createSemanticError("invalid_matrix_access_full", context);
  5089. error.context = {
  5090. line: sourceInfo.line,
  5091. column: sourceInfo.column
  5092. };
  5093. return error;
  5094. } else {
  5095. return ProcessorErrorFactory.invalid_matrix_access(id);
  5096. }
  5097. },
  5098. invalid_matrix_access: function invalid_matrix_access(id) {
  5099. var context = [id];
  5100. return createSemanticError("invalid_matrix_access", context);
  5101. },
  5102. matrix_column_outbounds_full: function matrix_column_outbounds_full(id, value, columns, sourceInfo) {
  5103. if (sourceInfo) {
  5104. var context = [sourceInfo.line, value, id, columns];
  5105. var error = createRuntimeError("matrix_column_outbounds_full", context);
  5106. error.context = {
  5107. line: sourceInfo.line,
  5108. column: sourceInfo.column
  5109. };
  5110. return error;
  5111. } else {
  5112. return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
  5113. }
  5114. },
  5115. matrix_column_outbounds: function matrix_column_outbounds(id, value, columns) {
  5116. var context = [value, id, columns];
  5117. return createRuntimeError("matrix_column_outbounds", context);
  5118. },
  5119. matrix_line_outbounds_full: function matrix_line_outbounds_full(id, value, lines, sourceInfo) {
  5120. if (sourceInfo) {
  5121. var context = [sourceInfo.line, value, id, lines];
  5122. var error = createRuntimeError("matrix_line_outbounds_full", context);
  5123. error.context = {
  5124. line: sourceInfo.line,
  5125. column: sourceInfo.column
  5126. };
  5127. return error;
  5128. } else {
  5129. return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
  5130. }
  5131. },
  5132. matrix_line_outbounds: function matrix_line_outbounds(id, value, lines) {
  5133. var context = [value, id, lines];
  5134. return createRuntimeError("matrix_line_outbounds", context);
  5135. },
  5136. vector_line_outbounds_full: function vector_line_outbounds_full(id, value, lines, sourceInfo) {
  5137. if (sourceInfo) {
  5138. var context = [sourceInfo.line, value, id, lines];
  5139. var error = createRuntimeError("vector_line_outbounds_full", context);
  5140. error.context = {
  5141. line: sourceInfo.line,
  5142. column: sourceInfo.column
  5143. };
  5144. return error;
  5145. } else {
  5146. return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
  5147. }
  5148. },
  5149. vector_line_outbounds: function vector_line_outbounds(id, value, lines) {
  5150. var context = [value, id, lines];
  5151. return createRuntimeError("vector_line_outbounds", context);
  5152. },
  5153. vector_not_matrix_full: function vector_not_matrix_full(id, sourceInfo) {
  5154. if (sourceInfo) {
  5155. var context = [sourceInfo.line, id];
  5156. var error = createRuntimeError("vector_not_matrix_full", context);
  5157. error.context = {
  5158. line: sourceInfo.line,
  5159. column: sourceInfo.column
  5160. };
  5161. return error;
  5162. } else {
  5163. return ProcessorErrorFactory.vector_not_matrix(id);
  5164. }
  5165. },
  5166. vector_not_matrix: function vector_not_matrix(id) {
  5167. var context = [id];
  5168. return createRuntimeError("vector_not_matrix", context);
  5169. },
  5170. function_no_return: function function_no_return(id) {
  5171. var context = [id];
  5172. return createSemanticError("function_no_return", context);
  5173. },
  5174. invalid_void_return_full: function invalid_void_return_full(id, type, dim, sourceInfo) {
  5175. if (sourceInfo) {
  5176. var context = [sourceInfo.line, id, LocalizedStrings.translateType(type, dim)];
  5177. var error = createSemanticError("invalid_void_return_full", context);
  5178. error.context = {
  5179. line: sourceInfo.line,
  5180. column: sourceInfo.column
  5181. };
  5182. return error;
  5183. } else {
  5184. return ProcessorErrorFactory.invalid_void_return(id, type, dim);
  5185. }
  5186. },
  5187. invalid_void_return: function invalid_void_return(id, type, dim) {
  5188. var context = [id, LocalizedStrings.translateType(type, dim)];
  5189. return createSemanticError("invalid_void_return_full", context);
  5190. },
  5191. invalid_return_type_full: function invalid_return_type_full(id, type, dim, sourceInfo) {
  5192. if (sourceInfo) {
  5193. var context = [sourceInfo.line, id, LocalizedStrings.translateType(type, dim)];
  5194. var error = createSemanticError("invalid_return_type_full", context);
  5195. error.context = {
  5196. line: sourceInfo.line,
  5197. column: sourceInfo.column
  5198. };
  5199. return error;
  5200. } else {
  5201. return ProcessorErrorFactory.invalid_return_type(id, type, dim);
  5202. }
  5203. },
  5204. invalid_return_type: function invalid_return_type(id, type, dim) {
  5205. var context = [id, LocalizedStrings.translateType(type, dim)];
  5206. return createSemanticError("invalid_return_type", context);
  5207. },
  5208. invalid_parameters_size_full: function invalid_parameters_size_full(id, expected, actual, sourceInfo) {
  5209. if (sourceInfo) {
  5210. var context = [sourceInfo.line, id, expected, actual];
  5211. var error = createSemanticError("invalid_parameters_size_full", context);
  5212. error.context = {
  5213. line: sourceInfo.line,
  5214. column: sourceInfo.column
  5215. };
  5216. return error;
  5217. } else {
  5218. return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
  5219. }
  5220. },
  5221. invalid_parameters_size: function invalid_parameters_size(id, expected, actual) {
  5222. var context = [id, expected, actual];
  5223. return createSemanticError("invalid_parameters_size", context);
  5224. },
  5225. invalid_parameter_type_full: function invalid_parameter_type_full(fun_name, exp, sourceInfo) {
  5226. if (sourceInfo) {
  5227. var context = [exp, _definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getLocalName(fun_name), sourceInfo.line];
  5228. var error = createSemanticError("invalid_parameter_type_full", context);
  5229. error.context = {
  5230. line: sourceInfo.line,
  5231. column: sourceInfo.column
  5232. };
  5233. return error;
  5234. } else {
  5235. return ProcessorErrorFactory.invalid_parameter_type(fun_name, exp);
  5236. }
  5237. },
  5238. invalid_parameter_type: function invalid_parameter_type(fun_name, exp) {
  5239. var context = [exp, _definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getLocalName(fun_name)];
  5240. return createSemanticError("invalid_parameter_type_full", context);
  5241. },
  5242. invalid_ref_full: function invalid_ref_full(id, exp, sourceInfo) {
  5243. if (sourceInfo) {
  5244. var context = [exp, id, sourceInfo.line];
  5245. var error = createSemanticError("invalid_ref_full", context);
  5246. error.context = {
  5247. line: sourceInfo.line,
  5248. column: sourceInfo.column
  5249. };
  5250. return error;
  5251. } else {
  5252. return ProcessorErrorFactory.invalid_ref(id, exp);
  5253. }
  5254. },
  5255. invalid_ref: function invalid_ref(id, exp) {
  5256. var context = [exp, id];
  5257. return createSemanticError("invalid_ref", context);
  5258. },
  5259. unexpected_break_command_full: function unexpected_break_command_full(sourceInfo) {
  5260. if (sourceInfo) {
  5261. var context = [sourceInfo.line];
  5262. var error = createRuntimeError("unexpected_break_command_full", context);
  5263. error.context = {
  5264. line: sourceInfo.line,
  5265. column: sourceInfo.column
  5266. };
  5267. return error;
  5268. } else {
  5269. return ProcessorErrorFactory.unexpected_break_command();
  5270. }
  5271. },
  5272. unexpected_break_command: function unexpected_break_command() {
  5273. return createRuntimeError("unexpected_break_command");
  5274. },
  5275. invalid_array_literal_type_full: function invalid_array_literal_type_full(exp, sourceInfo) {
  5276. if (sourceInfo) {
  5277. var context = [sourceInfo.line, exp];
  5278. var error = createRuntimeError("invalid_array_literal_type_full", context);
  5279. error.context = {
  5280. line: sourceInfo.line,
  5281. column: sourceInfo.column
  5282. };
  5283. return error;
  5284. } else {
  5285. return ProcessorErrorFactory.invalid_array_literal_type(exp);
  5286. }
  5287. },
  5288. invalid_array_literal_type: function invalid_array_literal_type(exp) {
  5289. var context = [exp];
  5290. return createRuntimeError("invalid_array_literal_type", context);
  5291. },
  5292. invalid_array_literal_line_full: function invalid_array_literal_line_full(expected, actual, sourceInfo) {
  5293. if (sourceInfo) {
  5294. var context = [sourceInfo.line, expected, actual];
  5295. var error = createRuntimeError("invalid_array_literal_line_full", context);
  5296. error.context = {
  5297. line: sourceInfo.line,
  5298. column: sourceInfo.column
  5299. };
  5300. return error;
  5301. } else {
  5302. return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
  5303. }
  5304. },
  5305. invalid_array_literal_line: function invalid_array_literal_line(expected, actual) {
  5306. var context = [expected, actual];
  5307. return createRuntimeError("invalid_array_literal_line", context);
  5308. },
  5309. invalid_array_literal_column_full: function invalid_array_literal_column_full(expected, actual, sourceInfo) {
  5310. if (sourceInfo) {
  5311. var context = [sourceInfo.line, expected, actual];
  5312. var error = createRuntimeError("invalid_array_literal_column_full", context);
  5313. error.context = {
  5314. line: sourceInfo.line,
  5315. column: sourceInfo.column
  5316. };
  5317. return error;
  5318. } else {
  5319. return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
  5320. }
  5321. },
  5322. invalid_array_literal_column: function invalid_array_literal_column(expected, actual) {
  5323. var context = [expected, actual];
  5324. return createRuntimeError("invalid_array_literal_column", context);
  5325. },
  5326. invalid_unary_op_full: function invalid_unary_op_full(expString, opName, type, dim, sourceInfo) {
  5327. if (sourceInfo) {
  5328. var context = [sourceInfo.line, expString, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(type, dim)];
  5329. var error = createRuntimeError("invalid_unary_op_full", context);
  5330. error.context = {
  5331. line: sourceInfo.line,
  5332. column: sourceInfo.column
  5333. };
  5334. return error;
  5335. } else {
  5336. return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
  5337. }
  5338. },
  5339. invalid_unary_op: function invalid_unary_op(expString, opName, type, dim) {
  5340. var context = [expString, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(type, dim)];
  5341. return createRuntimeError("invalid_unary_op", context);
  5342. },
  5343. invalid_infix_op_full: function invalid_infix_op_full(expString, opName, typeLeft, dimLeft, typeRight, dimRight, sourceInfo) {
  5344. if (sourceInfo) {
  5345. var context = [sourceInfo.line, expString, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(typeLeft, dimLeft), LocalizedStrings.translateType(typeRight, dimRight)];
  5346. var error = createRuntimeError("invalid_infix_op_full", context);
  5347. error.context = {
  5348. line: sourceInfo.line,
  5349. column: sourceInfo.column
  5350. };
  5351. return error;
  5352. } else {
  5353. return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
  5354. }
  5355. },
  5356. invalid_infix_op: function invalid_infix_op(expString, opName, typeLeft, dimLeft, typeRight, dimRight) {
  5357. var context = [expString, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(typeLeft, dimLeft), LocalizedStrings.translateType(typeRight, dimRight)];
  5358. return createRuntimeError("invalid_infix_op", context);
  5359. },
  5360. array_dimension_not_positive_full: function array_dimension_not_positive_full(sourceInfo) {
  5361. if (sourceInfo) {
  5362. var context = [sourceInfo.line];
  5363. var error = createSemanticError("array_dimension_not_positive_full", context);
  5364. error.context = {
  5365. line: sourceInfo.line,
  5366. column: sourceInfo.column
  5367. };
  5368. return error;
  5369. } else {
  5370. return ProcessorErrorFactory.array_dimension_not_positive();
  5371. }
  5372. },
  5373. array_dimension_not_positive: function array_dimension_not_positive() {
  5374. return createSemanticError("array_dimension_not_positive");
  5375. },
  5376. invalid_type_conversion: function invalid_type_conversion(value, type, dim) {
  5377. var context = [value, LocalizedStrings.translateType(type, dim)];
  5378. return createRuntimeError("invalid_type_conversion", context);
  5379. },
  5380. invalid_read_type: function invalid_read_type(exp, type, dim, name, source_info) {
  5381. var context = [source_info.line, exp, LocalizedStrings.translateType(type, dim), name];
  5382. var error = createRuntimeError("invalid_read_type", context);
  5383. error.context = {
  5384. line: source_info.line,
  5385. column: source_info.column
  5386. };
  5387. return error;
  5388. },
  5389. invalid_read_type_array: function invalid_read_type_array(exp, typePos, dimPos, name, typeArray, dimArray, sourceInfo) {
  5390. var context = [sourceInfo.line, exp, LocalizedStrings.translateType(typePos, dimPos), name, LocalizedStrings.translateType(typeArray, dimArray)];
  5391. var error = createRuntimeError("invalid_read_type_array", context);
  5392. error.context = {
  5393. line: sourceInfo.line,
  5394. column: sourceInfo.column
  5395. };
  5396. return error;
  5397. },
  5398. invalid_const_ref_full: function invalid_const_ref_full(fun_name, exp, sourceInfo) {
  5399. if (sourceInfo) {
  5400. var context = [exp, _definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getLocalName(fun_name), sourceInfo.line];
  5401. var error = createSemanticError("invalid_const_ref_full", context);
  5402. error.context = {
  5403. line: sourceInfo.line,
  5404. column: sourceInfo.column
  5405. };
  5406. return error;
  5407. } else {
  5408. return ProcessorErrorFactory.invalid_const_ref(fun_name, exp);
  5409. }
  5410. },
  5411. invalid_const_ref: function invalid_const_ref(fun_name, exp) {
  5412. var context = [exp, _definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getLocalName(fun_name)];
  5413. var error = createSemanticError("invalid_const_ref", context);
  5414. return error;
  5415. },
  5416. invalid_const_assignment_full: function invalid_const_assignment_full(var_id, source_info) {
  5417. if (source_info) {
  5418. var context = [source_info.line, var_id];
  5419. var error = createSemanticError("invalid_const_assignment_full", context);
  5420. error.context = {
  5421. line: source_info.line,
  5422. column: source_info.column
  5423. };
  5424. return error;
  5425. } else {
  5426. return ProcessorErrorFactory.invalid_const_assignment(var_id);
  5427. }
  5428. },
  5429. invalid_const_assignment: function invalid_const_assignment(var_id) {
  5430. var context = [var_id];
  5431. return createSemanticError("invalid_const_assignment", context);
  5432. },
  5433. invalid_vector_assignment_full: function invalid_vector_assignment_full(left_id, left_size, right_id, right_size, source_info) {
  5434. if (source_info) {
  5435. var context = [source_info.line, left_id, left_size, right_id, right_size];
  5436. var error = createRuntimeError("invalid_vector_assignment_full", context);
  5437. error.context = {
  5438. line: source_info.line,
  5439. column: source_info.column
  5440. };
  5441. return error;
  5442. } else {
  5443. return ProcessorErrorFactory.invalid_vector_assignment(left_id, left_size, right_id, right_size);
  5444. }
  5445. },
  5446. invalid_vector_assignment: function invalid_vector_assignment(left_id, left_size, right_id, right_size) {
  5447. var context = [left_id, left_size, right_id, right_size];
  5448. return createRuntimeError("invalid_vector_assignment", context);
  5449. },
  5450. invalid_matrix_assignment_full: function invalid_matrix_assignment_full(left_id, left_line, left_column, right_id, right_line, right_column, source_info) {
  5451. if (source_info) {
  5452. var context = [source_info.line, left_id, left_line, left_column, right_id, right_line, right_column];
  5453. var error = createRuntimeError("invalid_matrix_assignment_full", context);
  5454. error.context = {
  5455. line: source_info.line,
  5456. column: source_info.column
  5457. };
  5458. return error;
  5459. } else {
  5460. return ProcessorErrorFactory.invalid_matrix_assignment(left_id, left_line, left_column, right_id, right_line, right_column);
  5461. }
  5462. },
  5463. invalid_matrix_assignment: function invalid_matrix_assignment(left_id, left_line, left_column, right_id, right_line, right_column) {
  5464. var context = [left_id, left_line, left_column, right_id, right_line, right_column];
  5465. return createRuntimeError("invalid_matrix_assignment", context);
  5466. },
  5467. matrix_to_vector_attr: function matrix_to_vector_attr(left_id, right_id, source_info) {
  5468. // SourceInfo have to be valid...
  5469. var context = [source_info.line, right_id, left_id];
  5470. var error = createSemanticError("matrix_to_vector_attr", context);
  5471. error.context = {
  5472. line: source_info.line,
  5473. column: source_info.column
  5474. };
  5475. return error;
  5476. },
  5477. vector_to_matrix_attr: function vector_to_matrix_attr(left_id, right_id, source_info) {
  5478. // SourceInfo have to be valid...
  5479. var context = [source_info.line, right_id, left_id];
  5480. var error = createSemanticError("vector_to_matrix_attr", context);
  5481. error.context = {
  5482. line: source_info.line,
  5483. column: source_info.column
  5484. };
  5485. return error;
  5486. },
  5487. invalid_matrix_index_assign_full: function invalid_matrix_index_assign_full(mat_id, mat_line, mat_size, exp, exp_size, source_info) {
  5488. if (source_info) {
  5489. var context = [source_info.line, mat_line, mat_id, mat_size, exp, exp_size];
  5490. var error = createRuntimeError("invalid_matrix_index_assign_full", context);
  5491. error.context = {
  5492. line: source_info.line,
  5493. column: source_info.column
  5494. };
  5495. return error;
  5496. } else {
  5497. return ProcessorErrorFactory.invalid_matrix_index_assign(mat_id, mat_line, mat_size, exp, exp_size);
  5498. }
  5499. },
  5500. invalid_matrix_index_assign: function invalid_matrix_index_assign(mat_id, mat_line, mat_size, exp, exp_size) {
  5501. var context = [mat_line, mat_id, mat_size, exp, exp_size];
  5502. return createRuntimeError("invalid_matrix_index_assign", context);
  5503. },
  5504. invalid_number_elements_vector: function invalid_number_elements_vector(expected_num, exp, actual_num, source_info) {
  5505. // SourceInfo have to be valid...
  5506. var context = [expected_num, source_info.line, exp, actual_num];
  5507. var error = createRuntimeError("invalid_number_elements_vector", context);
  5508. error.context = {
  5509. line: source_info.line,
  5510. column: source_info.column
  5511. };
  5512. return error;
  5513. },
  5514. invalid_number_lines_matrix: function invalid_number_lines_matrix(expected_num, exp, actual_num, source_info) {
  5515. // SourceInfo have to be valid...
  5516. var context = [expected_num, source_info.line, exp, actual_num];
  5517. var error = createRuntimeError("invalid_number_lines_matrix", context);
  5518. error.context = {
  5519. line: source_info.line,
  5520. column: source_info.column
  5521. };
  5522. return error;
  5523. },
  5524. divsion_by_zero_full: function divsion_by_zero_full(exp, source_info) {
  5525. if (source_info) {
  5526. var context = [source_info.line, exp];
  5527. var error = createRuntimeError("divsion_by_zero_full", context);
  5528. error.context = {
  5529. line: source_info.line,
  5530. column: source_info.column
  5531. };
  5532. return error;
  5533. } else {
  5534. return ProcessorErrorFactory.divsion_by_zero(exp);
  5535. }
  5536. },
  5537. divsion_by_zero: function divsion_by_zero(exp) {
  5538. var context = [exp];
  5539. return createRuntimeError("divsion_by_zero", context);
  5540. },
  5541. undefined_tanget_value: function undefined_tanget_value(value, source_info) {
  5542. var context = [source_info.line, value];
  5543. var error = createRuntimeError("undefined_tanget_value", context);
  5544. error.context = {
  5545. line: source_info.line,
  5546. column: source_info.column
  5547. };
  5548. return error;
  5549. },
  5550. negative_log_value: function negative_log_value(source_info) {
  5551. var error = createRuntimeError("negative_log_value", [source_info.line]);
  5552. error.context = {
  5553. line: source_info.line,
  5554. column: source_info.column
  5555. };
  5556. return error;
  5557. },
  5558. invalid_string_index: function invalid_string_index(index, str, source_info) {
  5559. var local_fun_name = _definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getLocalName("$charAt");
  5560. var context = [source_info.line, local_fun_name, index, str, str.length - 1];
  5561. var error = createRuntimeError("invalid_string_index", context);
  5562. error.context = {
  5563. line: source_info.line,
  5564. column: source_info.column
  5565. };
  5566. return error;
  5567. },
  5568. negative_sqrt_value: function negative_sqrt_value(source_info) {
  5569. var error = createRuntimeError("negative_sqrt_value", [source_info.line]);
  5570. error.context = {
  5571. line: source_info.line,
  5572. column: source_info.column
  5573. };
  5574. return error;
  5575. },
  5576. /**
  5577. * @deprecated 01/10/2019
  5578. */
  5579. exceeded_recursive_calls: function exceeded_recursive_calls(source_info) {
  5580. var context = [source_info.line];
  5581. var error = createRuntimeError("exceeded_recursive_calls", context);
  5582. error.context = {
  5583. line: source_info.line,
  5584. column: source_info.column
  5585. };
  5586. return error;
  5587. },
  5588. invalid_for_variable: function invalid_for_variable(id, source_info) {
  5589. var context = [source_info.line, id];
  5590. var error = createSemanticError("invalid_for_variable", context);
  5591. error.context = {
  5592. line: source_info.line,
  5593. column: source_info.column
  5594. };
  5595. return error;
  5596. },
  5597. invalid_for_from: function invalid_for_from(exp, source_info) {
  5598. var context = [source_info.line, exp];
  5599. var error = createSemanticError("invalid_for_from", context);
  5600. error.context = {
  5601. line: source_info.line,
  5602. column: source_info.column
  5603. };
  5604. return error;
  5605. },
  5606. invalid_for_to: function invalid_for_to(exp, source_info) {
  5607. var context = [source_info.line, exp];
  5608. var error = createSemanticError("invalid_for_to", context);
  5609. error.context = {
  5610. line: source_info.line,
  5611. column: source_info.column
  5612. };
  5613. return error;
  5614. },
  5615. invalid_for_pass: function invalid_for_pass(exp, source_info) {
  5616. var context = [source_info.line, exp];
  5617. var error = createSemanticError("invalid_for_pass", context);
  5618. error.context = {
  5619. line: source_info.line,
  5620. column: source_info.column
  5621. };
  5622. return error;
  5623. },
  5624. exceed_max_instructions: function exceed_max_instructions() {
  5625. return createRuntimeError("exceed_max_instructions");
  5626. }
  5627. });
  5628. /***/ }),
  5629. /***/ "./js/processor/error/runtimeError.js":
  5630. /*!********************************************!*\
  5631. !*** ./js/processor/error/runtimeError.js ***!
  5632. \********************************************/
  5633. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  5634. "use strict";
  5635. __webpack_require__.r(__webpack_exports__);
  5636. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  5637. /* harmony export */ "RuntimeError": () => (/* binding */ RuntimeError)
  5638. /* harmony export */ });
  5639. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  5640. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  5641. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  5642. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  5643. /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js");
  5644. /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__);
  5645. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  5646. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__);
  5647. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  5648. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__);
  5649. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  5650. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__);
  5651. /* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ "./node_modules/@babel/runtime/helpers/wrapNativeSuper.js");
  5652. /* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6__);
  5653. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, result); }; }
  5654. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  5655. var RuntimeError = /*#__PURE__*/function (_Error) {
  5656. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default()(RuntimeError, _Error);
  5657. var _super = _createSuper(RuntimeError);
  5658. function RuntimeError(msg, id) {
  5659. var _this;
  5660. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, RuntimeError);
  5661. _this = _super.call(this, msg);
  5662. _this.id = id;
  5663. _this._context = {};
  5664. if (Error.captureStackTrace) Error.captureStackTrace(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), RuntimeError);
  5665. return _this;
  5666. }
  5667. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(RuntimeError, [{
  5668. key: "context",
  5669. get: function get() {
  5670. return this._context;
  5671. },
  5672. set: function set(contextObj) {
  5673. this._context = contextObj;
  5674. }
  5675. }]);
  5676. return RuntimeError;
  5677. }( /*#__PURE__*/_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6___default()(Error));
  5678. /***/ }),
  5679. /***/ "./js/processor/error/semanticError.js":
  5680. /*!*********************************************!*\
  5681. !*** ./js/processor/error/semanticError.js ***!
  5682. \*********************************************/
  5683. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  5684. "use strict";
  5685. __webpack_require__.r(__webpack_exports__);
  5686. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  5687. /* harmony export */ "SemanticError": () => (/* binding */ SemanticError)
  5688. /* harmony export */ });
  5689. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  5690. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  5691. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  5692. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  5693. /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js");
  5694. /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__);
  5695. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  5696. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__);
  5697. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  5698. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__);
  5699. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  5700. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__);
  5701. /* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ "./node_modules/@babel/runtime/helpers/wrapNativeSuper.js");
  5702. /* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6__);
  5703. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, result); }; }
  5704. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  5705. var SemanticError = /*#__PURE__*/function (_Error) {
  5706. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default()(SemanticError, _Error);
  5707. var _super = _createSuper(SemanticError);
  5708. function SemanticError(msg, id) {
  5709. var _this;
  5710. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, SemanticError);
  5711. _this = _super.call(this, msg);
  5712. _this.id = id;
  5713. _this._context = {};
  5714. if (Error.captureStackTrace) Error.captureStackTrace(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), SemanticError);
  5715. return _this;
  5716. }
  5717. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(SemanticError, [{
  5718. key: "context",
  5719. get: function get() {
  5720. return this._context;
  5721. },
  5722. set: function set(contextObj) {
  5723. this._context = contextObj;
  5724. }
  5725. }]);
  5726. return SemanticError;
  5727. }( /*#__PURE__*/_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_6___default()(Error));
  5728. /***/ }),
  5729. /***/ "./js/processor/ivprogProcessor.js":
  5730. /*!*****************************************!*\
  5731. !*** ./js/processor/ivprogProcessor.js ***!
  5732. \*****************************************/
  5733. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  5734. "use strict";
  5735. __webpack_require__.r(__webpack_exports__);
  5736. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  5737. /* harmony export */ "IVProgProcessor": () => (/* binding */ IVProgProcessor)
  5738. /* harmony export */ });
  5739. /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js");
  5740. /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__);
  5741. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
  5742. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__);
  5743. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
  5744. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__);
  5745. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  5746. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3__);
  5747. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  5748. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4__);
  5749. /* harmony import */ var _store_store__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.ts");
  5750. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./modes */ "./js/processor/modes.ts");
  5751. /* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./context */ "./js/processor/context.ts");
  5752. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.ts");
  5753. /* harmony import */ var _ast_operators__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.ts");
  5754. /* harmony import */ var _definedFunctions__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  5755. /* harmony import */ var _compatibilityTable__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.ts");
  5756. /* harmony import */ var _ast_commands___WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  5757. /* harmony import */ var _ast_commands_command__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./../ast/commands/command */ "./js/ast/commands/command.js");
  5758. /* harmony import */ var _ast_expressions___WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  5759. /* harmony import */ var _ast_expressions_expression__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./../ast/expressions/expression */ "./js/ast/expressions/expression.js");
  5760. /* harmony import */ var _util_utils__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./../util/utils */ "./js/util/utils.js");
  5761. /* harmony import */ var _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
  5762. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  5763. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../util/config */ "./js/util/config.ts");
  5764. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  5765. /* harmony import */ var _error_runtimeError__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./error/runtimeError */ "./js/processor/error/runtimeError.js");
  5766. /* harmony import */ var _memory_location__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../memory/location */ "./js/memory/location.ts");
  5767. /* harmony import */ var _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./store/value/store_value */ "./js/processor/store/value/store_value.ts");
  5768. /* harmony import */ var _store_value_store_value_ref__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./store/value/store_value_ref */ "./js/processor/store/value/store_value_ref.ts");
  5769. /* harmony import */ var _store_value_array_store_value__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./store/value/array_store_value */ "./js/processor/store/value/array_store_value.ts");
  5770. /* harmony import */ var _store_value_array_store_value_ref__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./store/value/array_store_value_ref */ "./js/processor/store/value/array_store_value_ref.ts");
  5771. /* harmony import */ var _store_value_store_value_address__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./store/value/store_value_address */ "./js/processor/store/value/store_value_address.ts");
  5772. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  5773. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  5774. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  5775. var IVProgProcessor = /*#__PURE__*/function () {
  5776. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4___default()(IVProgProcessor, null, [{
  5777. key: "MAIN_INTERNAL_ID",
  5778. get: function get() {
  5779. return "$main";
  5780. }
  5781. }]);
  5782. function IVProgProcessor(ast) {
  5783. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3___default()(this, IVProgProcessor);
  5784. this.ast = ast;
  5785. this.globalStore = new _store_store__WEBPACK_IMPORTED_MODULE_5__.Store("$global");
  5786. this.stores = [this.globalStore];
  5787. this.context = [_context__WEBPACK_IMPORTED_MODULE_7__.Context.BASE];
  5788. this.input = null;
  5789. this.forceKill = false;
  5790. this.output = null;
  5791. this.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RUN;
  5792. /**
  5793. * Stores the sourceInfo of every function call, command or expression
  5794. */
  5795. this.function_call_stack = [];
  5796. this.instruction_count = 0;
  5797. this.function_call_count = 0;
  5798. }
  5799. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4___default()(IVProgProcessor, [{
  5800. key: "registerInput",
  5801. value: function registerInput(input) {
  5802. if (this.input !== null) this.input = null;
  5803. this.input = input;
  5804. }
  5805. }, {
  5806. key: "registerOutput",
  5807. value: function registerOutput(output) {
  5808. if (this.output !== null) this.output = null;
  5809. this.output = output;
  5810. }
  5811. }, {
  5812. key: "checkContext",
  5813. value: function checkContext(context) {
  5814. return this.context[this.context.length - 1] === context;
  5815. }
  5816. }, {
  5817. key: "ignoreSwitchCases",
  5818. value: function ignoreSwitchCases(store) {
  5819. if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN) {
  5820. return true;
  5821. } else if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.BREAK) {
  5822. return true;
  5823. } else {
  5824. return false;
  5825. }
  5826. }
  5827. }, {
  5828. key: "prepareState",
  5829. value: function prepareState() {
  5830. if (this.stores !== null) {
  5831. for (var i = 0; i < this.stores.length; i++) {
  5832. delete this.stores[i];
  5833. }
  5834. this.stores = null;
  5835. }
  5836. if (this.globalStore !== null) this.globalStore = null;
  5837. this.globalStore = new _store_store__WEBPACK_IMPORTED_MODULE_5__.Store("$global");
  5838. this.stores = [this.globalStore];
  5839. this.context = [_context__WEBPACK_IMPORTED_MODULE_7__.Context.BASE];
  5840. this.instruction_count = 0;
  5841. this.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RUN;
  5842. }
  5843. }, {
  5844. key: "interpretAST",
  5845. value: function () {
  5846. var _interpretAST = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee() {
  5847. var mainFunc;
  5848. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee$(_context) {
  5849. while (1) {
  5850. switch (_context.prev = _context.next) {
  5851. case 0:
  5852. this.prepareState();
  5853. _memory_location__WEBPACK_IMPORTED_MODULE_22__.Location.clear();
  5854. _context.next = 4;
  5855. return this.initGlobal();
  5856. case 4:
  5857. mainFunc = this.findMainFunction();
  5858. if (!(mainFunc === null)) {
  5859. _context.next = 7;
  5860. break;
  5861. }
  5862. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.main_missing();
  5863. case 7:
  5864. return _context.abrupt("return", this.runFunction(mainFunc, [], this.globalStore));
  5865. case 8:
  5866. case "end":
  5867. return _context.stop();
  5868. }
  5869. }
  5870. }, _callee, this);
  5871. }));
  5872. function interpretAST() {
  5873. return _interpretAST.apply(this, arguments);
  5874. }
  5875. return interpretAST;
  5876. }()
  5877. }, {
  5878. key: "initGlobal",
  5879. value: function () {
  5880. var _initGlobal = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee2() {
  5881. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee2$(_context2) {
  5882. while (1) {
  5883. switch (_context2.prev = _context2.next) {
  5884. case 0:
  5885. if (this.checkContext(_context__WEBPACK_IMPORTED_MODULE_7__.Context.BASE)) {
  5886. _context2.next = 2;
  5887. break;
  5888. }
  5889. return _context2.abrupt("return", _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_global_var());
  5890. case 2:
  5891. return _context2.abrupt("return", this.executeCommands(this.globalStore, this.ast.global));
  5892. case 3:
  5893. case "end":
  5894. return _context2.stop();
  5895. }
  5896. }
  5897. }, _callee2, this);
  5898. }));
  5899. function initGlobal() {
  5900. return _initGlobal.apply(this, arguments);
  5901. }
  5902. return initGlobal;
  5903. }()
  5904. }, {
  5905. key: "findMainFunction",
  5906. value: function findMainFunction() {
  5907. return this.ast.functions.find(function (v) {
  5908. return v.isMain;
  5909. });
  5910. }
  5911. }, {
  5912. key: "findFunction",
  5913. value: function findFunction(name) {
  5914. if (name.match(/^\$.+$/)) {
  5915. if (name === IVProgProcessor.MAIN_INTERNAL_ID) {
  5916. return this.findMainFunction();
  5917. }
  5918. var fun = _definedFunctions__WEBPACK_IMPORTED_MODULE_10__.LanguageDefinedFunction.getFunction(name);
  5919. if (!fun) {
  5920. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.not_implemented(name);
  5921. }
  5922. return fun;
  5923. } else {
  5924. var val = this.ast.functions.find(function (v) {
  5925. return v.name === name;
  5926. });
  5927. if (!val) {
  5928. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.function_missing(name);
  5929. }
  5930. return val;
  5931. }
  5932. }
  5933. }, {
  5934. key: "runFunction",
  5935. value: function () {
  5936. var _runFunction = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee3(func, actualParameters, store) {
  5937. var funcName, funcStore, stoWithVars, finalSto;
  5938. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee3$(_context3) {
  5939. while (1) {
  5940. switch (_context3.prev = _context3.next) {
  5941. case 0:
  5942. funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
  5943. funcStore = new _store_store__WEBPACK_IMPORTED_MODULE_5__.Store(funcName);
  5944. funcStore.extendStore(this.globalStore);
  5945. _context3.next = 5;
  5946. return this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  5947. case 5:
  5948. this.context.push(_context__WEBPACK_IMPORTED_MODULE_7__.Context.FUNCTION);
  5949. this.stores.push(funcStore);
  5950. _context3.next = 9;
  5951. return this.executeCommands(funcStore, func.variablesDeclarations);
  5952. case 9:
  5953. stoWithVars = _context3.sent;
  5954. _context3.next = 12;
  5955. return this.executeCommands(stoWithVars, func.commands);
  5956. case 12:
  5957. finalSto = _context3.sent;
  5958. this.stores.pop();
  5959. this.context.pop();
  5960. return _context3.abrupt("return", finalSto);
  5961. case 16:
  5962. case "end":
  5963. return _context3.stop();
  5964. }
  5965. }
  5966. }, _callee3, this);
  5967. }));
  5968. function runFunction(_x, _x2, _x3) {
  5969. return _runFunction.apply(this, arguments);
  5970. }
  5971. return runFunction;
  5972. }()
  5973. /**
  5974. *
  5975. * @param {import('./../ast/commands/formalParameter').FormalParameter[]} formal_params
  5976. * @param {Expression[]} effective_params
  5977. * @param {Store} caller_store
  5978. * @param {Store} callee_store
  5979. */
  5980. }, {
  5981. key: "associateParameters",
  5982. value: function () {
  5983. var _associateParameters = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee4(formal_params, effective_params, caller_store, callee_store) {
  5984. var funcName, hasVariadic, i, j, formalParameter, _yield$this$associate, _yield$this$associate2, actualParam;
  5985. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee4$(_context4) {
  5986. while (1) {
  5987. switch (_context4.prev = _context4.next) {
  5988. case 0:
  5989. funcName = callee_store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_10__.LanguageDefinedFunction.getMainFunctionName() : callee_store.name;
  5990. hasVariadic = formal_params.some(function (p) {
  5991. return p.variadic;
  5992. });
  5993. if (!(formal_params.length != effective_params.length && !hasVariadic || formal_params.length > effective_params.length)) {
  5994. _context4.next = 4;
  5995. break;
  5996. }
  5997. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_parameters_size(funcName, formal_params.length, effective_params.length);
  5998. case 4:
  5999. i = 0, j = 0;
  6000. case 5:
  6001. if (!(i < formal_params.length && j < effective_params.length)) {
  6002. _context4.next = 23;
  6003. break;
  6004. }
  6005. formalParameter = formal_params[i];
  6006. if (!formalParameter.variadic) {
  6007. _context4.next = 16;
  6008. break;
  6009. }
  6010. _context4.next = 10;
  6011. return this.associateVariadicParameter(funcName, formalParameter, j, effective_params, caller_store, callee_store);
  6012. case 10:
  6013. _yield$this$associate = _context4.sent;
  6014. _yield$this$associate2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_yield$this$associate, 2);
  6015. j = _yield$this$associate2[0];
  6016. callee_store = _yield$this$associate2[1];
  6017. _context4.next = 20;
  6018. break;
  6019. case 16:
  6020. actualParam = effective_params[i];
  6021. _context4.next = 19;
  6022. return this.associateParameter(funcName, formalParameter, actualParam, caller_store, callee_store);
  6023. case 19:
  6024. callee_store = _context4.sent;
  6025. case 20:
  6026. i += 1, j += 1;
  6027. _context4.next = 5;
  6028. break;
  6029. case 23:
  6030. return _context4.abrupt("return", callee_store);
  6031. case 24:
  6032. case "end":
  6033. return _context4.stop();
  6034. }
  6035. }
  6036. }, _callee4, this);
  6037. }));
  6038. function associateParameters(_x4, _x5, _x6, _x7) {
  6039. return _associateParameters.apply(this, arguments);
  6040. }
  6041. return associateParameters;
  6042. }()
  6043. /**
  6044. *
  6045. * @param {string} funcName
  6046. * @param {import('./../ast/commands/formalParameter').FormalParameter} formalParameter
  6047. * @param {number} index
  6048. * @param {Expression[]} effective_params
  6049. * @param {Store} caller_store
  6050. * @param {Store} callee_store
  6051. */
  6052. }, {
  6053. key: "associateVariadicParameter",
  6054. value: function () {
  6055. var _associateVariadicParameter = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee5(funcName, formalParameter, index, effective_params, caller_store, callee_store) {
  6056. var i, count, actualParam, variadicCount;
  6057. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee5$(_context5) {
  6058. while (1) {
  6059. switch (_context5.prev = _context5.next) {
  6060. case 0:
  6061. count = 1;
  6062. i = index;
  6063. case 2:
  6064. if (!(i < effective_params.length)) {
  6065. _context5.next = 11;
  6066. break;
  6067. }
  6068. actualParam = effective_params[i];
  6069. _context5.next = 6;
  6070. return this.associateParameter(funcName, formalParameter, actualParam, caller_store, callee_store, count);
  6071. case 6:
  6072. callee_store = _context5.sent;
  6073. count += 1;
  6074. case 8:
  6075. i += 1;
  6076. _context5.next = 2;
  6077. break;
  6078. case 11:
  6079. variadicCount = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER, count, undefined, true);
  6080. callee_store.insertStore("".concat(formalParameter.id, ".0"), variadicCount);
  6081. return _context5.abrupt("return", [i - 1, callee_store]);
  6082. case 14:
  6083. case "end":
  6084. return _context5.stop();
  6085. }
  6086. }
  6087. }, _callee5, this);
  6088. }));
  6089. function associateVariadicParameter(_x8, _x9, _x10, _x11, _x12, _x13) {
  6090. return _associateVariadicParameter.apply(this, arguments);
  6091. }
  6092. return associateVariadicParameter;
  6093. }()
  6094. /**
  6095. *
  6096. * @param {string} funcName
  6097. * @param {import('./../ast/commands/formalParameter').FormalParameter} formalParameter
  6098. * @param {Expression} actualParameter
  6099. * @param {Store} callerStore
  6100. * @param {Store} calleeStore
  6101. * @param {number} variadicCount The number of the current value being assigned to the variadic parameter, default 0
  6102. */
  6103. }, {
  6104. key: "associateParameter",
  6105. value: function () {
  6106. var _associateParameter = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee6(funcName, formalParameter, actualParameter, callerStore, calleeStore) {
  6107. var variadicCount,
  6108. actualValue,
  6109. shouldTypeCast,
  6110. realObj,
  6111. ref,
  6112. values,
  6113. array_type,
  6114. addresses,
  6115. columns,
  6116. line,
  6117. column,
  6118. varID,
  6119. realValue,
  6120. _varID,
  6121. _args6 = arguments;
  6122. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee6$(_context6) {
  6123. while (1) {
  6124. switch (_context6.prev = _context6.next) {
  6125. case 0:
  6126. variadicCount = _args6.length > 5 && _args6[5] !== undefined ? _args6[5] : 0;
  6127. _context6.next = 3;
  6128. return this.evaluateExpression(callerStore, actualParameter);
  6129. case 3:
  6130. actualValue = _context6.sent;
  6131. shouldTypeCast = false;
  6132. if (formalParameter.type.isCompatible(actualValue.type)) {
  6133. _context6.next = 11;
  6134. break;
  6135. }
  6136. if (!(_util_config__WEBPACK_IMPORTED_MODULE_19__.Config.enable_type_casting && !formalParameter.byRef && _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.canImplicitTypeCast(formalParameter.type, actualValue.type))) {
  6137. _context6.next = 10;
  6138. break;
  6139. }
  6140. shouldTypeCast = true;
  6141. _context6.next = 11;
  6142. break;
  6143. case 10:
  6144. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_parameter_type(funcName, actualParameter.toString());
  6145. case 11:
  6146. if (!(formalParameter.byRef && !actualValue.inStore())) {
  6147. _context6.next = 13;
  6148. break;
  6149. }
  6150. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_ref(funcName, actualParameter.toString());
  6151. case 13:
  6152. if (formalParameter.byRef) {
  6153. realObj = callerStore.getStoreObject(actualValue.id);
  6154. ref = null;
  6155. if (actualValue instanceof _store_value_array_store_value__WEBPACK_IMPORTED_MODULE_25__.ArrayStoreValue) {
  6156. // it's a vector or matrix...
  6157. values = actualValue.get();
  6158. array_type = actualValue.type;
  6159. addresses = values.map(function (v) {
  6160. return realObj.getLocAddressOf(v.line, v.column);
  6161. });
  6162. columns = actualValue.isVector() ? 0 : actualValue.columns;
  6163. ref = new _store_value_array_store_value_ref__WEBPACK_IMPORTED_MODULE_26__.ArrayStoreValueRef(array_type, values, addresses, actualValue.lines, columns, realObj.id);
  6164. } else {
  6165. if (actualValue instanceof _store_value_store_value_address__WEBPACK_IMPORTED_MODULE_27__.StoreValueAddress) {
  6166. line = actualValue.line;
  6167. column = actualValue.column;
  6168. ref = new _store_value_store_value_ref__WEBPACK_IMPORTED_MODULE_24__.StoreValueRef(actualValue.type, actualValue.get(), realObj.getLocAddressOf(line, column), realObj.id);
  6169. ref.setReferenceDimension(realObj.type.dimensions);
  6170. } else {
  6171. ref = new _store_value_store_value_ref__WEBPACK_IMPORTED_MODULE_24__.StoreValueRef(actualValue.type, actualValue.get(), realObj.locAddress, realObj.id);
  6172. }
  6173. }
  6174. varID = formalParameter.id;
  6175. if (formalParameter.variadic) varID = "".concat(varID, ".").concat(variadicCount);
  6176. calleeStore.insertStore(varID, ref);
  6177. } else {
  6178. realValue = actualValue;
  6179. if (shouldTypeCast) {
  6180. realValue = _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.doImplicitCasting(formalParameter.type, realValue);
  6181. }
  6182. _varID = formalParameter.id;
  6183. if (formalParameter.variadic) _varID = "".concat(_varID, ".").concat(variadicCount);
  6184. calleeStore.insertStore(_varID, realValue);
  6185. }
  6186. return _context6.abrupt("return", calleeStore);
  6187. case 15:
  6188. case "end":
  6189. return _context6.stop();
  6190. }
  6191. }
  6192. }, _callee6, this);
  6193. }));
  6194. function associateParameter(_x14, _x15, _x16, _x17, _x18) {
  6195. return _associateParameter.apply(this, arguments);
  6196. }
  6197. return associateParameter;
  6198. }()
  6199. /**
  6200. *
  6201. * @param {Store} store
  6202. * @param {Command[]} cmds
  6203. *
  6204. * @returns {Promise<Store>}
  6205. */
  6206. }, {
  6207. key: "executeCommands",
  6208. value: function () {
  6209. var _executeCommands = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee7(store, cmds) {
  6210. var sto, i;
  6211. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee7$(_context7) {
  6212. while (1) {
  6213. switch (_context7.prev = _context7.next) {
  6214. case 0:
  6215. // helper to partially apply a function, in this case executeCommand
  6216. sto = store;
  6217. i = 0;
  6218. case 2:
  6219. if (!(i < cmds.length)) {
  6220. _context7.next = 9;
  6221. break;
  6222. }
  6223. _context7.next = 5;
  6224. return this.executeCommand(sto, cmds[i]);
  6225. case 5:
  6226. sto = _context7.sent;
  6227. case 6:
  6228. i += 1;
  6229. _context7.next = 2;
  6230. break;
  6231. case 9:
  6232. return _context7.abrupt("return", sto);
  6233. case 10:
  6234. case "end":
  6235. return _context7.stop();
  6236. }
  6237. }
  6238. }, _callee7, this);
  6239. }));
  6240. function executeCommands(_x19, _x20) {
  6241. return _executeCommands.apply(this, arguments);
  6242. }
  6243. return executeCommands;
  6244. }()
  6245. /**
  6246. *
  6247. * @param {Store} store
  6248. * @param {Command} cmd
  6249. *
  6250. * @returns {Promise<Store>}
  6251. */
  6252. }, {
  6253. key: "executeCommand",
  6254. value: function () {
  6255. var _executeCommand = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee8(store, cmd) {
  6256. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee8$(_context8) {
  6257. while (1) {
  6258. switch (_context8.prev = _context8.next) {
  6259. case 0:
  6260. this.instruction_count += 1;
  6261. if (!(this.instruction_count % _util_config__WEBPACK_IMPORTED_MODULE_19__.Config.suspend_threshold == 0)) {
  6262. _context8.next = 4;
  6263. break;
  6264. }
  6265. _context8.next = 4;
  6266. return _util_utils__WEBPACK_IMPORTED_MODULE_16__.sleep(3);
  6267. case 4:
  6268. if (!(this.instruction_count >= _util_config__WEBPACK_IMPORTED_MODULE_19__.Config.max_instruction_count)) {
  6269. _context8.next = 8;
  6270. break;
  6271. }
  6272. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.exceed_max_instructions();
  6273. case 8:
  6274. if (!this.forceKill) {
  6275. _context8.next = 12;
  6276. break;
  6277. }
  6278. throw "FORCED_KILL!";
  6279. case 12:
  6280. if (!(store.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.PAUSE)) {
  6281. _context8.next = 16;
  6282. break;
  6283. }
  6284. return _context8.abrupt("return", this.executeCommand(store, cmd));
  6285. case 16:
  6286. if (!(store.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN)) {
  6287. _context8.next = 20;
  6288. break;
  6289. }
  6290. return _context8.abrupt("return", store);
  6291. case 20:
  6292. if (!(this.checkContext(_context__WEBPACK_IMPORTED_MODULE_7__.Context.BREAKABLE) && store.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.BREAK)) {
  6293. _context8.next = 24;
  6294. break;
  6295. }
  6296. return _context8.abrupt("return", store);
  6297. case 24:
  6298. if (!(this.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.ABORT)) {
  6299. _context8.next = 26;
  6300. break;
  6301. }
  6302. throw _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_28__.LocalizedStrings.getMessage("aborted_execution");
  6303. case 26:
  6304. if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.Declaration)) {
  6305. _context8.next = 30;
  6306. break;
  6307. }
  6308. return _context8.abrupt("return", this.executeDeclaration(store, cmd));
  6309. case 30:
  6310. if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.ArrayIndexAssign)) {
  6311. _context8.next = 34;
  6312. break;
  6313. }
  6314. return _context8.abrupt("return", this.executeArrayIndexAssign(store, cmd));
  6315. case 34:
  6316. if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.Assign)) {
  6317. _context8.next = 38;
  6318. break;
  6319. }
  6320. return _context8.abrupt("return", this.executeAssign(store, cmd));
  6321. case 38:
  6322. if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.Break)) {
  6323. _context8.next = 42;
  6324. break;
  6325. }
  6326. return _context8.abrupt("return", this.executeBreak(store, cmd));
  6327. case 42:
  6328. if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.Return)) {
  6329. _context8.next = 46;
  6330. break;
  6331. }
  6332. return _context8.abrupt("return", this.executeReturn(store, cmd));
  6333. case 46:
  6334. if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.IfThenElse)) {
  6335. _context8.next = 50;
  6336. break;
  6337. }
  6338. return _context8.abrupt("return", this.executeIfThenElse(store, cmd));
  6339. case 50:
  6340. if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.RepeatUntil)) {
  6341. _context8.next = 54;
  6342. break;
  6343. }
  6344. return _context8.abrupt("return", this.executeRepeatUntil(store, cmd));
  6345. case 54:
  6346. if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.While)) {
  6347. _context8.next = 58;
  6348. break;
  6349. }
  6350. return _context8.abrupt("return", this.executeWhile(store, cmd));
  6351. case 58:
  6352. if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.For)) {
  6353. _context8.next = 62;
  6354. break;
  6355. }
  6356. return _context8.abrupt("return", this.executeFor(store, cmd));
  6357. case 62:
  6358. if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.Switch)) {
  6359. _context8.next = 66;
  6360. break;
  6361. }
  6362. return _context8.abrupt("return", this.executeSwitch(store, cmd));
  6363. case 66:
  6364. if (!(cmd instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.FunctionCall)) {
  6365. _context8.next = 70;
  6366. break;
  6367. }
  6368. return _context8.abrupt("return", this.executeFunctionCall(store, cmd));
  6369. case 70:
  6370. if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.SysCall)) {
  6371. _context8.next = 74;
  6372. break;
  6373. }
  6374. return _context8.abrupt("return", this.executeSysCall(store, cmd));
  6375. case 74:
  6376. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.unknown_command(cmd.sourceInfo);
  6377. case 75:
  6378. case "end":
  6379. return _context8.stop();
  6380. }
  6381. }
  6382. }, _callee8, this);
  6383. }));
  6384. function executeCommand(_x21, _x22) {
  6385. return _executeCommand.apply(this, arguments);
  6386. }
  6387. return executeCommand;
  6388. }()
  6389. /**
  6390. *
  6391. * @param {Store} store
  6392. * @param {Commands.SysCall} cmd
  6393. *
  6394. * @returns {Promise<Store>}
  6395. */
  6396. }, {
  6397. key: "executeSysCall",
  6398. value: function () {
  6399. var _executeSysCall = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee9(store, cmd) {
  6400. var func;
  6401. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee9$(_context9) {
  6402. while (1) {
  6403. switch (_context9.prev = _context9.next) {
  6404. case 0:
  6405. func = cmd.langFunc.bind(this);
  6406. return _context9.abrupt("return", func(store, cmd));
  6407. case 2:
  6408. case "end":
  6409. return _context9.stop();
  6410. }
  6411. }
  6412. }, _callee9, this);
  6413. }));
  6414. function executeSysCall(_x23, _x24) {
  6415. return _executeSysCall.apply(this, arguments);
  6416. }
  6417. return executeSysCall;
  6418. }()
  6419. /**
  6420. *
  6421. * @param {Store} store
  6422. * @param {Commands.FunctionCall} cmd
  6423. *
  6424. * @returns {Promise<Store>}
  6425. */
  6426. }, {
  6427. key: "executeFunctionCall",
  6428. value: function () {
  6429. var _executeFunctionCall = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee10(store, cmd) {
  6430. var func, sto, funcName;
  6431. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee10$(_context10) {
  6432. while (1) {
  6433. switch (_context10.prev = _context10.next) {
  6434. case 0:
  6435. func = null;
  6436. if (cmd.isMainCall) {
  6437. func = this.findMainFunction();
  6438. } else {
  6439. func = this.findFunction(cmd.id);
  6440. }
  6441. this.function_call_stack.push(cmd.sourceInfo);
  6442. _context10.next = 5;
  6443. return this.runFunction(func, cmd.actualParameters, store);
  6444. case 5:
  6445. sto = _context10.sent;
  6446. sto.destroy();
  6447. if (!(!_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.VOID.isCompatible(func.returnType) && sto.mode !== _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN)) {
  6448. _context10.next = 12;
  6449. break;
  6450. }
  6451. funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_10__.LanguageDefinedFunction.getMainFunctionName() : func.name;
  6452. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.function_no_return(funcName);
  6453. case 12:
  6454. this.function_call_stack.pop();
  6455. return _context10.abrupt("return", store);
  6456. case 14:
  6457. case "end":
  6458. return _context10.stop();
  6459. }
  6460. }
  6461. }, _callee10, this);
  6462. }));
  6463. function executeFunctionCall(_x25, _x26) {
  6464. return _executeFunctionCall.apply(this, arguments);
  6465. }
  6466. return executeFunctionCall;
  6467. }()
  6468. /**
  6469. *
  6470. * @param {Store} store
  6471. * @param {Commands.Switch} cmd
  6472. *
  6473. * @returns {Promise<Store>}
  6474. */
  6475. }, {
  6476. key: "executeSwitch",
  6477. value: function () {
  6478. var _executeSwitch = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee11(store, cmd) {
  6479. var switchCases, lastStore, lastCaseCheckResult, i, switchCase, equalityInfixApp, result;
  6480. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee11$(_context11) {
  6481. while (1) {
  6482. switch (_context11.prev = _context11.next) {
  6483. case 0:
  6484. this.context.push(_context__WEBPACK_IMPORTED_MODULE_7__.Context.BREAKABLE);
  6485. switchCases = cmd.cases;
  6486. lastStore = store;
  6487. lastCaseCheckResult = false;
  6488. i = 0;
  6489. case 5:
  6490. if (!(i < switchCases.length && !this.ignoreSwitchCases(lastStore))) {
  6491. _context11.next = 26;
  6492. break;
  6493. }
  6494. switchCase = switchCases[i];
  6495. if (!(lastCaseCheckResult || switchCase.isDefault)) {
  6496. _context11.next = 13;
  6497. break;
  6498. }
  6499. _context11.next = 10;
  6500. return this.executeCommands(lastStore, switchCase.commands);
  6501. case 10:
  6502. lastStore = _context11.sent;
  6503. _context11.next = 23;
  6504. break;
  6505. case 13:
  6506. equalityInfixApp = new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.InfixApp(_ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.EQ, cmd.expression, switchCase.expression);
  6507. equalityInfixApp.sourceInfo = switchCase.sourceInfo;
  6508. _context11.next = 17;
  6509. return this.evaluateExpression(lastStore, equalityInfixApp);
  6510. case 17:
  6511. result = _context11.sent;
  6512. if (!result.get()) {
  6513. _context11.next = 22;
  6514. break;
  6515. }
  6516. _context11.next = 21;
  6517. return this.executeCommands(lastStore, switchCase.commands);
  6518. case 21:
  6519. lastStore = _context11.sent;
  6520. case 22:
  6521. lastCaseCheckResult = result.get();
  6522. case 23:
  6523. i += 1;
  6524. _context11.next = 5;
  6525. break;
  6526. case 26:
  6527. this.context.pop();
  6528. if (lastStore.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.BREAK) {
  6529. lastStore.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RUN;
  6530. }
  6531. return _context11.abrupt("return", lastStore);
  6532. case 29:
  6533. case "end":
  6534. return _context11.stop();
  6535. }
  6536. }
  6537. }, _callee11, this);
  6538. }));
  6539. function executeSwitch(_x27, _x28) {
  6540. return _executeSwitch.apply(this, arguments);
  6541. }
  6542. return executeSwitch;
  6543. }()
  6544. /**
  6545. *
  6546. * @param {Store} store
  6547. * @param {Commands.For} cmd
  6548. *
  6549. * @returns {Promise<Store>}
  6550. */
  6551. }, {
  6552. key: "executeFor",
  6553. value: function () {
  6554. var _executeFor = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee12(store, cmd) {
  6555. var initCmd, passValue, condition, checkEndGTBegin, isForward, increment, whileBlock, forAsWhile, newCmdList;
  6556. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee12$(_context12) {
  6557. while (1) {
  6558. switch (_context12.prev = _context12.next) {
  6559. case 0:
  6560. //BEGIN for -> while rewrite
  6561. initCmd = new _ast_commands___WEBPACK_IMPORTED_MODULE_12__.Assign(cmd.for_id.id, cmd.for_from);
  6562. initCmd.sourceInfo = cmd.sourceInfo; // Assume for is iterating forward and that pass is not missing
  6563. passValue = cmd.for_pass;
  6564. condition = new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.InfixApp(_ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.LT, cmd.for_id, cmd.for_to);
  6565. if (!(cmd.for_pass == null)) {
  6566. _context12.next = 12;
  6567. break;
  6568. }
  6569. passValue = new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.IntLiteral((0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_18__.toInt)(1));
  6570. _context12.next = 8;
  6571. return this.evaluateExpression(store, new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.InfixApp(_ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.GE, cmd.for_to, cmd.for_from));
  6572. case 8:
  6573. checkEndGTBegin = _context12.sent;
  6574. if (!checkEndGTBegin.get()) {
  6575. passValue = new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.IntLiteral((0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_18__.toInt)(-1));
  6576. condition = new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.InfixApp(_ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.GT, cmd.for_id, cmd.for_to);
  6577. }
  6578. _context12.next = 16;
  6579. break;
  6580. case 12:
  6581. _context12.next = 14;
  6582. return this.evaluateExpression(store, new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.InfixApp(_ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.GE, cmd.for_pass, new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.IntLiteral((0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_18__.toInt)(0))));
  6583. case 14:
  6584. isForward = _context12.sent;
  6585. if (!isForward.get()) {
  6586. condition = new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.InfixApp(_ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.GT, cmd.for_id, cmd.for_to);
  6587. }
  6588. case 16:
  6589. condition.sourceInfo = cmd.sourceInfo;
  6590. increment = new _ast_commands___WEBPACK_IMPORTED_MODULE_12__.Assign(cmd.for_id.id, new _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.InfixApp(_ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.ADD, cmd.for_id, passValue));
  6591. increment.sourceInfo = cmd.sourceInfo;
  6592. whileBlock = new _ast_commands___WEBPACK_IMPORTED_MODULE_12__.CommandBlock([], cmd.commands.concat(increment));
  6593. forAsWhile = new _ast_commands___WEBPACK_IMPORTED_MODULE_12__.While(condition, whileBlock);
  6594. forAsWhile.sourceInfo = cmd.sourceInfo; //END for -> while rewrite
  6595. newCmdList = [initCmd, forAsWhile];
  6596. return _context12.abrupt("return", this.executeCommands(store, newCmdList));
  6597. case 24:
  6598. case "end":
  6599. return _context12.stop();
  6600. }
  6601. }
  6602. }, _callee12, this);
  6603. }));
  6604. function executeFor(_x29, _x30) {
  6605. return _executeFor.apply(this, arguments);
  6606. }
  6607. return executeFor;
  6608. }()
  6609. /**
  6610. *
  6611. * @param {Store} store
  6612. * @param {Commands.RepeatUntil} cmd
  6613. *
  6614. * @returns {Promise<Store>}
  6615. */
  6616. }, {
  6617. key: "executeRepeatUntil",
  6618. value: function () {
  6619. var _executeRepeatUntil = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee13(store, cmd) {
  6620. var sto, checkCondition;
  6621. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee13$(_context13) {
  6622. while (1) {
  6623. switch (_context13.prev = _context13.next) {
  6624. case 0:
  6625. this.context.push(_context__WEBPACK_IMPORTED_MODULE_7__.Context.BREAKABLE);
  6626. _context13.next = 3;
  6627. return this.executeCommands(store, cmd.commands);
  6628. case 3:
  6629. sto = _context13.sent;
  6630. if (!(sto.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.BREAK)) {
  6631. _context13.next = 8;
  6632. break;
  6633. }
  6634. this.context.pop();
  6635. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RUN;
  6636. return _context13.abrupt("return", sto);
  6637. case 8:
  6638. _context13.next = 10;
  6639. return this.evaluateExpression(sto, cmd.expression);
  6640. case 10:
  6641. checkCondition = _context13.sent;
  6642. if (checkCondition.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN)) {
  6643. _context13.next = 13;
  6644. break;
  6645. }
  6646. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo);
  6647. case 13:
  6648. this.context.pop();
  6649. if (!checkCondition.get()) {
  6650. _context13.next = 18;
  6651. break;
  6652. }
  6653. return _context13.abrupt("return", sto);
  6654. case 18:
  6655. return _context13.abrupt("return", this.executeCommand(sto, cmd));
  6656. case 19:
  6657. case "end":
  6658. return _context13.stop();
  6659. }
  6660. }
  6661. }, _callee13, this);
  6662. }));
  6663. function executeRepeatUntil(_x31, _x32) {
  6664. return _executeRepeatUntil.apply(this, arguments);
  6665. }
  6666. return executeRepeatUntil;
  6667. }()
  6668. /**
  6669. *
  6670. * @param {Store} store
  6671. * @param {Commands.While} cmd
  6672. *
  6673. * @returns {Promise<Store>}
  6674. */
  6675. }, {
  6676. key: "executeWhile",
  6677. value: function () {
  6678. var _executeWhile = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee14(store, cmd) {
  6679. var checkCondition, sto;
  6680. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee14$(_context14) {
  6681. while (1) {
  6682. switch (_context14.prev = _context14.next) {
  6683. case 0:
  6684. this.context.push(_context__WEBPACK_IMPORTED_MODULE_7__.Context.BREAKABLE);
  6685. _context14.next = 3;
  6686. return this.evaluateExpression(store, cmd.expression);
  6687. case 3:
  6688. checkCondition = _context14.sent;
  6689. if (checkCondition.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN)) {
  6690. _context14.next = 6;
  6691. break;
  6692. }
  6693. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.loop_condition_type_full(cmd.expression.toString(), cmd.sourceInfo);
  6694. case 6:
  6695. if (!checkCondition.get()) {
  6696. _context14.next = 17;
  6697. break;
  6698. }
  6699. _context14.next = 9;
  6700. return this.executeCommands(store, cmd.commands);
  6701. case 9:
  6702. sto = _context14.sent;
  6703. this.context.pop();
  6704. if (!(sto.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.BREAK)) {
  6705. _context14.next = 14;
  6706. break;
  6707. }
  6708. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RUN;
  6709. return _context14.abrupt("return", sto);
  6710. case 14:
  6711. return _context14.abrupt("return", this.executeCommand(sto, cmd));
  6712. case 17:
  6713. this.context.pop();
  6714. return _context14.abrupt("return", store);
  6715. case 19:
  6716. case "end":
  6717. return _context14.stop();
  6718. }
  6719. }
  6720. }, _callee14, this);
  6721. }));
  6722. function executeWhile(_x33, _x34) {
  6723. return _executeWhile.apply(this, arguments);
  6724. }
  6725. return executeWhile;
  6726. }()
  6727. /**
  6728. *
  6729. * @param {Store} store
  6730. * @param {Commands.IfThenElse} cmd
  6731. *
  6732. * @returns {Promise<Store>}
  6733. */
  6734. }, {
  6735. key: "executeIfThenElse",
  6736. value: function () {
  6737. var _executeIfThenElse = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee15(store, cmd) {
  6738. var isTrue;
  6739. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee15$(_context15) {
  6740. while (1) {
  6741. switch (_context15.prev = _context15.next) {
  6742. case 0:
  6743. _context15.next = 2;
  6744. return this.evaluateExpression(store, cmd.condition);
  6745. case 2:
  6746. isTrue = _context15.sent;
  6747. if (isTrue.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN)) {
  6748. _context15.next = 5;
  6749. break;
  6750. }
  6751. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.if_condition_type_full(cmd.condition.toString(), cmd.sourceInfo);
  6752. case 5:
  6753. if (!isTrue.get()) {
  6754. _context15.next = 9;
  6755. break;
  6756. }
  6757. return _context15.abrupt("return", this.executeCommands(store, cmd.ifTrue.commands));
  6758. case 9:
  6759. if (!(cmd.ifFalse !== null)) {
  6760. _context15.next = 17;
  6761. break;
  6762. }
  6763. if (!(cmd.ifFalse instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.IfThenElse)) {
  6764. _context15.next = 14;
  6765. break;
  6766. }
  6767. return _context15.abrupt("return", this.executeCommand(store, cmd.ifFalse));
  6768. case 14:
  6769. return _context15.abrupt("return", this.executeCommands(store, cmd.ifFalse.commands));
  6770. case 15:
  6771. _context15.next = 18;
  6772. break;
  6773. case 17:
  6774. return _context15.abrupt("return", store);
  6775. case 18:
  6776. case "end":
  6777. return _context15.stop();
  6778. }
  6779. }
  6780. }, _callee15, this);
  6781. }));
  6782. function executeIfThenElse(_x35, _x36) {
  6783. return _executeIfThenElse.apply(this, arguments);
  6784. }
  6785. return executeIfThenElse;
  6786. }()
  6787. /**
  6788. *
  6789. * @param {Store} store
  6790. * @param {Commands.Return} cmd
  6791. *
  6792. * @returns {Promise<Store>}
  6793. */
  6794. }, {
  6795. key: "executeReturn",
  6796. value: function () {
  6797. var _executeReturn = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee16(store, cmd) {
  6798. var funcName, func, funcType, value, real_value, stringInfo, info;
  6799. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee16$(_context16) {
  6800. while (1) {
  6801. switch (_context16.prev = _context16.next) {
  6802. case 0:
  6803. funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_10__.LanguageDefinedFunction.getMainFunctionName() : store.name; // console.log(funcName, store.name === IVProgProcessor.MAIN_INTERNAL_ID);
  6804. func = this.findFunction(store.name);
  6805. funcType = func.returnType;
  6806. _context16.next = 5;
  6807. return this.evaluateExpression(store, cmd.expression);
  6808. case 5:
  6809. value = _context16.sent;
  6810. if (!(value === null && funcType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.VOID))) {
  6811. _context16.next = 9;
  6812. break;
  6813. }
  6814. store.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN;
  6815. return _context16.abrupt("return", store);
  6816. case 9:
  6817. real_value = value;
  6818. if (!(value === null || !funcType.isCompatible(value.type))) {
  6819. _context16.next = 16;
  6820. break;
  6821. }
  6822. if (!(!_util_config__WEBPACK_IMPORTED_MODULE_19__.Config.enable_type_casting || !_store_store__WEBPACK_IMPORTED_MODULE_5__.Store.canImplicitTypeCast(funcType, value.type))) {
  6823. _context16.next = 15;
  6824. break;
  6825. }
  6826. stringInfo = funcType.stringInfo();
  6827. info = stringInfo[0];
  6828. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo);
  6829. case 15:
  6830. real_value = _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.doImplicitCasting(funcType, value);
  6831. case 16:
  6832. store.insertStore("$", real_value);
  6833. store.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN;
  6834. return _context16.abrupt("return", store);
  6835. case 19:
  6836. case "end":
  6837. return _context16.stop();
  6838. }
  6839. }
  6840. }, _callee16, this);
  6841. }));
  6842. function executeReturn(_x37, _x38) {
  6843. return _executeReturn.apply(this, arguments);
  6844. }
  6845. return executeReturn;
  6846. }()
  6847. /**
  6848. *
  6849. * @param {Store} store
  6850. * @param {Commands.Break} cmd
  6851. *
  6852. * @returns {Promise<Store>}
  6853. */
  6854. }, {
  6855. key: "executeBreak",
  6856. value: function () {
  6857. var _executeBreak = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee17(store, cmd) {
  6858. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee17$(_context17) {
  6859. while (1) {
  6860. switch (_context17.prev = _context17.next) {
  6861. case 0:
  6862. if (!this.checkContext(_context__WEBPACK_IMPORTED_MODULE_7__.Context.BREAKABLE)) {
  6863. _context17.next = 5;
  6864. break;
  6865. }
  6866. store.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.BREAK;
  6867. return _context17.abrupt("return", store);
  6868. case 5:
  6869. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.unexpected_break_command_full(cmd.sourceInfo);
  6870. case 6:
  6871. case "end":
  6872. return _context17.stop();
  6873. }
  6874. }
  6875. }, _callee17, this);
  6876. }));
  6877. function executeBreak(_x39, _x40) {
  6878. return _executeBreak.apply(this, arguments);
  6879. }
  6880. return executeBreak;
  6881. }()
  6882. /**
  6883. *
  6884. * @param {Store} store
  6885. * @param {Commands.Assign} cmd
  6886. *
  6887. * @returns {Promise<Store>}
  6888. */
  6889. }, {
  6890. key: "executeAssign",
  6891. value: function () {
  6892. var _executeAssign = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee18(store, cmd) {
  6893. var inStore, value, realValue, stringInfo, info, exp_type_string_info, exp_type_info, exp, columns, _exp;
  6894. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee18$(_context18) {
  6895. while (1) {
  6896. switch (_context18.prev = _context18.next) {
  6897. case 0:
  6898. inStore = store.applyStore(cmd.id);
  6899. if (!inStore.isConst) {
  6900. _context18.next = 3;
  6901. break;
  6902. }
  6903. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_const_assignment_full(cmd.id, cmd.sourceInfo);
  6904. case 3:
  6905. _context18.next = 5;
  6906. return this.evaluateExpression(store, cmd.expression);
  6907. case 5:
  6908. value = _context18.sent;
  6909. realValue = value;
  6910. if (inStore.type.isCompatible(realValue.type)) {
  6911. _context18.next = 18;
  6912. break;
  6913. }
  6914. if (!(_util_config__WEBPACK_IMPORTED_MODULE_19__.Config.enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.canImplicitTypeCast(inStore.type, value.type))) {
  6915. _context18.next = 12;
  6916. break;
  6917. }
  6918. realValue = _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.doImplicitCasting(inStore.type, realValue);
  6919. _context18.next = 18;
  6920. break;
  6921. case 12:
  6922. stringInfo = inStore.type.stringInfo();
  6923. info = stringInfo[0];
  6924. exp_type_string_info = value.type.stringInfo();
  6925. exp_type_info = exp_type_string_info[0];
  6926. exp = cmd.expression.toString();
  6927. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, exp_type_info.type, exp_type_info.dim, exp, cmd.sourceInfo);
  6928. case 18:
  6929. if (!(inStore instanceof _store_value_array_store_value__WEBPACK_IMPORTED_MODULE_25__.ArrayStoreValue)) {
  6930. _context18.next = 27;
  6931. break;
  6932. }
  6933. columns = realValue.columns == null ? 0 : realValue.columns;
  6934. if (!(inStore.lines !== realValue.lines || inStore.columns !== columns)) {
  6935. _context18.next = 27;
  6936. break;
  6937. }
  6938. _exp = cmd.expression.toString();
  6939. if (!inStore.isVector()) {
  6940. _context18.next = 26;
  6941. break;
  6942. }
  6943. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_vector_assignment_full(cmd.id, inStore.lines, _exp, realValue.lines, cmd.sourceInfo);
  6944. case 26:
  6945. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_matrix_assignment_full(cmd.id, inStore.lines, inStore.columns, _exp, realValue.lines, realValue.columns, cmd.sourceInfo);
  6946. case 27:
  6947. store.updateStore(cmd.id, realValue);
  6948. return _context18.abrupt("return", store);
  6949. case 29:
  6950. case "end":
  6951. return _context18.stop();
  6952. }
  6953. }
  6954. }, _callee18, this);
  6955. }));
  6956. function executeAssign(_x41, _x42) {
  6957. return _executeAssign.apply(this, arguments);
  6958. }
  6959. return executeAssign;
  6960. }()
  6961. /**
  6962. *
  6963. * @param {Store} store
  6964. * @param {Commands.ArrayIndexAssign} cmd
  6965. *
  6966. * @returns {Promise<Store>}
  6967. */
  6968. }, {
  6969. key: "executeArrayIndexAssign",
  6970. value: function () {
  6971. var _executeArrayIndexAssign = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee19(store, cmd) {
  6972. var mustBeArray, used_dims, lineSV, line, columnSV, column, value, actualValue, type, stringInfo, info, exp_type_string_info, exp_type_info, exp, current_value, _exp2;
  6973. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee19$(_context19) {
  6974. while (1) {
  6975. switch (_context19.prev = _context19.next) {
  6976. case 0:
  6977. mustBeArray = store.applyStore(cmd.id);
  6978. used_dims = 0;
  6979. if (!mustBeArray.isConst) {
  6980. _context19.next = 4;
  6981. break;
  6982. }
  6983. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_const_assignment_full(cmd.id, cmd.sourceInfo);
  6984. case 4:
  6985. if (mustBeArray.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_17__.ArrayType) {
  6986. _context19.next = 6;
  6987. break;
  6988. }
  6989. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo);
  6990. case 6:
  6991. _context19.next = 8;
  6992. return this.evaluateExpression(store, cmd.line);
  6993. case 8:
  6994. lineSV = _context19.sent;
  6995. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(lineSV.type)) {
  6996. _context19.next = 11;
  6997. break;
  6998. }
  6999. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  7000. case 11:
  7001. used_dims += 1;
  7002. line = lineSV.get().toNumber();
  7003. _context19.next = 15;
  7004. return this.evaluateExpression(store, cmd.column);
  7005. case 15:
  7006. columnSV = _context19.sent;
  7007. column = null;
  7008. if (!(columnSV != null)) {
  7009. _context19.next = 22;
  7010. break;
  7011. }
  7012. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(columnSV.type)) {
  7013. _context19.next = 20;
  7014. break;
  7015. }
  7016. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  7017. case 20:
  7018. column = columnSV.get().toNumber();
  7019. used_dims += 1;
  7020. case 22:
  7021. _context19.next = 24;
  7022. return this.evaluateExpression(store, cmd.expression);
  7023. case 24:
  7024. value = _context19.sent;
  7025. actualValue = value;
  7026. if (!(line >= mustBeArray.lines)) {
  7027. _context19.next = 34;
  7028. break;
  7029. }
  7030. if (!mustBeArray.isVector) {
  7031. _context19.next = 31;
  7032. break;
  7033. }
  7034. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo);
  7035. case 31:
  7036. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo);
  7037. case 32:
  7038. _context19.next = 36;
  7039. break;
  7040. case 34:
  7041. if (!(line < 0)) {
  7042. _context19.next = 36;
  7043. break;
  7044. }
  7045. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7046. case 36:
  7047. if (!(column != null && mustBeArray.columns === 0)) {
  7048. _context19.next = 38;
  7049. break;
  7050. }
  7051. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.vector_not_matrix_full(cmd.id, cmd.sourceInfo);
  7052. case 38:
  7053. if (!(column != null)) {
  7054. _context19.next = 45;
  7055. break;
  7056. }
  7057. if (!(column >= mustBeArray.columns)) {
  7058. _context19.next = 43;
  7059. break;
  7060. }
  7061. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.matrix_column_outbounds_full(cmd.id, column, mustBeArray.columns, cmd.sourceInfo);
  7062. case 43:
  7063. if (!(column < 0)) {
  7064. _context19.next = 45;
  7065. break;
  7066. }
  7067. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7068. case 45:
  7069. if (mustBeArray.type.canAccept(value.type, used_dims)) {
  7070. _context19.next = 55;
  7071. break;
  7072. }
  7073. if (!(!_util_config__WEBPACK_IMPORTED_MODULE_19__.Config.enable_type_casting || !_store_store__WEBPACK_IMPORTED_MODULE_5__.Store.canImplicitTypeCast(mustBeArray.type.innerType, value.type))) {
  7074. _context19.next = 54;
  7075. break;
  7076. }
  7077. type = mustBeArray.type.innerType;
  7078. stringInfo = type.stringInfo();
  7079. info = stringInfo[0];
  7080. exp_type_string_info = value.type.stringInfo();
  7081. exp_type_info = exp_type_string_info[0];
  7082. exp = cmd.expression.toString();
  7083. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, exp_type_info.type, exp_type_info.dim, exp, cmd.sourceInfo);
  7084. case 54:
  7085. actualValue = _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.doImplicitCasting(mustBeArray.type.innerType, value);
  7086. case 55:
  7087. current_value = mustBeArray.getAt(line, column);
  7088. if (!(current_value instanceof _store_value_array_store_value__WEBPACK_IMPORTED_MODULE_25__.ArrayStoreValue)) {
  7089. _context19.next = 60;
  7090. break;
  7091. }
  7092. if (!(current_value.lines !== actualValue.lines || current_value.columns !== actualValue.columns)) {
  7093. _context19.next = 60;
  7094. break;
  7095. }
  7096. _exp2 = cmd.expression.toString();
  7097. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_matrix_index_assign_full(cmd.id, line, current_value.lines, _exp2, actualValue.lines, cmd.sourceInfo);
  7098. case 60:
  7099. return _context19.abrupt("return", store.updateStoreArray(cmd.id, actualValue, line, column));
  7100. case 61:
  7101. case "end":
  7102. return _context19.stop();
  7103. }
  7104. }
  7105. }, _callee19, this);
  7106. }));
  7107. function executeArrayIndexAssign(_x43, _x44) {
  7108. return _executeArrayIndexAssign.apply(this, arguments);
  7109. }
  7110. return executeArrayIndexAssign;
  7111. }()
  7112. /**
  7113. *
  7114. * @param {Store} store
  7115. * @param {Commands.Declaration} cmd
  7116. *
  7117. * @returns {Promise<Store>}
  7118. */
  7119. }, {
  7120. key: "executeDeclaration",
  7121. value: function () {
  7122. var _executeDeclaration = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee20(store, cmd) {
  7123. var temp, value, realValue, stringInfo, info, exp_type_string_info, exp_type_info, exp;
  7124. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee20$(_context20) {
  7125. while (1) {
  7126. switch (_context20.prev = _context20.next) {
  7127. case 0:
  7128. if (!(cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_12__.ArrayDeclaration)) {
  7129. _context20.next = 4;
  7130. break;
  7131. }
  7132. return _context20.abrupt("return", this.executeArrayDeclaration(store, cmd));
  7133. case 4:
  7134. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(cmd.type, null, null, cmd.isConst);
  7135. if (!(cmd.initial !== null)) {
  7136. _context20.next = 22;
  7137. break;
  7138. }
  7139. _context20.next = 8;
  7140. return this.evaluateExpression(store, cmd.initial);
  7141. case 8:
  7142. value = _context20.sent;
  7143. realValue = value;
  7144. if (value.type.isCompatible(cmd.type)) {
  7145. _context20.next = 21;
  7146. break;
  7147. }
  7148. if (!(_util_config__WEBPACK_IMPORTED_MODULE_19__.Config.enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.canImplicitTypeCast(cmd.type, value.type))) {
  7149. _context20.next = 15;
  7150. break;
  7151. }
  7152. realValue = _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.doImplicitCasting(cmd.type, realValue);
  7153. _context20.next = 21;
  7154. break;
  7155. case 15:
  7156. stringInfo = value.type.stringInfo();
  7157. info = stringInfo[0];
  7158. exp_type_string_info = value.type.stringInfo();
  7159. exp_type_info = exp_type_string_info[0];
  7160. exp = cmd.expression.toString();
  7161. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, exp_type_info.type, exp_type_info.dim, exp, cmd.sourceInfo);
  7162. case 21:
  7163. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(cmd.type, realValue.get(), null, cmd.isConst);
  7164. case 22:
  7165. store.insertStore(cmd.id, temp);
  7166. return _context20.abrupt("return", store);
  7167. case 24:
  7168. case "end":
  7169. return _context20.stop();
  7170. }
  7171. }
  7172. }, _callee20, this);
  7173. }));
  7174. function executeDeclaration(_x45, _x46) {
  7175. return _executeDeclaration.apply(this, arguments);
  7176. }
  7177. return executeDeclaration;
  7178. }()
  7179. /**
  7180. *
  7181. * @param {Store} store
  7182. * @param {Commands.ArrayDeclaration} cmd
  7183. *
  7184. * @returns {Promise<Store>}
  7185. */
  7186. }, {
  7187. key: "executeArrayDeclaration",
  7188. value: function () {
  7189. var _executeArrayDeclaration = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee21(store, cmd) {
  7190. var linesSV, line, columnsSV, column, temp, valueList;
  7191. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee21$(_context21) {
  7192. while (1) {
  7193. switch (_context21.prev = _context21.next) {
  7194. case 0:
  7195. _context21.next = 2;
  7196. return this.evaluateExpression(store, cmd.lines);
  7197. case 2:
  7198. linesSV = _context21.sent;
  7199. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(linesSV.type)) {
  7200. _context21.next = 5;
  7201. break;
  7202. }
  7203. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  7204. case 5:
  7205. line = linesSV.get().toNumber();
  7206. _context21.next = 8;
  7207. return this.evaluateExpression(store, cmd.columns);
  7208. case 8:
  7209. columnsSV = _context21.sent;
  7210. column = null;
  7211. if (!(columnsSV !== null)) {
  7212. _context21.next = 16;
  7213. break;
  7214. }
  7215. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(columnsSV.type)) {
  7216. _context21.next = 13;
  7217. break;
  7218. }
  7219. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  7220. case 13:
  7221. column = columnsSV.get().toNumber();
  7222. if (!(column < 0)) {
  7223. _context21.next = 16;
  7224. break;
  7225. }
  7226. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7227. case 16:
  7228. temp = new _store_value_array_store_value__WEBPACK_IMPORTED_MODULE_25__.ArrayStoreValue(cmd.type, [], line, column, null, cmd.isConst);
  7229. if (!(cmd.initial !== null)) {
  7230. _context21.next = 22;
  7231. break;
  7232. }
  7233. _context21.next = 20;
  7234. return this.evaluateArrayLiteral(store, cmd.initial, cmd.type, line, column);
  7235. case 20:
  7236. valueList = _context21.sent;
  7237. temp = new _store_value_array_store_value__WEBPACK_IMPORTED_MODULE_25__.ArrayStoreValue(cmd.type, valueList, line, column, null, cmd.isConst);
  7238. case 22:
  7239. store.insertStore(cmd.id, temp);
  7240. return _context21.abrupt("return", store);
  7241. case 24:
  7242. case "end":
  7243. return _context21.stop();
  7244. }
  7245. }
  7246. }, _callee21, this);
  7247. }));
  7248. function executeArrayDeclaration(_x47, _x48) {
  7249. return _executeArrayDeclaration.apply(this, arguments);
  7250. }
  7251. return executeArrayDeclaration;
  7252. }()
  7253. /**
  7254. *
  7255. * @param {Store} store
  7256. * @param {Expression} exp
  7257. *
  7258. * @returns {Promise<import('./store/value/istore_value').IStoreValue>}
  7259. */
  7260. }, {
  7261. key: "evaluateExpression",
  7262. value: function () {
  7263. var _evaluateExpression = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee22(store, exp) {
  7264. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee22$(_context22) {
  7265. while (1) {
  7266. switch (_context22.prev = _context22.next) {
  7267. case 0:
  7268. this.instruction_count += 1;
  7269. if (!(this.instruction_count % _util_config__WEBPACK_IMPORTED_MODULE_19__.Config.suspend_threshold == 0)) {
  7270. _context22.next = 4;
  7271. break;
  7272. }
  7273. _context22.next = 4;
  7274. return _util_utils__WEBPACK_IMPORTED_MODULE_16__.sleep(3);
  7275. case 4:
  7276. if (!(this.mode === _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.ABORT)) {
  7277. _context22.next = 6;
  7278. break;
  7279. }
  7280. throw _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_28__.LocalizedStrings.getMessage("aborted_execution");
  7281. case 6:
  7282. if (!(this.instruction_count >= _util_config__WEBPACK_IMPORTED_MODULE_19__.Config.max_instruction_count)) {
  7283. _context22.next = 8;
  7284. break;
  7285. }
  7286. throw new Error("Número de instruções excedeu o limite definido. Verifique se seu código não possui laços infinitos ou muitas chamadas de funções recursivas.");
  7287. case 8:
  7288. if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.UnaryApp)) {
  7289. _context22.next = 12;
  7290. break;
  7291. }
  7292. return _context22.abrupt("return", this.evaluateUnaryApp(store, exp));
  7293. case 12:
  7294. if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.InfixApp)) {
  7295. _context22.next = 16;
  7296. break;
  7297. }
  7298. return _context22.abrupt("return", this.evaluateInfixApp(store, exp));
  7299. case 16:
  7300. if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.ArrayAccess)) {
  7301. _context22.next = 20;
  7302. break;
  7303. }
  7304. return _context22.abrupt("return", this.evaluateArrayAccess(store, exp));
  7305. case 20:
  7306. if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.VariableLiteral)) {
  7307. _context22.next = 24;
  7308. break;
  7309. }
  7310. return _context22.abrupt("return", this.evaluateVariableLiteral(store, exp));
  7311. case 24:
  7312. if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.IntLiteral)) {
  7313. _context22.next = 28;
  7314. break;
  7315. }
  7316. return _context22.abrupt("return", this.evaluateLiteral(store, exp));
  7317. case 28:
  7318. if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.RealLiteral)) {
  7319. _context22.next = 32;
  7320. break;
  7321. }
  7322. return _context22.abrupt("return", this.evaluateLiteral(store, exp));
  7323. case 32:
  7324. if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.BoolLiteral)) {
  7325. _context22.next = 36;
  7326. break;
  7327. }
  7328. return _context22.abrupt("return", this.evaluateLiteral(store, exp));
  7329. case 36:
  7330. if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.StringLiteral)) {
  7331. _context22.next = 40;
  7332. break;
  7333. }
  7334. return _context22.abrupt("return", this.evaluateLiteral(store, exp));
  7335. case 40:
  7336. if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.CharLiteral)) {
  7337. _context22.next = 44;
  7338. break;
  7339. }
  7340. return _context22.abrupt("return", this.evaluateLiteral(store, exp));
  7341. case 44:
  7342. if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.ArrayLiteral)) {
  7343. _context22.next = 48;
  7344. break;
  7345. }
  7346. throw new Error("Internal Error: The system should not eval an array literal.");
  7347. case 48:
  7348. if (!(exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_14__.FunctionCall)) {
  7349. _context22.next = 50;
  7350. break;
  7351. }
  7352. return _context22.abrupt("return", this.evaluateFunctionCall(store, exp));
  7353. case 50:
  7354. return _context22.abrupt("return", null);
  7355. case 51:
  7356. case "end":
  7357. return _context22.stop();
  7358. }
  7359. }
  7360. }, _callee22, this);
  7361. }));
  7362. function evaluateExpression(_x49, _x50) {
  7363. return _evaluateExpression.apply(this, arguments);
  7364. }
  7365. return evaluateExpression;
  7366. }()
  7367. }, {
  7368. key: "evaluateFunctionCall",
  7369. value: function () {
  7370. var _evaluateFunctionCall = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee23(store, exp) {
  7371. var func, sto, val;
  7372. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee23$(_context23) {
  7373. while (1) {
  7374. switch (_context23.prev = _context23.next) {
  7375. case 0:
  7376. if (!exp.isMainCall) {
  7377. _context23.next = 2;
  7378. break;
  7379. }
  7380. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.void_in_expression_full(_definedFunctions__WEBPACK_IMPORTED_MODULE_10__.LanguageDefinedFunction.getMainFunctionName(), exp.sourceInfo);
  7381. case 2:
  7382. func = this.findFunction(exp.id);
  7383. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.VOID.isCompatible(func.returnType)) {
  7384. _context23.next = 5;
  7385. break;
  7386. }
  7387. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.void_in_expression_full(exp.id, exp.sourceInfo);
  7388. case 5:
  7389. if (!(this.function_call_stack.length >= _util_config__WEBPACK_IMPORTED_MODULE_19__.Config.max_call_stack)) {
  7390. _context23.next = 7;
  7391. break;
  7392. }
  7393. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.exceeded_recursive_calls(exp.sourceInfo);
  7394. case 7:
  7395. this.function_call_stack.push(exp.sourceInfo);
  7396. _context23.next = 10;
  7397. return this.runFunction(func, exp.actualParameters, store);
  7398. case 10:
  7399. sto = _context23.sent;
  7400. if (!(sto.mode !== _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN)) {
  7401. _context23.next = 13;
  7402. break;
  7403. }
  7404. throw new Error("!!!Internal error: the function that was called did not have a return command or did not set the store mode properly -> " + exp.id);
  7405. case 13:
  7406. val = sto.applyStore("$");
  7407. sto.destroy();
  7408. this.function_call_stack.pop();
  7409. return _context23.abrupt("return", val);
  7410. case 17:
  7411. case "end":
  7412. return _context23.stop();
  7413. }
  7414. }
  7415. }, _callee23, this);
  7416. }));
  7417. function evaluateFunctionCall(_x51, _x52) {
  7418. return _evaluateFunctionCall.apply(this, arguments);
  7419. }
  7420. return evaluateFunctionCall;
  7421. }()
  7422. /**
  7423. *
  7424. * @param {Store} store
  7425. * @param {Expressions.ArrayLiteral} exp
  7426. * @param {ArrayType} type
  7427. *
  7428. * @returns {Promise<StoreValue[]>}
  7429. */
  7430. }, {
  7431. key: "evaluateArrayLiteral",
  7432. value: function () {
  7433. var _evaluateArrayLiteral = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee24(store, exp, type, lines, columns) {
  7434. var storeValueMatrix;
  7435. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee24$(_context24) {
  7436. while (1) {
  7437. switch (_context24.prev = _context24.next) {
  7438. case 0:
  7439. if (exp.isVector) {
  7440. _context24.next = 9;
  7441. break;
  7442. }
  7443. if (!(columns == null)) {
  7444. _context24.next = 3;
  7445. break;
  7446. }
  7447. throw new Error("This should never happen: Vector cannot be initialized by a matrix");
  7448. case 3:
  7449. _context24.next = 5;
  7450. return this.evaluateMatrix(store, exp, type, lines, columns);
  7451. case 5:
  7452. storeValueMatrix = _context24.sent;
  7453. return _context24.abrupt("return", storeValueMatrix.reduce(function (prev, next) {
  7454. return prev.concat(next);
  7455. }, []));
  7456. case 9:
  7457. if (!(columns != null)) {
  7458. _context24.next = 11;
  7459. break;
  7460. }
  7461. throw new Error("This should never happen: Matrix cannot be initialized by a vector");
  7462. case 11:
  7463. return _context24.abrupt("return", this.evaluateVector(store, exp, type, lines));
  7464. case 12:
  7465. case "end":
  7466. return _context24.stop();
  7467. }
  7468. }
  7469. }, _callee24, this);
  7470. }));
  7471. function evaluateArrayLiteral(_x53, _x54, _x55, _x56, _x57) {
  7472. return _evaluateArrayLiteral.apply(this, arguments);
  7473. }
  7474. return evaluateArrayLiteral;
  7475. }()
  7476. /**
  7477. * Evalautes a list of literals and expression composing the vector
  7478. * @param {Store} store
  7479. * @param {Expressions.ArrayLiteral} exps
  7480. * @param {ArrayType} type
  7481. * @param {number} n_elements
  7482. *
  7483. * @returns {Promise<StoreValue[]>} store object list
  7484. */
  7485. }, {
  7486. key: "evaluateVector",
  7487. value: function () {
  7488. var _evaluateVector = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee25(store, exps, type, n_elements) {
  7489. var _this = this;
  7490. var values, actualValues;
  7491. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee25$(_context25) {
  7492. while (1) {
  7493. switch (_context25.prev = _context25.next) {
  7494. case 0:
  7495. values = exps.value;
  7496. if (!(n_elements !== values.length)) {
  7497. _context25.next = 3;
  7498. break;
  7499. }
  7500. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_number_elements_vector(n_elements, exps.toString(), values.length, exps.sourceInfo);
  7501. case 3:
  7502. _context25.next = 5;
  7503. return Promise.all(values.map(function (exp) {
  7504. return _this.evaluateExpression(store, exp);
  7505. }));
  7506. case 5:
  7507. actualValues = _context25.sent;
  7508. return _context25.abrupt("return", actualValues.map(function (v, index) {
  7509. if (!type.canAccept(v.type, 1)) {
  7510. if (!_util_config__WEBPACK_IMPORTED_MODULE_19__.Config.enable_type_casting || !_store_store__WEBPACK_IMPORTED_MODULE_5__.Store.canImplicitTypeCast(type.innerType, v.type)) {
  7511. // const stringInfo = v.type.stringInfo();
  7512. // const info = stringInfo[0];
  7513. var exp_str = values[index].toString(); // TODO - fix error message
  7514. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_array_literal_type_full(exp_str, values[index].sourceInfo);
  7515. }
  7516. var newValue = _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.doImplicitCasting(type.innerType, v);
  7517. return newValue;
  7518. }
  7519. return v;
  7520. }));
  7521. case 7:
  7522. case "end":
  7523. return _context25.stop();
  7524. }
  7525. }
  7526. }, _callee25);
  7527. }));
  7528. function evaluateVector(_x58, _x59, _x60, _x61) {
  7529. return _evaluateVector.apply(this, arguments);
  7530. }
  7531. return evaluateVector;
  7532. }()
  7533. /**
  7534. * Evaluates a list of array literals composing the matrix
  7535. * @param {Store} store
  7536. * @param {Expressions.ArrayLiteral} exps
  7537. * @param {ArrayType} type
  7538. *
  7539. * @returns {Promise<StoreValue[][]>}
  7540. */
  7541. }, {
  7542. key: "evaluateMatrix",
  7543. value: function () {
  7544. var _evaluateMatrix = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee26(store, exps, type, lines, columns) {
  7545. var _this2 = this;
  7546. var values, vectors;
  7547. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee26$(_context26) {
  7548. while (1) {
  7549. switch (_context26.prev = _context26.next) {
  7550. case 0:
  7551. values = exps.value;
  7552. if (!(values.length !== lines)) {
  7553. _context26.next = 3;
  7554. break;
  7555. }
  7556. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_number_lines_matrix(lines, exps.toString(), values.length, exps.sourceInfo);
  7557. case 3:
  7558. vectors = values.map(function (vector) {
  7559. var vec_type = new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_17__.ArrayType(type.innerType, 1);
  7560. return _this2.evaluateVector(store, vector, vec_type, columns);
  7561. });
  7562. _context26.next = 6;
  7563. return Promise.all(vectors);
  7564. case 6:
  7565. return _context26.abrupt("return", _context26.sent);
  7566. case 7:
  7567. case "end":
  7568. return _context26.stop();
  7569. }
  7570. }
  7571. }, _callee26);
  7572. }));
  7573. function evaluateMatrix(_x62, _x63, _x64, _x65, _x66) {
  7574. return _evaluateMatrix.apply(this, arguments);
  7575. }
  7576. return evaluateMatrix;
  7577. }()
  7578. /**
  7579. *
  7580. * @param {Store} _
  7581. * @param {import('../ast/expressions/literal').Literal} exp
  7582. *
  7583. * @returns {import('./store/value/istore_value').IStoreValue}
  7584. */
  7585. }, {
  7586. key: "evaluateLiteral",
  7587. value: function () {
  7588. var _evaluateLiteral = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee27(_, exp) {
  7589. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee27$(_context27) {
  7590. while (1) {
  7591. switch (_context27.prev = _context27.next) {
  7592. case 0:
  7593. return _context27.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(exp.type, exp.value));
  7594. case 1:
  7595. case "end":
  7596. return _context27.stop();
  7597. }
  7598. }
  7599. }, _callee27);
  7600. }));
  7601. function evaluateLiteral(_x67, _x68) {
  7602. return _evaluateLiteral.apply(this, arguments);
  7603. }
  7604. return evaluateLiteral;
  7605. }()
  7606. /**
  7607. *
  7608. * @param {Store} store
  7609. * @param {Expressions.VariableLiteral} exp
  7610. *
  7611. * @returns {import('./store/value/istore_value').IStoreValue}
  7612. */
  7613. }, {
  7614. key: "evaluateVariableLiteral",
  7615. value: function () {
  7616. var _evaluateVariableLiteral = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee28(store, exp) {
  7617. var val;
  7618. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee28$(_context28) {
  7619. while (1) {
  7620. switch (_context28.prev = _context28.next) {
  7621. case 0:
  7622. val = store.applyStore(exp.id);
  7623. return _context28.abrupt("return", val);
  7624. case 2:
  7625. case "end":
  7626. return _context28.stop();
  7627. }
  7628. }
  7629. }, _callee28);
  7630. }));
  7631. function evaluateVariableLiteral(_x69, _x70) {
  7632. return _evaluateVariableLiteral.apply(this, arguments);
  7633. }
  7634. return evaluateVariableLiteral;
  7635. }()
  7636. /**
  7637. *
  7638. * @param {Store} store
  7639. * @param {Expressions.ArrayAccess} exp
  7640. *
  7641. * @returns {import('./store/value/istore_value').IStoreValue}
  7642. */
  7643. }, {
  7644. key: "evaluateArrayAccess",
  7645. value: function () {
  7646. var _evaluateArrayAccess = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee29(store, exp) {
  7647. var mustBeArray, lineSV, line, columnSV, column, result, type, values;
  7648. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee29$(_context29) {
  7649. while (1) {
  7650. switch (_context29.prev = _context29.next) {
  7651. case 0:
  7652. mustBeArray = store.getStoreObject(exp.id);
  7653. if (mustBeArray.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_17__.ArrayType) {
  7654. _context29.next = 3;
  7655. break;
  7656. }
  7657. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_array_access_full(exp.id, exp.sourceInfo);
  7658. case 3:
  7659. _context29.next = 5;
  7660. return this.evaluateExpression(store, exp.line);
  7661. case 5:
  7662. lineSV = _context29.sent;
  7663. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(lineSV.type)) {
  7664. _context29.next = 8;
  7665. break;
  7666. }
  7667. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo);
  7668. case 8:
  7669. line = lineSV.get().toNumber();
  7670. _context29.next = 11;
  7671. return this.evaluateExpression(store, exp.column);
  7672. case 11:
  7673. columnSV = _context29.sent;
  7674. column = null;
  7675. if (!(columnSV !== null)) {
  7676. _context29.next = 17;
  7677. break;
  7678. }
  7679. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(columnSV.type)) {
  7680. _context29.next = 16;
  7681. break;
  7682. }
  7683. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo);
  7684. case 16:
  7685. column = columnSV.get().toNumber();
  7686. case 17:
  7687. if (!(line >= mustBeArray.lines)) {
  7688. _context29.next = 25;
  7689. break;
  7690. }
  7691. if (!mustBeArray.isVector) {
  7692. _context29.next = 22;
  7693. break;
  7694. }
  7695. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo);
  7696. case 22:
  7697. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo);
  7698. case 23:
  7699. _context29.next = 27;
  7700. break;
  7701. case 25:
  7702. if (!(line < 0)) {
  7703. _context29.next = 27;
  7704. break;
  7705. }
  7706. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7707. case 27:
  7708. if (!(column !== null && mustBeArray.columns === 0)) {
  7709. _context29.next = 29;
  7710. break;
  7711. }
  7712. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.vector_not_matrix_full(exp.id, exp.sourceInfo);
  7713. case 29:
  7714. if (!(column !== null)) {
  7715. _context29.next = 36;
  7716. break;
  7717. }
  7718. if (!(column >= mustBeArray.columns)) {
  7719. _context29.next = 34;
  7720. break;
  7721. }
  7722. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.matrix_column_outbounds_full(exp.id, column, mustBeArray.columns, exp.sourceInfo);
  7723. case 34:
  7724. if (!(column < 0)) {
  7725. _context29.next = 36;
  7726. break;
  7727. }
  7728. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7729. case 36:
  7730. result = mustBeArray.getAt(line, column);
  7731. type = mustBeArray.type.innerType;
  7732. if (!Array.isArray(result)) {
  7733. _context29.next = 43;
  7734. break;
  7735. }
  7736. values = result.map(function (val, col) {
  7737. return new _store_value_store_value_address__WEBPACK_IMPORTED_MODULE_27__.StoreValueAddress(type, val, line, col, mustBeArray.id, mustBeArray.readOnly);
  7738. });
  7739. return _context29.abrupt("return", new _store_value_array_store_value__WEBPACK_IMPORTED_MODULE_25__.ArrayStoreValue(new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_17__.ArrayType(type, 1), values, mustBeArray.columns, null, mustBeArray.id, mustBeArray.readOnly));
  7740. case 43:
  7741. return _context29.abrupt("return", new _store_value_store_value_address__WEBPACK_IMPORTED_MODULE_27__.StoreValueAddress(type, result, line, column, mustBeArray.id, mustBeArray.readOnly));
  7742. case 44:
  7743. case "end":
  7744. return _context29.stop();
  7745. }
  7746. }
  7747. }, _callee29, this);
  7748. }));
  7749. function evaluateArrayAccess(_x71, _x72) {
  7750. return _evaluateArrayAccess.apply(this, arguments);
  7751. }
  7752. return evaluateArrayAccess;
  7753. }()
  7754. /**
  7755. *
  7756. * @param {Store} store
  7757. * @param {Expressions.UnaryApp} unaryApp
  7758. *
  7759. * @returns {import('./store/value/istore_value').IStoreValue}
  7760. */
  7761. }, {
  7762. key: "evaluateUnaryApp",
  7763. value: function () {
  7764. var _evaluateUnaryApp = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee30(store, unaryApp) {
  7765. var left, resultType, stringInfo, info;
  7766. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee30$(_context30) {
  7767. while (1) {
  7768. switch (_context30.prev = _context30.next) {
  7769. case 0:
  7770. _context30.next = 2;
  7771. return this.evaluateExpression(store, unaryApp.left);
  7772. case 2:
  7773. left = _context30.sent;
  7774. resultType = (0,_compatibilityTable__WEBPACK_IMPORTED_MODULE_11__.resultTypeAfterUnaryOp)(unaryApp.op, left.type);
  7775. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.UNDEFINED.isCompatible(resultType)) {
  7776. _context30.next = 8;
  7777. break;
  7778. }
  7779. stringInfo = left.type.stringInfo();
  7780. info = stringInfo[0];
  7781. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo);
  7782. case 8:
  7783. _context30.t0 = unaryApp.op.ord;
  7784. _context30.next = _context30.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.ADD.ord ? 11 : _context30.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.SUB.ord ? 12 : _context30.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.NOT.ord ? 13 : 14;
  7785. break;
  7786. case 11:
  7787. return _context30.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, left.get()));
  7788. case 12:
  7789. return _context30.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, left.get().negated()));
  7790. case 13:
  7791. return _context30.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, !left.get()));
  7792. case 14:
  7793. throw new _error_runtimeError__WEBPACK_IMPORTED_MODULE_21__.RuntimeError("!!!Critical Invalid UnaryApp " + unaryApp.op);
  7794. case 15:
  7795. case "end":
  7796. return _context30.stop();
  7797. }
  7798. }
  7799. }, _callee30, this);
  7800. }));
  7801. function evaluateUnaryApp(_x73, _x74) {
  7802. return _evaluateUnaryApp.apply(this, arguments);
  7803. }
  7804. return evaluateUnaryApp;
  7805. }()
  7806. /**
  7807. *
  7808. * @param {Store} store
  7809. * @param {Expressions.InfixApp} infixApp
  7810. *
  7811. * @returns {import('./store/value/istore_value').IStoreValue}
  7812. */
  7813. }, {
  7814. key: "evaluateInfixApp",
  7815. value: function () {
  7816. var _evaluateInfixApp = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee31(store, infixApp) {
  7817. var left, right, shouldImplicitCast, resultType, stringInfoLeft, infoLeft, stringInfoRight, infoRight, result, rightStr, leftStr, strLeft, strRight, leftValue, rightValue, _leftValue, _rightValue, _leftValue2, _rightValue2, _leftValue3, _rightValue3, _leftValue4, _rightValue4, _leftValue5, _rightValue5, _leftValue6, _rightValue6;
  7818. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee31$(_context31) {
  7819. while (1) {
  7820. switch (_context31.prev = _context31.next) {
  7821. case 0:
  7822. _context31.next = 2;
  7823. return this.evaluateExpression(store, infixApp.left);
  7824. case 2:
  7825. left = _context31.sent;
  7826. _context31.next = 5;
  7827. return this.evaluateExpression(store, infixApp.right);
  7828. case 5:
  7829. right = _context31.sent;
  7830. shouldImplicitCast = false;
  7831. resultType = (0,_compatibilityTable__WEBPACK_IMPORTED_MODULE_11__.resultTypeAfterInfixOp)(infixApp.op, left.type, right.type);
  7832. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.UNDEFINED.isCompatible(resultType)) {
  7833. _context31.next = 18;
  7834. break;
  7835. }
  7836. if (!(_util_config__WEBPACK_IMPORTED_MODULE_19__.Config.enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_5__.Store.canImplicitTypeCast(left.type, right.type))) {
  7837. _context31.next = 13;
  7838. break;
  7839. }
  7840. shouldImplicitCast = true;
  7841. _context31.next = 18;
  7842. break;
  7843. case 13:
  7844. stringInfoLeft = left.type.stringInfo();
  7845. infoLeft = stringInfoLeft[0];
  7846. stringInfoRight = right.type.stringInfo();
  7847. infoRight = stringInfoRight[0];
  7848. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, infixApp.sourceInfo);
  7849. case 18:
  7850. result = null;
  7851. _context31.t0 = infixApp.op.ord;
  7852. _context31.next = _context31.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.ADD.ord ? 22 : _context31.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.SUB.ord ? 39 : _context31.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.MULT.ord ? 40 : _context31.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.DIV.ord ? 42 : _context31.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.MOD.ord ? 46 : _context31.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.GT.ord ? 51 : _context31.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.GE.ord ? 55 : _context31.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.LT.ord ? 59 : _context31.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.LE.ord ? 63 : _context31.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.EQ.ord ? 67 : _context31.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.NEQ.ord ? 71 : _context31.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.AND.ord ? 75 : _context31.t0 === _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.OR.ord ? 76 : 77;
  7853. break;
  7854. case 22:
  7855. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.STRING.isCompatible(left.type)) {
  7856. _context31.next = 27;
  7857. break;
  7858. }
  7859. rightStr = (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_18__.convertToString)(right.get(), right.type);
  7860. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, left.get() + rightStr));
  7861. case 27:
  7862. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.STRING.isCompatible(right.type)) {
  7863. _context31.next = 32;
  7864. break;
  7865. }
  7866. leftStr = (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_18__.convertToString)(left.get(), left.type);
  7867. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, leftStr + right.get()));
  7868. case 32:
  7869. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.CHAR.isCompatible(left.type)) {
  7870. _context31.next = 38;
  7871. break;
  7872. }
  7873. strLeft = (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_18__.convertToString)(left.get(), left.type);
  7874. strRight = (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_18__.convertToString)(right.get(), right.type);
  7875. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, strLeft + strRight));
  7876. case 38:
  7877. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, left.get().plus(right.get())));
  7878. case 39:
  7879. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, left.get().minus(right.get())));
  7880. case 40:
  7881. result = left.get().times(right.get());
  7882. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
  7883. case 42:
  7884. if (!(right.get() == 0)) {
  7885. _context31.next = 44;
  7886. break;
  7887. }
  7888. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_20__.ProcessorErrorFactory.divsion_by_zero_full(infixApp.toString(), infixApp.sourceInfo);
  7889. case 44:
  7890. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(resultType)) result = left.get().divToInt(right.get());else result = left.get().div(right.get());
  7891. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
  7892. case 46:
  7893. leftValue = left.get();
  7894. rightValue = right.get();
  7895. if (shouldImplicitCast) {
  7896. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER;
  7897. leftValue = leftValue.trunc();
  7898. rightValue = rightValue.trunc();
  7899. }
  7900. result = leftValue.modulo(rightValue);
  7901. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
  7902. case 51:
  7903. _leftValue = left.get();
  7904. _rightValue = right.get();
  7905. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.STRING.isCompatible(left.type)) {
  7906. result = _leftValue.length > _rightValue.length;
  7907. } else if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.CHAR.isCompatible(left.type)) {
  7908. result = _leftValue.charCodeAt(0) > _rightValue.charCodeAt(0);
  7909. } else {
  7910. if (shouldImplicitCast) {
  7911. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN;
  7912. _leftValue = _leftValue.trunc();
  7913. _rightValue = _rightValue.trunc();
  7914. }
  7915. result = _leftValue.gt(_rightValue);
  7916. }
  7917. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
  7918. case 55:
  7919. _leftValue2 = left.get();
  7920. _rightValue2 = right.get();
  7921. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.STRING.isCompatible(left.type)) {
  7922. result = _leftValue2.length >= _rightValue2.length;
  7923. } else if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.CHAR.isCompatible(left.type)) {
  7924. result = _leftValue2.charCodeAt(0) >= _rightValue2.charCodeAt(0);
  7925. } else {
  7926. if (shouldImplicitCast) {
  7927. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN;
  7928. _leftValue2 = _leftValue2.trunc();
  7929. _rightValue2 = _rightValue2.trunc();
  7930. }
  7931. result = _leftValue2.gte(_rightValue2);
  7932. }
  7933. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
  7934. case 59:
  7935. _leftValue3 = left.get();
  7936. _rightValue3 = right.get();
  7937. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.STRING.isCompatible(left.type)) {
  7938. result = _leftValue3.length < _rightValue3.length;
  7939. } else if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.CHAR.isCompatible(left.type)) {
  7940. result = _leftValue3.charCodeAt(0) < _rightValue3.charCodeAt(0);
  7941. } else {
  7942. if (shouldImplicitCast) {
  7943. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN;
  7944. _leftValue3 = _leftValue3.trunc();
  7945. _rightValue3 = _rightValue3.trunc();
  7946. }
  7947. result = _leftValue3.lt(_rightValue3);
  7948. }
  7949. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
  7950. case 63:
  7951. _leftValue4 = left.get();
  7952. _rightValue4 = right.get();
  7953. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.STRING.isCompatible(left.type)) {
  7954. result = _leftValue4.length <= _rightValue4.length;
  7955. } else if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.CHAR.isCompatible(left.type)) {
  7956. result = _leftValue4.charCodeAt(0) <= _rightValue4.charCodeAt(0);
  7957. } else {
  7958. if (shouldImplicitCast) {
  7959. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN;
  7960. _leftValue4 = _leftValue4.trunc();
  7961. _rightValue4 = _rightValue4.trunc();
  7962. }
  7963. result = _leftValue4.lte(_rightValue4);
  7964. }
  7965. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
  7966. case 67:
  7967. _leftValue5 = left.get();
  7968. _rightValue5 = right.get();
  7969. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(left.type) || _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.REAL.isCompatible(left.type)) {
  7970. if (shouldImplicitCast) {
  7971. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN;
  7972. _leftValue5 = _leftValue5.trunc();
  7973. _rightValue5 = _rightValue5.trunc();
  7974. }
  7975. result = _leftValue5.eq(_rightValue5);
  7976. } else {
  7977. result = _leftValue5 === _rightValue5;
  7978. }
  7979. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
  7980. case 71:
  7981. _leftValue6 = left.get();
  7982. _rightValue6 = right.get();
  7983. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.INTEGER.isCompatible(left.type) || _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.REAL.isCompatible(left.type)) {
  7984. if (shouldImplicitCast) {
  7985. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_8__.Types.BOOLEAN;
  7986. _leftValue6 = _leftValue6.trunc();
  7987. _rightValue6 = _rightValue6.trunc();
  7988. }
  7989. result = !_leftValue6.eq(_rightValue6);
  7990. } else {
  7991. result = _leftValue6 !== _rightValue6;
  7992. }
  7993. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, result));
  7994. case 75:
  7995. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, left.get() && right.get()));
  7996. case 76:
  7997. return _context31.abrupt("return", new _store_value_store_value__WEBPACK_IMPORTED_MODULE_23__.StoreValue(resultType, left.get() || right.get()));
  7998. case 77:
  7999. throw new _error_runtimeError__WEBPACK_IMPORTED_MODULE_21__.RuntimeError("!!!Critical Invalid InfixApp " + infixApp.op);
  8000. case 78:
  8001. case "end":
  8002. return _context31.stop();
  8003. }
  8004. }
  8005. }, _callee31, this);
  8006. }));
  8007. function evaluateInfixApp(_x75, _x76) {
  8008. return _evaluateInfixApp.apply(this, arguments);
  8009. }
  8010. return evaluateInfixApp;
  8011. }()
  8012. }]);
  8013. return IVProgProcessor;
  8014. }();
  8015. /***/ }),
  8016. /***/ "./js/processor/lib/arrays.js":
  8017. /*!************************************!*\
  8018. !*** ./js/processor/lib/arrays.js ***!
  8019. \************************************/
  8020. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  8021. "use strict";
  8022. __webpack_require__.r(__webpack_exports__);
  8023. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  8024. /* harmony export */ "createNumElementsFun": () => (/* binding */ createNumElementsFun),
  8025. /* harmony export */ "createMatrixLinesFun": () => (/* binding */ createMatrixLinesFun),
  8026. /* harmony export */ "createMatrixColumnsFun": () => (/* binding */ createMatrixColumnsFun)
  8027. /* harmony export */ });
  8028. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
  8029. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
  8030. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
  8031. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
  8032. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8033. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
  8034. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8035. /* harmony import */ var _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
  8036. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.ts");
  8037. /* harmony import */ var _store_value_store_value__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../store/value/store_value */ "./js/processor/store/value/store_value.ts");
  8038. /**
  8039. * num_elements
  8040. * matrix_lines
  8041. * matrix_columns
  8042. */
  8043. function createNumElementsFun() {
  8044. var numElementsFun = /*#__PURE__*/function () {
  8045. var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(sto, _) {
  8046. var vector, temp;
  8047. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
  8048. while (1) {
  8049. switch (_context.prev = _context.next) {
  8050. case 0:
  8051. vector = sto.applyStore("vector");
  8052. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_7__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toInt)(vector.lines));
  8053. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN;
  8054. sto.insertStore("$", temp);
  8055. return _context.abrupt("return", sto);
  8056. case 5:
  8057. case "end":
  8058. return _context.stop();
  8059. }
  8060. }
  8061. }, _callee);
  8062. }));
  8063. return function numElementsFun(_x, _x2) {
  8064. return _ref.apply(this, arguments);
  8065. };
  8066. }();
  8067. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(numElementsFun)]);
  8068. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function('$numElements', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_5__.ArrayType(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.ALL, 1), 'vector', false)], block);
  8069. return func;
  8070. }
  8071. function createMatrixLinesFun() {
  8072. var matrixLinesFun = /*#__PURE__*/function () {
  8073. var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2(sto, _) {
  8074. var matrix, temp;
  8075. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) {
  8076. while (1) {
  8077. switch (_context2.prev = _context2.next) {
  8078. case 0:
  8079. matrix = sto.applyStore("matrix");
  8080. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_7__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toInt)(matrix.lines));
  8081. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN;
  8082. sto.insertStore("$", temp);
  8083. return _context2.abrupt("return", sto);
  8084. case 5:
  8085. case "end":
  8086. return _context2.stop();
  8087. }
  8088. }
  8089. }, _callee2);
  8090. }));
  8091. return function matrixLinesFun(_x3, _x4) {
  8092. return _ref2.apply(this, arguments);
  8093. };
  8094. }();
  8095. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(matrixLinesFun)]);
  8096. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function('$matrixLines', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_5__.ArrayType(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.ALL, 2), 'matrix', false)], block);
  8097. return func;
  8098. }
  8099. function createMatrixColumnsFun() {
  8100. var matrixColumnsFun = /*#__PURE__*/function () {
  8101. var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee3(sto, _) {
  8102. var matrix, temp;
  8103. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee3$(_context3) {
  8104. while (1) {
  8105. switch (_context3.prev = _context3.next) {
  8106. case 0:
  8107. matrix = sto.applyStore("matrix");
  8108. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_7__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toInt)(matrix.columns));
  8109. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__.Modes.RETURN;
  8110. sto.insertStore("$", temp);
  8111. return _context3.abrupt("return", sto);
  8112. case 5:
  8113. case "end":
  8114. return _context3.stop();
  8115. }
  8116. }
  8117. }, _callee3);
  8118. }));
  8119. return function matrixColumnsFun(_x5, _x6) {
  8120. return _ref3.apply(this, arguments);
  8121. };
  8122. }();
  8123. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(matrixColumnsFun)]);
  8124. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function('$matrixColumns', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_5__.ArrayType(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.ALL, 2), 'matrix', false)], block);
  8125. return func;
  8126. }
  8127. /***/ }),
  8128. /***/ "./js/processor/lib/io.js":
  8129. /*!********************************!*\
  8130. !*** ./js/processor/lib/io.js ***!
  8131. \********************************/
  8132. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  8133. "use strict";
  8134. __webpack_require__.r(__webpack_exports__);
  8135. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  8136. /* harmony export */ "createOutputFun": () => (/* binding */ createOutputFun),
  8137. /* harmony export */ "createInputFun": () => (/* binding */ createInputFun)
  8138. /* harmony export */ });
  8139. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
  8140. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
  8141. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
  8142. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
  8143. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8144. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.ts");
  8145. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8146. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
  8147. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8148. /* harmony import */ var _store_value_store_value__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../store/value/store_value */ "./js/processor/store/value/store_value.ts");
  8149. function createOutputFun() {
  8150. var writeFunction = /*#__PURE__*/function () {
  8151. var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(store, _) {
  8152. var totalSV, total, i, val;
  8153. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
  8154. while (1) {
  8155. switch (_context.prev = _context.next) {
  8156. case 0:
  8157. totalSV = store.applyStore("p1.0");
  8158. total = totalSV.get();
  8159. for (i = 1; i < total; i += 1) {
  8160. val = store.applyStore("p1.".concat(i));
  8161. this.output.sendOutput(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.convertToString(val.get(), val.type));
  8162. }
  8163. store.mode = _modes__WEBPACK_IMPORTED_MODULE_3__.Modes.RETURN;
  8164. return _context.abrupt("return", store);
  8165. case 5:
  8166. case "end":
  8167. return _context.stop();
  8168. }
  8169. }
  8170. }, _callee, this);
  8171. }));
  8172. return function writeFunction(_x, _x2) {
  8173. return _ref.apply(this, arguments);
  8174. };
  8175. }();
  8176. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(writeFunction)]);
  8177. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function("$write", _typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.VOID, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.ALL, "p1", false, true)], block);
  8178. return func;
  8179. }
  8180. function createInputFun() {
  8181. var readFunction = /*#__PURE__*/function () {
  8182. var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2(store, _) {
  8183. var text, typeToConvert, type, result, stringInfo, realObject, arrayInfo, dim, stoValue;
  8184. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) {
  8185. while (1) {
  8186. switch (_context2.prev = _context2.next) {
  8187. case 0:
  8188. _context2.next = 2;
  8189. return this.input.requestInput();
  8190. case 2:
  8191. text = _context2.sent;
  8192. typeToConvert = store.applyStore("p1").type;
  8193. type = null;
  8194. result = null;
  8195. _context2.prev = 6;
  8196. if (!typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.INTEGER)) {
  8197. _context2.next = 12;
  8198. break;
  8199. }
  8200. result = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toInt(text.trim()).trunc();
  8201. type = _typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.INTEGER;
  8202. _context2.next = 33;
  8203. break;
  8204. case 12:
  8205. if (!typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.REAL)) {
  8206. _context2.next = 17;
  8207. break;
  8208. }
  8209. result = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toReal(text.trim());
  8210. type = _typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.REAL;
  8211. _context2.next = 33;
  8212. break;
  8213. case 17:
  8214. if (!typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.BOOLEAN)) {
  8215. _context2.next = 22;
  8216. break;
  8217. }
  8218. result = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toBool(text.trim());
  8219. type = _typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.BOOLEAN;
  8220. _context2.next = 33;
  8221. break;
  8222. case 22:
  8223. if (!typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.STRING)) {
  8224. _context2.next = 27;
  8225. break;
  8226. }
  8227. result = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toString(text);
  8228. type = _typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.STRING;
  8229. _context2.next = 33;
  8230. break;
  8231. case 27:
  8232. if (!typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.CHAR)) {
  8233. _context2.next = 32;
  8234. break;
  8235. }
  8236. result = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toChar(text);
  8237. type = _typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.CHAR;
  8238. _context2.next = 33;
  8239. break;
  8240. case 32:
  8241. throw new Error("!!!!Critical error: Unknown type in readFunction!!!!");
  8242. case 33:
  8243. _context2.next = 47;
  8244. break;
  8245. case 35:
  8246. _context2.prev = 35;
  8247. _context2.t0 = _context2["catch"](6);
  8248. if (!(this.mode == _modes__WEBPACK_IMPORTED_MODULE_3__.Modes.ABORT)) {
  8249. _context2.next = 40;
  8250. break;
  8251. }
  8252. store.mode = _modes__WEBPACK_IMPORTED_MODULE_3__.Modes.RETURN;
  8253. return _context2.abrupt("return", store);
  8254. case 40:
  8255. stringInfo = typeToConvert.stringInfo()[0];
  8256. realObject = store.getStoreObject("p1");
  8257. if (!(realObject.getReferenceDimension() > 0)) {
  8258. _context2.next = 46;
  8259. break;
  8260. }
  8261. arrayInfo = realObject.type.stringInfo()[0];
  8262. dim = realObject.getReferenceDimension();
  8263. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_6__.ProcessorErrorFactory.invalid_read_type_array(text, stringInfo.type, stringInfo.dim, realObject.getRefObj(), arrayInfo.type, dim, this.function_call_stack.pop());
  8264. case 46:
  8265. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_6__.ProcessorErrorFactory.invalid_read_type(text, stringInfo.type, stringInfo.dim, realObject.getRefObj(), this.function_call_stack.pop());
  8266. case 47:
  8267. stoValue = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_7__.StoreValue(type, result);
  8268. store.updateStore("p1", stoValue);
  8269. store.mode = _modes__WEBPACK_IMPORTED_MODULE_3__.Modes.RETURN;
  8270. return _context2.abrupt("return", store);
  8271. case 51:
  8272. case "end":
  8273. return _context2.stop();
  8274. }
  8275. }
  8276. }, _callee2, this, [[6, 35]]);
  8277. }));
  8278. return function readFunction(_x3, _x4) {
  8279. return _ref2.apply(this, arguments);
  8280. };
  8281. }();
  8282. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(readFunction)]);
  8283. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function("$read", _typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.VOID, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_5__.Types.ALL, "p1", true)], block);
  8284. return func;
  8285. }
  8286. /***/ }),
  8287. /***/ "./js/processor/lib/lang.js":
  8288. /*!**********************************!*\
  8289. !*** ./js/processor/lib/lang.js ***!
  8290. \**********************************/
  8291. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  8292. "use strict";
  8293. __webpack_require__.r(__webpack_exports__);
  8294. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  8295. /* harmony export */ "createIsRealFun": () => (/* binding */ createIsRealFun),
  8296. /* harmony export */ "createIsIntFun": () => (/* binding */ createIsIntFun),
  8297. /* harmony export */ "createIsBoolFun": () => (/* binding */ createIsBoolFun),
  8298. /* harmony export */ "createCastRealFun": () => (/* binding */ createCastRealFun),
  8299. /* harmony export */ "createCastIntFun": () => (/* binding */ createCastIntFun),
  8300. /* harmony export */ "createCastBoolFun": () => (/* binding */ createCastBoolFun),
  8301. /* harmony export */ "createCastStringFun": () => (/* binding */ createCastStringFun),
  8302. /* harmony export */ "createCastCharFun": () => (/* binding */ createCastCharFun)
  8303. /* harmony export */ });
  8304. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
  8305. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
  8306. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
  8307. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
  8308. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8309. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
  8310. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8311. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  8312. /* harmony import */ var _ast_expressions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8313. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.ts");
  8314. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.ts");
  8315. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8316. /* harmony import */ var _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../store/value/store_value */ "./js/processor/store/value/store_value.ts");
  8317. /**
  8318. *
  8319. * is_real
  8320. * is_int
  8321. * is_bool
  8322. * cast_real
  8323. * cast_int
  8324. * cast_bool
  8325. * cast_string
  8326. * cast_char
  8327. */
  8328. function createIsRealFun() {
  8329. var isRealFun = /*#__PURE__*/function () {
  8330. var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(sto, _) {
  8331. var str, parser, result, val, temp;
  8332. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
  8333. while (1) {
  8334. switch (_context.prev = _context.next) {
  8335. case 0:
  8336. str = sto.applyStore("str");
  8337. parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_5__.IVProgParser.createParser(str.get());
  8338. result = false;
  8339. try {
  8340. val = parser.parseTerm();
  8341. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.RealLiteral) {
  8342. result = true;
  8343. }
  8344. } catch (error) {// ignore
  8345. }
  8346. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.BOOLEAN, result);
  8347. sto.insertStore("$", temp);
  8348. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
  8349. return _context.abrupt("return", sto);
  8350. case 8:
  8351. case "end":
  8352. return _context.stop();
  8353. }
  8354. }
  8355. }, _callee);
  8356. }));
  8357. return function isRealFun(_x, _x2) {
  8358. return _ref.apply(this, arguments);
  8359. };
  8360. }();
  8361. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(isRealFun)]);
  8362. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function("$isReal", _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, "str", false)], block);
  8363. return func;
  8364. }
  8365. function createIsIntFun() {
  8366. var isIntFun = /*#__PURE__*/function () {
  8367. var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2(sto, _) {
  8368. var str, parser, result, val, temp;
  8369. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) {
  8370. while (1) {
  8371. switch (_context2.prev = _context2.next) {
  8372. case 0:
  8373. str = sto.applyStore("str");
  8374. parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_5__.IVProgParser.createParser(str.get());
  8375. result = false;
  8376. try {
  8377. val = parser.parseTerm();
  8378. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.IntLiteral) {
  8379. result = true;
  8380. }
  8381. } catch (_unused) {// ignore
  8382. }
  8383. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.BOOLEAN, result);
  8384. sto.insertStore("$", temp);
  8385. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
  8386. return _context2.abrupt("return", sto);
  8387. case 8:
  8388. case "end":
  8389. return _context2.stop();
  8390. }
  8391. }
  8392. }, _callee2);
  8393. }));
  8394. return function isIntFun(_x3, _x4) {
  8395. return _ref2.apply(this, arguments);
  8396. };
  8397. }();
  8398. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(isIntFun)]);
  8399. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function("$isInt", _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, "str", false)], block);
  8400. return func;
  8401. }
  8402. function createIsBoolFun() {
  8403. var isBoolFun = function isBoolFun(sto, _) {
  8404. var str = sto.applyStore("str");
  8405. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_5__.IVProgParser.createParser(str.get());
  8406. var result = false;
  8407. try {
  8408. var val = parser.parseTerm();
  8409. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.BoolLiteral) {
  8410. result = true;
  8411. }
  8412. } catch (error) {// ignore
  8413. }
  8414. var temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.BOOLEAN, result);
  8415. sto.insertStore("$", temp);
  8416. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
  8417. return sto;
  8418. };
  8419. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(isBoolFun)]);
  8420. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function("$isBool", _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, "str", false)], block);
  8421. return func;
  8422. }
  8423. function createCastRealFun() {
  8424. var castRealFun = /*#__PURE__*/function () {
  8425. var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee3(sto, _) {
  8426. var val, value, temp, parser, result, _temp, typeStringInfoArray, typeInfo;
  8427. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee3$(_context3) {
  8428. while (1) {
  8429. switch (_context3.prev = _context3.next) {
  8430. case 0:
  8431. val = sto.applyStore("val");
  8432. value = val.get();
  8433. _context3.t0 = val.type.ord;
  8434. _context3.next = _context3.t0 === _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER.ord ? 5 : _context3.t0 === _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING.ord ? 10 : 22;
  8435. break;
  8436. case 5:
  8437. value = value.toNumber();
  8438. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.REAL, _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toReal(value));
  8439. sto.insertStore("$", temp);
  8440. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
  8441. return _context3.abrupt("return", sto);
  8442. case 10:
  8443. parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_5__.IVProgParser.createParser(value);
  8444. _context3.prev = 11;
  8445. result = parser.parseTerm();
  8446. if (!(result instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.RealLiteral)) {
  8447. _context3.next = 18;
  8448. break;
  8449. }
  8450. _temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.REAL, _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toReal(result.value));
  8451. sto.insertStore("$", _temp);
  8452. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
  8453. return _context3.abrupt("return", sto);
  8454. case 18:
  8455. _context3.next = 22;
  8456. break;
  8457. case 20:
  8458. _context3.prev = 20;
  8459. _context3.t1 = _context3["catch"](11);
  8460. case 22:
  8461. typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.REAL.stringInfo();
  8462. typeInfo = typeStringInfoArray[0];
  8463. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_9__.ProcessorErrorFactory.invalid_type_conversion(value, typeInfo.type, typeInfo.dim);
  8464. case 25:
  8465. case "end":
  8466. return _context3.stop();
  8467. }
  8468. }
  8469. }, _callee3, null, [[11, 20]]);
  8470. }));
  8471. return function castRealFun(_x5, _x6) {
  8472. return _ref3.apply(this, arguments);
  8473. };
  8474. }();
  8475. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(castRealFun)]);
  8476. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function("$castReal", _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_8__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING]), "val", false)], block);
  8477. return func;
  8478. }
  8479. function createCastIntFun() {
  8480. var castIntFun = /*#__PURE__*/function () {
  8481. var _ref4 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee4(sto, _) {
  8482. var val, value, temp, _temp2, parser, result, _temp3, typeStringInfoArray, typeInfo;
  8483. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee4$(_context4) {
  8484. while (1) {
  8485. switch (_context4.prev = _context4.next) {
  8486. case 0:
  8487. val = sto.applyStore("val");
  8488. value = val.get();
  8489. _context4.t0 = val.type.ord;
  8490. _context4.next = _context4.t0 === _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.REAL.ord ? 5 : _context4.t0 === _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.CHAR.ord ? 10 : _context4.t0 === _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING.ord ? 14 : 26;
  8491. break;
  8492. case 5:
  8493. value = value.toNumber();
  8494. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toInt(Math.floor(value)));
  8495. sto.insertStore("$", temp);
  8496. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
  8497. return _context4.abrupt("return", sto);
  8498. case 10:
  8499. _temp2 = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toInt(value.charCodeAt(0)));
  8500. sto.insertStore("$", _temp2);
  8501. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
  8502. return _context4.abrupt("return", sto);
  8503. case 14:
  8504. parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_5__.IVProgParser.createParser(value);
  8505. _context4.prev = 15;
  8506. result = parser.parseTerm();
  8507. if (!(result instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.IntLiteral)) {
  8508. _context4.next = 22;
  8509. break;
  8510. }
  8511. _temp3 = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toInt(result.value));
  8512. sto.insertStore("$", _temp3);
  8513. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
  8514. return _context4.abrupt("return", sto);
  8515. case 22:
  8516. _context4.next = 26;
  8517. break;
  8518. case 24:
  8519. _context4.prev = 24;
  8520. _context4.t1 = _context4["catch"](15);
  8521. case 26:
  8522. typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER.stringInfo();
  8523. typeInfo = typeStringInfoArray[0];
  8524. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_9__.ProcessorErrorFactory.invalid_type_conversion(value, typeInfo.type, typeInfo.dim);
  8525. case 29:
  8526. case "end":
  8527. return _context4.stop();
  8528. }
  8529. }
  8530. }, _callee4, null, [[15, 24]]);
  8531. }));
  8532. return function castIntFun(_x7, _x8) {
  8533. return _ref4.apply(this, arguments);
  8534. };
  8535. }();
  8536. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(castIntFun)]);
  8537. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function("$castInt", _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_8__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.REAL, _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.CHAR]), "val", false)], block);
  8538. return func;
  8539. }
  8540. function createCastBoolFun() {
  8541. var castBoolFun = /*#__PURE__*/function () {
  8542. var _ref5 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee5(sto, _) {
  8543. var str, value, parser, val, temp, typeStringInfoArray, typeInfo;
  8544. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee5$(_context5) {
  8545. while (1) {
  8546. switch (_context5.prev = _context5.next) {
  8547. case 0:
  8548. str = sto.applyStore("str");
  8549. value = str.get();
  8550. parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_5__.IVProgParser.createParser(value);
  8551. _context5.prev = 3;
  8552. val = parser.parseTerm();
  8553. if (!(val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.BoolLiteral)) {
  8554. _context5.next = 10;
  8555. break;
  8556. }
  8557. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.BOOLEAN, val.value);
  8558. sto.insertStore("$", temp);
  8559. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
  8560. return _context5.abrupt("return", sto);
  8561. case 10:
  8562. _context5.next = 14;
  8563. break;
  8564. case 12:
  8565. _context5.prev = 12;
  8566. _context5.t0 = _context5["catch"](3);
  8567. case 14:
  8568. typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.BOOLEAN.stringInfo();
  8569. typeInfo = typeStringInfoArray[0];
  8570. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_9__.ProcessorErrorFactory.invalid_type_conversion(value, typeInfo.type, typeInfo.dim);
  8571. case 17:
  8572. case "end":
  8573. return _context5.stop();
  8574. }
  8575. }
  8576. }, _callee5, null, [[3, 12]]);
  8577. }));
  8578. return function castBoolFun(_x9, _x10) {
  8579. return _ref5.apply(this, arguments);
  8580. };
  8581. }();
  8582. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(castBoolFun)]);
  8583. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function("$castBool", _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, "str", false)], block);
  8584. return func;
  8585. }
  8586. function createCastStringFun() {
  8587. var castStringFun = /*#__PURE__*/function () {
  8588. var _ref6 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee6(store, _) {
  8589. var val, result, temp;
  8590. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee6$(_context6) {
  8591. while (1) {
  8592. switch (_context6.prev = _context6.next) {
  8593. case 0:
  8594. val = store.applyStore("str");
  8595. result = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.convertToString(val.get(), val.type);
  8596. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, result);
  8597. store.insertStore("$", temp);
  8598. store.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
  8599. return _context6.abrupt("return", store);
  8600. case 6:
  8601. case "end":
  8602. return _context6.stop();
  8603. }
  8604. }
  8605. }, _callee6);
  8606. }));
  8607. return function castStringFun(_x11, _x12) {
  8608. return _ref6.apply(this, arguments);
  8609. };
  8610. }();
  8611. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(castStringFun)]);
  8612. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function("$castString", _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.ALL, "str", false)], block);
  8613. return func;
  8614. }
  8615. function createCastCharFun() {
  8616. var castCharFun = function castCharFun(store, _) {
  8617. var valSV = store.applyStore("charCode"); // Force the int value to the range [0, 255]
  8618. var value = valSV.get().toNumber() & 0xff;
  8619. var result = String.fromCharCode(value);
  8620. var temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.CHAR, result);
  8621. store.insertStore("$", temp);
  8622. store.mode = _modes__WEBPACK_IMPORTED_MODULE_7__.Modes.RETURN;
  8623. return store;
  8624. };
  8625. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(castCharFun)]);
  8626. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function("$castChar", _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.CHAR, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, "charCode", false)], block);
  8627. return func;
  8628. }
  8629. /***/ }),
  8630. /***/ "./js/processor/lib/math.js":
  8631. /*!**********************************!*\
  8632. !*** ./js/processor/lib/math.js ***!
  8633. \**********************************/
  8634. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  8635. "use strict";
  8636. __webpack_require__.r(__webpack_exports__);
  8637. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  8638. /* harmony export */ "createSinFun": () => (/* binding */ createSinFun),
  8639. /* harmony export */ "createCosFun": () => (/* binding */ createCosFun),
  8640. /* harmony export */ "createTanFun": () => (/* binding */ createTanFun),
  8641. /* harmony export */ "createSqrtFun": () => (/* binding */ createSqrtFun),
  8642. /* harmony export */ "createPowFun": () => (/* binding */ createPowFun),
  8643. /* harmony export */ "createLogFun": () => (/* binding */ createLogFun),
  8644. /* harmony export */ "createAbsFun": () => (/* binding */ createAbsFun),
  8645. /* harmony export */ "createNegateFun": () => (/* binding */ createNegateFun),
  8646. /* harmony export */ "createInvertFun": () => (/* binding */ createInvertFun),
  8647. /* harmony export */ "createMaxFun": () => (/* binding */ createMaxFun),
  8648. /* harmony export */ "createMinFun": () => (/* binding */ createMinFun),
  8649. /* harmony export */ "createRandFun": () => (/* binding */ createRandFun),
  8650. /* harmony export */ "createSetSeedFun": () => (/* binding */ createSetSeedFun)
  8651. /* harmony export */ });
  8652. /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
  8653. /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__);
  8654. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
  8655. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__);
  8656. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
  8657. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__);
  8658. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8659. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
  8660. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8661. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8662. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_6__);
  8663. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.ts");
  8664. /* harmony import */ var _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
  8665. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.ts");
  8666. /* harmony import */ var _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../store/value/store_value */ "./js/processor/store/value/store_value.ts");
  8667. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8668. /**
  8669. * sin
  8670. * cos
  8671. * tan
  8672. * sqrt
  8673. * pow
  8674. * log
  8675. * abs
  8676. * negate
  8677. * invert
  8678. * max
  8679. * min
  8680. */
  8681. function convertToRadians(degrees) {
  8682. return degrees.times(decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal.acos(-1)).div(180);
  8683. }
  8684. function createSinFun() {
  8685. var sinFun = /*#__PURE__*/function () {
  8686. var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee(sto, _) {
  8687. var x, angle, result, temp;
  8688. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee$(_context) {
  8689. while (1) {
  8690. switch (_context.prev = _context.next) {
  8691. case 0:
  8692. x = sto.applyStore('x');
  8693. angle = x.get().mod(360);
  8694. result = null;
  8695. if (angle.eq(90)) {
  8696. result = new decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal(1);
  8697. } else if (angle.eq(180)) {
  8698. result = new decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal(0);
  8699. } else if (angle.eq(270)) {
  8700. result = new decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal(-1);
  8701. } else {
  8702. result = decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal.sin(convertToRadians(angle));
  8703. }
  8704. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, result);
  8705. sto.insertStore("$", temp);
  8706. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
  8707. return _context.abrupt("return", sto);
  8708. case 8:
  8709. case "end":
  8710. return _context.stop();
  8711. }
  8712. }
  8713. }, _callee);
  8714. }));
  8715. return function sinFun(_x, _x2) {
  8716. return _ref.apply(this, arguments);
  8717. };
  8718. }();
  8719. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(sinFun)]);
  8720. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.Function("$sin", _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.FormalParameter(new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), "x", false)], block);
  8721. return func;
  8722. }
  8723. function createCosFun() {
  8724. var cosFun = /*#__PURE__*/function () {
  8725. var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee2(sto, _) {
  8726. var x, angle, result, temp;
  8727. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee2$(_context2) {
  8728. while (1) {
  8729. switch (_context2.prev = _context2.next) {
  8730. case 0:
  8731. x = sto.applyStore('x');
  8732. angle = x.get().mod(360);
  8733. result = null;
  8734. if (angle.eq(90)) {
  8735. result = new decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal(0);
  8736. } else if (angle.eq(180)) {
  8737. result = new decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal(-1);
  8738. } else if (angle.eq(270)) {
  8739. result = new decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal(0);
  8740. }
  8741. result = decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal.cos(convertToRadians(angle));
  8742. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, result);
  8743. sto.insertStore("$", temp);
  8744. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
  8745. return _context2.abrupt("return", sto);
  8746. case 9:
  8747. case "end":
  8748. return _context2.stop();
  8749. }
  8750. }
  8751. }, _callee2);
  8752. }));
  8753. return function cosFun(_x3, _x4) {
  8754. return _ref2.apply(this, arguments);
  8755. };
  8756. }();
  8757. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(cosFun)]);
  8758. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.Function("$cos", _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.FormalParameter(new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), "x", false)], block);
  8759. return func;
  8760. }
  8761. function createTanFun() {
  8762. var tanFun = /*#__PURE__*/function () {
  8763. var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee3(sto, _) {
  8764. var x, angle, result, temp;
  8765. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee3$(_context3) {
  8766. while (1) {
  8767. switch (_context3.prev = _context3.next) {
  8768. case 0:
  8769. x = sto.applyStore('x');
  8770. angle = x.get().mod(360);
  8771. if (!(angle.eq(90) || angle.eq(270))) {
  8772. _context3.next = 4;
  8773. break;
  8774. }
  8775. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_11__.ProcessorErrorFactory.undefined_tanget_value(x.get().toNumber(), this.function_call_stack.pop());
  8776. case 4:
  8777. result = decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal.tan(convertToRadians(angle));
  8778. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, result);
  8779. sto.insertStore("$", temp);
  8780. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
  8781. return _context3.abrupt("return", sto);
  8782. case 9:
  8783. case "end":
  8784. return _context3.stop();
  8785. }
  8786. }
  8787. }, _callee3, this);
  8788. }));
  8789. return function tanFun(_x5, _x6) {
  8790. return _ref3.apply(this, arguments);
  8791. };
  8792. }();
  8793. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(tanFun)]);
  8794. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.Function("$tan", _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.FormalParameter(new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), "x", false)], block);
  8795. return func;
  8796. }
  8797. function createSqrtFun() {
  8798. var sqrtFun = /*#__PURE__*/function () {
  8799. var _ref4 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee4(sto, _) {
  8800. var x, result, temp;
  8801. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee4$(_context4) {
  8802. while (1) {
  8803. switch (_context4.prev = _context4.next) {
  8804. case 0:
  8805. x = sto.applyStore('x');
  8806. if (!x.get().isNeg()) {
  8807. _context4.next = 3;
  8808. break;
  8809. }
  8810. return _context4.abrupt("return", Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_11__.ProcessorErrorFactory.negative_sqrt_value(this.function_call_stack.pop())));
  8811. case 3:
  8812. result = x.get().sqrt();
  8813. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, result);
  8814. sto.insertStore("$", temp);
  8815. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
  8816. return _context4.abrupt("return", sto);
  8817. case 8:
  8818. case "end":
  8819. return _context4.stop();
  8820. }
  8821. }
  8822. }, _callee4, this);
  8823. }));
  8824. return function sqrtFun(_x7, _x8) {
  8825. return _ref4.apply(this, arguments);
  8826. };
  8827. }();
  8828. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(sqrtFun)]);
  8829. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.Function("$sqrt", _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.FormalParameter(new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), "x", false)], block);
  8830. return func;
  8831. }
  8832. function createPowFun() {
  8833. var powFun = /*#__PURE__*/function () {
  8834. var _ref5 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee5(sto, _) {
  8835. var x, y, result, temp;
  8836. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee5$(_context5) {
  8837. while (1) {
  8838. switch (_context5.prev = _context5.next) {
  8839. case 0:
  8840. x = sto.applyStore('x');
  8841. y = sto.applyStore('y');
  8842. result = x.get().pow(y.get());
  8843. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, result);
  8844. sto.insertStore("$", temp);
  8845. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
  8846. return _context5.abrupt("return", sto);
  8847. case 7:
  8848. case "end":
  8849. return _context5.stop();
  8850. }
  8851. }
  8852. }, _callee5);
  8853. }));
  8854. return function powFun(_x9, _x10) {
  8855. return _ref5.apply(this, arguments);
  8856. };
  8857. }();
  8858. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(powFun)]);
  8859. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.Function("$pow", _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.FormalParameter(new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), "x", false), new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.FormalParameter(new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), "y", false)], block);
  8860. return func;
  8861. }
  8862. function createLogFun() {
  8863. var logFun = /*#__PURE__*/function () {
  8864. var _ref6 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee6(sto, _) {
  8865. var x, result, temp;
  8866. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee6$(_context6) {
  8867. while (1) {
  8868. switch (_context6.prev = _context6.next) {
  8869. case 0:
  8870. x = sto.applyStore('x');
  8871. if (!x.get().isNegative()) {
  8872. _context6.next = 3;
  8873. break;
  8874. }
  8875. return _context6.abrupt("return", Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_11__.ProcessorErrorFactory.negative_log_value(this.function_call_stack.pop())));
  8876. case 3:
  8877. result = decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal.log10(x.get());
  8878. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, result);
  8879. sto.insertStore("$", temp);
  8880. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
  8881. return _context6.abrupt("return", sto);
  8882. case 8:
  8883. case "end":
  8884. return _context6.stop();
  8885. }
  8886. }
  8887. }, _callee6, this);
  8888. }));
  8889. return function logFun(_x11, _x12) {
  8890. return _ref6.apply(this, arguments);
  8891. };
  8892. }();
  8893. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(logFun)]);
  8894. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.Function("$log", _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.FormalParameter(new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), "x", false)], block);
  8895. return func;
  8896. }
  8897. function createAbsFun() {
  8898. var absFun = /*#__PURE__*/function () {
  8899. var _ref7 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee7(sto, _) {
  8900. var x, result, temp;
  8901. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee7$(_context7) {
  8902. while (1) {
  8903. switch (_context7.prev = _context7.next) {
  8904. case 0:
  8905. x = sto.applyStore('x');
  8906. result = x.get().abs();
  8907. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(x.type, result);
  8908. sto.insertStore("$", temp);
  8909. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
  8910. return _context7.abrupt("return", sto);
  8911. case 6:
  8912. case "end":
  8913. return _context7.stop();
  8914. }
  8915. }
  8916. }, _callee7);
  8917. }));
  8918. return function absFun(_x13, _x14) {
  8919. return _ref7.apply(this, arguments);
  8920. };
  8921. }();
  8922. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(absFun)]);
  8923. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.Function("$abs", new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.FormalParameter(new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), "x", false)], block);
  8924. return func;
  8925. }
  8926. function createNegateFun() {
  8927. var negateFun = /*#__PURE__*/function () {
  8928. var _ref8 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee8(sto, _) {
  8929. var x, result, temp;
  8930. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee8$(_context8) {
  8931. while (1) {
  8932. switch (_context8.prev = _context8.next) {
  8933. case 0:
  8934. x = sto.applyStore('x');
  8935. result = x.get().negated();
  8936. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(x.type, result);
  8937. sto.insertStore("$", temp);
  8938. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
  8939. return _context8.abrupt("return", sto);
  8940. case 6:
  8941. case "end":
  8942. return _context8.stop();
  8943. }
  8944. }
  8945. }, _callee8);
  8946. }));
  8947. return function negateFun(_x15, _x16) {
  8948. return _ref8.apply(this, arguments);
  8949. };
  8950. }();
  8951. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(negateFun)]);
  8952. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.Function("$negate", new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.FormalParameter(new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), "x", false)], block);
  8953. return func;
  8954. }
  8955. function createInvertFun() {
  8956. var invertFun = /*#__PURE__*/function () {
  8957. var _ref9 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee9(sto, _) {
  8958. var x, result, temp;
  8959. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee9$(_context9) {
  8960. while (1) {
  8961. switch (_context9.prev = _context9.next) {
  8962. case 0:
  8963. x = sto.applyStore('x');
  8964. result = _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_5__.toReal(1).dividedBy(x.get());
  8965. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, result);
  8966. sto.insertStore("$", temp);
  8967. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
  8968. return _context9.abrupt("return", sto);
  8969. case 6:
  8970. case "end":
  8971. return _context9.stop();
  8972. }
  8973. }
  8974. }, _callee9);
  8975. }));
  8976. return function invertFun(_x17, _x18) {
  8977. return _ref9.apply(this, arguments);
  8978. };
  8979. }();
  8980. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(invertFun)]);
  8981. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.Function("$invert", _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.FormalParameter(new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), "x", false)], block);
  8982. return func;
  8983. }
  8984. function createMaxFun() {
  8985. var maxFun = /*#__PURE__*/function () {
  8986. var _ref10 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee10(sto, _) {
  8987. var x, numbers, result, temp;
  8988. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee10$(_context10) {
  8989. while (1) {
  8990. switch (_context10.prev = _context10.next) {
  8991. case 0:
  8992. x = sto.applyStore('x');
  8993. numbers = x.get().map(function (sto_addrs) {
  8994. return sto_addrs.get();
  8995. });
  8996. result = decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal.max.apply(decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal, _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(numbers));
  8997. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(x.type.innerType, result);
  8998. sto.insertStore("$", temp);
  8999. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
  9000. return _context10.abrupt("return", sto);
  9001. case 7:
  9002. case "end":
  9003. return _context10.stop();
  9004. }
  9005. }
  9006. }, _callee10);
  9007. }));
  9008. return function maxFun(_x19, _x20) {
  9009. return _ref10.apply(this, arguments);
  9010. };
  9011. }();
  9012. var paramType = new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_8__.ArrayType(new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), 1);
  9013. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(maxFun)]);
  9014. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.Function("$max", new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.FormalParameter(paramType, "x", false)], block);
  9015. return func;
  9016. }
  9017. function createMinFun() {
  9018. var minFun = /*#__PURE__*/function () {
  9019. var _ref11 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee11(sto, _) {
  9020. var x, numbers, result, temp;
  9021. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee11$(_context11) {
  9022. while (1) {
  9023. switch (_context11.prev = _context11.next) {
  9024. case 0:
  9025. x = sto.applyStore('x');
  9026. numbers = x.get().map(function (sto_addrs) {
  9027. return sto_addrs.get();
  9028. });
  9029. result = decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal.min.apply(decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal, _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(numbers));
  9030. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(x.type.innerType, result);
  9031. sto.insertStore("$", temp);
  9032. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
  9033. return _context11.abrupt("return", sto);
  9034. case 7:
  9035. case "end":
  9036. return _context11.stop();
  9037. }
  9038. }
  9039. }, _callee11);
  9040. }));
  9041. return function minFun(_x21, _x22) {
  9042. return _ref11.apply(this, arguments);
  9043. };
  9044. }();
  9045. var paramType = new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_8__.ArrayType(new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), 1);
  9046. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(minFun)]);
  9047. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.Function("$min", new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__.MultiType([_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.FormalParameter(paramType, "x", false)], block);
  9048. return func;
  9049. }
  9050. var seed = Date.now();
  9051. function createRandFun() {
  9052. var a = 16807;
  9053. var m = 2147483647;
  9054. var c = 12345;
  9055. var randFun = /*#__PURE__*/function () {
  9056. var _ref12 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee12(sto, _) {
  9057. var val, temp;
  9058. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee12$(_context12) {
  9059. while (1) {
  9060. switch (_context12.prev = _context12.next) {
  9061. case 0:
  9062. seed = (a * seed + c) % m;
  9063. val = seed / (m - 1);
  9064. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_10__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, new decimal_js__WEBPACK_IMPORTED_MODULE_6__.Decimal(val));
  9065. sto.insertStore("$", temp);
  9066. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
  9067. return _context12.abrupt("return", sto);
  9068. case 6:
  9069. case "end":
  9070. return _context12.stop();
  9071. }
  9072. }
  9073. }, _callee12);
  9074. }));
  9075. return function randFun(_x23, _x24) {
  9076. return _ref12.apply(this, arguments);
  9077. };
  9078. }();
  9079. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(randFun)]);
  9080. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.Function("$rand", _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.REAL, [], block);
  9081. return func;
  9082. }
  9083. function createSetSeedFun() {
  9084. var setSeedFun = /*#__PURE__*/function () {
  9085. var _ref13 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee13(sto, _) {
  9086. var value;
  9087. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee13$(_context13) {
  9088. while (1) {
  9089. switch (_context13.prev = _context13.next) {
  9090. case 0:
  9091. value = sto.applyStore("x");
  9092. seed = value.get().toNumber();
  9093. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_9__.Modes.RETURN;
  9094. return _context13.abrupt("return", sto);
  9095. case 4:
  9096. case "end":
  9097. return _context13.stop();
  9098. }
  9099. }
  9100. }, _callee13);
  9101. }));
  9102. return function setSeedFun(_x25, _x26) {
  9103. return _ref13.apply(this, arguments);
  9104. };
  9105. }();
  9106. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.SysCall(setSeedFun)]);
  9107. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.Function("$setSeed", _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.VOID, [new _ast_commands__WEBPACK_IMPORTED_MODULE_3__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__.Types.INTEGER, "x", false)], block);
  9108. return func;
  9109. }
  9110. /***/ }),
  9111. /***/ "./js/processor/lib/strings.js":
  9112. /*!*************************************!*\
  9113. !*** ./js/processor/lib/strings.js ***!
  9114. \*************************************/
  9115. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  9116. "use strict";
  9117. __webpack_require__.r(__webpack_exports__);
  9118. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  9119. /* harmony export */ "createSubstringFun": () => (/* binding */ createSubstringFun),
  9120. /* harmony export */ "createLengthFun": () => (/* binding */ createLengthFun),
  9121. /* harmony export */ "createUppercaseFun": () => (/* binding */ createUppercaseFun),
  9122. /* harmony export */ "createLowercaseFun": () => (/* binding */ createLowercaseFun),
  9123. /* harmony export */ "createrCharAtFun": () => (/* binding */ createrCharAtFun)
  9124. /* harmony export */ });
  9125. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
  9126. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
  9127. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
  9128. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
  9129. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  9130. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.ts");
  9131. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  9132. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.ts");
  9133. /* harmony import */ var _store_value_store_value__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../store/value/store_value */ "./js/processor/store/value/store_value.ts");
  9134. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  9135. /*
  9136. * substring
  9137. * length
  9138. * uppercase
  9139. * lowercase
  9140. * charAt
  9141. **/
  9142. function createSubstringFun() {
  9143. var substringFun = /*#__PURE__*/function () {
  9144. var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(sto, _) {
  9145. var str, start, end, result, temp;
  9146. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
  9147. while (1) {
  9148. switch (_context.prev = _context.next) {
  9149. case 0:
  9150. str = sto.applyStore("str");
  9151. start = sto.applyStore("start");
  9152. end = sto.applyStore("end");
  9153. result = str.get().substring(start.get(), end.get());
  9154. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_6__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, result);
  9155. sto.insertStore("$", temp);
  9156. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__.Modes.RETURN;
  9157. return _context.abrupt("return", sto);
  9158. case 8:
  9159. case "end":
  9160. return _context.stop();
  9161. }
  9162. }
  9163. }, _callee);
  9164. }));
  9165. return function substringFun(_x, _x2) {
  9166. return _ref.apply(this, arguments);
  9167. };
  9168. }();
  9169. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(substringFun)]);
  9170. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function('$substring', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, 'str', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, 'start', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, 'end', false)], block);
  9171. return func;
  9172. }
  9173. function createLengthFun() {
  9174. var lengthFun = /*#__PURE__*/function () {
  9175. var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2(sto, _) {
  9176. var str, temp;
  9177. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) {
  9178. while (1) {
  9179. switch (_context2.prev = _context2.next) {
  9180. case 0:
  9181. str = sto.applyStore("str");
  9182. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_6__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.toInt)(str.value.length));
  9183. sto.insertStore("$", temp);
  9184. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__.Modes.RETURN;
  9185. return _context2.abrupt("return", sto);
  9186. case 5:
  9187. case "end":
  9188. return _context2.stop();
  9189. }
  9190. }
  9191. }, _callee2);
  9192. }));
  9193. return function lengthFun(_x3, _x4) {
  9194. return _ref2.apply(this, arguments);
  9195. };
  9196. }();
  9197. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(lengthFun)]);
  9198. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function('$length', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, 'str', false)], block);
  9199. return func;
  9200. }
  9201. function createUppercaseFun() {
  9202. var uppercaseFun = /*#__PURE__*/function () {
  9203. var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee3(sto, _) {
  9204. var str, temp;
  9205. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee3$(_context3) {
  9206. while (1) {
  9207. switch (_context3.prev = _context3.next) {
  9208. case 0:
  9209. str = sto.applyStore("str");
  9210. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_6__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, str.get().toUpperCase());
  9211. sto.insertStore("$", temp);
  9212. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__.Modes.RETURN;
  9213. return _context3.abrupt("return", sto);
  9214. case 5:
  9215. case "end":
  9216. return _context3.stop();
  9217. }
  9218. }
  9219. }, _callee3);
  9220. }));
  9221. return function uppercaseFun(_x5, _x6) {
  9222. return _ref3.apply(this, arguments);
  9223. };
  9224. }();
  9225. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(uppercaseFun)]);
  9226. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function('$uppercase', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, 'str', false)], block);
  9227. return func;
  9228. }
  9229. function createLowercaseFun() {
  9230. var lowercaseFun = /*#__PURE__*/function () {
  9231. var _ref4 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee4(sto, _) {
  9232. var str, temp;
  9233. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee4$(_context4) {
  9234. while (1) {
  9235. switch (_context4.prev = _context4.next) {
  9236. case 0:
  9237. str = sto.applyStore("str");
  9238. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_6__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, str.get().toLowerCase());
  9239. sto.insertStore("$", temp);
  9240. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__.Modes.RETURN;
  9241. return _context4.abrupt("return", sto);
  9242. case 5:
  9243. case "end":
  9244. return _context4.stop();
  9245. }
  9246. }
  9247. }, _callee4);
  9248. }));
  9249. return function lowercaseFun(_x7, _x8) {
  9250. return _ref4.apply(this, arguments);
  9251. };
  9252. }();
  9253. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(lowercaseFun)]);
  9254. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function('$lowercase', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, 'str', false)], block);
  9255. return func;
  9256. }
  9257. function createrCharAtFun() {
  9258. var charAtFun = /*#__PURE__*/function () {
  9259. var _ref5 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee5(sto, _) {
  9260. var str, idx, temp;
  9261. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee5$(_context5) {
  9262. while (1) {
  9263. switch (_context5.prev = _context5.next) {
  9264. case 0:
  9265. str = sto.applyStore("str");
  9266. idx = sto.applyStore("index");
  9267. if (!(idx.get().toNumber() < 0 || idx.get().toNumber() >= str.get().length)) {
  9268. _context5.next = 4;
  9269. break;
  9270. }
  9271. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_7__.ProcessorErrorFactory.invalid_string_index(idx.get().toNumber(), str.get(), this.function_call_stack.pop());
  9272. case 4:
  9273. temp = new _store_value_store_value__WEBPACK_IMPORTED_MODULE_6__.StoreValue(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.CHAR, str.get().charAt(idx.get().toNumber()));
  9274. sto.insertStore("$", temp);
  9275. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__.Modes.RETURN;
  9276. return _context5.abrupt("return", sto);
  9277. case 8:
  9278. case "end":
  9279. return _context5.stop();
  9280. }
  9281. }
  9282. }, _callee5, this);
  9283. }));
  9284. return function charAtFun(_x9, _x10) {
  9285. return _ref5.apply(this, arguments);
  9286. };
  9287. }();
  9288. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.CommandBlock([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.SysCall(charAtFun)]);
  9289. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.Function('$charAt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.CHAR, [new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.STRING, 'str', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_2__.FormalParameter(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.INTEGER, 'index', false)], block);
  9290. return func;
  9291. }
  9292. /***/ }),
  9293. /***/ "./js/processor/semantic/semanticAnalyser.js":
  9294. /*!***************************************************!*\
  9295. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  9296. \***************************************************/
  9297. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  9298. "use strict";
  9299. __webpack_require__.r(__webpack_exports__);
  9300. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  9301. /* harmony export */ "SemanticAnalyser": () => (/* binding */ SemanticAnalyser)
  9302. /* harmony export */ });
  9303. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  9304. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  9305. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  9306. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  9307. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  9308. /* harmony import */ var _definedFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  9309. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  9310. /* harmony import */ var _ast_expressions_expression__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../../ast/expressions/expression */ "./js/ast/expressions/expression.js");
  9311. /* harmony import */ var _ast_expressions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  9312. /* harmony import */ var _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  9313. /* harmony import */ var _compatibilityTable__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.ts");
  9314. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.ts");
  9315. /* harmony import */ var _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
  9316. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.ts");
  9317. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../util/config */ "./js/util/config.ts");
  9318. /* harmony import */ var _store_store__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../store/store */ "./js/processor/store/store.ts");
  9319. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  9320. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  9321. var SemanticAnalyser = /*#__PURE__*/function () {
  9322. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(SemanticAnalyser, null, [{
  9323. key: "analyseFromSource",
  9324. value: function analyseFromSource(stringCode) {
  9325. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_14__.IVProgParser.createParser(stringCode);
  9326. var semantic = new SemanticAnalyser(parser.parseTree());
  9327. return semantic.analyseTree();
  9328. }
  9329. }]);
  9330. function SemanticAnalyser(ast) {
  9331. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, SemanticAnalyser);
  9332. this.ast = ast;
  9333. this.symbolMap = null;
  9334. this.currentFunction = null;
  9335. }
  9336. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(SemanticAnalyser, [{
  9337. key: "pushMap",
  9338. value: function pushMap() {
  9339. if (this.symbolMap === null) {
  9340. this.symbolMap = {
  9341. map: {},
  9342. next: null
  9343. };
  9344. } else {
  9345. var n = {
  9346. map: {},
  9347. next: this.symbolMap
  9348. };
  9349. this.symbolMap = n;
  9350. }
  9351. }
  9352. }, {
  9353. key: "popMap",
  9354. value: function popMap() {
  9355. if (this.symbolMap !== null) {
  9356. this.symbolMap = this.symbolMap.next;
  9357. }
  9358. }
  9359. }, {
  9360. key: "insertSymbol",
  9361. value: function insertSymbol(id, typeInfo) {
  9362. this.symbolMap.map[id] = typeInfo;
  9363. }
  9364. }, {
  9365. key: "findSymbol",
  9366. value: function findSymbol(id, symbol_map) {
  9367. if (!symbol_map.map[id]) {
  9368. if (symbol_map.next) {
  9369. return this.findSymbol(id, symbol_map.next);
  9370. }
  9371. return null;
  9372. } else {
  9373. return symbol_map.map[id];
  9374. }
  9375. }
  9376. }, {
  9377. key: "getMainFunction",
  9378. value: function getMainFunction() {
  9379. return this.ast.functions.find(function (v) {
  9380. return v.isMain;
  9381. });
  9382. }
  9383. }, {
  9384. key: "findFunction",
  9385. value: function findFunction(name) {
  9386. if (name.match(/^\$.+$/)) {
  9387. var fun = _definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getFunction(name);
  9388. if (!fun) {
  9389. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.not_implemented(name);
  9390. }
  9391. return fun;
  9392. } else {
  9393. var val = this.ast.functions.find(function (v) {
  9394. return v.name === name;
  9395. });
  9396. if (!val) {
  9397. return null;
  9398. }
  9399. return val;
  9400. }
  9401. }
  9402. }, {
  9403. key: "analyseTree",
  9404. value: function analyseTree() {
  9405. var globalVars = this.ast.global;
  9406. this.pushMap();
  9407. this.assertDeclarations(globalVars);
  9408. var functions = this.ast.functions;
  9409. var mainFunc = functions.filter(function (f) {
  9410. return f.name === null;
  9411. });
  9412. if (mainFunc.length <= 0) {
  9413. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.main_missing();
  9414. }
  9415. for (var i = 0; i < functions.length; i++) {
  9416. var fun = functions[i];
  9417. this.assertFunction(fun);
  9418. }
  9419. return this.ast;
  9420. }
  9421. }, {
  9422. key: "assertDeclarations",
  9423. value: function assertDeclarations(list) {
  9424. for (var i = 0; i < list.length; i++) {
  9425. this.assertDeclaration(list[i]);
  9426. }
  9427. }
  9428. }, {
  9429. key: "assertDeclaration",
  9430. value: function assertDeclaration(declaration) {
  9431. if (declaration instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.ArrayDeclaration) {
  9432. this.assertArrayDeclaration(declaration);
  9433. this.insertSymbol(declaration.id, {
  9434. id: declaration.id,
  9435. lines: declaration.lines,
  9436. columns: declaration.columns,
  9437. type: declaration.type,
  9438. isConst: declaration.isConst
  9439. });
  9440. } else {
  9441. if (declaration.initial === null) {
  9442. this.insertSymbol(declaration.id, {
  9443. id: declaration.id,
  9444. type: declaration.type,
  9445. isConst: declaration.isConst
  9446. });
  9447. return;
  9448. }
  9449. var resultType = this.evaluateExpressionType(declaration.initial);
  9450. if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_11__.MultiType) {
  9451. if (!resultType.isCompatible(declaration.type)) {
  9452. var stringInfo = declaration.type.stringInfo();
  9453. var info = stringInfo[0];
  9454. var result_string_info = resultType.stringInfo();
  9455. var result_info = result_string_info[0];
  9456. var exp = declaration.initial;
  9457. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, result_info.type, result_info.dim, exp.toString(), declaration.sourceInfo);
  9458. }
  9459. this.insertSymbol(declaration.id, {
  9460. id: declaration.id,
  9461. type: declaration.type,
  9462. isConst: declaration.isConst
  9463. });
  9464. } else if (!declaration.type.isCompatible(resultType) && !_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting || !declaration.type.isCompatible(resultType) && _util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting && !_store_store__WEBPACK_IMPORTED_MODULE_13__.Store.canImplicitTypeCast(declaration.type, resultType)) {
  9465. var _stringInfo = declaration.type.stringInfo();
  9466. var _info = _stringInfo[0];
  9467. var _result_string_info = resultType.stringInfo();
  9468. var _result_info = _result_string_info[0];
  9469. var _exp = declaration.initial;
  9470. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.incompatible_types_full(_info.type, _info.dim, _result_info.type, _result_info.dim, _exp.toString(), declaration.sourceInfo);
  9471. } else {
  9472. this.insertSymbol(declaration.id, {
  9473. id: declaration.id,
  9474. type: declaration.type,
  9475. isConst: declaration.isConst
  9476. });
  9477. }
  9478. }
  9479. }
  9480. }, {
  9481. key: "assertArrayDeclaration",
  9482. value: function assertArrayDeclaration(declaration) {
  9483. if (declaration.initial === null) {
  9484. var lineType = this.evaluateExpressionType(declaration.lines);
  9485. if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
  9486. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  9487. }
  9488. if (declaration.columns !== null) {
  9489. var columnType = this.evaluateExpressionType(declaration.columns);
  9490. if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
  9491. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  9492. }
  9493. }
  9494. } else {
  9495. this.evaluateArrayLiteral(declaration);
  9496. }
  9497. this.insertSymbol(declaration.id, {
  9498. id: declaration.id,
  9499. lines: declaration.lines,
  9500. columns: declaration.columns,
  9501. type: declaration.type
  9502. });
  9503. return;
  9504. }
  9505. }, {
  9506. key: "evaluateExpressionType",
  9507. value: function evaluateExpressionType(expression) {
  9508. // TODO: Throw operator error in case type == UNDEFINED
  9509. if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.UnaryApp) {
  9510. var op = expression.op;
  9511. var resultType = this.evaluateExpressionType(expression.left);
  9512. var finalResult = (0,_compatibilityTable__WEBPACK_IMPORTED_MODULE_8__.resultTypeAfterUnaryOp)(op, resultType);
  9513. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.UNDEFINED.isCompatible(finalResult)) {
  9514. var stringInfo = resultType.stringInfo();
  9515. var info = stringInfo[0];
  9516. var expString = expression.toString();
  9517. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_unary_op_full(expString, op, info.type, info.dim, expression.sourceInfo);
  9518. }
  9519. return finalResult;
  9520. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.InfixApp) {
  9521. var _op = expression.op;
  9522. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  9523. var resultTypeRight = this.evaluateExpressionType(expression.right);
  9524. var _finalResult = (0,_compatibilityTable__WEBPACK_IMPORTED_MODULE_8__.resultTypeAfterInfixOp)(_op, resultTypeLeft, resultTypeRight);
  9525. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.UNDEFINED.isCompatible(_finalResult)) {
  9526. var stringInfoLeft = resultTypeLeft.stringInfo();
  9527. var infoLeft = stringInfoLeft[0];
  9528. var stringInfoRight = resultTypeRight.stringInfo();
  9529. var infoRight = stringInfoRight[0];
  9530. var _expString = expression.toString();
  9531. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_infix_op_full(_expString, _op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, expression.sourceInfo);
  9532. }
  9533. return _finalResult;
  9534. } else if (expression instanceof _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_7__.Literal) {
  9535. return this.evaluateLiteralType(expression);
  9536. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.FunctionCall) {
  9537. if (expression.isMainCall) {
  9538. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.void_in_expression_full(_definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getMainFunctionName(), expression.sourceInfo);
  9539. }
  9540. var fun = this.findFunction(expression.id);
  9541. if (fun === null) {
  9542. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.function_missing_full(expression.id, expression.sourceInfo);
  9543. }
  9544. if (fun.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.VOID)) {
  9545. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.void_in_expression_full(expression.id, expression.sourceInfo);
  9546. }
  9547. this.assertParameters(fun, expression.actualParameters);
  9548. return fun.returnType;
  9549. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.ArrayAccess) {
  9550. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  9551. if (arrayTypeInfo === null) {
  9552. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.symbol_not_found_full(expression.id, expression.sourceInfo);
  9553. }
  9554. if (!(arrayTypeInfo.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType)) {
  9555. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_array_access_full(expression.id, expression.sourceInfo);
  9556. }
  9557. var lineType = this.evaluateExpressionType(expression.line);
  9558. if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
  9559. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  9560. }
  9561. if (expression.column !== null) {
  9562. if (arrayTypeInfo.columns === null) {
  9563. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_matrix_access_full(expression.id, expression.sourceInfo);
  9564. }
  9565. var columnType = this.evaluateExpressionType(expression.column);
  9566. if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
  9567. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  9568. }
  9569. }
  9570. var arrType = arrayTypeInfo.type;
  9571. if (expression.column !== null) {
  9572. // indexing matrix
  9573. return arrType.innerType;
  9574. } else {
  9575. if (arrayTypeInfo.columns === null) {
  9576. return arrType.innerType;
  9577. }
  9578. return new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType(arrType.innerType, 1);
  9579. }
  9580. }
  9581. }
  9582. }, {
  9583. key: "evaluateLiteralType",
  9584. value: function evaluateLiteralType(literal) {
  9585. if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.IntLiteral) {
  9586. return literal.type;
  9587. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.RealLiteral) {
  9588. return literal.type;
  9589. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.StringLiteral) {
  9590. return literal.type;
  9591. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.BoolLiteral) {
  9592. return literal.type;
  9593. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.CharLiteral) {
  9594. return literal.type;
  9595. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.VariableLiteral) {
  9596. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  9597. if (typeInfo === null) {
  9598. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.symbol_not_found_full(literal.id, literal.sourceInfo);
  9599. }
  9600. if (typeInfo.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType) {
  9601. return typeInfo.type;
  9602. }
  9603. return typeInfo.type;
  9604. } else {
  9605. // console.warn("Evaluating type only for an array literal...");
  9606. var last = null;
  9607. if (literal.value.length === 1) {
  9608. last = this.evaluateExpressionType(literal.value[0]);
  9609. } else {
  9610. for (var i = 0; i < literal.value.length; i++) {
  9611. var e = this.evaluateExpressionType(literal.value[i]);
  9612. if (last === null) {
  9613. last = e;
  9614. } else if (!last.isCompatible(e)) {
  9615. var strInfo = last.stringInfo();
  9616. var info = strInfo[0];
  9617. var strExp = literal.toString();
  9618. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  9619. }
  9620. }
  9621. }
  9622. if (last instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType) {
  9623. return new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType(last.innerType, last.dimensions + 1);
  9624. }
  9625. return new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType(last, 1);
  9626. }
  9627. }
  9628. }, {
  9629. key: "evaluateArrayLiteral",
  9630. value: function evaluateArrayLiteral(arrayDeclaration) {
  9631. var type = arrayDeclaration.type;
  9632. var literal = arrayDeclaration.initial; // console.log(arrayDeclaration);
  9633. if (arrayDeclaration.isVector) {
  9634. this.evaluateVectorLiteralType(literal, type);
  9635. } else {
  9636. // TODO matrix type check
  9637. for (var i = 0; i < literal.lines; ++i) {
  9638. var line_literal = literal.value[i];
  9639. this.evaluateVectorLiteralType(line_literal, new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType(type.innerType, 1));
  9640. }
  9641. }
  9642. return true;
  9643. }
  9644. }, {
  9645. key: "assertFunction",
  9646. value: function assertFunction(fun) {
  9647. var _this = this;
  9648. this.pushMap();
  9649. this.currentFunction = fun;
  9650. fun.formalParameters.forEach(function (formalParam) {
  9651. if (formalParam.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType) {
  9652. if (formalParam.type.dimensions > 1) {
  9653. _this.insertSymbol(formalParam.id, {
  9654. id: formalParam.id,
  9655. lines: -1,
  9656. columns: -1,
  9657. type: formalParam.type
  9658. });
  9659. } else {
  9660. _this.insertSymbol(formalParam.id, {
  9661. id: formalParam.id,
  9662. lines: -1,
  9663. columns: null,
  9664. type: formalParam.type
  9665. });
  9666. }
  9667. } else {
  9668. _this.insertSymbol(formalParam.id, {
  9669. id: formalParam.id,
  9670. type: formalParam.type
  9671. });
  9672. }
  9673. });
  9674. this.assertDeclarations(fun.variablesDeclarations);
  9675. var optional = fun.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.VOID);
  9676. var valid = this.assertReturn(fun, optional);
  9677. if (!valid) {
  9678. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.function_no_return(fun.name);
  9679. }
  9680. this.popMap();
  9681. }
  9682. }, {
  9683. key: "assertReturn",
  9684. value: function assertReturn(fun, optional) {
  9685. var _this2 = this;
  9686. return fun.commands.reduce(function (last, next) {
  9687. return _this2.checkCommand(fun.returnType, next, optional) || last;
  9688. }, optional);
  9689. }
  9690. }, {
  9691. key: "checkCommand",
  9692. value: function checkCommand(type, cmd, optional) {
  9693. if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.While) {
  9694. var resultType = this.evaluateExpressionType(cmd.expression);
  9695. if (!resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.BOOLEAN)) {
  9696. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.loop_condition_type_full(cmd.expression.toString(), cmd.sourceInfo);
  9697. }
  9698. this.checkCommands(type, cmd.commands, optional);
  9699. return false;
  9700. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.For) {
  9701. var var_type = this.evaluateExpressionType(cmd.for_id);
  9702. if (!var_type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
  9703. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_for_variable(cmd.for_id, cmd.sourceInfo);
  9704. }
  9705. var from_type = this.evaluateExpressionType(cmd.for_from);
  9706. if (!from_type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
  9707. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_for_from(cmd.for_from, cmd.sourceInfo);
  9708. }
  9709. var to_type = this.evaluateExpressionType(cmd.for_to);
  9710. if (!to_type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
  9711. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_for_to(cmd.for_to, cmd.sourceInfo);
  9712. }
  9713. if (cmd.for_pass != null) {
  9714. var pass_type = this.evaluateExpressionType(cmd.for_pass);
  9715. if (!pass_type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
  9716. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_for_pass(cmd.for_pass, cmd.sourceInfo);
  9717. }
  9718. }
  9719. this.checkCommands(type, cmd.commands, optional);
  9720. return false;
  9721. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.Switch) {
  9722. var sType = this.evaluateExpressionType(cmd.expression);
  9723. var result = optional;
  9724. var hasDefault = false;
  9725. for (var i = 0; i < cmd.cases.length; i++) {
  9726. var aCase = cmd.cases[i];
  9727. if (aCase.expression !== null) {
  9728. var caseType = this.evaluateExpressionType(aCase.expression);
  9729. if (!sType.isCompatible(caseType)) {
  9730. var strInfo = sType.stringInfo();
  9731. var info = strInfo[0];
  9732. var strExp = aCase.expression.toString();
  9733. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
  9734. }
  9735. } else {
  9736. hasDefault = true;
  9737. }
  9738. result = result && this.checkCommands(type, aCase.commands, result);
  9739. }
  9740. return result && hasDefault;
  9741. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.ArrayIndexAssign) {
  9742. // TODO - rework!!!!!
  9743. var used_dims = 0;
  9744. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9745. if (typeInfo === null) {
  9746. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9747. }
  9748. if (typeInfo.isConst) {
  9749. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_const_assignment_full(cmd.id, cmd.sourceInfo);
  9750. }
  9751. if (!(typeInfo.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType)) {
  9752. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo);
  9753. }
  9754. var exp = cmd.expression;
  9755. var lineExp = cmd.line;
  9756. var lineType = this.evaluateExpressionType(lineExp);
  9757. if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
  9758. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  9759. }
  9760. used_dims += 1;
  9761. var columnExp = cmd.column;
  9762. if (typeInfo.columns === null && columnExp !== null) {
  9763. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
  9764. } else if (columnExp !== null) {
  9765. var columnType = this.evaluateExpressionType(columnExp);
  9766. if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER)) {
  9767. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  9768. }
  9769. used_dims += 1;
  9770. } // exp a single value exp or an array access
  9771. var exp_type = this.evaluateExpressionType(exp);
  9772. var access_type = typeInfo.type;
  9773. var compatible = false;
  9774. var _type = access_type;
  9775. if (exp_type instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_11__.MultiType) {
  9776. if (access_type.dimensions - used_dims == 0) {
  9777. _type = access_type.innerType;
  9778. } else {
  9779. _type = new _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType(access_type.innerType, Math.max(0, access_type.dimensions - used_dims));
  9780. }
  9781. compatible = exp_type.isCompatible(_type);
  9782. } else {
  9783. compatible = access_type.canAccept(exp_type, used_dims);
  9784. }
  9785. if (!compatible) {
  9786. if (0 === access_type.dimensions - used_dims) {
  9787. _type = access_type.innerType; // enable a valid attempt to cast real <--> integer
  9788. }
  9789. if (!_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting || !_store_store__WEBPACK_IMPORTED_MODULE_13__.Store.canImplicitTypeCast(_type, exp_type)) {
  9790. var access_type_string_info = access_type.stringInfo();
  9791. var access_type_info = access_type_string_info[0];
  9792. var exp_type_string_info = exp_type.stringInfo();
  9793. var exp_type_info = exp_type_string_info[0];
  9794. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.incompatible_types_full(access_type_info.type, access_type_info.dim - used_dims, exp_type_info.type, exp_type_info.dim, exp.toString(), cmd.sourceInfo);
  9795. }
  9796. }
  9797. return optional;
  9798. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.Assign) {
  9799. // TODO - rework since there is no literal array assignment
  9800. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9801. if (_typeInfo === null) {
  9802. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9803. }
  9804. if (_typeInfo.isConst) {
  9805. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_const_assignment_full(cmd.id, cmd.sourceInfo);
  9806. }
  9807. var _exp2 = cmd.expression;
  9808. var _exp_type = this.evaluateExpressionType(_exp2);
  9809. if (_exp_type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType) {
  9810. if (!(_typeInfo.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_10__.ArrayType)) {
  9811. // TODO better error message
  9812. throw new Error("Cannot assign an array to a non-array variable ");
  9813. } // Both are arrays...
  9814. // if both don't have same dimensions and type, cannot perform assignment
  9815. if (!_exp_type.isCompatible(_typeInfo.type)) {
  9816. if (_exp_type.dimensions === _typeInfo.type.dimensions && !_exp_type.innerType.isCompatible(_typeInfo.type.innerType)) {
  9817. if (!_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting || !_store_store__WEBPACK_IMPORTED_MODULE_13__.Store.canImplicitTypeCast(_typeInfo.type.innerType, _exp_type.innerType)) {
  9818. var stringInfo = _typeInfo.type.stringInfo();
  9819. var _info2 = stringInfo[0];
  9820. var _exp_type_string_info = _exp_type.stringInfo();
  9821. var _exp_type_info = _exp_type_string_info[0];
  9822. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.incompatible_types_full(_info2.type, _info2.dim, _exp_type_info.type, _exp_type_info.dim, _exp2.toString(), cmd.sourceInfo);
  9823. }
  9824. } else {
  9825. switch (_exp_type.dimensions) {
  9826. case 1:
  9827. {
  9828. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.vector_to_matrix_attr(cmd.id, _exp2.toString(), cmd.sourceInfo);
  9829. }
  9830. case 2:
  9831. {
  9832. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.matrix_to_vector_attr(cmd.id, _exp2.toString(), cmd.sourceInfo);
  9833. }
  9834. }
  9835. }
  9836. }
  9837. } else if (!_exp_type.isCompatible(_typeInfo.type)) {
  9838. if (!_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting || !_store_store__WEBPACK_IMPORTED_MODULE_13__.Store.canImplicitTypeCast(_typeInfo.type, _exp_type)) {
  9839. var _stringInfo2 = _typeInfo.type.stringInfo();
  9840. var _info3 = _stringInfo2[0];
  9841. var _exp_type_string_info2 = _exp_type.stringInfo();
  9842. var _exp_type_info2 = _exp_type_string_info2[0];
  9843. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.incompatible_types_full(_info3.type, _info3.dim, _exp_type_info2.type, _exp_type_info2.dim, _exp2.toString(), cmd.sourceInfo);
  9844. }
  9845. }
  9846. return optional;
  9847. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.Break) {
  9848. return optional;
  9849. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.IfThenElse) {
  9850. var _resultType = this.evaluateExpressionType(cmd.condition);
  9851. if (!_resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.BOOLEAN)) {
  9852. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.if_condition_type_full(cmd.condition.toString(), cmd.sourceInfo);
  9853. }
  9854. if (cmd.ifFalse instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.IfThenElse) {
  9855. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  9856. } else if (cmd.ifFalse != null) {
  9857. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  9858. } else {
  9859. return this.checkCommands(type, cmd.ifTrue.commands, optional);
  9860. }
  9861. } else if (cmd instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.FunctionCall) {
  9862. var fun = null;
  9863. if (cmd.isMainCall) {
  9864. fun = this.getMainFunction();
  9865. } else {
  9866. fun = this.findFunction(cmd.id);
  9867. }
  9868. if (fun === null) {
  9869. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.function_missing_full(cmd.id, cmd.sourceInfo);
  9870. }
  9871. this.assertParameters(fun, cmd.actualParameters);
  9872. return optional;
  9873. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_4__.Return) {
  9874. var funcName = this.currentFunction.isMain ? _definedFunctions__WEBPACK_IMPORTED_MODULE_3__.LanguageDefinedFunction.getMainFunctionName() : this.currentFunction.name;
  9875. if (cmd.expression === null && !type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.VOID)) {
  9876. var _stringInfo3 = type.stringInfo();
  9877. var _info4 = _stringInfo3[0];
  9878. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_void_return_full(funcName, _info4.type, _info4.dim, cmd.sourceInfo);
  9879. } else if (cmd.expression !== null) {
  9880. var _resultType2 = this.evaluateExpressionType(cmd.expression);
  9881. if (!type.isCompatible(_resultType2)) {
  9882. if (!_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting || !_store_store__WEBPACK_IMPORTED_MODULE_13__.Store.canImplicitTypeCast(type, _resultType2)) {
  9883. var _stringInfo4 = type.stringInfo();
  9884. var _info5 = _stringInfo4[0];
  9885. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_return_type_full(funcName, _info5.type, _info5.dim, cmd.sourceInfo);
  9886. }
  9887. }
  9888. return true;
  9889. } else {
  9890. return true;
  9891. }
  9892. }
  9893. }
  9894. }, {
  9895. key: "checkCommands",
  9896. value: function checkCommands(type, cmds, optional) {
  9897. var _this3 = this;
  9898. return cmds.reduce(function (last, next) {
  9899. return _this3.checkCommand(type, next, optional) || last;
  9900. }, optional);
  9901. }
  9902. /**
  9903. *
  9904. * @param {import('./../../ast/commands/function').Function} fun
  9905. * @param {Expression[]} actualParametersList
  9906. */
  9907. }, {
  9908. key: "assertParameters",
  9909. value: function assertParameters(fun, actualParametersList) {
  9910. var parameterList = fun.formalParameters;
  9911. if (parameterList.length > actualParametersList.length || parameterList.length !== actualParametersList.length && !fun.hasVariadic()) {
  9912. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
  9913. }
  9914. for (var i = 0, j = 0; i < parameterList.length && j < actualParametersList.length; i += 1, j += 1) {
  9915. var formalParam = parameterList[i];
  9916. if (formalParam.variadic && i + 1 !== parameterList.length) {
  9917. throw "A function variadic parameter must be its last parameter!";
  9918. }
  9919. if (formalParam.variadic) {
  9920. j = this.assertVariadicParameter(fun, formalParam, j, actualParametersList);
  9921. } else {
  9922. var param = actualParametersList[j];
  9923. this.assertParameter(fun, formalParam, param);
  9924. }
  9925. }
  9926. }
  9927. }, {
  9928. key: "evaluateVectorLiteralType",
  9929. value: function evaluateVectorLiteralType(literal, type) {
  9930. // console.log(literal);
  9931. for (var i = 0; i < literal.value.length; i += 1) {
  9932. var exp = literal.value[i];
  9933. var expType = this.evaluateExpressionType(exp);
  9934. var compatible = false;
  9935. if (expType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_11__.MultiType) {
  9936. compatible = expType.isCompatible(type.innerType);
  9937. } else {
  9938. compatible = type.canAccept(expType, 1);
  9939. }
  9940. if (!compatible) {
  9941. if (!_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting || !_store_store__WEBPACK_IMPORTED_MODULE_13__.Store.canImplicitTypeCast(type.innerType, expType)) {
  9942. var stringInfo = type.stringInfo();
  9943. var info = stringInfo[0];
  9944. var result_string_info = expType.stringInfo();
  9945. var result_info = result_string_info[0];
  9946. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.incompatible_types_full(info.type, 0, result_info.type, result_info.dim, exp.toString(), literal.sourceInfo);
  9947. }
  9948. }
  9949. }
  9950. return type;
  9951. }
  9952. /**
  9953. *
  9954. * @param {import('./../../ast/commands/function').Function} fun
  9955. * @param {import('./../../ast/commands/formalParameter').FormalParameter} formalParam
  9956. * @param {number} index
  9957. * @param {Expression[]} actualParametersList
  9958. */
  9959. }, {
  9960. key: "assertVariadicParameter",
  9961. value: function assertVariadicParameter(fun, formalParam, index, actualParametersList) {
  9962. var i;
  9963. for (i = index; i < actualParametersList.length; i += 1) {
  9964. this.assertParameter(fun, formalParam, actualParametersList[i]);
  9965. }
  9966. return i - 1;
  9967. }
  9968. /**
  9969. *
  9970. * @param {import('./../../ast/commands/function').Function} fun
  9971. * @param {import('./../../ast/commands/formalParameter').FormalParameter} formalParam
  9972. * @param {Expression} actualParameter
  9973. */
  9974. }, {
  9975. key: "assertParameter",
  9976. value: function assertParameter(fun, formalParam, actualParameter) {
  9977. // const id = formalParam.id;
  9978. if (formalParam.byRef) {
  9979. if (actualParameter instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.VariableLiteral) {
  9980. var variable = this.findSymbol(actualParameter.id, this.symbolMap);
  9981. if (variable.isConst) {
  9982. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_const_ref_full(fun.name, actualParameter.toString(), actualParameter.sourceInfo);
  9983. }
  9984. } else if (!(actualParameter instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.VariableLiteral || actualParameter instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_6__.ArrayAccess)) {
  9985. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_parameter_type_full(fun.name, actualParameter.toString(), actualParameter.sourceInfo);
  9986. }
  9987. }
  9988. var resultType = this.evaluateExpressionType(actualParameter);
  9989. if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_11__.MultiType && formalParam.type instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_11__.MultiType) {
  9990. var shared = 0;
  9991. for (var j = 0; j < resultType.types.length; ++j) {
  9992. var element = resultType.types[j];
  9993. if (formalParam.type.types.indexOf(element) !== -1) {
  9994. shared += 1;
  9995. }
  9996. }
  9997. if (shared <= 0) {
  9998. if (_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting && !formalParam.byRef) {
  9999. if (!resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER) && !resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.REAL) || formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER) || formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.REAL)) {
  10000. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_parameter_type_full(fun.name, actualParameter.toString(), actualParameter.sourceInfo);
  10001. }
  10002. }
  10003. }
  10004. } else if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_11__.MultiType) {
  10005. if (!resultType.isCompatible(formalParam.type)) {
  10006. if (_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting && !formalParam.byRef) {
  10007. if (!resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER) && !resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.REAL) || formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.INTEGER) || formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_9__.Types.REAL)) {
  10008. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_parameter_type_full(fun.name, actualParameter.toString(), actualParameter.sourceInfo);
  10009. }
  10010. }
  10011. }
  10012. } else if (!formalParam.type.isCompatible(resultType)) {
  10013. if (_util_config__WEBPACK_IMPORTED_MODULE_12__.Config.enable_type_casting && !formalParam.byRef) {
  10014. if (!_store_store__WEBPACK_IMPORTED_MODULE_13__.Store.canImplicitTypeCast(formalParam.type, resultType)) {
  10015. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_2__.ProcessorErrorFactory.invalid_parameter_type_full(fun.name, actualParameter.toString(), actualParameter.sourceInfo);
  10016. }
  10017. }
  10018. }
  10019. }
  10020. }]);
  10021. return SemanticAnalyser;
  10022. }();
  10023. /***/ }),
  10024. /***/ "./js/runner.js":
  10025. /*!**********************!*\
  10026. !*** ./js/runner.js ***!
  10027. \**********************/
  10028. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  10029. "use strict";
  10030. __webpack_require__.r(__webpack_exports__);
  10031. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  10032. /* harmony export */ "runner": () => (/* binding */ runner)
  10033. /* harmony export */ });
  10034. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  10035. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  10036. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
  10037. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  10038. /* harmony import */ var _memory_location__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./memory/location */ "./js/memory/location.ts");
  10039. function runner() {
  10040. // const lexer = new ivprogLexer(new InputStream(input));
  10041. // const stream = new CommonTokenStream(lexer);
  10042. // stream.fill();
  10043. // let i = 1;
  10044. // let token = null;
  10045. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  10046. // console.log(`${token.type}-${token.text}`);
  10047. // console.log('\n')
  10048. // i++;
  10049. // }
  10050. // const anaSin = new IVProgParser(input, ivprogLexer);
  10051. var editor = new window.JsonEditor('#json-renderer', {});
  10052. var domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole("#console", true);
  10053. domConsole.hide(); // proc.interpretAST().then( sto => {
  10054. // console.log(sto.applyStore('a'));
  10055. // }).catch(e => console.log(e));
  10056. try {
  10057. window.$('#btn').click(function () {
  10058. var input = window.$('#input').val();
  10059. var analiser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__.IVProgParser.createParser(input);
  10060. try {
  10061. analiser.fill(); //console.debug(analiser.tokenStream)
  10062. var data = analiser.parseTree();
  10063. var semAna = new _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_3__.SemanticAnalyser(data);
  10064. var proc = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__.IVProgProcessor(semAna.analyseTree());
  10065. proc.registerInput(domConsole);
  10066. domConsole.clear();
  10067. proc.registerOutput(domConsole);
  10068. proc.interpretAST().then(function (sto) {
  10069. console.log(sto);
  10070. editor.load(sto.store);
  10071. console.log(_memory_location__WEBPACK_IMPORTED_MODULE_4__.Location.size());
  10072. })["catch"](function (e) {
  10073. alert(e);
  10074. console.log(e);
  10075. console.log(_memory_location__WEBPACK_IMPORTED_MODULE_4__.Location.size());
  10076. });
  10077. } catch (error) {
  10078. alert(error);
  10079. console.log(error);
  10080. console.log(_memory_location__WEBPACK_IMPORTED_MODULE_4__.Location.size());
  10081. }
  10082. });
  10083. } catch (a) {
  10084. console.log(a);
  10085. }
  10086. }
  10087. /***/ }),
  10088. /***/ "./js/services/i18nHelper.js":
  10089. /*!***********************************!*\
  10090. !*** ./js/services/i18nHelper.js ***!
  10091. \***********************************/
  10092. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  10093. "use strict";
  10094. __webpack_require__.r(__webpack_exports__);
  10095. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  10096. /* harmony export */ "i18nHelper": () => (/* binding */ i18nHelper)
  10097. /* harmony export */ });
  10098. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  10099. /* harmony import */ var _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./localizedStringsService */ "./js/services/localizedStringsService.js");
  10100. var StringTypes = line_i18n__WEBPACK_IMPORTED_MODULE_0__["default"].StringTypes;
  10101. var i18nHelper = Object.freeze({
  10102. i18n: function i18n(identifier) {
  10103. var opts = identifier.split(':');
  10104. var type = opts[0].toLowerCase();
  10105. var id = opts[1];
  10106. if (StringTypes.ERROR === type) {
  10107. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getError(id);
  10108. } else if (StringTypes.MESSAGE === type) {
  10109. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getMessage(id);
  10110. } else if (StringTypes.UI === type) {
  10111. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI(id);
  10112. } else {
  10113. console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> " + identifier);
  10114. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getString(identifier, type);
  10115. }
  10116. }
  10117. });
  10118. /***/ }),
  10119. /***/ "./js/services/localizedStringsService.js":
  10120. /*!************************************************!*\
  10121. !*** ./js/services/localizedStringsService.js ***!
  10122. \************************************************/
  10123. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  10124. "use strict";
  10125. __webpack_require__.r(__webpack_exports__);
  10126. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  10127. /* harmony export */ "LocalizedStrings": () => (/* binding */ LocalizedStrings),
  10128. /* harmony export */ "getInstance": () => (/* binding */ getInstance)
  10129. /* harmony export */ });
  10130. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  10131. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  10132. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  10133. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  10134. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  10135. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  10136. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  10137. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  10138. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  10139. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  10140. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  10141. /* harmony import */ var _languageService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./languageService */ "./js/services/languageService.ts");
  10142. /* harmony import */ var _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  10143. /* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./../../i18n */ "./i18n/index.ts");
  10144. /* harmony import */ var _ast_operators__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.ts");
  10145. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  10146. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  10147. var IVProgLocalizedStrings = /*#__PURE__*/function (_line_i18n$LocalizedS) {
  10148. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(IVProgLocalizedStrings, _line_i18n$LocalizedS);
  10149. var _super = _createSuper(IVProgLocalizedStrings);
  10150. function IVProgLocalizedStrings(langService, langsJsons) {
  10151. var shouldListenToChange = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  10152. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, IVProgLocalizedStrings);
  10153. return _super.call(this, langService, langsJsons, shouldListenToChange);
  10154. }
  10155. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(IVProgLocalizedStrings, [{
  10156. key: "translateType",
  10157. value: function translateType(type, dim) {
  10158. var type_string = this.getUI("type_".concat(type));
  10159. switch (dim) {
  10160. case 0:
  10161. return type_string;
  10162. default:
  10163. if (dim > 1) return this.getUI("matrix_info_string", [type_string]);else return this.getUI("vector_info_string", [type_string]);
  10164. }
  10165. }
  10166. }, {
  10167. key: "translateOp",
  10168. value: function translateOp(op) {
  10169. switch (op.ord) {
  10170. case _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.AND.ord:
  10171. case _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.OR.ord:
  10172. case _ast_operators__WEBPACK_IMPORTED_MODULE_9__.Operators.NOT.ord:
  10173. return this.getUI("logic_operator_".concat(op.value));
  10174. default:
  10175. return op.value;
  10176. }
  10177. }
  10178. }, {
  10179. key: "translateInternalFunction",
  10180. value: function translateInternalFunction(name) {
  10181. var category = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  10182. if (category == null) {
  10183. return _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_7__.LanguageDefinedFunction.getLocalName(name);
  10184. } else {
  10185. return _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_7__.LanguageDefinedFunction.getLocalName("".concat(category, ".").concat(name));
  10186. }
  10187. }
  10188. }]);
  10189. return IVProgLocalizedStrings;
  10190. }(line_i18n__WEBPACK_IMPORTED_MODULE_5__["default"].LocalizedStrings);
  10191. var LocalizedStrings = Object.freeze(new IVProgLocalizedStrings(_languageService__WEBPACK_IMPORTED_MODULE_6__.LanguageService, _i18n__WEBPACK_IMPORTED_MODULE_8__["default"], true));
  10192. var _instance = null;
  10193. function getInstance() {
  10194. if (_instance == null) {
  10195. _instance = new IVProgLocalizedStrings(_languageService__WEBPACK_IMPORTED_MODULE_6__.LanguageService, _i18n__WEBPACK_IMPORTED_MODULE_8__["default"]);
  10196. }
  10197. return _instance;
  10198. }
  10199. /***/ }),
  10200. /***/ "./js/services/userLog.js":
  10201. /*!********************************!*\
  10202. !*** ./js/services/userLog.js ***!
  10203. \********************************/
  10204. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  10205. "use strict";
  10206. __webpack_require__.r(__webpack_exports__);
  10207. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  10208. /* harmony export */ "ActionTypes": () => (/* binding */ ActionTypes),
  10209. /* harmony export */ "registerClick": () => (/* binding */ registerClick),
  10210. /* harmony export */ "registerUserEvent": () => (/* binding */ registerUserEvent),
  10211. /* harmony export */ "registerSystemEvent": () => (/* binding */ registerSystemEvent),
  10212. /* harmony export */ "getLogs": () => (/* binding */ getLogs),
  10213. /* harmony export */ "setRebuildMode": () => (/* binding */ setRebuildMode),
  10214. /* harmony export */ "getLogsAsString": () => (/* binding */ getLogsAsString),
  10215. /* harmony export */ "parseLogs": () => (/* binding */ parseLogs)
  10216. /* harmony export */ });
  10217. var clicks = [];
  10218. var inRebuildMode = false;
  10219. var ActionTypes = Object.freeze({
  10220. // registerUserEvent payload:
  10221. // (function_name, insert action)
  10222. INSERT_FUNCTION: "INSERT_FUNCTION",
  10223. // (function_name, remove action)
  10224. REMOVE_FUNCTION: "REMOVE_FUNCTION",
  10225. // (var_name,insert action, type, dim)
  10226. INSERT_GLOBAL_VAR: "INSERT_GLOBAL_VAR",
  10227. // (var name, remove action)
  10228. REMOVE_GLOBAL_VAR: "REMOVE_GLOBAL_VAR",
  10229. // (old function name, rename action, new function name)
  10230. RENAME_FUNCTION: "RENAME_FUNCTION",
  10231. // (old var name, rename action. new var name)
  10232. RENAME_GLOBAL_VAR: "RENAME_GLOBAL_VAR",
  10233. // (var name, set const action)
  10234. SET_GLOBAL_CONST: "SET_GLOBAL_CONST",
  10235. // (function name, change return action, type, dim)
  10236. CHANGE_FUNCTION_RETURN: "CHANGE_FUNCTION_RETURN",
  10237. // (var name, change type action, type, dim, rows?, columns?)
  10238. CHANGE_GLOBAL_TYPE: "CHANGE_GLOBAL_TYPE",
  10239. // (var name, change value action, value)
  10240. CHANGE_GLOBAL_VALUE: "CHANGE_GLOBAL_VALUE",
  10241. // (function name, insert param action, param varname, type, dim)
  10242. INSERT_FUNCTION_PARAM: "INSERT_FUNCTION_PARAM",
  10243. // (function name, remove param action, param varname)
  10244. REMOVE_FUNCTION_PARAM: "REMOVE_FUNCTION_PARAM",
  10245. // (function name, change param type action, type, dim)
  10246. CHANGE_PARAM_TYPE: "CHANGE_PARAM_TYPE",
  10247. // (function name, rename param action, old param name, new param name)
  10248. RENAME_FUNCTION_PARAM: "RENAME_FUNCTION_PARAM",
  10249. // (function name, insert var action, var name, type, dim)
  10250. INSERT_FUNCTION_VAR: "INSERT_FUCNTION_VAR",
  10251. // (function name, remove var action, var name)
  10252. REMOVE_FUNCTION_VAR: "REMOVE_FUNCTION_VAR",
  10253. // (function name, rename var action, old var name, new var name)
  10254. RENAME_FUNCTION_VAR: "RENAME_FUNCTION_VAR",
  10255. // (function name, change var type action, var name, type, dim, rows?, columns?)
  10256. CHANGE_VAR_TYPE: "CHANGE_VAR_TYPE",
  10257. // (function name, change var value action, var name, value)
  10258. CHANGE_VAR_VALUE: "CHANGE_VAR_VALUE",
  10259. // (function name, insert command action, command, path)
  10260. INSERT_COMMAND: "INSERT_COMMAND",
  10261. // (function name, remove command action, path)
  10262. REMOVE_COMMAND: "REMOVE_COMMAND",
  10263. // (function name, change command exp action, path, exp)
  10264. CHANGE_COMMAND_EXP: "CHANGE_COMMAND_EXP",
  10265. // (function name, change attrib exp action, path, exp)
  10266. CHANGE_ATTRIB_EXP: "CHANGE_ATTRIB_EXP",
  10267. // (function name, change attrib var action, path, var name, row_exp?, column_exp?)
  10268. CHANGE_ATTRIB_VAR: "CHANGE_ATTRIB_VAR",
  10269. // (function name, move command action, old path, new path)
  10270. MOVE_COMMAND: "MOVE_COMMAND",
  10271. // (function name, enter change name action, var name)
  10272. ENTER_CHANGE_VAR_NAME: 'ENTER_CHANGE_VAR_NAME',
  10273. // (function name, enter change value action, var name)
  10274. ENTER_CHANGE_VAR_VALUE: 'ENTER_CHANGE_VAR_VALUE',
  10275. // (var name, enter change name action)
  10276. ENTER_CHANGE_GLOBAL_NAME: 'ENTER_CHANGE_GLOBAL_NAME',
  10277. // (var name, enter change value action)
  10278. ENTER_CHANGE_GLOBAL_VALUE: 'ENTER_CHANGE_GLOBAL_VALUE',
  10279. // (function name, enter change name action, param name)
  10280. ENTER_CHANGE_PARAM_NAME: 'ENTER_CHANGE_PARAM_NAME'
  10281. });
  10282. function registerClick(x, y, details) {
  10283. if (inRebuildMode) {
  10284. return;
  10285. }
  10286. clicks.push([x, y, Date.now(), details]);
  10287. }
  10288. function registerUserEvent(command, action) {
  10289. for (var _len = arguments.length, params = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
  10290. params[_key - 2] = arguments[_key];
  10291. }
  10292. registerEvent('user_event', command, action, params);
  10293. }
  10294. function registerSystemEvent(command, action) {
  10295. for (var _len2 = arguments.length, params = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
  10296. params[_key2 - 2] = arguments[_key2];
  10297. }
  10298. registerEvent('system_event', command, action, params);
  10299. }
  10300. function registerEvent(tag, command, action, params) {
  10301. if (inRebuildMode) {
  10302. return;
  10303. }
  10304. var event = {
  10305. context: command,
  10306. action: action,
  10307. params: params
  10308. };
  10309. clicks.push([tag, Date.now(), event]);
  10310. }
  10311. function getLogs() {
  10312. return clicks;
  10313. }
  10314. function setRebuildMode(flag) {
  10315. inRebuildMode = flag;
  10316. }
  10317. function getLogsAsString() {
  10318. return JSON.stringify(clicks);
  10319. }
  10320. function parseLogs(logData) {
  10321. clicks = JSON.parse(logData);
  10322. }
  10323. /***/ }),
  10324. /***/ "./js/typeSystem/parsers.js":
  10325. /*!**********************************!*\
  10326. !*** ./js/typeSystem/parsers.js ***!
  10327. \**********************************/
  10328. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  10329. "use strict";
  10330. __webpack_require__.r(__webpack_exports__);
  10331. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  10332. /* harmony export */ "toInt": () => (/* binding */ toInt),
  10333. /* harmony export */ "toString": () => (/* binding */ toString),
  10334. /* harmony export */ "toChar": () => (/* binding */ toChar),
  10335. /* harmony export */ "toReal": () => (/* binding */ toReal),
  10336. /* harmony export */ "toBool": () => (/* binding */ toBool),
  10337. /* harmony export */ "convertBoolToString": () => (/* binding */ convertBoolToString),
  10338. /* harmony export */ "convertToString": () => (/* binding */ convertToString)
  10339. /* harmony export */ });
  10340. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.ts");
  10341. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/typeSystem/types.ts");
  10342. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  10343. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_2__);
  10344. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/config */ "./js/util/config.ts");
  10345. function toInt(str) {
  10346. return new (decimal_js__WEBPACK_IMPORTED_MODULE_2___default())(str);
  10347. }
  10348. function toString(str) {
  10349. var value = str.replace(/^"/, "");
  10350. value = value.replace(/"$/, "");
  10351. value = value.replace(/\\b/g, "\b");
  10352. value = value.replace(/\\t/g, "\t");
  10353. value = value.replace(/\\n/g, "\n");
  10354. value = value.replace(/\\r/g, "\r");
  10355. value = value.replace(/\\"/g, '"');
  10356. value = value.replace(/\\'/g, "'");
  10357. value = value.replace(/\\\\/g, "\\");
  10358. return value;
  10359. }
  10360. function toChar(str) {
  10361. //console.debug(str, str.length);
  10362. var value = str.replace(/^'/, "");
  10363. value = value.replace(/'$/, "");
  10364. value = value.replace(/\\b/g, "\b");
  10365. value = value.replace(/\\t/g, "\t");
  10366. value = value.replace(/\\n/g, "\n");
  10367. value = value.replace(/\\r/g, "\r");
  10368. value = value.replace(/\\"/g, '"');
  10369. value = value.replace(/\\'/g, "'");
  10370. value = value[0];
  10371. return value;
  10372. }
  10373. function toReal(value) {
  10374. return new (decimal_js__WEBPACK_IMPORTED_MODULE_2___default())(value);
  10375. }
  10376. function toBool(str) {
  10377. var val = str;
  10378. var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLexer();
  10379. if (lexer.getReservedKeys()[lexer.getRules().RK_TRUE] === val) {
  10380. return true;
  10381. } else if (lexer.getReservedKeys()[lexer.getRules().RK_FALSE] === val) {
  10382. return false;
  10383. } else {
  10384. // TODO: better error message
  10385. throw new Error(str + "not a valid boolean");
  10386. }
  10387. }
  10388. function convertBoolToString(bool) {
  10389. var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_0__.LanguageService.getCurrentLexer();
  10390. var result = null;
  10391. if (bool) {
  10392. result = lexer.getReservedKeys()[lexer.getRules().RK_TRUE];
  10393. } else {
  10394. result = lexer.getReservedKeys()[lexer.getRules().RK_FALSE];
  10395. } //console.debug(result)
  10396. return result.replace(/'/g, "");
  10397. }
  10398. function convertToString(value, type) {
  10399. switch (type.ord) {
  10400. case _types__WEBPACK_IMPORTED_MODULE_1__.Types.INTEGER.ord:
  10401. return value.toString();
  10402. case _types__WEBPACK_IMPORTED_MODULE_1__.Types.REAL.ord:
  10403. {
  10404. if (value.dp() <= 0) {
  10405. return value.toFixed(1);
  10406. } else {
  10407. return value.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_3__.Config.decimalPlaces);
  10408. }
  10409. }
  10410. case _types__WEBPACK_IMPORTED_MODULE_1__.Types.BOOLEAN.ord:
  10411. return convertBoolToString(value);
  10412. default:
  10413. return value;
  10414. }
  10415. }
  10416. /***/ }),
  10417. /***/ "./js/util/auto_gen_output.js":
  10418. /*!************************************!*\
  10419. !*** ./js/util/auto_gen_output.js ***!
  10420. \************************************/
  10421. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  10422. "use strict";
  10423. __webpack_require__.r(__webpack_exports__);
  10424. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  10425. /* harmony export */ "autoGenerateTestCaseOutput": () => (/* binding */ autoGenerateTestCaseOutput)
  10426. /* harmony export */ });
  10427. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  10428. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  10429. /* harmony import */ var _inputTest__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./inputTest */ "./js/util/inputTest.js");
  10430. /* harmony import */ var _outputTest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./outputTest */ "./js/util/outputTest.js");
  10431. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  10432. function autoGenerateTestCaseOutput(program_text, testCases) {
  10433. var copyTestCases = testCases.map(function (test) {
  10434. return Object.assign({}, test);
  10435. });
  10436. try {
  10437. var program = _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_0__.SemanticAnalyser.analyseFromSource(program_text);
  10438. var resultList = testCases.map(function (test, id) {
  10439. var input = new _inputTest__WEBPACK_IMPORTED_MODULE_2__.InputTest(test.input);
  10440. var output = new _outputTest__WEBPACK_IMPORTED_MODULE_3__.OutputTest();
  10441. var exec = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__.IVProgProcessor(program);
  10442. exec.registerInput(input);
  10443. exec.registerOutput(output);
  10444. return exec.interpretAST().then(function (_) {
  10445. return {
  10446. id: id,
  10447. program: exec
  10448. };
  10449. });
  10450. });
  10451. return Promise.all(resultList).then(function (result_final) {
  10452. for (var i = 0; i < result_final.length; ++i) {
  10453. var result = result_final[i];
  10454. var output = result.program.output.list;
  10455. var input = result.program.input;
  10456. if (input.index != input.inputList.length) {
  10457. window.showAlert(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__.LocalizedStrings.getMessage("testcase_autogen_unused_input", [result.id + 1]));
  10458. return Promise.resolve(false);
  10459. }
  10460. if (output.length == 0) {
  10461. window.showAlert(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__.LocalizedStrings.getMessage("testcase_autogen_empty", [result.id + 1]));
  10462. }
  10463. copyTestCases[result.id].output = output;
  10464. }
  10465. window.outputGenerated(copyTestCases);
  10466. return Promise.resolve(true);
  10467. });
  10468. } catch (error) {
  10469. return Promise.reject(error);
  10470. }
  10471. }
  10472. /***/ }),
  10473. /***/ "./js/util/codeParser.js":
  10474. /*!*******************************!*\
  10475. !*** ./js/util/codeParser.js ***!
  10476. \*******************************/
  10477. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  10478. "use strict";
  10479. __webpack_require__.r(__webpack_exports__);
  10480. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  10481. /* harmony export */ "parserCodeVisual": () => (/* binding */ parserCodeVisual)
  10482. /* harmony export */ });
  10483. /* harmony import */ var _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../visualUI/ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  10484. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  10485. /* harmony import */ var _visualUI_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../visualUI/commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  10486. /* harmony import */ var _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../visualUI/commands/generic_expression */ "./js/visualUI/commands/generic_expression.js");
  10487. function parseBoolean(var_value, dimensions) {
  10488. if (dimensions == 0) return var_value == _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("logic_value_true");
  10489. if (dimensions == 1) {
  10490. var final_array = [];
  10491. var_value.forEach(function (el) {
  10492. final_array.push(el == _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("logic_value_true"));
  10493. });
  10494. return final_array;
  10495. }
  10496. if (dimensions == 2) {
  10497. var final_array = [];
  10498. var_value.forEach(function (row) {
  10499. var temp = [];
  10500. row.forEach(function (el) {
  10501. temp.push(el == _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("logic_value_true"));
  10502. });
  10503. final_array.push(temp);
  10504. });
  10505. return final_array;
  10506. }
  10507. }
  10508. function parseGlobal(global_obj) {
  10509. var new_global = new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Variable(global_obj.type, global_obj.name, global_obj.value);
  10510. new_global.is_constant = global_obj.is_const;
  10511. new_global.columns = global_obj.columns;
  10512. new_global.dimensions = global_obj.dimension;
  10513. new_global.rows = global_obj.rows;
  10514. if (global_obj.type == "boolean") new_global.value = parseBoolean(global_obj.value, global_obj.dimension);
  10515. window.program_obj.addGlobal(new_global);
  10516. }
  10517. function parseParameter(parameter_obj) {
  10518. var new_parameter = new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Variable(parameter_obj.type, parameter_obj.name, null, parameter_obj.dimension, parameter_obj.is_const, parameter_obj.rows, parameter_obj.columns, parameter_obj.reference);
  10519. new_parameter.value = parameter_obj.value;
  10520. if (parameter_obj.type == "boolean" && parameter_obj.value) new_parameter.value = parseBoolean(parameter_obj.value, parameter_obj.dimension);
  10521. return new_parameter;
  10522. }
  10523. function parseFunction(function_obj) {
  10524. var new_function = new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Function(function_obj.name, function_obj.return_type, function_obj.return_dimensions, [], false, false, []);
  10525. if (!new_function.name) {
  10526. new_function.name = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("start");
  10527. new_function.is_main = true;
  10528. }
  10529. if (function_obj.parameters_list) {
  10530. function_obj.parameters_list.forEach(function (el) {
  10531. new_function.parameters_list.push(parseParameter(el));
  10532. });
  10533. }
  10534. if (function_obj.variables_list) {
  10535. function_obj.variables_list.forEach(function (el) {
  10536. new_function.variables_list.push(parseParameter(el));
  10537. });
  10538. }
  10539. window.program_obj.addFunction(new_function);
  10540. }
  10541. function parserCodeVisual() {
  10542. var code_obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  10543. window.conteudo = code_obj; // Globals:
  10544. window.program_obj.globals = [];
  10545. code_obj.globals.forEach(parseGlobal); // Functions:
  10546. window.program_obj.functions = [];
  10547. code_obj.functions.forEach(parseFunction); // Commands:
  10548. window.program_obj.functions.forEach(function (preparedFunction) {
  10549. code_obj.functions.forEach(function (rawFunction) {
  10550. if (preparedFunction.name == rawFunction.name || !rawFunction.name && preparedFunction.name == _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("start")) {
  10551. preparedFunction.commands = parseCommands(rawFunction.commands, preparedFunction);
  10552. }
  10553. });
  10554. });
  10555. }
  10556. function parseCommands(commands_block, function_obj) {
  10557. if (Array.isArray(commands_block)) {
  10558. var temp = [];
  10559. commands_block.forEach(function (command) {
  10560. temp.push(parseCommands(command, function_obj));
  10561. });
  10562. return temp;
  10563. } else {
  10564. switch (commands_block.type) {
  10565. case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.reader:
  10566. return parseReader(commands_block, function_obj);
  10567. case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["return"]:
  10568. return parseReturn(commands_block, function_obj);
  10569. case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.writer:
  10570. return parseWriter(commands_block, function_obj);
  10571. case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]:
  10572. return parseBreak(commands_block, function_obj);
  10573. case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment:
  10574. return parseComment(commands_block, function_obj);
  10575. case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.attribution:
  10576. return parseAttribution(commands_block, function_obj);
  10577. case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.functioncall:
  10578. return parseFunctionCall(commands_block, function_obj);
  10579. case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue:
  10580. return parseIfTrue(commands_block, function_obj);
  10581. case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes:
  10582. return parseRepeatNTimes(commands_block, function_obj);
  10583. case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue:
  10584. return parseWhileTrue(commands_block, function_obj);
  10585. case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue:
  10586. return parseDoWhileTrue(commands_block, function_obj);
  10587. case _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]:
  10588. return parseSwitch(commands_block, function_obj);
  10589. }
  10590. return null;
  10591. }
  10592. }
  10593. function parseReader(command, function_obj) {
  10594. var temp = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.variable, function_obj);
  10595. if (Array.isArray(temp) && temp[0]) temp = temp[0];
  10596. return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Reader(temp);
  10597. }
  10598. function parseReturn(command, function_obj) {
  10599. var temp = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.expression, function_obj);
  10600. return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Return(temp);
  10601. }
  10602. function parseWriter(command, function_obj) {
  10603. var temp = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.content[0], function_obj);
  10604. return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Writer(temp, command.newLine);
  10605. }
  10606. function parseBreak(command, function_obj) {
  10607. return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Break();
  10608. }
  10609. function parseAttribution(command, function_obj) {
  10610. var variable = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.variable, function_obj);
  10611. var expression = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.expression, function_obj);
  10612. if (Array.isArray(variable)) variable = variable[0];
  10613. return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Attribution(variable, expression);
  10614. }
  10615. function parseComment(command, function_obj) {
  10616. // TODO
  10617. return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Comment(null);
  10618. }
  10619. function parseFunctionCall(command, function_obj) {
  10620. var parameters = [];
  10621. if (command.parameters_list) {
  10622. command.parameters_list.forEach(function (el) {
  10623. var temp = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(el, function_obj);
  10624. if (temp.content === 0) temp.content = "0";
  10625. parameters.push(temp[0]);
  10626. });
  10627. }
  10628. var function_called = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.searchFunction(command.name);
  10629. var temp = new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_visualUI_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.only_function, null, null, null, false);
  10630. temp.function_called = function_called;
  10631. temp.parameters_list = parameters;
  10632. return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.FunctionCall(temp, null);
  10633. }
  10634. function parseIfTrue(command, function_obj) {
  10635. var expression = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.expression, function_obj);
  10636. var ifTrueBlock = parseCommands(command.ifTrue, function_obj);
  10637. var ifFalseBlock = parseCommands(command.ifFalse, function_obj);
  10638. return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.IfTrue(expression, ifTrueBlock, ifFalseBlock);
  10639. }
  10640. function parseRepeatNTimes(command, function_obj) {
  10641. var var_attribution = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.var_attribution, function_obj);
  10642. var_attribution = var_attribution[0];
  10643. var expression1 = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.var_initial, function_obj);
  10644. expression1 = expression1[0];
  10645. var expression2 = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.condition, function_obj);
  10646. if (expression2[0].item == 'minus') {
  10647. expression2 = expression2[1];
  10648. expression2.content *= -1;
  10649. } else expression2 = expression2[0];
  10650. var var_step = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.step_expression, function_obj);
  10651. var commands_block = parseCommands(command.commands, function_obj);
  10652. var operator = command.step_expression[0].value == '+' ? _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus : _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus;
  10653. var expression3 = new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ExpressionElement(_visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp, [null, operator, var_step[1]]);
  10654. return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.RepeatNTimes(var_attribution, new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_visualUI_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), expression1, expression2, expression3, commands_block);
  10655. }
  10656. function parseWhileTrue(command, function_obj) {
  10657. var expression = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.expression, function_obj);
  10658. var commands = parseCommands(command.commands, function_obj);
  10659. return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.WhileTrue(expression, commands);
  10660. }
  10661. function parseDoWhileTrue(command, function_obj) {
  10662. var expression = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.expression, function_obj);
  10663. var commands = parseCommands(command.commands, function_obj);
  10664. return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.DoWhileTrue(expression, commands);
  10665. }
  10666. function parseSwitch(command, function_obj) {
  10667. var expression = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(command.expression, function_obj);
  10668. var sc = [];
  10669. if (command.cases) {
  10670. command.cases.forEach(function (case_el) {
  10671. var temp_exp = _visualUI_commands_generic_expression__WEBPACK_IMPORTED_MODULE_3__.expressionParserCodeVisual(case_el.expression, function_obj);
  10672. var temp_commands = parseCommands(case_el.commands, function_obj);
  10673. var temp_case = new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SwitchCase(temp_exp[0], temp_commands);
  10674. sc.push(temp_case);
  10675. });
  10676. }
  10677. return new _visualUI_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Switch(expression[0], sc);
  10678. }
  10679. /***/ }),
  10680. /***/ "./js/util/dataProcess.js":
  10681. /*!********************************!*\
  10682. !*** ./js/util/dataProcess.js ***!
  10683. \********************************/
  10684. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  10685. "use strict";
  10686. __webpack_require__.r(__webpack_exports__);
  10687. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  10688. /* harmony export */ "processData": () => (/* binding */ processData)
  10689. /* harmony export */ });
  10690. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
  10691. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
  10692. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
  10693. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
  10694. function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  10695. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  10696. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  10697. function processData() {
  10698. var folderInput = document.querySelector("#folder");
  10699. var header = ["submissionid", "file", "filesize", "timestamp", "humandate", "grade", "userid", "exerciseid"];
  10700. function generateSubCode(algorithmInIlm) {
  10701. window.program_obj.functions = JSON.parse(algorithmInIlm).functions;
  10702. window.program_obj.globals = JSON.parse(algorithmInIlm).globals;
  10703. return window.ivprogCore.generateCode();
  10704. }
  10705. function prepareData(map, submission) {
  10706. if (!submission) {
  10707. return map;
  10708. }
  10709. var exercID = submission["exerciseid"];
  10710. var studentID = submission["userid"];
  10711. var exercMap = null;
  10712. if (map.has(exercID)) {
  10713. exercMap = map.get(exercID);
  10714. } else {
  10715. exercMap = new Map();
  10716. map.set(exercID, exercMap);
  10717. }
  10718. if (exercMap.has(studentID)) {
  10719. exercMap.get(studentID).push(submission);
  10720. } else {
  10721. exercMap.set(studentID, [submission]);
  10722. }
  10723. return map;
  10724. }
  10725. folderInput.addEventListener("change", /*#__PURE__*/_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee4() {
  10726. var files, idx, folderName, data, csvEntries, blockExercMap, getFilePath, matrix, counter, download, getExercHeader, id;
  10727. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee4$(_context4) {
  10728. while (1) {
  10729. switch (_context4.prev = _context4.next) {
  10730. case 0:
  10731. getExercHeader = function _getExercHeader(id) {
  10732. var props = ["TES", "DES", "grade", "D/T", "timestamp"];
  10733. return props.reduce(function (acc, prop) {
  10734. return acc + "".concat(id, "_").concat(prop, ",");
  10735. }, "");
  10736. };
  10737. download = function _download(file, text) {
  10738. //creating an invisible element
  10739. var element = document.createElement("a");
  10740. element.setAttribute("href", "data:text/plain," + encodeURIComponent(text));
  10741. element.setAttribute("download", file);
  10742. element.innerHTML = file;
  10743. element.classList.add("ui", "primary", "button"); // Above code is equivalent to
  10744. // <a href="path of file" download="file name">
  10745. document.querySelector("#downloads").appendChild(element);
  10746. };
  10747. files = Array.from(folderInput.files);
  10748. idx = files.find(function (f) {
  10749. return f.name == "index.csv";
  10750. });
  10751. folderName = idx.webkitRelativePath.replace(idx.name, ""); //console.debug(idx);
  10752. //console.debug(folderName);
  10753. _context4.next = 7;
  10754. return idx.text();
  10755. case 7:
  10756. data = _context4.sent;
  10757. //console.debug(data);
  10758. csvEntries = data.split("\n").slice(1).filter(function (line) {
  10759. return line.length > 0;
  10760. }).map(function (line) {
  10761. return line.split(",");
  10762. }).map(function (vec) {
  10763. var obj = {};
  10764. vec.forEach(function (val, i) {
  10765. return obj[header[i]] = val;
  10766. });
  10767. return obj;
  10768. }); //console.debug(csvEntries);
  10769. blockExercMap = csvEntries.reduce(prepareData, new Map()); //console.log(Array.from(blockExercMatrix.entries()));
  10770. getFilePath = /*#__PURE__*/function () {
  10771. var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(submission) {
  10772. var path, file, text;
  10773. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
  10774. while (1) {
  10775. switch (_context.prev = _context.next) {
  10776. case 0:
  10777. path = "".concat(folderName).concat(submission["file"]);
  10778. file = files.find(function (f) {
  10779. return f.webkitRelativePath == path;
  10780. });
  10781. _context.next = 4;
  10782. return file.text();
  10783. case 4:
  10784. text = _context.sent;
  10785. return _context.abrupt("return", text);
  10786. case 6:
  10787. case "end":
  10788. return _context.stop();
  10789. }
  10790. }
  10791. }, _callee);
  10792. }));
  10793. return function getFilePath(_x) {
  10794. return _ref2.apply(this, arguments);
  10795. };
  10796. }();
  10797. matrix = {};
  10798. counter = 0;
  10799. blockExercMap.forEach(function (studentsMap, exercID) {
  10800. var column = [];
  10801. studentsMap.forEach( /*#__PURE__*/function () {
  10802. var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee3(submissions, studentID) {
  10803. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee3$(_context3) {
  10804. while (1) {
  10805. switch (_context3.prev = _context3.next) {
  10806. case 0:
  10807. submissions = submissions.sort(function (a, b) {
  10808. return parseInt(a["timestamp"]) - parseInt(b["timestamp"]);
  10809. });
  10810. counter++;
  10811. submissions.forEach( /*#__PURE__*/function () {
  10812. var _ref4 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2(submission, index, array) {
  10813. var student, previousCode, previousFile, previous, currentFile, current, currentCode, logs, event, ratio;
  10814. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) {
  10815. while (1) {
  10816. switch (_context2.prev = _context2.next) {
  10817. case 0:
  10818. counter++;
  10819. student = {};
  10820. student["grade"] = Math.max(0, parseFloat(submission["grade"]));
  10821. student["timestamp"] = parseInt(submission["timestamp"]);
  10822. student["student_id"] = studentID;
  10823. student["TES"] = 0;
  10824. student["DES"] = 0;
  10825. student["D/T"] = 0;
  10826. previousCode = "";
  10827. if (!(index > 0)) {
  10828. _context2.next = 19;
  10829. break;
  10830. }
  10831. student["TES"] = parseInt(submission["timestamp"]) - parseInt(array[index - 1]["timestamp"]);
  10832. _context2.next = 13;
  10833. return getFilePath(array[index - 1]);
  10834. case 13:
  10835. previousFile = _context2.sent;
  10836. previous = window.ivprogCore.prepareActivityToStudentHelper(previousFile).getOrElse(1);
  10837. if (!(previous == 1)) {
  10838. _context2.next = 18;
  10839. break;
  10840. }
  10841. console.error("A submission from ".concat(studentID, " to ").concat(exercID, " is invalid"));
  10842. return _context2.abrupt("return");
  10843. case 18:
  10844. previousCode = generateSubCode(previous.algorithmInIlm);
  10845. case 19:
  10846. _context2.next = 21;
  10847. return getFilePath(submission);
  10848. case 21:
  10849. currentFile = _context2.sent;
  10850. current = window.ivprogCore.prepareActivityToStudentHelper(currentFile).getOrElse(2);
  10851. if (!(current == 2)) {
  10852. _context2.next = 26;
  10853. break;
  10854. }
  10855. console.error("A submission from ".concat(studentID, " to ").concat(exercID, " is invalid"));
  10856. return _context2.abrupt("return");
  10857. case 26:
  10858. currentCode = generateSubCode(current.algorithmInIlm);
  10859. if (previousCode === "") {
  10860. logs = JSON.parse(currentFile.split("::logs::")[1]);
  10861. event = logs[0];
  10862. if (event == null) {
  10863. // empty submission
  10864. student["TES"] = 0;
  10865. } else if (event.length === 4) {
  10866. student["TES"] = parseInt(submission["timestamp"]) - Math.floor(parseInt(event[2]) / 1000);
  10867. } else {
  10868. student["TES"] = parseInt(submission["timestamp"]) - Math.floor(parseInt(event[1]) / 1000);
  10869. }
  10870. }
  10871. student["DES"] = window.ivprogCore.levenshteinDistance(previousCode, currentCode);
  10872. ratio = student["TES"] === 0 ? 0 : student["DES"] / student["TES"];
  10873. student["D/T"] = isNaN(ratio) ? 0 : ratio;
  10874. column.push(student);
  10875. counter--;
  10876. case 33:
  10877. case "end":
  10878. return _context2.stop();
  10879. }
  10880. }
  10881. }, _callee2);
  10882. }));
  10883. return function (_x4, _x5, _x6) {
  10884. return _ref4.apply(this, arguments);
  10885. };
  10886. }());
  10887. counter--;
  10888. case 4:
  10889. case "end":
  10890. return _context3.stop();
  10891. }
  10892. }
  10893. }, _callee3);
  10894. }));
  10895. return function (_x2, _x3) {
  10896. return _ref3.apply(this, arguments);
  10897. };
  10898. }());
  10899. matrix[exercID] = column;
  10900. });
  10901. id = setInterval(function () {
  10902. if (counter == 0) {
  10903. clearInterval(id);
  10904. for (var exercID in matrix) {
  10905. var csv = "";
  10906. var firstLine = "student_id,";
  10907. firstLine += getExercHeader(exercID);
  10908. var _iterator = _createForOfIteratorHelper(matrix[exercID]),
  10909. _step;
  10910. try {
  10911. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  10912. var submission = _step.value;
  10913. csv += "".concat(submission["student_id"], ",");
  10914. csv += "".concat(submission["TES"], ",");
  10915. csv += "".concat(submission["DES"], ",");
  10916. csv += "".concat(submission["grade"], ",");
  10917. csv += "".concat(submission["D/T"], ",");
  10918. csv += "".concat(submission["timestamp"]);
  10919. csv += "\n";
  10920. }
  10921. } catch (err) {
  10922. _iterator.e(err);
  10923. } finally {
  10924. _iterator.f();
  10925. }
  10926. download("".concat(exercID, ".csv"), "".concat(firstLine, "\n").concat(csv));
  10927. }
  10928. }
  10929. }, 1000);
  10930. case 15:
  10931. case "end":
  10932. return _context4.stop();
  10933. }
  10934. }
  10935. }, _callee4);
  10936. })));
  10937. }
  10938. /***/ }),
  10939. /***/ "./js/util/editorMode2.js":
  10940. /*!********************************!*\
  10941. !*** ./js/util/editorMode2.js ***!
  10942. \********************************/
  10943. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  10944. "use strict";
  10945. __webpack_require__.r(__webpack_exports__);
  10946. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  10947. /* harmony export */ "CodeEditorMode": () => (/* binding */ CodeEditorMode)
  10948. /* harmony export */ });
  10949. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./js/util/utils.js");
  10950. /**
  10951. * Source: https://raw.githubusercontent.com/codemirror/CodeMirror/master/mode/clike/clike.js
  10952. * @author arijn Haverbeke and others
  10953. * @author Lucas de Souza
  10954. * @param {CodeMirror} CodeMirror
  10955. */
  10956. function CodeEditorMode(CodeMirror) {
  10957. "use strict";
  10958. function Context(indented, column, type, info, align, prev) {
  10959. this.indented = indented;
  10960. this.column = column;
  10961. this.type = type;
  10962. this.info = info;
  10963. this.align = align;
  10964. this.prev = prev;
  10965. }
  10966. function pushContext(state, col, type, info) {
  10967. var indent = state.indented;
  10968. if (state.context && state.context.type == "statement" && type != "statement") indent = state.context.indented;
  10969. return state.context = new Context(indent, col, type, info, null, state.context);
  10970. }
  10971. function popContext(state) {
  10972. var t = state.context.type;
  10973. if (t == ")" || t == "]" || t == "}") state.indented = state.context.indented;
  10974. return state.context = state.context.prev;
  10975. }
  10976. function typeBefore(stream, state, pos) {
  10977. if (state.prevToken == "variable" || state.prevToken == "type") return true;
  10978. if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, pos))) return true;
  10979. if (state.typeAtEndOfLine && stream.column() == stream.indentation()) return true;
  10980. }
  10981. function isTopScope(context) {
  10982. for (;;) {
  10983. if (!context || context.type == "top") return true;
  10984. if (context.type == "}" && context.prev.info != "namespace") return false;
  10985. context = context.prev;
  10986. }
  10987. }
  10988. function contains(words, word) {
  10989. if (typeof words === "function") {
  10990. return words(word);
  10991. } else {
  10992. return Object.propertyIsEnumerable.call(words, word);
  10993. }
  10994. }
  10995. function tokenComment(stream, state) {
  10996. var maybeEnd = false,
  10997. ch;
  10998. while (ch = stream.next()) {
  10999. if (ch == "/" && maybeEnd) {
  11000. state.tokenize = null;
  11001. break;
  11002. }
  11003. maybeEnd = ch == "*";
  11004. }
  11005. return "comment";
  11006. }
  11007. CodeMirror.defineMode("ivprog", function (config, parserConfig) {
  11008. var indentUnit = config.indentUnit,
  11009. statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
  11010. dontAlignCalls = parserConfig.dontAlignCalls,
  11011. keywords = parserConfig.keywords || {},
  11012. switchKeyword = parserConfig.switchKeyword,
  11013. caseKeyword = parserConfig.caseKeyword,
  11014. defaultKeyword = parserConfig.defaultKeyword,
  11015. caseRegex = new RegExp("^\\s*(?:".concat(caseKeyword, " .*?:|").concat(defaultKeyword, ":|\\{\\}?|\\})$")),
  11016. ////,
  11017. types = parserConfig.types || {},
  11018. builtin = parserConfig.builtin || {},
  11019. blockKeywords = parserConfig.blockKeywords || {},
  11020. defKeywords = parserConfig.defKeywords || {},
  11021. atoms = parserConfig.atoms || {},
  11022. hooks = parserConfig.hooks || {},
  11023. multiLineStrings = parserConfig.multiLineStrings,
  11024. indentStatements = false,
  11025. namespaceSeparator = null,
  11026. isPunctuationChar = /[[\]{}(),;:\n]/,
  11027. numberStart = /[\d.]/,
  11028. number = /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)$/i,
  11029. isOperatorChar = /[+\-*%=<>!/&]/,
  11030. isIdentifierChar = /[a-zA-Z0-9_]/,
  11031. // An optional function that takes a {string} token and returns true if it
  11032. // should be treated as a builtin.
  11033. isReservedIdentifier = parserConfig.isReservedIdentifier || false;
  11034. var curPunc, isDefKeyword;
  11035. var tokenString = function tokenString() {
  11036. /*SKIP*/
  11037. };
  11038. function tokenBase(stream, state) {
  11039. var ch = stream.next();
  11040. if (hooks[ch]) {
  11041. var result = hooks[ch](stream, state);
  11042. if (result !== false) return result;
  11043. }
  11044. if (ch == '"') {
  11045. state.tokenize = tokenString(ch);
  11046. return state.tokenize(stream, state);
  11047. }
  11048. if (isPunctuationChar.test(ch)) {
  11049. curPunc = ch;
  11050. return null;
  11051. }
  11052. if (numberStart.test(ch)) {
  11053. stream.backUp(1);
  11054. if (stream.match(number)) return "number";
  11055. stream.next();
  11056. }
  11057. if (ch == "/") {
  11058. if (stream.eat("*")) {
  11059. state.tokenize = tokenComment;
  11060. return tokenComment(stream, state);
  11061. }
  11062. if (stream.eat("/")) {
  11063. stream.skipToEnd();
  11064. return "comment";
  11065. }
  11066. }
  11067. if (isOperatorChar.test(ch)) {
  11068. while (!stream.match(/^\/[/*]/, false) && stream.eat(isOperatorChar)) {
  11069. /* SKIP */
  11070. }
  11071. return "operator";
  11072. }
  11073. stream.eatWhile(isIdentifierChar);
  11074. if (namespaceSeparator) while (stream.match(namespaceSeparator)) {
  11075. stream.eatWhile(isIdentifierChar);
  11076. }
  11077. var cur = stream.current();
  11078. if (contains(keywords, cur)) {
  11079. if (contains(blockKeywords, cur)) curPunc = "newstatement";
  11080. if (contains(defKeywords, cur)) isDefKeyword = true;
  11081. return "keyword";
  11082. }
  11083. if (contains(types, cur)) return "type";
  11084. if (contains(builtin, cur) || isReservedIdentifier && isReservedIdentifier(cur)) {
  11085. if (contains(blockKeywords, cur)) curPunc = "newstatement";
  11086. return "builtin";
  11087. }
  11088. if (contains(atoms, cur)) return "atom";
  11089. return "variable";
  11090. }
  11091. tokenString = function tokenString(quote) {
  11092. return function (stream, state) {
  11093. var escaped = false,
  11094. next,
  11095. end = false;
  11096. while ((next = stream.next()) != null) {
  11097. if (next == quote && !escaped) {
  11098. end = true;
  11099. break;
  11100. }
  11101. escaped = !escaped && next == "\\";
  11102. }
  11103. if (end || !(escaped || multiLineStrings)) state.tokenize = null;
  11104. return "string";
  11105. };
  11106. };
  11107. function maybeEOL(stream, state) {
  11108. if (parserConfig.typeFirstDefinitions && stream.eol() && isTopScope(state.context)) state.typeAtEndOfLine = typeBefore(stream, state, stream.pos);
  11109. } // Interface
  11110. return {
  11111. startState: function startState(basecolumn) {
  11112. return {
  11113. tokenize: null,
  11114. context: new Context((basecolumn || 0) - indentUnit, 0, "top", null, false),
  11115. indented: 0,
  11116. startOfLine: true,
  11117. prevToken: null
  11118. };
  11119. },
  11120. token: function token(stream, state) {
  11121. var ctx = state.context;
  11122. if (stream.sol()) {
  11123. if (ctx.align == null) ctx.align = false;
  11124. state.indented = stream.indentation();
  11125. state.startOfLine = true;
  11126. }
  11127. if (stream.eatSpace()) {
  11128. maybeEOL(stream, state);
  11129. return null;
  11130. }
  11131. curPunc = isDefKeyword = null;
  11132. var style = (state.tokenize || tokenBase)(stream, state);
  11133. if (style == "comment" || style == "meta") return style;
  11134. if (ctx.align == null) ctx.align = true;
  11135. if (curPunc == ";" || curPunc == ":" || curPunc == "," && stream.match(/^\s*(?:\/\/.*)?$/, false)) while (state.context.type == "statement") {
  11136. popContext(state);
  11137. } else if (curPunc == "{") pushContext(state, stream.column(), "}");else if (curPunc == "[") pushContext(state, stream.column(), "]");else if (curPunc == "(") pushContext(state, stream.column(), ")");else if (curPunc == "}") {
  11138. while (ctx.type == "statement") {
  11139. ctx = popContext(state);
  11140. }
  11141. if (ctx.type == "}") ctx = popContext(state);
  11142. while (ctx.type == "statement") {
  11143. ctx = popContext(state);
  11144. }
  11145. } else if (curPunc == ctx.type) popContext(state);else if (indentStatements && ((ctx.type == "}" || ctx.type == "top") && curPunc != ";" || ctx.type == "statement" && curPunc == "newstatement")) {
  11146. pushContext(state, stream.column(), "statement", stream.current());
  11147. }
  11148. if (style == "variable" && (state.prevToken == "def" || parserConfig.typeFirstDefinitions && typeBefore(stream, state, stream.start) && isTopScope(state.context) && stream.match(/^\s*\(/, false))) style = "def";
  11149. if (hooks.token) {
  11150. var result = hooks.token(stream, state, style);
  11151. if (result !== undefined) style = result;
  11152. }
  11153. if (style == "def" && parserConfig.styleDefs === false) style = "variable";
  11154. state.startOfLine = false;
  11155. state.prevToken = isDefKeyword ? "def" : style || curPunc;
  11156. maybeEOL(stream, state);
  11157. return style;
  11158. },
  11159. indent: function indent(state, textAfter) {
  11160. if (state.tokenize != tokenBase && state.tokenize != null || state.typeAtEndOfLine) return CodeMirror.Pass;
  11161. var ctx = state.context;
  11162. var firstChar = textAfter && textAfter.charAt(0);
  11163. var closing = firstChar == ctx.type;
  11164. if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
  11165. if (parserConfig.dontIndentStatements) while (ctx.type == "statement" && parserConfig.dontIndentStatements.test(ctx.info)) {
  11166. ctx = ctx.prev;
  11167. }
  11168. if (hooks.indent) {
  11169. var hook = hooks.indent(state, ctx, textAfter, indentUnit);
  11170. if (typeof hook == "number") return hook;
  11171. }
  11172. var switchBlock = ctx.prev && ctx.prev.info == switchKeyword;
  11173. if (parserConfig.allmanIndentation && /[{(]/.test(firstChar)) {
  11174. while (ctx.type != "top" && ctx.type != "}") {
  11175. ctx = ctx.prev;
  11176. }
  11177. return ctx.indented;
  11178. }
  11179. if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
  11180. if (ctx.align && (!dontAlignCalls || ctx.type != ")")) return ctx.column + (closing ? 0 : 1);
  11181. if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit;
  11182. var caseTestRegex = new RegExp("^(?:".concat(caseKeyword, "|").concat(defaultKeyword, ")\b"));
  11183. return ctx.indented + (closing ? 0 : indentUnit) + (!closing && switchBlock && !caseTestRegex.test(textAfter) ? indentUnit : 0);
  11184. },
  11185. electricInput: caseRegex,
  11186. blockCommentStart: "/*",
  11187. blockCommentEnd: "*/",
  11188. blockCommentContinue: " * ",
  11189. lineComment: "//",
  11190. fold: "brace"
  11191. };
  11192. });
  11193. function words(str) {
  11194. var obj = {},
  11195. words = str.split(" ");
  11196. for (var i = 0; i < words.length; ++i) {
  11197. obj[words[i]] = true;
  11198. }
  11199. return obj;
  11200. }
  11201. var codeConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getCodeEditorModeConfig)();
  11202. var ivprogKeywords = codeConfig.keywords.join(" ");
  11203. var basicTypes = words(codeConfig.types.join(" "));
  11204. function ivprogTypes(identifier) {
  11205. return contains(basicTypes, identifier);
  11206. }
  11207. var ivprogBlockKeywords = codeConfig.blocks.join(" ");
  11208. var ivprogDefKeywords = "funcao const";
  11209. function def(mimes, mode) {
  11210. if (typeof mimes == "string") mimes = [mimes];
  11211. var words = [];
  11212. function add(obj) {
  11213. if (obj) {
  11214. for (var prop in obj) {
  11215. if (Object.hasOwnProperty.call(obj, prop)) {
  11216. words.push(prop);
  11217. }
  11218. }
  11219. }
  11220. }
  11221. add(mode.keywords);
  11222. add(mode.types);
  11223. add(mode.builtin);
  11224. add(mode.atoms);
  11225. if (words.length) {
  11226. mode.helperType = mimes[0];
  11227. CodeMirror.registerHelper("hintWords", mimes[0], words);
  11228. }
  11229. for (var i = 0; i < mimes.length; ++i) {
  11230. CodeMirror.defineMIME(mimes[i], mode);
  11231. }
  11232. }
  11233. def(["text/x-ivprog"], {
  11234. name: "ivprog",
  11235. keywords: words(ivprogKeywords),
  11236. types: ivprogTypes,
  11237. blockKeywords: words(ivprogBlockKeywords),
  11238. defKeywords: words(ivprogDefKeywords),
  11239. typeFirstDefinitions: true,
  11240. atoms: words(codeConfig.atoms.join(" ")),
  11241. switchKeyword: codeConfig.switchString,
  11242. caseKeyword: codeConfig.case_default[0],
  11243. defaultKeyword: codeConfig.case_default[1],
  11244. modeProps: {
  11245. fold: ["brace"]
  11246. }
  11247. });
  11248. }
  11249. /***/ }),
  11250. /***/ "./js/util/iassignHelpers.js":
  11251. /*!***********************************!*\
  11252. !*** ./js/util/iassignHelpers.js ***!
  11253. \***********************************/
  11254. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  11255. "use strict";
  11256. __webpack_require__.r(__webpack_exports__);
  11257. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  11258. /* harmony export */ "setPreviousAlgorithm": () => (/* binding */ setPreviousAlgorithm),
  11259. /* harmony export */ "prepareActivityToStudentHelperJSON": () => (/* binding */ prepareActivityToStudentHelperJSON),
  11260. /* harmony export */ "prepareActivityToStudentHelper": () => (/* binding */ prepareActivityToStudentHelper),
  11261. /* harmony export */ "autoEval": () => (/* binding */ autoEval)
  11262. /* harmony export */ });
  11263. /* harmony import */ var _visualUI_functions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../visualUI/functions */ "./js/visualUI/functions.js");
  11264. /* harmony import */ var _visualUI_code_generator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../visualUI/code_generator */ "./js/visualUI/code_generator.js");
  11265. /* harmony import */ var _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  11266. /* harmony import */ var _testConsole__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./testConsole */ "./js/util/testConsole.js");
  11267. /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../services/userLog */ "./js/services/userLog.js");
  11268. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  11269. /* harmony import */ var _maybe__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./maybe */ "./js/util/maybe.ts");
  11270. /* harmony import */ var _codeParser__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./codeParser */ "./js/util/codeParser.js");
  11271. function parseActivityData(data) {
  11272. var algorithm_in_ilm = null;
  11273. if (data.split("\n::algorithm::")[1]) {
  11274. algorithm_in_ilm = data.split("\n::algorithm::")[1].split("\n::logs::")[0];
  11275. var logs = data.split("\n::algorithm::")[1].split("\n::logs::")[1];
  11276. if (logs != null) {
  11277. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.parseLogs)(logs);
  11278. }
  11279. }
  11280. var content;
  11281. try {
  11282. content = JSON.parse(data.split("\n::algorithm::")[0]);
  11283. content["algorithm_in_ilm"] = algorithm_in_ilm;
  11284. } catch (e) {
  11285. console.error(e);
  11286. return _maybe__WEBPACK_IMPORTED_MODULE_6__.Maybe.none();
  11287. }
  11288. return _maybe__WEBPACK_IMPORTED_MODULE_6__.Maybe.some(content);
  11289. }
  11290. function configAuxiliar(obj_config) {
  11291. return new Map(Object.keys(obj_config).map(function (key) {
  11292. return [key, obj_config[key]];
  11293. }));
  11294. }
  11295. function setActivityConfig(config_json) {
  11296. ivprogCore.Config.activity_commands = configAuxiliar(config_json.commands);
  11297. ivprogCore.Config.activity_functions = configAuxiliar(config_json.functions);
  11298. ivprogCore.Config.activity_datatypes = configAuxiliar(config_json.datatypes);
  11299. ivprogCore.Config.activity_filter = configAuxiliar(config_json.filter);
  11300. ivprogCore.Config.activity_programming_type = configAuxiliar(config_json.programming);
  11301. }
  11302. function setPreviousAlgorithm(code) {
  11303. var code_obj = null;
  11304. try {
  11305. code_obj = ivprogCore.parseCode(code);
  11306. (0,_codeParser__WEBPACK_IMPORTED_MODULE_7__.parserCodeVisual)(code_obj);
  11307. } catch (e) {
  11308. showInvalidData();
  11309. console.log(e);
  11310. return;
  11311. }
  11312. }
  11313. function prepareActivityToStudentHelperJSON(ilm_cont) {
  11314. (0,_visualUI_functions__WEBPACK_IMPORTED_MODULE_0__.setTestCases)(ilm_cont.test_cases);
  11315. setActivityConfig(ilm_cont.settings);
  11316. if (ilm_cont.code) setPreviousAlgorithm(ilm_cont.code);else if (ilm_cont.algorithm) setPreviousAlgorithm(ilm_cont.algorithm);
  11317. }
  11318. function prepareActivityToStudentHelper(ilm_cont) {
  11319. var maybe_content = parseActivityData(ilm_cont);
  11320. return maybe_content.map(function (content) {
  11321. var testCases = content.testcases;
  11322. (0,_visualUI_functions__WEBPACK_IMPORTED_MODULE_0__.setTestCases)(testCases);
  11323. var prog_type = null;
  11324. if (content.settings_programming_type) {
  11325. prog_type = content.settings_programming_type[0].value;
  11326. } else {
  11327. prog_type = "visual";
  11328. }
  11329. return {
  11330. settingsProgrammingType: prog_type,
  11331. settingsDataTypes: content.settings_data_types,
  11332. settingsCommands: content.settings_commands,
  11333. settingsFunctions: content.settings_functions,
  11334. algorithmInIlm: content.algorithm_in_ilm,
  11335. settingsFilter: content.settings_filter
  11336. };
  11337. });
  11338. }
  11339. function compareArray(a, b) {
  11340. for (var i = 0; i < a.length; ++i) {
  11341. var elementA = a[i];
  11342. var elementB = b[i];
  11343. if (elementA != elementB) {
  11344. return false;
  11345. }
  11346. }
  11347. return true;
  11348. }
  11349. function compareTestcases(original, student) {
  11350. if (original.length != student.length) {
  11351. return false;
  11352. }
  11353. for (var i = 0; i < original.length; ++i) {
  11354. var elementO = original[i];
  11355. var elementS = student[i];
  11356. if (!compareArray(elementO.input, elementS.input)) {
  11357. return false;
  11358. }
  11359. if (!compareArray(elementO.output, elementS.output)) {
  11360. return false;
  11361. }
  11362. }
  11363. return true;
  11364. }
  11365. function autoEval(originalData, callback) {
  11366. var code = (0,_visualUI_code_generator__WEBPACK_IMPORTED_MODULE_1__.generate)(); //console.debug(code);
  11367. var original = parseActivityData(originalData).getOrElse(undefined);
  11368. if (original == null) {
  11369. alert("iAssign did not provide the original activity data!");
  11370. return callback(null);
  11371. }
  11372. if (code == null) {
  11373. return callback(-1); // @FeedbackConvention Casos de teste vazios
  11374. } else {
  11375. if (!compareTestcases(original.testcases, (0,_visualUI_functions__WEBPACK_IMPORTED_MODULE_0__.getTestCases)())) {
  11376. return callback(-2); // @FeedbackConvention Casos de teste alterados pelo aluno
  11377. }
  11378. try {
  11379. var ast_code = _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_5__.SemanticAnalyser.analyseFromSource(code);
  11380. var con = new _testConsole__WEBPACK_IMPORTED_MODULE_3__.TestConsole([]);
  11381. var autoAssessment = new _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_2__.IVProgAssessment(ast_code, original.testcases, con);
  11382. autoAssessment.runTest().then(function (grade) {
  11383. return callback(grade);
  11384. })["catch"](function (err) {
  11385. console.log(err);
  11386. callback(-5); // @FeedbackConvention Falha na execução
  11387. });
  11388. } catch (e) {
  11389. console.error(e);
  11390. callback(-5);
  11391. }
  11392. }
  11393. }
  11394. /***/ }),
  11395. /***/ "./js/util/inputTest.js":
  11396. /*!******************************!*\
  11397. !*** ./js/util/inputTest.js ***!
  11398. \******************************/
  11399. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  11400. "use strict";
  11401. __webpack_require__.r(__webpack_exports__);
  11402. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  11403. /* harmony export */ "InputTest": () => (/* binding */ InputTest)
  11404. /* harmony export */ });
  11405. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  11406. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  11407. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  11408. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  11409. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  11410. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  11411. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  11412. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  11413. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  11414. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  11415. /* harmony import */ var _io_input__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  11416. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  11417. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  11418. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  11419. var InputTest = /*#__PURE__*/function (_Input) {
  11420. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(InputTest, _Input);
  11421. var _super = _createSuper(InputTest);
  11422. function InputTest(inputList) {
  11423. var _this;
  11424. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, InputTest);
  11425. _this = _super.call(this);
  11426. _this.index = 0;
  11427. _this.inputList = inputList;
  11428. return _this;
  11429. }
  11430. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(InputTest, [{
  11431. key: "requestInput",
  11432. value: function requestInput() {
  11433. var _this2 = this;
  11434. var promise = new Promise(function (resolve, reject) {
  11435. if (_this2.index < _this2.inputList.length) {
  11436. resolve(_this2.inputList[_this2.index]);
  11437. _this2.index++;
  11438. } else {
  11439. reject(new Error(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_6__.LocalizedStrings.getError("exceeded_input_request")));
  11440. }
  11441. });
  11442. return promise;
  11443. }
  11444. }]);
  11445. return InputTest;
  11446. }(_io_input__WEBPACK_IMPORTED_MODULE_5__.Input);
  11447. /***/ }),
  11448. /***/ "./js/util/input_assessment.js":
  11449. /*!*************************************!*\
  11450. !*** ./js/util/input_assessment.js ***!
  11451. \*************************************/
  11452. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  11453. "use strict";
  11454. __webpack_require__.r(__webpack_exports__);
  11455. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  11456. /* harmony export */ "InputAssessment": () => (/* binding */ InputAssessment)
  11457. /* harmony export */ });
  11458. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  11459. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  11460. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  11461. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  11462. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  11463. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  11464. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  11465. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  11466. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  11467. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  11468. /* harmony import */ var _io_input__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  11469. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  11470. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  11471. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  11472. var InputAssessment = /*#__PURE__*/function (_Input) {
  11473. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(InputAssessment, _Input);
  11474. var _super = _createSuper(InputAssessment);
  11475. function InputAssessment(input_list) {
  11476. var _this;
  11477. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, InputAssessment);
  11478. _this = _super.call(this);
  11479. _this.index = 0;
  11480. _this.input_list = input_list.map(function (val) {
  11481. return {
  11482. "value": val,
  11483. "read": false
  11484. };
  11485. });
  11486. return _this;
  11487. }
  11488. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(InputAssessment, [{
  11489. key: "requestInput",
  11490. value: function requestInput() {
  11491. var _this2 = this;
  11492. var promise = new Promise(function (resolve, reject) {
  11493. if (_this2.index < _this2.input_list.length) {
  11494. var input = _this2.input_list[_this2.index];
  11495. input.read = true;
  11496. _this2.index += 1;
  11497. resolve(input.value);
  11498. } else {
  11499. reject(new Error(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_6__.LocalizedStrings.getError("exceeded_input_request")));
  11500. }
  11501. });
  11502. return promise;
  11503. }
  11504. }, {
  11505. key: "isInputAvailable",
  11506. value: function isInputAvailable() {
  11507. return this.index < this.input_list.length;
  11508. }
  11509. }]);
  11510. return InputAssessment;
  11511. }(_io_input__WEBPACK_IMPORTED_MODULE_5__.Input);
  11512. /***/ }),
  11513. /***/ "./js/util/outputTest.js":
  11514. /*!*******************************!*\
  11515. !*** ./js/util/outputTest.js ***!
  11516. \*******************************/
  11517. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  11518. "use strict";
  11519. __webpack_require__.r(__webpack_exports__);
  11520. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  11521. /* harmony export */ "OutputTest": () => (/* binding */ OutputTest)
  11522. /* harmony export */ });
  11523. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  11524. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  11525. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  11526. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  11527. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  11528. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  11529. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  11530. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  11531. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  11532. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  11533. /* harmony import */ var _io_output__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  11534. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default()(this, result); }; }
  11535. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  11536. var OutputTest = /*#__PURE__*/function (_Output) {
  11537. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(OutputTest, _Output);
  11538. var _super = _createSuper(OutputTest);
  11539. function OutputTest() {
  11540. var _this;
  11541. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, OutputTest);
  11542. _this = _super.call(this);
  11543. _this.list = [];
  11544. _this.currentLine = null;
  11545. return _this;
  11546. }
  11547. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(OutputTest, [{
  11548. key: "write",
  11549. value: function write(text) {
  11550. var newLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  11551. if (this.currentLine == null) {
  11552. this.currentLine = this.list.push("") - 1;
  11553. }
  11554. this.list[this.currentLine] += text;
  11555. if (newLine) {
  11556. this.currentLine = null;
  11557. }
  11558. }
  11559. }, {
  11560. key: "sendOutput",
  11561. value: function sendOutput(text) {
  11562. var _this2 = this;
  11563. var output = "" + text;
  11564. if (output.indexOf("\n") !== -1) {
  11565. var outputList = output.split("\n");
  11566. var last = outputList.pop();
  11567. outputList.forEach(function (t) {
  11568. //t = t.replace(/\t/g, '&#x0020;&#x0020;');
  11569. //t = t.replace(/\s/g, "&#x0020;");
  11570. if (t.length == 0) _this2.currentLine = null;else _this2.write(t, true);
  11571. }); //last = last.replace(/\t/g, '&#x0020;&#x0020;');
  11572. //last = last.replace(/\s/g, "&#x0020;");
  11573. if (last.length != 0) this.write(last);
  11574. } else {
  11575. //output = output.replace(/\t/g, '&#x0020;&#x0020;');
  11576. //output = output.replace(/\s/g, "&#x0020;");
  11577. this.write(output);
  11578. }
  11579. }
  11580. }]);
  11581. return OutputTest;
  11582. }(_io_output__WEBPACK_IMPORTED_MODULE_5__.Output);
  11583. /***/ }),
  11584. /***/ "./js/util/parseFromVisual.js":
  11585. /*!************************************!*\
  11586. !*** ./js/util/parseFromVisual.js ***!
  11587. \************************************/
  11588. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  11589. "use strict";
  11590. __webpack_require__.r(__webpack_exports__);
  11591. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  11592. /* harmony export */ "parseExpression": () => (/* binding */ parseExpression),
  11593. /* harmony export */ "parseCode": () => (/* binding */ parseCode)
  11594. /* harmony export */ });
  11595. /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
  11596. /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__);
  11597. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  11598. /* harmony import */ var _ast_expressions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ast/expressions */ "./js/ast/expressions/index.js");
  11599. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../typeSystem/types */ "./js/typeSystem/types.ts");
  11600. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  11601. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../ast/commands */ "./js/ast/commands/index.js");
  11602. /* harmony import */ var _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
  11603. /* harmony import */ var _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  11604. var TYPES = {
  11605. VARIABLE: "var",
  11606. CONST: "const",
  11607. FUNCTION: "function",
  11608. RELATIONAL: "relational",
  11609. LOGIC: "logic",
  11610. ARITHMETIC: "arithmetic"
  11611. };
  11612. function translateOp(type, op) {
  11613. switch (type) {
  11614. case TYPES.ARITHMETIC:
  11615. return op.value;
  11616. case TYPES.RELATIONAL:
  11617. return op.value;
  11618. case TYPES.LOGIC:
  11619. {
  11620. if (op.ord === 11) {
  11621. return "and";
  11622. } else if (op.ord === 12) {
  11623. return "or";
  11624. } else {
  11625. return "not";
  11626. }
  11627. }
  11628. }
  11629. }
  11630. function getOpType(op) {
  11631. switch (op.ord) {
  11632. case 0:
  11633. case 1:
  11634. case 2:
  11635. case 3:
  11636. case 4:
  11637. return TYPES.ARITHMETIC;
  11638. case 5:
  11639. case 6:
  11640. case 7:
  11641. case 8:
  11642. case 9:
  11643. case 10:
  11644. return TYPES.RELATIONAL;
  11645. default:
  11646. return TYPES.LOGIC;
  11647. }
  11648. }
  11649. /**
  11650. * @param {Commands.Case} switchCase
  11651. * */
  11652. function switchCaseWalker(switchCase) {
  11653. var commands = switchCase.commands.map(commandWalker);
  11654. var expression = switchCase.isDefault ? null : expressionWalker(switchCase.expression);
  11655. return {
  11656. type: "switchcase",
  11657. line: switchCase.sourceInfo.line,
  11658. expression: expression,
  11659. commands: commands
  11660. };
  11661. }
  11662. /**
  11663. * @param {Commands.Switch} switchCommand
  11664. * */
  11665. function switchWalker(switchCommand) {
  11666. var expression = expressionWalker(switchCommand.expression);
  11667. var cases = switchCommand.cases.map(switchCaseWalker);
  11668. return {
  11669. type: "switch",
  11670. expression: expression,
  11671. cases: cases
  11672. };
  11673. }
  11674. /**
  11675. * @param {Commands.Return} returnCommand
  11676. * */
  11677. function returnWalker(returnCommand) {
  11678. var expression = expressionWalker(returnCommand.expression);
  11679. return {
  11680. type: "return",
  11681. expression: expression
  11682. };
  11683. }
  11684. function breakWalker(_) {
  11685. return {
  11686. type: "break"
  11687. };
  11688. }
  11689. /**
  11690. * @param {Commands.For} forLoop
  11691. * */
  11692. function forWalker(forLoop) {
  11693. var var_attribution = expressionWalker(forLoop.for_id);
  11694. var var_initial = expressionWalker(forLoop.for_from);
  11695. var condition = expressionWalker(forLoop.for_to);
  11696. var step_expression = forLoop.for_pass ? expressionWalker(forLoop.for_pass) : [];
  11697. var commands = forLoop.commands.map(commandWalker);
  11698. return {
  11699. type: "repeatNtimes",
  11700. var_attribution: var_attribution,
  11701. var_initial: var_initial,
  11702. condition: condition,
  11703. step_expression: step_expression,
  11704. commands: commands
  11705. };
  11706. }
  11707. /**
  11708. * @param {Commands.While} whileLoop
  11709. * */
  11710. function whileWalker(whileLoop) {
  11711. var expression = expressionWalker(whileLoop.expression);
  11712. var commands = whileLoop.commands.map(commandWalker);
  11713. var type = whileLoop.testFirst ? "whiletrue" : "dowhiletrue";
  11714. return {
  11715. type: type,
  11716. expression: expression,
  11717. commands: commands
  11718. };
  11719. }
  11720. /**
  11721. * @param {Commands.IfThenElse} ifthenelse
  11722. * */
  11723. function ifThenElseWalker(ifthenelse) {
  11724. //ifthenelse.
  11725. var expression = expressionWalker(ifthenelse.condition);
  11726. var ifTrue = ifthenelse.ifTrue.commands.map(commandWalker);
  11727. var ifFalse = [];
  11728. if (ifthenelse.ifFalse) {
  11729. if (ifthenelse.ifFalse instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.CommandBlock) {
  11730. ifFalse = ifthenelse.ifFalse.commands.map(commandWalker);
  11731. } else {
  11732. ifFalse = [ifThenElseWalker(ifthenelse.ifFalse)];
  11733. }
  11734. }
  11735. return {
  11736. type: "iftrue",
  11737. expression: expression,
  11738. ifTrue: ifTrue,
  11739. ifFalse: ifFalse
  11740. };
  11741. }
  11742. /**
  11743. * @param {Commands.Assign} assingment
  11744. * */
  11745. function assignmentWalker(assingment) {
  11746. var variable = null;
  11747. if (assingment instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.ArrayIndexAssign) {
  11748. var line = expressionWalker(assingment.line);
  11749. var arrayClass = "vector";
  11750. var column = null;
  11751. if (assingment.column) {
  11752. arrayClass = "matrix";
  11753. column = expressionWalker(assingment.column);
  11754. }
  11755. variable = [{
  11756. instance: "expression",
  11757. type: TYPES.VARIABLE,
  11758. "class": arrayClass,
  11759. column: column,
  11760. line: line,
  11761. value: assingment.id
  11762. }];
  11763. } else {
  11764. variable = [{
  11765. instance: "expression",
  11766. type: TYPES.VARIABLE,
  11767. value: assingment.id
  11768. }];
  11769. }
  11770. var expression = expressionWalker(assingment.expression);
  11771. return {
  11772. type: "attribution",
  11773. variable: variable,
  11774. expression: expression
  11775. };
  11776. }
  11777. /**
  11778. * @param {Command} command
  11779. * */
  11780. function commandWalker(command) {
  11781. var parsedCommand = null;
  11782. if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.FunctionCall) {
  11783. parsedCommand = functionCallWalker(command);
  11784. } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.Assign) {
  11785. parsedCommand = assignmentWalker(command);
  11786. } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.IfThenElse) {
  11787. parsedCommand = ifThenElseWalker(command);
  11788. } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.While) {
  11789. parsedCommand = whileWalker(command);
  11790. } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.Break) {
  11791. parsedCommand = breakWalker(command);
  11792. } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.Return) {
  11793. parsedCommand = returnWalker(command);
  11794. } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.Switch) {
  11795. parsedCommand = switchWalker(command);
  11796. } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.For) {
  11797. parsedCommand = forWalker(command);
  11798. } else {
  11799. throw new Error("not implemented");
  11800. }
  11801. parsedCommand.line = command.sourceInfo.line;
  11802. return parsedCommand;
  11803. }
  11804. /**
  11805. * @param {Commands.FunctionCall} functionCall
  11806. * */
  11807. function functionCallWalker(functionCall) {
  11808. var name = functionCall.id;
  11809. if (name.indexOf(".") !== -1) {
  11810. name = name.split(".")[1];
  11811. }
  11812. var parameters = functionCall.actualParameters.map(expressionWalker);
  11813. if (name === "$write") {
  11814. var lastInput = parameters[parameters.length - 1][0]; // if lastInput is an object with value === '\n', newLine is true
  11815. var newLine = lastInput.value && lastInput.value.match(/^\n$/) !== null;
  11816. var content = newLine ? parameters.slice(0, parameters.length - 1) : parameters;
  11817. return {
  11818. type: "writer",
  11819. newLine: newLine,
  11820. content: content
  11821. };
  11822. }
  11823. if (name === "$read") {
  11824. return {
  11825. type: "reader",
  11826. variable: parameters[0]
  11827. };
  11828. }
  11829. return {
  11830. type: "functioncall",
  11831. parameters_list: parameters,
  11832. name: functionCall.id
  11833. };
  11834. }
  11835. /**
  11836. * @param {Commands.Function} func
  11837. * */
  11838. function functionWalker(func) {
  11839. var funcDeclaration = {
  11840. name: func.name,
  11841. line: func.sourceInfo.line,
  11842. return_type: "",
  11843. return_dimensions: 0,
  11844. parameters_list: [],
  11845. variables_list: [],
  11846. commands: []
  11847. };
  11848. if (func.returnType instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_6__.ArrayType) {
  11849. funcDeclaration.return_type = func.returnType.innerType.value;
  11850. funcDeclaration.return_dimensions = func.returnType.dimensions;
  11851. } else {
  11852. funcDeclaration.return_type = func.returnType.value;
  11853. }
  11854. funcDeclaration.parameters_list = func.formalParameters.map(functionParameterWalker);
  11855. funcDeclaration.variables_list = func.variablesDeclarations.map(variableDeclarationWalker);
  11856. funcDeclaration.commands = func.commands.map(commandWalker);
  11857. return funcDeclaration;
  11858. }
  11859. /**
  11860. * @param {Commands.FormalParameter} formalParameter
  11861. * */
  11862. function functionParameterWalker(formalParameter) {
  11863. var variable = {
  11864. name: formalParameter.id,
  11865. line: formalParameter.sourceInfo.line,
  11866. type: "",
  11867. rows: 0,
  11868. columns: 0,
  11869. dimension: 0,
  11870. value: 0,
  11871. is_const: false,
  11872. reference: formalParameter.byRef
  11873. };
  11874. if (formalParameter.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_6__.ArrayType) {
  11875. variable.type = formalParameter.type.innerType.value;
  11876. variable.dimension = formalParameter.type.dimensions;
  11877. } else {
  11878. variable.type = formalParameter.type.value;
  11879. }
  11880. return variable;
  11881. }
  11882. /**
  11883. * @param {Commands.Declaration} command
  11884. * @param {boolean} global
  11885. * */
  11886. function variableDeclarationWalker(command) {
  11887. var global = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  11888. var variable = {
  11889. name: command.id,
  11890. line: command.sourceInfo.line,
  11891. type: "",
  11892. rows: 0,
  11893. columns: 0,
  11894. dimension: 0,
  11895. value: 0,
  11896. is_const: false
  11897. };
  11898. variable.is_const = global && command.isConst;
  11899. if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.ArrayDeclaration) {
  11900. // array
  11901. var lines = expressionWalker(command.lines).pop();
  11902. variable.type = command.type.innerType.value;
  11903. if (command.isVector) {
  11904. variable.columns = lines.value;
  11905. variable.dimension = 1;
  11906. var values = command.initial.value.map(function (exp) {
  11907. return variableInitialWalker(exp);
  11908. });
  11909. variable.value = values;
  11910. } else {
  11911. var columns = expressionWalker(command.columns).pop();
  11912. variable.dimension = 2;
  11913. variable.rows = lines.value;
  11914. variable.columns = columns.value;
  11915. var _values = command.initial.value.map(function (rows) {
  11916. return rows.value.map(function (exp) {
  11917. return variableInitialWalker(exp);
  11918. });
  11919. });
  11920. variable.value = _values;
  11921. }
  11922. } else {
  11923. // atomic
  11924. variable.type = command.type.value;
  11925. variable.value = variableInitialWalker(command.initial);
  11926. }
  11927. return variable;
  11928. }
  11929. /**
  11930. * @param {any} expression
  11931. * */
  11932. function variableInitialWalker(expression) {
  11933. if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.UnaryApp) {
  11934. var left = variableInitialWalker(expression.left);
  11935. var opType = getOpType(expression.op);
  11936. if (opType !== TYPES.ARITHMETIC) {
  11937. throw new Error("invalid variable initial value: " + expression.toString());
  11938. }
  11939. return "".concat(expression.op.value).concat(left);
  11940. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.BoolLiteral) {
  11941. var value = expression.value;
  11942. return (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.convertBoolToString)(value);
  11943. } else if (expression instanceof _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_7__.Literal) {
  11944. var _value = expression.value;
  11945. if (expression.value.toNumber) {
  11946. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.REAL.isCompatible(expression.type) && expression.value.decimalPlaces() == 0) {
  11947. _value = expression.value.toFixed(2);
  11948. } else {
  11949. _value = expression.value.toNumber();
  11950. }
  11951. }
  11952. return _value;
  11953. }
  11954. throw new Error("invalid variable initial value: " + expression.toString());
  11955. }
  11956. /**
  11957. *
  11958. * @return {[]}
  11959. **/
  11960. function expressionWalker(expression) {
  11961. var result;
  11962. if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.VariableLiteral) {
  11963. result = [{
  11964. instance: "expression",
  11965. type: TYPES.VARIABLE,
  11966. value: expression.id
  11967. }];
  11968. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.FunctionCall) {
  11969. var funcObj = {
  11970. instance: "expression",
  11971. type: TYPES.FUNCTION,
  11972. value: expression.id
  11973. };
  11974. var paramsList = expression.actualParameters.map(function (e) {
  11975. return expressionWalker(e);
  11976. }); //const params = Array.prototype.concat.apply([], paramsList);
  11977. funcObj.params = paramsList;
  11978. result = [funcObj];
  11979. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.UnaryApp) {
  11980. console.log(expression);
  11981. var left = expressionWalker(expression.left);
  11982. var opType = getOpType(expression.op);
  11983. var opValue = translateOp(opType, expression.op);
  11984. result = [{
  11985. instance: "operator",
  11986. type: opType,
  11987. value: opValue
  11988. }].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(left));
  11989. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.InfixApp) {
  11990. var _left = expressionWalker(expression.left);
  11991. var right = expressionWalker(expression.right);
  11992. var _opType = getOpType(expression.op);
  11993. var _opValue = translateOp(_opType, expression.op);
  11994. result = [].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(_left), [{
  11995. instance: "operator",
  11996. type: _opType,
  11997. value: _opValue
  11998. }], _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(right));
  11999. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.ArrayAccess) {
  12000. var line = expressionWalker(expression.line);
  12001. var arrayClass = "vector";
  12002. var column = null;
  12003. if (expression.column) {
  12004. arrayClass = "matrix";
  12005. column = expressionWalker(expression.column);
  12006. }
  12007. result = [{
  12008. instance: "expression",
  12009. type: TYPES.VARIABLE,
  12010. "class": arrayClass,
  12011. column: column,
  12012. line: line,
  12013. value: expression.id
  12014. }];
  12015. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.BoolLiteral) {
  12016. var value = expression.value;
  12017. result = [{
  12018. instance: "expression",
  12019. "class": "simple",
  12020. type: TYPES.CONST,
  12021. value: (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.convertBoolToString)(value)
  12022. }];
  12023. } else {
  12024. var _value2 = expression.value;
  12025. if (expression.value.toNumber) {
  12026. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.REAL.isCompatible(expression.type) && expression.value.decimalPlaces() == 0) {
  12027. _value2 = expression.value.toFixed(2);
  12028. } else {
  12029. _value2 = expression.value.toNumber();
  12030. }
  12031. }
  12032. result = [{
  12033. instance: "expression",
  12034. "class": "simple",
  12035. type: TYPES.CONST,
  12036. value: _value2
  12037. }];
  12038. }
  12039. if (expression.parenthesis) return ["("].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(result), [")"]);else return result;
  12040. }
  12041. function parseExpression(text) {
  12042. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_1__.IVProgParser.createParser(text);
  12043. var expressionAST = parser.parseExpressionOR();
  12044. return expressionWalker(expressionAST);
  12045. }
  12046. /**
  12047. * @param {string} text
  12048. * */
  12049. function parseCode(text) {
  12050. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_1__.IVProgParser.createParser(text, false);
  12051. var codeLinesMap = new Map();
  12052. var tokens = Array.from(parser.lexer.reset(text));
  12053. var tokenStream = [];
  12054. for (var _i = 0, _tokens = tokens; _i < _tokens.length; _i++) {
  12055. var token = _tokens[_i];
  12056. if (token.type === parser.ruleNames.ERROR) {
  12057. return null;
  12058. }
  12059. if (token.type === parser.ruleNames.COMMENTS) {
  12060. for (var i = 0; i <= token.lineBreaks; i++) {
  12061. if (codeLinesMap.has(i + token.line)) codeLinesMap.get(i + token.line).push(token);else codeLinesMap.set(i + token.line, [token]);
  12062. }
  12063. continue;
  12064. }
  12065. if (token.type !== parser.ruleNames.WHITESPACE) {
  12066. tokenStream.push(token);
  12067. }
  12068. }
  12069. parser.fill(tokenStream);
  12070. try {
  12071. var program = parser.parseTree();
  12072. var globals = program.global.map(function (decl) {
  12073. return variableDeclarationWalker(decl, true);
  12074. });
  12075. var functions = program.functions.map(functionWalker);
  12076. return {
  12077. globals: globals,
  12078. functions: functions
  12079. };
  12080. } catch (e) {
  12081. console.error(e);
  12082. return null;
  12083. }
  12084. }
  12085. /***/ }),
  12086. /***/ "./js/util/string_diff.js":
  12087. /*!********************************!*\
  12088. !*** ./js/util/string_diff.js ***!
  12089. \********************************/
  12090. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  12091. "use strict";
  12092. __webpack_require__.r(__webpack_exports__);
  12093. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  12094. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  12095. /* harmony export */ });
  12096. /**
  12097. * Author: @jhchen - https://github.com/jhchen
  12098. * Modified by: @lucascalion - 23/07/2019
  12099. * This library modifies the diff-patch-match library by Neil Fraser
  12100. * by removing the patch and match functionality and certain advanced
  12101. * options in the diff function. The original license is as follows:
  12102. *
  12103. * ===
  12104. *
  12105. * Diff Match and Patch
  12106. *
  12107. * Copyright 2006 Google Inc.
  12108. * http://code.google.com/p/google-diff-match-patch/
  12109. *
  12110. * Licensed under the Apache License, Version 2.0 (the "License");
  12111. * you may not use this file except in compliance with the License.
  12112. * You may obtain a copy of the License at
  12113. *
  12114. * http://www.apache.org/licenses/LICENSE-2.0
  12115. *
  12116. * Unless required by applicable law or agreed to in writing, software
  12117. * distributed under the License is distributed on an "AS IS" BASIS,
  12118. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12119. * See the License for the specific language governing permissions and
  12120. * limitations under the License.
  12121. */
  12122. /**
  12123. * The data structure representing a diff is an array of tuples:
  12124. * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
  12125. * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
  12126. */
  12127. var DIFF_DELETE = -1;
  12128. var DIFF_INSERT = 1;
  12129. var DIFF_EQUAL = 0;
  12130. /**
  12131. * Find the differences between two texts. Simplifies the problem by stripping
  12132. * any common prefix or suffix off the texts before diffing.
  12133. * @param {string} text1 Old string to be diffed.
  12134. * @param {string} text2 New string to be diffed.
  12135. * @param {Int|Object} [cursor_pos] Edit position in text1 or object with more info
  12136. * @return {Array} Array of diff tuples.
  12137. */
  12138. function diff_main(text1, text2, cursor_pos, _fix_unicode) {
  12139. // Check for equality
  12140. if (text1 === text2) {
  12141. if (text1) {
  12142. return [[DIFF_EQUAL, text1]];
  12143. }
  12144. return [];
  12145. }
  12146. if (cursor_pos != null) {
  12147. var editdiff = find_cursor_edit_diff(text1, text2, cursor_pos);
  12148. if (editdiff) {
  12149. return editdiff;
  12150. }
  12151. } // Trim off common prefix (speedup).
  12152. var commonlength = diff_commonPrefix(text1, text2);
  12153. var commonprefix = text1.substring(0, commonlength);
  12154. text1 = text1.substring(commonlength);
  12155. text2 = text2.substring(commonlength); // Trim off common suffix (speedup).
  12156. commonlength = diff_commonSuffix(text1, text2);
  12157. var commonsuffix = text1.substring(text1.length - commonlength);
  12158. text1 = text1.substring(0, text1.length - commonlength);
  12159. text2 = text2.substring(0, text2.length - commonlength); // Compute the diff on the middle block.
  12160. var diffs = diff_compute_(text1, text2); // Restore the prefix and suffix.
  12161. if (commonprefix) {
  12162. diffs.unshift([DIFF_EQUAL, commonprefix]);
  12163. }
  12164. if (commonsuffix) {
  12165. diffs.push([DIFF_EQUAL, commonsuffix]);
  12166. }
  12167. diff_cleanupMerge(diffs, _fix_unicode);
  12168. return diffs;
  12169. }
  12170. /**
  12171. * Find the differences between two texts. Assumes that the texts do not
  12172. * have any common prefix or suffix.
  12173. * @param {string} text1 Old string to be diffed.
  12174. * @param {string} text2 New string to be diffed.
  12175. * @return {Array} Array of diff tuples.
  12176. */
  12177. function diff_compute_(text1, text2) {
  12178. var diffs;
  12179. if (!text1) {
  12180. // Just add some text (speedup).
  12181. return [[DIFF_INSERT, text2]];
  12182. }
  12183. if (!text2) {
  12184. // Just delete some text (speedup).
  12185. return [[DIFF_DELETE, text1]];
  12186. }
  12187. var longtext = text1.length > text2.length ? text1 : text2;
  12188. var shorttext = text1.length > text2.length ? text2 : text1;
  12189. var i = longtext.indexOf(shorttext);
  12190. if (i !== -1) {
  12191. // Shorter text is inside the longer text (speedup).
  12192. diffs = [[DIFF_INSERT, longtext.substring(0, i)], [DIFF_EQUAL, shorttext], [DIFF_INSERT, longtext.substring(i + shorttext.length)]]; // Swap insertions for deletions if diff is reversed.
  12193. if (text1.length > text2.length) {
  12194. diffs[0][0] = diffs[2][0] = DIFF_DELETE;
  12195. }
  12196. return diffs;
  12197. }
  12198. if (shorttext.length === 1) {
  12199. // Single character string.
  12200. // After the previous speedup, the character can't be an equality.
  12201. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
  12202. } // Check to see if the problem can be split in two.
  12203. var hm = diff_halfMatch_(text1, text2);
  12204. if (hm) {
  12205. // A half-match was found, sort out the return data.
  12206. var text1_a = hm[0];
  12207. var text1_b = hm[1];
  12208. var text2_a = hm[2];
  12209. var text2_b = hm[3];
  12210. var mid_common = hm[4]; // Send both pairs off for separate processing.
  12211. var diffs_a = diff_main(text1_a, text2_a);
  12212. var diffs_b = diff_main(text1_b, text2_b); // Merge the results.
  12213. return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
  12214. }
  12215. return diff_bisect_(text1, text2);
  12216. }
  12217. /**
  12218. * Find the 'middle snake' of a diff, split the problem in two
  12219. * and return the recursively constructed diff.
  12220. * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
  12221. * @param {string} text1 Old string to be diffed.
  12222. * @param {string} text2 New string to be diffed.
  12223. * @return {Array} Array of diff tuples.
  12224. * @private
  12225. */
  12226. function diff_bisect_(text1, text2) {
  12227. // Cache the text lengths to prevent multiple calls.
  12228. var text1_length = text1.length;
  12229. var text2_length = text2.length;
  12230. var max_d = Math.ceil((text1_length + text2_length) / 2);
  12231. var v_offset = max_d;
  12232. var v_length = 2 * max_d;
  12233. var v1 = new Array(v_length);
  12234. var v2 = new Array(v_length); // Setting all elements to -1 is faster in Chrome & Firefox than mixing
  12235. // integers and undefined.
  12236. for (var x = 0; x < v_length; x++) {
  12237. v1[x] = -1;
  12238. v2[x] = -1;
  12239. }
  12240. v1[v_offset + 1] = 0;
  12241. v2[v_offset + 1] = 0;
  12242. var delta = text1_length - text2_length; // If the total number of characters is odd, then the front path will collide
  12243. // with the reverse path.
  12244. var front = delta % 2 !== 0; // Offsets for start and end of k loop.
  12245. // Prevents mapping of space beyond the grid.
  12246. var k1start = 0;
  12247. var k1end = 0;
  12248. var k2start = 0;
  12249. var k2end = 0;
  12250. for (var d = 0; d < max_d; d++) {
  12251. // Walk the front path one step.
  12252. for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
  12253. var k1_offset = v_offset + k1;
  12254. var x1 = void 0;
  12255. if (k1 === -d || k1 !== d && v1[k1_offset - 1] < v1[k1_offset + 1]) {
  12256. x1 = v1[k1_offset + 1];
  12257. } else {
  12258. x1 = v1[k1_offset - 1] + 1;
  12259. }
  12260. var y1 = x1 - k1;
  12261. while (x1 < text1_length && y1 < text2_length && text1.charAt(x1) === text2.charAt(y1)) {
  12262. x1++;
  12263. y1++;
  12264. }
  12265. v1[k1_offset] = x1;
  12266. if (x1 > text1_length) {
  12267. // Ran off the right of the graph.
  12268. k1end += 2;
  12269. } else if (y1 > text2_length) {
  12270. // Ran off the bottom of the graph.
  12271. k1start += 2;
  12272. } else if (front) {
  12273. var k2_offset = v_offset + delta - k1;
  12274. if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] !== -1) {
  12275. // Mirror x2 onto top-left coordinate system.
  12276. var x2 = text1_length - v2[k2_offset];
  12277. if (x1 >= x2) {
  12278. // Overlap detfrontected.
  12279. return diff_bisectSplit_(text1, text2, x1, y1);
  12280. }
  12281. }
  12282. }
  12283. } // Walk the reverse path one step.
  12284. for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
  12285. var _k2_offset = v_offset + k2;
  12286. var _x = void 0;
  12287. if (k2 === -d || k2 !== d && v2[_k2_offset - 1] < v2[_k2_offset + 1]) {
  12288. _x = v2[_k2_offset + 1];
  12289. } else {
  12290. _x = v2[_k2_offset - 1] + 1;
  12291. }
  12292. var y2 = _x - k2;
  12293. while (_x < text1_length && y2 < text2_length && text1.charAt(text1_length - _x - 1) === text2.charAt(text2_length - y2 - 1)) {
  12294. _x++;
  12295. y2++;
  12296. }
  12297. v2[_k2_offset] = _x;
  12298. if (_x > text1_length) {
  12299. // Ran off the left of the graph.
  12300. k2end += 2;
  12301. } else if (y2 > text2_length) {
  12302. // Ran off the top of the graph.
  12303. k2start += 2;
  12304. } else if (!front) {
  12305. var _k1_offset = v_offset + delta - k2;
  12306. if (_k1_offset >= 0 && _k1_offset < v_length && v1[_k1_offset] !== -1) {
  12307. var _x2 = v1[_k1_offset];
  12308. var _y = v_offset + _x2 - _k1_offset; // Mirror x2 onto top-left coordinate system.
  12309. _x = text1_length - _x;
  12310. if (_x2 >= _x) {
  12311. // Overlap detected.
  12312. return diff_bisectSplit_(text1, text2, _x2, _y);
  12313. }
  12314. }
  12315. }
  12316. }
  12317. } // Diff took too long and hit the deadline or
  12318. // number of diffs equals number of characters, no commonality at all.
  12319. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
  12320. }
  12321. /**
  12322. * Given the location of the 'middle snake', split the diff in two parts
  12323. * and recurse.
  12324. * @param {string} text1 Old string to be diffed.
  12325. * @param {string} text2 New string to be diffed.
  12326. * @param {number} x Index of split point in text1.
  12327. * @param {number} y Index of split point in text2.
  12328. * @return {Array} Array of diff tuples.
  12329. */
  12330. function diff_bisectSplit_(text1, text2, x, y) {
  12331. var text1a = text1.substring(0, x);
  12332. var text2a = text2.substring(0, y);
  12333. var text1b = text1.substring(x);
  12334. var text2b = text2.substring(y); // Compute both diffs serially.
  12335. var diffs = diff_main(text1a, text2a);
  12336. var diffsb = diff_main(text1b, text2b);
  12337. return diffs.concat(diffsb);
  12338. }
  12339. /**
  12340. * Determine the common prefix of two strings.
  12341. * @param {string} text1 First string.
  12342. * @param {string} text2 Second string.
  12343. * @return {number} The number of characters common to the start of each
  12344. * string.
  12345. */
  12346. function diff_commonPrefix(text1, text2) {
  12347. // Quick check for common null cases.
  12348. if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) {
  12349. return 0;
  12350. } // Binary search.
  12351. // Performance analysis: http://neil.fraser.name/news/2007/10/09/
  12352. var pointermin = 0;
  12353. var pointermax = Math.min(text1.length, text2.length);
  12354. var pointermid = pointermax;
  12355. var pointerstart = 0;
  12356. while (pointermin < pointermid) {
  12357. if (text1.substring(pointerstart, pointermid) == text2.substring(pointerstart, pointermid)) {
  12358. pointermin = pointermid;
  12359. pointerstart = pointermin;
  12360. } else {
  12361. pointermax = pointermid;
  12362. }
  12363. pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
  12364. }
  12365. if (is_surrogate_pair_start(text1.charCodeAt(pointermid - 1))) {
  12366. pointermid--;
  12367. }
  12368. return pointermid;
  12369. }
  12370. /**
  12371. * Determine the common suffix of two strings.
  12372. * @param {string} text1 First string.
  12373. * @param {string} text2 Second string.
  12374. * @return {number} The number of characters common to the end of each string.
  12375. */
  12376. function diff_commonSuffix(text1, text2) {
  12377. // Quick check for common null cases.
  12378. if (!text1 || !text2 || text1.slice(-1) !== text2.slice(-1)) {
  12379. return 0;
  12380. } // Binary search.
  12381. // Performance analysis: http://neil.fraser.name/news/2007/10/09/
  12382. var pointermin = 0;
  12383. var pointermax = Math.min(text1.length, text2.length);
  12384. var pointermid = pointermax;
  12385. var pointerend = 0;
  12386. while (pointermin < pointermid) {
  12387. if (text1.substring(text1.length - pointermid, text1.length - pointerend) == text2.substring(text2.length - pointermid, text2.length - pointerend)) {
  12388. pointermin = pointermid;
  12389. pointerend = pointermin;
  12390. } else {
  12391. pointermax = pointermid;
  12392. }
  12393. pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
  12394. }
  12395. if (is_surrogate_pair_end(text1.charCodeAt(text1.length - pointermid))) {
  12396. pointermid--;
  12397. }
  12398. return pointermid;
  12399. }
  12400. /**
  12401. * Do the two texts share a substring which is at least half the length of the
  12402. * longer text?
  12403. * This speedup can produce non-minimal diffs.
  12404. * @param {string} text1 First string.
  12405. * @param {string} text2 Second string.
  12406. * @return {Array.<string>} Five element Array, containing the prefix of
  12407. * text1, the suffix of text1, the prefix of text2, the suffix of
  12408. * text2 and the common middle. Or null if there was no match.
  12409. */
  12410. function diff_halfMatch_(text1, text2) {
  12411. var longtext = text1.length > text2.length ? text1 : text2;
  12412. var shorttext = text1.length > text2.length ? text2 : text1;
  12413. if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
  12414. return null; // Pointless.
  12415. }
  12416. /**
  12417. * Does a substring of shorttext exist within longtext such that the substring
  12418. * is at least half the length of longtext?
  12419. * Closure, but does not reference any external variables.
  12420. * @param {string} longtext Longer string.
  12421. * @param {string} shorttext Shorter string.
  12422. * @param {number} i Start index of quarter length substring within longtext.
  12423. * @return {Array.<string>} Five element Array, containing the prefix of
  12424. * longtext, the suffix of longtext, the prefix of shorttext, the suffix
  12425. * of shorttext and the common middle. Or null if there was no match.
  12426. * @private
  12427. */
  12428. function diff_halfMatchI_(longtext, shorttext, i) {
  12429. // Start with a 1/4 length substring at position i as a seed.
  12430. var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
  12431. var j = -1;
  12432. var best_common = '';
  12433. var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
  12434. while ((j = shorttext.indexOf(seed, j + 1)) !== -1) {
  12435. var prefixLength = diff_commonPrefix(longtext.substring(i), shorttext.substring(j));
  12436. var suffixLength = diff_commonSuffix(longtext.substring(0, i), shorttext.substring(0, j));
  12437. if (best_common.length < suffixLength + prefixLength) {
  12438. best_common = shorttext.substring(j - suffixLength, j) + shorttext.substring(j, j + prefixLength);
  12439. best_longtext_a = longtext.substring(0, i - suffixLength);
  12440. best_longtext_b = longtext.substring(i + prefixLength);
  12441. best_shorttext_a = shorttext.substring(0, j - suffixLength);
  12442. best_shorttext_b = shorttext.substring(j + prefixLength);
  12443. }
  12444. }
  12445. if (best_common.length * 2 >= longtext.length) {
  12446. return [best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b, best_common];
  12447. } else {
  12448. return null;
  12449. }
  12450. } // First check if the second quarter is the seed for a half-match.
  12451. var hm1 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 4)); // Check again based on the third quarter.
  12452. var hm2 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 2));
  12453. var hm;
  12454. if (!hm1 && !hm2) {
  12455. return null;
  12456. } else if (!hm2) {
  12457. hm = hm1;
  12458. } else if (!hm1) {
  12459. hm = hm2;
  12460. } else {
  12461. // Both matched. Select the longest.
  12462. hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
  12463. } // A half-match was found, sort out the return data.
  12464. var text1_a, text1_b, text2_a, text2_b;
  12465. if (text1.length > text2.length) {
  12466. text1_a = hm[0];
  12467. text1_b = hm[1];
  12468. text2_a = hm[2];
  12469. text2_b = hm[3];
  12470. } else {
  12471. text2_a = hm[0];
  12472. text2_b = hm[1];
  12473. text1_a = hm[2];
  12474. text1_b = hm[3];
  12475. }
  12476. var mid_common = hm[4];
  12477. return [text1_a, text1_b, text2_a, text2_b, mid_common];
  12478. }
  12479. /**
  12480. * Reorder and merge like edit sections. Merge equalities.
  12481. * Any edit section can move as long as it doesn't cross an equality.
  12482. * @param {Array} diffs Array of diff tuples.
  12483. * @param {boolean} fix_unicode Whether to normalize to a unicode-correct diff
  12484. */
  12485. function diff_cleanupMerge(diffs, fix_unicode) {
  12486. diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.
  12487. var pointer = 0;
  12488. var count_delete = 0;
  12489. var count_insert = 0;
  12490. var text_delete = '';
  12491. var text_insert = '';
  12492. var commonlength;
  12493. var previous_equality;
  12494. while (pointer < diffs.length) {
  12495. if (pointer < diffs.length - 1 && !diffs[pointer][1]) {
  12496. diffs.splice(pointer, 1);
  12497. continue;
  12498. }
  12499. switch (diffs[pointer][0]) {
  12500. case DIFF_INSERT:
  12501. count_insert++;
  12502. text_insert += diffs[pointer][1];
  12503. pointer++;
  12504. break;
  12505. case DIFF_DELETE:
  12506. count_delete++;
  12507. text_delete += diffs[pointer][1];
  12508. pointer++;
  12509. break;
  12510. case DIFF_EQUAL:
  12511. previous_equality = pointer - count_insert - count_delete - 1;
  12512. if (fix_unicode) {
  12513. // prevent splitting of unicode surrogate pairs. when fix_unicode is true,
  12514. // we assume that the old and new text in the diff are complete and correct
  12515. // unicode-encoded JS strings, but the tuple boundaries may fall between
  12516. // surrogate pairs. we fix this by shaving off stray surrogates from the end
  12517. // of the previous equality and the beginning of this equality. this may create
  12518. // empty equalities or a common prefix or suffix. for example, if AB and AC are
  12519. // emojis, `[[0, 'A'], [-1, 'BA'], [0, 'C']]` would turn into deleting 'ABAC' and
  12520. // inserting 'AC', and then the common suffix 'AC' will be eliminated. in this
  12521. // particular case, both equalities go away, we absorb any previous inequalities,
  12522. // and we keep scanning for the next equality before rewriting the tuples.
  12523. if (previous_equality >= 0 && ends_with_pair_start(diffs[previous_equality][1])) {
  12524. var stray = diffs[previous_equality][1].slice(-1);
  12525. diffs[previous_equality][1] = diffs[previous_equality][1].slice(0, -1);
  12526. text_delete = stray + text_delete;
  12527. text_insert = stray + text_insert;
  12528. if (!diffs[previous_equality][1]) {
  12529. // emptied out previous equality, so delete it and include previous delete/insert
  12530. diffs.splice(previous_equality, 1);
  12531. pointer--;
  12532. var k = previous_equality - 1;
  12533. if (diffs[k] && diffs[k][0] === DIFF_INSERT) {
  12534. count_insert++;
  12535. text_insert = diffs[k][1] + text_insert;
  12536. k--;
  12537. }
  12538. if (diffs[k] && diffs[k][0] === DIFF_DELETE) {
  12539. count_delete++;
  12540. text_delete = diffs[k][1] + text_delete;
  12541. k--;
  12542. }
  12543. previous_equality = k;
  12544. }
  12545. }
  12546. if (starts_with_pair_end(diffs[pointer][1])) {
  12547. var _stray = diffs[pointer][1].charAt(0);
  12548. diffs[pointer][1] = diffs[pointer][1].slice(1);
  12549. text_delete += _stray;
  12550. text_insert += _stray;
  12551. }
  12552. }
  12553. if (pointer < diffs.length - 1 && !diffs[pointer][1]) {
  12554. // for empty equality not at end, wait for next equality
  12555. diffs.splice(pointer, 1);
  12556. break;
  12557. }
  12558. if (text_delete.length > 0 || text_insert.length > 0) {
  12559. // note that diff_commonPrefix and diff_commonSuffix are unicode-aware
  12560. if (text_delete.length > 0 && text_insert.length > 0) {
  12561. // Factor out any common prefixes.
  12562. commonlength = diff_commonPrefix(text_insert, text_delete);
  12563. if (commonlength !== 0) {
  12564. if (previous_equality >= 0) {
  12565. diffs[previous_equality][1] += text_insert.substring(0, commonlength);
  12566. } else {
  12567. diffs.splice(0, 0, [DIFF_EQUAL, text_insert.substring(0, commonlength)]);
  12568. pointer++;
  12569. }
  12570. text_insert = text_insert.substring(commonlength);
  12571. text_delete = text_delete.substring(commonlength);
  12572. } // Factor out any common suffixes.
  12573. commonlength = diff_commonSuffix(text_insert, text_delete);
  12574. if (commonlength !== 0) {
  12575. diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];
  12576. text_insert = text_insert.substring(0, text_insert.length - commonlength);
  12577. text_delete = text_delete.substring(0, text_delete.length - commonlength);
  12578. }
  12579. } // Delete the offending records and add the merged ones.
  12580. var n = count_insert + count_delete;
  12581. if (text_delete.length === 0 && text_insert.length === 0) {
  12582. diffs.splice(pointer - n, n);
  12583. pointer = pointer - n;
  12584. } else if (text_delete.length === 0) {
  12585. diffs.splice(pointer - n, n, [DIFF_INSERT, text_insert]);
  12586. pointer = pointer - n + 1;
  12587. } else if (text_insert.length === 0) {
  12588. diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete]);
  12589. pointer = pointer - n + 1;
  12590. } else {
  12591. diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete], [DIFF_INSERT, text_insert]);
  12592. pointer = pointer - n + 2;
  12593. }
  12594. }
  12595. if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) {
  12596. // Merge this equality with the previous one.
  12597. diffs[pointer - 1][1] += diffs[pointer][1];
  12598. diffs.splice(pointer, 1);
  12599. } else {
  12600. pointer++;
  12601. }
  12602. count_insert = 0;
  12603. count_delete = 0;
  12604. text_delete = '';
  12605. text_insert = '';
  12606. break;
  12607. }
  12608. }
  12609. if (diffs[diffs.length - 1][1] === '') {
  12610. diffs.pop(); // Remove the dummy entry at the end.
  12611. } // Second pass: look for single edits surrounded on both sides by equalities
  12612. // which can be shifted sideways to eliminate an equality.
  12613. // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
  12614. var changes = false;
  12615. pointer = 1; // Intentionally ignore the first and last element (don't need checking).
  12616. while (pointer < diffs.length - 1) {
  12617. if (diffs[pointer - 1][0] === DIFF_EQUAL && diffs[pointer + 1][0] === DIFF_EQUAL) {
  12618. // This is a single edit surrounded by equalities.
  12619. if (diffs[pointer][1].substring(diffs[pointer][1].length - diffs[pointer - 1][1].length) === diffs[pointer - 1][1]) {
  12620. // Shift the edit over the previous equality.
  12621. diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length);
  12622. diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
  12623. diffs.splice(pointer - 1, 1);
  12624. changes = true;
  12625. } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == diffs[pointer + 1][1]) {
  12626. // Shift the edit over the next equality.
  12627. diffs[pointer - 1][1] += diffs[pointer + 1][1];
  12628. diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1];
  12629. diffs.splice(pointer + 1, 1);
  12630. changes = true;
  12631. }
  12632. }
  12633. pointer++;
  12634. } // If shifts were made, the diff needs reordering and another shift sweep.
  12635. if (changes) {
  12636. diff_cleanupMerge(diffs, fix_unicode);
  12637. }
  12638. }
  12639. function is_surrogate_pair_start(charCode) {
  12640. return charCode >= 0xD800 && charCode <= 0xDBFF;
  12641. }
  12642. function is_surrogate_pair_end(charCode) {
  12643. return charCode >= 0xDC00 && charCode <= 0xDFFF;
  12644. }
  12645. function starts_with_pair_end(str) {
  12646. return is_surrogate_pair_end(str.charCodeAt(0));
  12647. }
  12648. function ends_with_pair_start(str) {
  12649. return is_surrogate_pair_start(str.charCodeAt(str.length - 1));
  12650. }
  12651. function remove_empty_tuples(tuples) {
  12652. var ret = [];
  12653. for (var i = 0; i < tuples.length; i++) {
  12654. if (tuples[i][1].length > 0) {
  12655. ret.push(tuples[i]);
  12656. }
  12657. }
  12658. return ret;
  12659. }
  12660. function make_edit_splice(before, oldMiddle, newMiddle, after) {
  12661. if (ends_with_pair_start(before) || starts_with_pair_end(after)) {
  12662. return null;
  12663. }
  12664. return remove_empty_tuples([[DIFF_EQUAL, before], [DIFF_DELETE, oldMiddle], [DIFF_INSERT, newMiddle], [DIFF_EQUAL, after]]);
  12665. }
  12666. function find_cursor_edit_diff(oldText, newText, cursor_pos) {
  12667. // note: this runs after equality check has ruled out exact equality
  12668. var oldRange = typeof cursor_pos === 'number' ? {
  12669. index: cursor_pos,
  12670. length: 0
  12671. } : cursor_pos.oldRange;
  12672. var newRange = typeof cursor_pos === 'number' ? null : cursor_pos.newRange; // take into account the old and new selection to generate the best diff
  12673. // possible for a text edit. for example, a text change from "xxx" to "xx"
  12674. // could be a delete or forwards-delete of any one of the x's, or the
  12675. // result of selecting two of the x's and typing "x".
  12676. var oldLength = oldText.length;
  12677. var newLength = newText.length;
  12678. if (oldRange.length === 0 && (newRange === null || newRange.length === 0)) {
  12679. // see if we have an insert or delete before or after cursor
  12680. var oldCursor = oldRange.index;
  12681. var oldBefore = oldText.slice(0, oldCursor);
  12682. var oldAfter = oldText.slice(oldCursor);
  12683. var maybeNewCursor = newRange ? newRange.index : null;
  12684. editBefore: {
  12685. // is this an insert or delete right before oldCursor?
  12686. var newCursor = oldCursor + newLength - oldLength;
  12687. if (maybeNewCursor !== null && maybeNewCursor !== newCursor) {
  12688. break editBefore;
  12689. }
  12690. if (newCursor < 0 || newCursor > newLength) {
  12691. break editBefore;
  12692. }
  12693. var newBefore = newText.slice(0, newCursor);
  12694. var newAfter = newText.slice(newCursor);
  12695. if (newAfter !== oldAfter) {
  12696. break editBefore;
  12697. }
  12698. var prefixLength = Math.min(oldCursor, newCursor);
  12699. var oldPrefix = oldBefore.slice(0, prefixLength);
  12700. var newPrefix = newBefore.slice(0, prefixLength);
  12701. if (oldPrefix !== newPrefix) {
  12702. break editBefore;
  12703. }
  12704. var oldMiddle = oldBefore.slice(prefixLength);
  12705. var newMiddle = newBefore.slice(prefixLength);
  12706. return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldAfter);
  12707. }
  12708. editAfter: {
  12709. // is this an insert or delete right after oldCursor?
  12710. if (maybeNewCursor !== null && maybeNewCursor !== oldCursor) {
  12711. break editAfter;
  12712. }
  12713. var cursor = oldCursor;
  12714. var _newBefore = newText.slice(0, cursor);
  12715. var _newAfter = newText.slice(cursor);
  12716. if (_newBefore !== oldBefore) {
  12717. break editAfter;
  12718. }
  12719. var suffixLength = Math.min(oldLength - cursor, newLength - cursor);
  12720. var oldSuffix = oldAfter.slice(oldAfter.length - suffixLength);
  12721. var newSuffix = _newAfter.slice(_newAfter.length - suffixLength);
  12722. if (oldSuffix !== newSuffix) {
  12723. break editAfter;
  12724. }
  12725. var _oldMiddle = oldAfter.slice(0, oldAfter.length - suffixLength);
  12726. var _newMiddle = _newAfter.slice(0, _newAfter.length - suffixLength);
  12727. return make_edit_splice(oldBefore, _oldMiddle, _newMiddle, oldSuffix);
  12728. }
  12729. }
  12730. if (oldRange.length > 0 && newRange && newRange.length === 0) {
  12731. replaceRange: {
  12732. // see if diff could be a splice of the old selection range
  12733. var _oldPrefix = oldText.slice(0, oldRange.index);
  12734. var _oldSuffix = oldText.slice(oldRange.index + oldRange.length);
  12735. var _prefixLength = _oldPrefix.length;
  12736. var _suffixLength = _oldSuffix.length;
  12737. if (newLength < _prefixLength + _suffixLength) {
  12738. break replaceRange;
  12739. }
  12740. var _newPrefix = newText.slice(0, _prefixLength);
  12741. var _newSuffix = newText.slice(newLength - _suffixLength);
  12742. if (_oldPrefix !== _newPrefix || _oldSuffix !== _newSuffix) {
  12743. break replaceRange;
  12744. }
  12745. var _oldMiddle2 = oldText.slice(_prefixLength, oldLength - _suffixLength);
  12746. var _newMiddle2 = newText.slice(_prefixLength, newLength - _suffixLength);
  12747. return make_edit_splice(_oldPrefix, _oldMiddle2, _newMiddle2, _oldSuffix);
  12748. }
  12749. }
  12750. return null;
  12751. }
  12752. function diff(text1, text2, cursor_pos) {
  12753. // only pass fix_unicode=true at the top level, not when diff_main is
  12754. // recursively invoked
  12755. return diff_main(text1, text2, cursor_pos, true);
  12756. }
  12757. diff.INSERT = DIFF_INSERT;
  12758. diff.DELETE = DIFF_DELETE;
  12759. diff.EQUAL = DIFF_EQUAL;
  12760. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (diff);
  12761. /***/ }),
  12762. /***/ "./js/util/testConsole.js":
  12763. /*!********************************!*\
  12764. !*** ./js/util/testConsole.js ***!
  12765. \********************************/
  12766. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  12767. "use strict";
  12768. __webpack_require__.r(__webpack_exports__);
  12769. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  12770. /* harmony export */ "TestConsole": () => (/* binding */ TestConsole)
  12771. /* harmony export */ });
  12772. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  12773. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  12774. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  12775. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  12776. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../io/domConsole */ "./js/io/domConsole.js");
  12777. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  12778. var LocalizedStrings = (0,_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.getInstance)();
  12779. var TestConsole = /*#__PURE__*/function () {
  12780. function TestConsole(inputList) {
  12781. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, TestConsole);
  12782. this.index = 0;
  12783. this.inputList = inputList;
  12784. this.list = [];
  12785. this.currentLine = null;
  12786. }
  12787. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(TestConsole, [{
  12788. key: "writeRawHTML",
  12789. value: function writeRawHTML(text) {
  12790. this._appendTextLn(text);
  12791. }
  12792. }, {
  12793. key: "write",
  12794. value: function write(text) {
  12795. var newLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  12796. this._appendText(text, _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.USER, newLine);
  12797. }
  12798. }, {
  12799. key: "info",
  12800. value: function info(text) {
  12801. this._appendTextLn(text, _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.INFO);
  12802. }
  12803. }, {
  12804. key: "err",
  12805. value: function err(text) {
  12806. this._appendTextLn(text, _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.ERR);
  12807. }
  12808. }, {
  12809. key: "_appendText",
  12810. value: function _appendText(text, _type) {
  12811. var newLine = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  12812. if (this.currentLine == null) {
  12813. this.currentLine = this.list.push('') - 1;
  12814. }
  12815. this.list[this.currentLine] += text;
  12816. if (newLine) {
  12817. this.currentLine = null;
  12818. }
  12819. }
  12820. }, {
  12821. key: "_appendTextLn",
  12822. value: function _appendTextLn(text) {
  12823. this.list.push(text);
  12824. this.currentLine = null;
  12825. }
  12826. }, {
  12827. key: "getClassForType",
  12828. value: function getClassForType(type) {
  12829. switch (type) {
  12830. case _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.USER:
  12831. return "ivprog-term-userText";
  12832. case _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.INFO:
  12833. return "ivprog-term-info";
  12834. case _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.ERR:
  12835. return "ivprog-term-error";
  12836. }
  12837. }
  12838. }, {
  12839. key: "requestInput",
  12840. value: function requestInput() {
  12841. var _this = this;
  12842. var promise = new Promise(function (resolve, reject) {
  12843. if (_this.index < _this.inputList.length) {
  12844. resolve(_this.inputList[_this.index]);
  12845. _this.index++;
  12846. } else {
  12847. reject(new Error(LocalizedStrings.getError("exceeded_input_request")));
  12848. }
  12849. });
  12850. return promise;
  12851. }
  12852. }, {
  12853. key: "sendOutput",
  12854. value: function sendOutput(text) {
  12855. var _this2 = this;
  12856. var output = '' + text;
  12857. if (output.indexOf('\n') !== -1) {
  12858. var outputList = output.split('\n');
  12859. var last = outputList.pop();
  12860. outputList.forEach(function (t) {
  12861. t = t.replace(/\t/g, '&#x0020;&#x0020;');
  12862. t = t.replace(/\s/g, "&#x0020;");
  12863. if (t.length == 0) _this2.currentLine = null;else _this2.write(t, true);
  12864. });
  12865. last = last.replace(/\t/g, '&#x0020;&#x0020;');
  12866. last = last.replace(/\s/g, "&#x0020;");
  12867. if (last.length != 0) this.write(last);
  12868. } else {
  12869. output = output.replace(/\t/g, '&#x0020;&#x0020;');
  12870. output = output.replace(/\s/g, "&#x0020;");
  12871. this.write(output);
  12872. }
  12873. }
  12874. }]);
  12875. return TestConsole;
  12876. }();
  12877. /***/ }),
  12878. /***/ "./js/util/utils.js":
  12879. /*!**************************!*\
  12880. !*** ./js/util/utils.js ***!
  12881. \**************************/
  12882. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  12883. "use strict";
  12884. __webpack_require__.r(__webpack_exports__);
  12885. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  12886. /* harmony export */ "scrollIt": () => (/* binding */ scrollIt),
  12887. /* harmony export */ "isElementInViewport": () => (/* binding */ isElementInViewport),
  12888. /* harmony export */ "isKeyword": () => (/* binding */ isKeyword),
  12889. /* harmony export */ "isValidIdentifier": () => (/* binding */ isValidIdentifier),
  12890. /* harmony export */ "getCodeEditorModeConfig": () => (/* binding */ getCodeEditorModeConfig),
  12891. /* harmony export */ "levenshteinDistance": () => (/* binding */ levenshteinDistance),
  12892. /* harmony export */ "openAssessmentDetail": () => (/* binding */ openAssessmentDetail),
  12893. /* harmony export */ "range": () => (/* binding */ range),
  12894. /* harmony export */ "sleep": () => (/* binding */ sleep)
  12895. /* harmony export */ });
  12896. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
  12897. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
  12898. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
  12899. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
  12900. /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
  12901. /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_2__);
  12902. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/languageService */ "./js/services/languageService.ts");
  12903. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  12904. /* harmony import */ var _ast_operators__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.ts");
  12905. /**
  12906. * source: https://pawelgrzybek.com/page-scroll-in-vanilla-javascript/
  12907. *
  12908. */
  12909. function scrollIt(destination) {
  12910. var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
  12911. var easing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "linear";
  12912. var callback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  12913. var easings = {
  12914. linear: function linear(t) {
  12915. return t;
  12916. },
  12917. easeInQuad: function easeInQuad(t) {
  12918. return t * t;
  12919. },
  12920. easeOutQuad: function easeOutQuad(t) {
  12921. return t * (2 - t);
  12922. },
  12923. easeInOutQuad: function easeInOutQuad(t) {
  12924. return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
  12925. },
  12926. easeInCubic: function easeInCubic(t) {
  12927. return t * t * t;
  12928. },
  12929. easeOutCubic: function easeOutCubic(t) {
  12930. return --t * t * t + 1;
  12931. },
  12932. easeInOutCubic: function easeInOutCubic(t) {
  12933. return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
  12934. },
  12935. easeInQuart: function easeInQuart(t) {
  12936. return t * t * t * t;
  12937. },
  12938. easeOutQuart: function easeOutQuart(t) {
  12939. return 1 - --t * t * t * t;
  12940. },
  12941. easeInOutQuart: function easeInOutQuart(t) {
  12942. return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t;
  12943. },
  12944. easeInQuint: function easeInQuint(t) {
  12945. return t * t * t * t * t;
  12946. },
  12947. easeOutQuint: function easeOutQuint(t) {
  12948. return 1 + --t * t * t * t * t;
  12949. },
  12950. easeInOutQuint: function easeInOutQuint(t) {
  12951. return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t;
  12952. }
  12953. };
  12954. var start = window.pageYOffset;
  12955. var startTime = "now" in window.performance ? performance.now() : new Date().getTime();
  12956. var documentHeight = Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);
  12957. var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName("body")[0].clientHeight;
  12958. var destinationOffset = typeof destination === "number" ? destination : destination.offsetTop;
  12959. var destinationOffsetToScroll = Math.round(documentHeight - destinationOffset < windowHeight ? documentHeight - windowHeight : destinationOffset);
  12960. if ("requestAnimationFrame" in window === false) {
  12961. window.scroll(0, destinationOffsetToScroll);
  12962. if (callback) {
  12963. callback();
  12964. }
  12965. return;
  12966. }
  12967. function scroll() {
  12968. var now = "now" in window.performance ? performance.now() : new Date().getTime();
  12969. var time = Math.min(1, (now - startTime) / duration);
  12970. var timeFunction = easings[easing](time);
  12971. window.scroll(0, Math.ceil(timeFunction * (destinationOffsetToScroll - start) + start));
  12972. if (window.pageYOffset === destinationOffsetToScroll) {
  12973. if (callback) {
  12974. callback();
  12975. }
  12976. return;
  12977. }
  12978. requestAnimationFrame(scroll);
  12979. }
  12980. scroll();
  12981. }
  12982. /**
  12983. *
  12984. * source: https://stackoverflow.com/a/16270434
  12985. */
  12986. function isElementInViewport(el) {
  12987. var rect = el.getBoundingClientRect();
  12988. return rect.bottom > 0 && rect.right > 0 && rect.left < (window.innerWidth || document.documentElement.clientWidth) && rect.top < (window.innerHeight || document.documentElement.clientHeight);
  12989. }
  12990. var cacheMainList = null;
  12991. var cacheOp = null;
  12992. function fillCache() {
  12993. if (cacheMainList == null) {
  12994. cacheMainList = [];
  12995. var mainList = ["RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN", "RK_STRING", "RK_INTEGER", "RK_CHARACTER", "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST", "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE", "RK_TRUE"];
  12996. var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_3__.LanguageService.getCurrentLexer();
  12997. var names = lexer.getReservedKeys();
  12998. for (var key = 0; key < mainList.length; ++key) {
  12999. var word = mainList[key];
  13000. var keyword = names[word];
  13001. cacheMainList.push(keyword.substring(1, keyword.length - 1));
  13002. }
  13003. }
  13004. if (cacheOp == null) {
  13005. cacheOp = [];
  13006. var logicOpList = [_ast_operators__WEBPACK_IMPORTED_MODULE_5__.Operators.AND.value, _ast_operators__WEBPACK_IMPORTED_MODULE_5__.Operators.OR.value, _ast_operators__WEBPACK_IMPORTED_MODULE_5__.Operators.NOT.value];
  13007. for (var op = 0; op < logicOpList.length; ++op) {
  13008. var lOp = "logic_operator_".concat(logicOpList[op]);
  13009. cacheOp.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__.LocalizedStrings.getUI(lOp));
  13010. }
  13011. }
  13012. }
  13013. function isKeyword(text) {
  13014. fillCache();
  13015. for (var key = 0; key < cacheMainList.length; ++key) {
  13016. var keyword = cacheMainList[key];
  13017. if (keyword == text) {
  13018. return true;
  13019. }
  13020. } // not in main list, check op
  13021. for (var op = 0; op < cacheOp.length; op++) {
  13022. var lOp = cacheOp[op];
  13023. if (lOp == text) {
  13024. return true;
  13025. }
  13026. }
  13027. return false;
  13028. }
  13029. function isValidIdentifier(identifier_str) {
  13030. var validRegex = /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  13031. if (!validRegex) {
  13032. return false;
  13033. }
  13034. return !isKeyword(identifier_str);
  13035. }
  13036. function getCodeEditorModeConfig() {
  13037. var blockList = ["RK_SWITCH", "RK_PROGRAM", "RK_CASE", "RK_DEFAULT", "RK_FOR", "RK_FOR_ALT", "RK_FUNCTION", "RK_DO", "RK_WHILE", "RK_WHILE_ALT", "RK_IF", "RK_ELSE"];
  13038. var keywordsList = ["RK_CONST", "RK_RETURN", "RK_BREAK", "RK_FOR_FROM", "RK_FOR_TO", "RK_FOR_PASS", "RK_DO_UNTIL"];
  13039. var typeList = ["RK_REAL", "RK_VOID", "RK_BOOLEAN", "RK_STRING", "RK_INTEGER", "RK_CHARACTER"];
  13040. var atomList = ["RK_FALSE", "RK_TRUE"];
  13041. var case_default = [];
  13042. var blocks = [];
  13043. var keywords = [];
  13044. var types = [];
  13045. var atoms = [];
  13046. var switchString = "";
  13047. cacheMainList = [];
  13048. var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_3__.LanguageService.getCurrentLexer();
  13049. var names = lexer.getReservedKeys(); //console.debug(names);
  13050. blockList.forEach(function (v) {
  13051. var keyword = names[v];
  13052. var value = keyword.substring(1, keyword.length - 1);
  13053. cacheMainList.push(value);
  13054. keywords.push(value);
  13055. blocks.push(value);
  13056. if (v == "RK_SWITCH") {
  13057. switchString = value;
  13058. } else if (v == "RK_CASE" || v == "RK_DEFAULT") {
  13059. case_default.push(value);
  13060. }
  13061. });
  13062. keywordsList.forEach(function (v) {
  13063. var keyword = names[v];
  13064. var value = keyword.substring(1, keyword.length - 1);
  13065. cacheMainList.push(value);
  13066. keywords.push(value);
  13067. });
  13068. typeList.forEach(function (v) {
  13069. var keyword = names[v];
  13070. var value = keyword.substring(1, keyword.length - 1);
  13071. cacheMainList.push(value);
  13072. types.push(value);
  13073. });
  13074. atomList.forEach(function (v) {
  13075. var keyword = names[v];
  13076. var value = keyword.substring(1, keyword.length - 1);
  13077. cacheMainList.push(value);
  13078. atoms.push(value);
  13079. });
  13080. cacheOp = [];
  13081. var logicOpList = ["NOT_OPERATOR", "OR_OPERATOR", "AND_OPERATOR"];
  13082. logicOpList.forEach(function (v) {
  13083. var keyword = names[v];
  13084. var value = keyword.substring(1, keyword.length - 1);
  13085. cacheOp.push(value);
  13086. keywords.push(value);
  13087. });
  13088. return {
  13089. case_default: case_default,
  13090. atoms: atoms,
  13091. keywords: keywords,
  13092. switchString: switchString,
  13093. types: types,
  13094. blocks: blocks
  13095. };
  13096. }
  13097. /**
  13098. * Source: https://gist.github.com/andrei-m/982927
  13099. * @param {string} a
  13100. * @param {string} b
  13101. */
  13102. function levenshteinDistance(a, b) {
  13103. if (a.length == 0) return b.length;
  13104. if (b.length == 0) return a.length;
  13105. var matrix = []; // increment along the first column of each row
  13106. var i;
  13107. for (i = 0; i <= b.length; i++) {
  13108. matrix[i] = [i];
  13109. } // increment each column in the first row
  13110. var j;
  13111. for (j = 0; j <= a.length; j++) {
  13112. matrix[0][j] = j;
  13113. } // Fill in the rest of the matrix
  13114. for (i = 1; i <= b.length; i++) {
  13115. for (j = 1; j <= a.length; j++) {
  13116. if (b.charCodeAt(i - 1) == a.charCodeAt(j - 1)) {
  13117. matrix[i][j] = matrix[i - 1][j - 1];
  13118. } else {
  13119. matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
  13120. Math.min(matrix[i][j - 1] + 1, // insertion
  13121. matrix[i - 1][j] + 1)); // deletion
  13122. }
  13123. }
  13124. }
  13125. return matrix[b.length][a.length];
  13126. }
  13127. var win = null;
  13128. function openAssessmentDetail(event) {
  13129. event.preventDefault();
  13130. var page_code = event.currentTarget.dataset.page;
  13131. if (win != null) {
  13132. win.close();
  13133. }
  13134. win = window.open("", "DetailWindow", "width=550,height=600");
  13135. win.document.open();
  13136. win.document.write(page_code);
  13137. win.document.close();
  13138. }
  13139. function range(size) {
  13140. var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  13141. return _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_2___default()(Array(size).keys()).map(function (i) {
  13142. return i + startAt;
  13143. });
  13144. }
  13145. /**
  13146. *
  13147. * @param {number} ms
  13148. */
  13149. function sleep(_x) {
  13150. return _sleep.apply(this, arguments);
  13151. }
  13152. function _sleep() {
  13153. _sleep = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(ms) {
  13154. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
  13155. while (1) {
  13156. switch (_context.prev = _context.next) {
  13157. case 0:
  13158. return _context.abrupt("return", new Promise(function (res, _) {
  13159. return setTimeout(res, ms);
  13160. }));
  13161. case 1:
  13162. case "end":
  13163. return _context.stop();
  13164. }
  13165. }
  13166. }, _callee);
  13167. }));
  13168. return _sleep.apply(this, arguments);
  13169. }
  13170. /***/ }),
  13171. /***/ "./js/visualUI/algorithm.js":
  13172. /*!**********************************!*\
  13173. !*** ./js/visualUI/algorithm.js ***!
  13174. \**********************************/
  13175. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  13176. "use strict";
  13177. __webpack_require__.r(__webpack_exports__);
  13178. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  13179. /* harmony export */ "renderAlgorithm": () => (/* binding */ renderAlgorithm)
  13180. /* harmony export */ });
  13181. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  13182. /* harmony import */ var _functions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
  13183. window.block_render = false;
  13184. function renderAlgorithm() {
  13185. if (window.block_render) {
  13186. return;
  13187. }
  13188. if (window.draging) {
  13189. return;
  13190. }
  13191. window.block_render = true;
  13192. $('.all_functions').children().off();
  13193. $('.all_functions').empty();
  13194. $('.list_globals').children().off();
  13195. $('.list_globals').empty();
  13196. for (var i = 0; i < window.program_obj.functions.length; i++) {
  13197. _functions__WEBPACK_IMPORTED_MODULE_1__.renderFunction(window.program_obj.functions[i]);
  13198. }
  13199. for (var i = 0; i < window.program_obj.globals.length; i++) {
  13200. _globals__WEBPACK_IMPORTED_MODULE_0__.renderGlobal(window.program_obj.globals[i]);
  13201. }
  13202. setTimeout(function () {
  13203. window.block_render = false;
  13204. }, 100);
  13205. if (settingsFilter && settingsFilter[0]) {
  13206. blockAllEditingOptions();
  13207. }
  13208. $('.command_drag').popup({
  13209. content: LocalizedStrings.getUI("text_move_command"),
  13210. delay: {
  13211. show: 1000,
  13212. hide: 0
  13213. }
  13214. });
  13215. }
  13216. /***/ }),
  13217. /***/ "./js/visualUI/code_generator.js":
  13218. /*!***************************************!*\
  13219. !*** ./js/visualUI/code_generator.js ***!
  13220. \***************************************/
  13221. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  13222. "use strict";
  13223. __webpack_require__.r(__webpack_exports__);
  13224. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  13225. /* harmony export */ "generate": () => (/* binding */ generate),
  13226. /* harmony export */ "repeatNtimesHeader": () => (/* binding */ repeatNtimesHeader),
  13227. /* harmony export */ "elementExpressionCode": () => (/* binding */ elementExpressionCode),
  13228. /* harmony export */ "variableValueMenuCode": () => (/* binding */ variableValueMenuCode)
  13229. /* harmony export */ });
  13230. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  13231. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  13232. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  13233. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  13234. /* eslint-disable @typescript-eslint/no-use-before-define */
  13235. /* globals $*/
  13236. function generate() {
  13237. $(".ivprog_visual_panel").find(".error_icon").remove();
  13238. var code = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("program") + " { ";
  13239. code += globalsCode();
  13240. code += "\n";
  13241. var has_error = false;
  13242. for (var i = 0; i < window.program_obj.functions.length; i++) {
  13243. var n_code = functionsCode(window.program_obj.functions[i]);
  13244. if (n_code == null) {
  13245. has_error = true;
  13246. }
  13247. code += n_code;
  13248. code += "\n";
  13249. }
  13250. code += "\n}";
  13251. if (has_error) {
  13252. return null;
  13253. } else {
  13254. return code;
  13255. }
  13256. }
  13257. function functionsCode(function_obj) {
  13258. var ret = "\n\t" + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("function") + " ";
  13259. var has_error = false;
  13260. switch (function_obj.return_type) {
  13261. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  13262. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_integer");
  13263. break;
  13264. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  13265. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_real");
  13266. break;
  13267. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  13268. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_text");
  13269. break;
  13270. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  13271. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_boolean");
  13272. break;
  13273. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  13274. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_char");
  13275. break;
  13276. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID:
  13277. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_void");
  13278. break;
  13279. }
  13280. ret += " ";
  13281. if (function_obj.return_dimensions == 1) {
  13282. ret += "[] ";
  13283. } else if (function_obj.return_dimensions == 2) {
  13284. ret += "[][] ";
  13285. }
  13286. if (function_obj.is_main) {
  13287. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("start");
  13288. } else {
  13289. ret += function_obj.name;
  13290. }
  13291. ret += " ( ";
  13292. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  13293. ret += parametersCode(function_obj.parameters_list[j]);
  13294. if (j + 1 < function_obj.parameters_list.length) {
  13295. ret += ", ";
  13296. }
  13297. }
  13298. ret += " ) {";
  13299. for (var _j = 0; _j < function_obj.variables_list.length; _j++) {
  13300. ret += variablesCode(function_obj.variables_list[_j]);
  13301. }
  13302. for (var _j2 = 0; _j2 < function_obj.commands.length; _j2++) {
  13303. //try {
  13304. ret += commandsCode(function_obj.commands[_j2]);
  13305. /*} catch (err) {
  13306. has_error = true;
  13307. console.error(err.message);
  13308. var todos = $('body').find('.command_container');
  13309. for (var i = 0; i < todos.length; i++) {
  13310. if ($(todos[i]).data('command') == function_obj.commands[j]) {
  13311. $( todos[i] ).prepend( ' <i class="ui icon red exclamation triangle error_icon"></i> ' );
  13312. break;
  13313. }
  13314. }
  13315. }*/
  13316. }
  13317. ret += "\n\t}";
  13318. if (has_error) {
  13319. return null;
  13320. } else {
  13321. return ret;
  13322. }
  13323. }
  13324. function commandsCode(command_obj) {
  13325. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  13326. switch (command_obj.type) {
  13327. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES["break"]:
  13328. return breaksCode(command_obj, indentation);
  13329. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.comment:
  13330. return commentsCode(command_obj, indentation);
  13331. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.reader:
  13332. return readersCode(command_obj, indentation);
  13333. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.writer:
  13334. return writersCode(command_obj, indentation);
  13335. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.functioncall:
  13336. return functioncallsCode(command_obj, indentation);
  13337. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.attribution:
  13338. return attributionsCode(command_obj, indentation);
  13339. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.whiletrue:
  13340. return whiletruesCode(command_obj, indentation);
  13341. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.dowhiletrue:
  13342. return doWhilesCode(command_obj, indentation);
  13343. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.iftrue:
  13344. return iftruesCode(command_obj, indentation);
  13345. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.repeatNtimes:
  13346. return repeatNtimesCode(command_obj, indentation);
  13347. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES["switch"]:
  13348. return switchsCode(command_obj, indentation);
  13349. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES["return"]:
  13350. return returnsCode(command_obj, indentation);
  13351. }
  13352. }
  13353. function returnsCode(command_obj, indentation) {
  13354. var ret = "\n";
  13355. for (var i = 0; i < indentation; i++) {
  13356. ret += "\t";
  13357. }
  13358. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_return");
  13359. if (command_obj.variable_value_menu) {
  13360. try {
  13361. ret += " " + elementExpressionCode(command_obj.variable_value_menu); //ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu, true);
  13362. } catch (err) {//Empty block
  13363. }
  13364. }
  13365. return ret;
  13366. }
  13367. function breaksCode(_command_obj, indentation) {
  13368. var ret = "\n";
  13369. for (var i = 0; i < indentation; i++) {
  13370. ret += "\t";
  13371. }
  13372. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_break");
  13373. return ret;
  13374. }
  13375. function switchsCode(command_obj, indentation) {
  13376. var ret = "\n";
  13377. for (var i = 0; i < indentation; i++) {
  13378. ret += "\t";
  13379. }
  13380. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_switch") + " ( ";
  13381. ret += variableValueMenuCode(command_obj.variable);
  13382. ret += " ) { ";
  13383. if (command_obj.cases) {
  13384. for (var _i = 0; _i < command_obj.cases.length; _i++) {
  13385. ret += switchcasesCode(command_obj.cases[_i], indentation + 1);
  13386. }
  13387. }
  13388. ret += "\n";
  13389. for (var _i2 = 0; _i2 < indentation; _i2++) {
  13390. ret += "\t";
  13391. }
  13392. ret += "} ";
  13393. return ret;
  13394. }
  13395. function switchcasesCode(switchcase, indentation) {
  13396. var ret = "\n";
  13397. for (var i = 0; i < indentation; i++) {
  13398. ret += "\t";
  13399. }
  13400. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_case") + " ";
  13401. ret += variableValueMenuCode(switchcase.variable_value_menu);
  13402. ret += " :";
  13403. if (switchcase.commands_block) {
  13404. for (var _i3 = 0; _i3 < switchcase.commands_block.length; _i3++) {
  13405. ret += commandsCode(switchcase.commands_block[_i3], indentation + 1);
  13406. }
  13407. }
  13408. return ret;
  13409. }
  13410. function repeatNtimesHeader(command_obj) {
  13411. var ret = "";
  13412. if (command_obj.var_attribution) {
  13413. ret += '<span class="repeatN_text_par_1">';
  13414. ret += variableValueMenuCode(command_obj.var_attribution);
  13415. ret += '</span>';
  13416. ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_from"), " ");
  13417. ret += '<span class="repeatN_text_par_2">';
  13418. ret += variableValueMenuCode(command_obj.expression1);
  13419. ret += '</span>';
  13420. }
  13421. if (command_obj.expression2) {
  13422. ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_to"), " ");
  13423. ret += '<span class="repeatN_text_par_3">';
  13424. ret += variableValueMenuCode(command_obj.expression2);
  13425. ret += '</span>';
  13426. }
  13427. if (command_obj.expression3) {
  13428. ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_pass"), " ");
  13429. ret += '<span class="repeatN_text_par_4">';
  13430. switch (command_obj.expression3.itens[1]) {
  13431. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.plus:
  13432. ret += " +";
  13433. break;
  13434. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.minus:
  13435. ret += " -";
  13436. break;
  13437. }
  13438. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  13439. ret += '</span>';
  13440. }
  13441. return ret;
  13442. }
  13443. function repeatNtimesCode(command_obj, indentation) {
  13444. var ret = "\n";
  13445. for (var i = 0; i < indentation; i++) {
  13446. ret += "\t";
  13447. }
  13448. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_for") + " ";
  13449. if (command_obj.var_attribution) {
  13450. ret += variableValueMenuCode(command_obj.var_attribution);
  13451. ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_from"), " ");
  13452. ret += variableValueMenuCode(command_obj.expression1);
  13453. }
  13454. if (command_obj.expression2) {
  13455. ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_to"), " ");
  13456. ret += variableValueMenuCode(command_obj.expression2);
  13457. }
  13458. if (command_obj.expression3) {
  13459. ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_pass"), " ");
  13460. switch (command_obj.expression3.itens[1]) {
  13461. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.plus:
  13462. ret += " +";
  13463. break;
  13464. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.minus:
  13465. ret += " -";
  13466. break;
  13467. }
  13468. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  13469. }
  13470. ret += " { ";
  13471. if (command_obj.commands_block) {
  13472. for (var _i4 = 0; _i4 < command_obj.commands_block.length; _i4++) {
  13473. ret += commandsCode(command_obj.commands_block[_i4], indentation + 1);
  13474. }
  13475. }
  13476. ret += "\n";
  13477. for (var _i5 = 0; _i5 < indentation; _i5++) {
  13478. ret += "\t";
  13479. }
  13480. ret += "}";
  13481. return ret;
  13482. }
  13483. function iftruesCode(command_obj, indentation) {
  13484. var ret = "\n";
  13485. for (var i = 0; i < indentation; i++) {
  13486. ret += "\t";
  13487. }
  13488. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_if");
  13489. if (!command_obj.expression) {
  13490. _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("inform_valid_expression"));
  13491. } else {
  13492. ret += " ( ";
  13493. ret += elementExpressionCode(command_obj.expression);
  13494. ret += " ) ";
  13495. }
  13496. /*switch (command_obj.expression.expression.type) {
  13497. case Models.EXPRESSION_TYPES.exp_logic:
  13498. ret += logicExpressionCode(command_obj.expression.expression);
  13499. break;
  13500. case Models.EXPRESSION_TYPES.exp_arithmetic:
  13501. ret += arithmeticExpressionCode(command_obj.expression.expression);
  13502. break;
  13503. }*/
  13504. ret += " { ";
  13505. if (command_obj.commands_block) {
  13506. for (var _i6 = 0; _i6 < command_obj.commands_block.length; _i6++) {
  13507. ret += commandsCode(command_obj.commands_block[_i6], indentation + 1);
  13508. }
  13509. }
  13510. ret += "\n";
  13511. for (var _i7 = 0; _i7 < indentation; _i7++) {
  13512. ret += "\t";
  13513. }
  13514. ret += "} " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_else") + " {";
  13515. if (command_obj.commands_else) {
  13516. for (var _i8 = 0; _i8 < command_obj.commands_else.length; _i8++) {
  13517. ret += commandsCode(command_obj.commands_else[_i8], indentation + 1);
  13518. }
  13519. }
  13520. ret += "\n";
  13521. for (var _i9 = 0; _i9 < indentation; _i9++) {
  13522. ret += "\t";
  13523. }
  13524. ret += "}";
  13525. return ret;
  13526. }
  13527. function doWhilesCode(command_obj, indentation) {
  13528. var ret = "\n";
  13529. for (var i = 0; i < indentation; i++) {
  13530. ret += "\t";
  13531. }
  13532. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_do") + " { ";
  13533. if (command_obj.commands_block) {
  13534. for (var _i10 = 0; _i10 < command_obj.commands_block.length; _i10++) {
  13535. ret += commandsCode(command_obj.commands_block[_i10], indentation + 1);
  13536. }
  13537. }
  13538. ret += "\n";
  13539. for (var _i11 = 0; _i11 < indentation; _i11++) {
  13540. ret += "\t";
  13541. }
  13542. ret += "} " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_do_until");
  13543. if (!command_obj.expression) {
  13544. _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("inform_valid_expression"));
  13545. }
  13546. /*switch (command_obj.expression.expression.type) {
  13547. case Models.EXPRESSION_TYPES.exp_logic:
  13548. ret += logicExpressionCode(command_obj.expression.expression);
  13549. break;
  13550. case Models.EXPRESSION_TYPES.exp_arithmetic:
  13551. ret += arithmeticExpressionCode(command_obj.expression.expression);
  13552. break;
  13553. }*/
  13554. if (command_obj.expression) {
  13555. ret += " ( ";
  13556. ret += elementExpressionCode(command_obj.expression);
  13557. ret += " ) ";
  13558. }
  13559. return ret;
  13560. }
  13561. function whiletruesCode(command_obj, indentation) {
  13562. var ret = "\n";
  13563. for (var i = 0; i < indentation; i++) {
  13564. ret += "\t";
  13565. }
  13566. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_while");
  13567. if (!command_obj.expression) {
  13568. _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("inform_valid_expression"));
  13569. }
  13570. /*switch (command_obj.expression.expression.type) {
  13571. case Models.EXPRESSION_TYPES.exp_logic:
  13572. ret += logicExpressionCode(command_obj.expression.expression);
  13573. break;
  13574. case Models.EXPRESSION_TYPES.exp_arithmetic:
  13575. ret += arithmeticExpressionCode(command_obj.expression.expression);
  13576. break;
  13577. }*/
  13578. if (command_obj.expression) {
  13579. ret += " ( ";
  13580. ret += elementExpressionCode(command_obj.expression);
  13581. ret += " ) ";
  13582. }
  13583. ret += " { ";
  13584. if (command_obj.commands_block) {
  13585. for (var _i12 = 0; _i12 < command_obj.commands_block.length; _i12++) {
  13586. ret += commandsCode(command_obj.commands_block[_i12], indentation + 1);
  13587. }
  13588. }
  13589. ret += "\n";
  13590. for (var _i13 = 0; _i13 < indentation; _i13++) {
  13591. ret += "\t";
  13592. }
  13593. ret += "}";
  13594. return ret;
  13595. }
  13596. function logicExpressionCode(expression) {
  13597. var ret = " ( ";
  13598. if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_logic) {
  13599. ret += logicExpressionCode(expression.first_operand);
  13600. } else if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_arithmetic) {
  13601. ret += arithmeticExpressionCode(expression.first_operand);
  13602. } else {
  13603. ret += variableValueMenuCode(expression.first_operand);
  13604. }
  13605. if (expression.operator) {
  13606. switch (expression.operator) {
  13607. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.equals_to:
  13608. ret += " == ";
  13609. break;
  13610. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.not_equals_to:
  13611. ret += " != ";
  13612. break;
  13613. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.and:
  13614. ret += " && ";
  13615. break;
  13616. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.or:
  13617. ret += " || ";
  13618. break;
  13619. }
  13620. if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_logic) {
  13621. ret += logicExpressionCode(expression.second_operand);
  13622. } else if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_arithmetic) {
  13623. ret += arithmeticExpressionCode(expression.second_operand);
  13624. } else {
  13625. ret += variableValueMenuCode(expression.second_operand);
  13626. }
  13627. }
  13628. ret += " ) ";
  13629. return ret;
  13630. }
  13631. function arithmeticExpressionCode(expression) {
  13632. var ret = " ( ";
  13633. if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_logic) {
  13634. ret += logicExpressionCode(expression.first_operand);
  13635. } else if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_arithmetic) {
  13636. ret += arithmeticExpressionCode(expression.first_operand);
  13637. } else {
  13638. ret += variableValueMenuCode(expression.first_operand);
  13639. }
  13640. switch (expression.operator) {
  13641. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.greater_than:
  13642. ret += " > ";
  13643. break;
  13644. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.less_than:
  13645. ret += " < ";
  13646. break;
  13647. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.equals_to:
  13648. ret += " == ";
  13649. break;
  13650. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.not_equals_to:
  13651. ret += " != ";
  13652. break;
  13653. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
  13654. ret += " >= ";
  13655. break;
  13656. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.less_than_or_equals_to:
  13657. ret += " <= ";
  13658. break;
  13659. }
  13660. if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_logic) {
  13661. ret += logicExpressionCode(expression.second_operand);
  13662. } else if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_arithmetic) {
  13663. ret += arithmeticExpressionCode(expression.second_operand);
  13664. } else {
  13665. ret += variableValueMenuCode(expression.second_operand);
  13666. }
  13667. ret += " ) ";
  13668. return ret;
  13669. }
  13670. function attributionsCode(command_obj, indentation) {
  13671. var ret = "\n";
  13672. for (var i = 0; i < indentation; i++) {
  13673. ret += "\t";
  13674. }
  13675. ret += variableValueMenuCode(command_obj.variable) + " <- ";
  13676. /*for (var i = 0; i < command_obj.expression.length; i++) {
  13677. ret += elementExpressionCode(command_obj.expression[i]);
  13678. }*/
  13679. ret += elementExpressionCode(command_obj.expression);
  13680. return ret;
  13681. }
  13682. function elementExpressionCode(expression_obj) {
  13683. var ret = "";
  13684. for (var i = 0; i < expression_obj.length; i++) {
  13685. if (expression_obj[i].type) {
  13686. ret += variableValueMenuCode(expression_obj[i]);
  13687. } else if (expression_obj[i].type_op) {
  13688. switch (expression_obj[i].item) {
  13689. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.plus:
  13690. ret += " + ";
  13691. break;
  13692. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.minus:
  13693. ret += " - ";
  13694. break;
  13695. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.multiplication:
  13696. ret += " * ";
  13697. break;
  13698. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.division:
  13699. ret += " / ";
  13700. break;
  13701. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.module:
  13702. ret += " % ";
  13703. break;
  13704. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.equals_to:
  13705. ret += " == ";
  13706. break;
  13707. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.not_equals_to:
  13708. ret += " != ";
  13709. break;
  13710. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.and:
  13711. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_operator_and") + " ";
  13712. break;
  13713. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.or:
  13714. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_operator_or") + " ";
  13715. break;
  13716. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.not:
  13717. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_operator_not") + " ";
  13718. break;
  13719. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.greater_than:
  13720. ret += " > ";
  13721. break;
  13722. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.less_than:
  13723. ret += " < ";
  13724. break;
  13725. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
  13726. ret += " >= ";
  13727. break;
  13728. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.less_than_or_equals_to:
  13729. ret += " <= ";
  13730. break;
  13731. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.write_sep:
  13732. ret += ', " ", ';
  13733. break;
  13734. }
  13735. } else {
  13736. ret += " " + expression_obj[i] + " ";
  13737. }
  13738. }
  13739. return ret;
  13740. }
  13741. function functioncallsCode(command_obj, indentation) {
  13742. var ret = "\n";
  13743. for (var i = 0; i < indentation; i++) {
  13744. ret += "\t";
  13745. }
  13746. ret += variableValueMenuCode(command_obj.function_called);
  13747. return ret;
  13748. }
  13749. function readersCode(command_obj, indentation) {
  13750. var ret = "\n";
  13751. for (var i = 0; i < indentation; i++) {
  13752. ret += "\t";
  13753. }
  13754. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_command_read") + " ( ";
  13755. ret += variableValueMenuCode(command_obj.variable_value_menu);
  13756. ret += " ) ";
  13757. return ret;
  13758. }
  13759. function variableValueMenuCode(variable_obj) {
  13760. var is_return = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  13761. var ret = "";
  13762. try {
  13763. if (variable_obj.function_called) {
  13764. if (variable_obj.function_called.name) {
  13765. ret += variable_obj.function_called.name + " ( ";
  13766. } else {
  13767. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.translateInternalFunction(variable_obj.function_called.identifier, variable_obj.function_called.category) + " ( ";
  13768. }
  13769. if (variable_obj.parameters_list) {
  13770. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  13771. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  13772. if (i + 1 < variable_obj.parameters_list.length) {
  13773. ret += ", ";
  13774. }
  13775. }
  13776. }
  13777. ret += " )";
  13778. } else if (variable_obj.content.type) {
  13779. ret += variable_obj.content.name;
  13780. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  13781. ret += " [ " + variableValueMenuCode(variable_obj.column) + " ] ";
  13782. }
  13783. if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2 && variable_obj.reference_dimensions == 1) {
  13784. ret += " [ " + variableValueMenuCode(variable_obj.row) + " ] ";
  13785. } else if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  13786. ret += " [ " + variableValueMenuCode(variable_obj.row) + " ] ";
  13787. ret += " [ " + variableValueMenuCode(variable_obj.column) + " ] ";
  13788. }
  13789. } else {
  13790. var content = String(variable_obj.content);
  13791. if (isNaN(content)) {
  13792. // console.debug("Content length: ", content.length);
  13793. // console.debug("Char code at 0", content.charCodeAt(0));
  13794. var isBackslash = content.charCodeAt(0) === 92;
  13795. if (content.length === 1 || content.length === 2 && isBackslash) {
  13796. ret += "'".concat(content, "'");
  13797. } else {
  13798. ret += '"' + variable_obj.content + '"';
  13799. }
  13800. } else if (content.length == 0) {
  13801. ret += '""';
  13802. } else if (content.trim().length == 0) {
  13803. ret += '"' + content + '"';
  13804. } else {
  13805. ret += variable_obj.content;
  13806. }
  13807. }
  13808. } catch (err) {
  13809. if (!is_return) {
  13810. _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(variable_obj.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("inform_valid_content"));
  13811. throw err;
  13812. }
  13813. }
  13814. return ret;
  13815. }
  13816. function writersCode(command_obj, indentation) {
  13817. var ret = "\n";
  13818. for (var i = 0; i < indentation; i++) {
  13819. ret += "\t";
  13820. }
  13821. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_command_write") + " ( ";
  13822. /*for (var i = 0; i < command_obj.content.length; i++) {
  13823. ret += variableValueMenuCode(command_obj.content[i]);
  13824. if ((i + 1) < command_obj.content.length) {
  13825. ret += ' + ';
  13826. }
  13827. }*/
  13828. ret += elementExpressionCode(command_obj.content);
  13829. if (command_obj.newline) {
  13830. ret += ', "\\n"';
  13831. }
  13832. ret += " ) ";
  13833. return ret;
  13834. }
  13835. function commentsCode(command_obj, indentation) {
  13836. var ret = "\n";
  13837. for (var i = 0; i < indentation; i++) {
  13838. ret += "\t";
  13839. }
  13840. ret += "// ";
  13841. ret += command_obj.comment_text.content;
  13842. return ret;
  13843. }
  13844. function parametersCode(parameter_obj) {
  13845. var ret = "";
  13846. switch (parameter_obj.type) {
  13847. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  13848. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_integer") + " ";
  13849. break;
  13850. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  13851. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_real") + " ";
  13852. break;
  13853. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  13854. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_text") + " ";
  13855. break;
  13856. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  13857. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_boolean") + " ";
  13858. break;
  13859. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  13860. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_char") + " ";
  13861. break;
  13862. }
  13863. if (parameter_obj.reference) ret += "&";
  13864. ret += parameter_obj.name + "";
  13865. if (parameter_obj.dimensions == 1) {
  13866. ret += " []";
  13867. } else if (parameter_obj.dimensions == 2) {
  13868. ret += " [][]";
  13869. }
  13870. return ret;
  13871. }
  13872. function variablesCode(variable_obj) {
  13873. var ret = "";
  13874. var temp = variable_obj;
  13875. ret += "\n\t\t";
  13876. if (temp.is_constant) {
  13877. ret += "const ";
  13878. }
  13879. switch (temp.type) {
  13880. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  13881. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_integer") + " ";
  13882. break;
  13883. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  13884. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_real") + " ";
  13885. break;
  13886. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  13887. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_text") + " ";
  13888. break;
  13889. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  13890. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_boolean") + " ";
  13891. break;
  13892. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  13893. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_char") + " ";
  13894. break;
  13895. }
  13896. ret += temp.name + " ";
  13897. if (temp.dimensions == 1) {
  13898. ret += "[" + temp.columns + "] ";
  13899. switch (temp.type) {
  13900. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  13901. ret += "<- {";
  13902. for (var j = 0; j < temp.value.length; j++) {
  13903. ret += temp.value[j];
  13904. if (j + 1 < temp.value.length) {
  13905. ret += ", ";
  13906. }
  13907. }
  13908. ret += "}";
  13909. break;
  13910. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  13911. ret += "<- {";
  13912. for (var _j3 = 0; _j3 < temp.value.length; _j3++) {
  13913. ret += parseFloat(temp.value[_j3]).toFixed(2);
  13914. if (_j3 + 1 < temp.value.length) {
  13915. ret += ", ";
  13916. }
  13917. }
  13918. ret += "}";
  13919. break;
  13920. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  13921. ret += "<- {";
  13922. for (var _j4 = 0; _j4 < temp.value.length; _j4++) {
  13923. ret += '"' + temp.value[_j4] + '"';
  13924. if (_j4 + 1 < temp.value.length) {
  13925. ret += ", ";
  13926. }
  13927. }
  13928. ret += "}";
  13929. break;
  13930. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  13931. ret += "<- {";
  13932. for (var _j5 = 0; _j5 < temp.value.length; _j5++) {
  13933. if (temp.value[_j5]) {
  13934. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
  13935. } else {
  13936. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
  13937. }
  13938. if (_j5 + 1 < temp.value.length) {
  13939. ret += ", ";
  13940. }
  13941. }
  13942. ret += "}";
  13943. break;
  13944. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  13945. ret += "<- {";
  13946. for (var _j6 = 0; _j6 < temp.value.length; _j6++) {
  13947. ret += "'" + temp.value[_j6] + "'";
  13948. if (_j6 + 1 < temp.value.length) {
  13949. ret += ", ";
  13950. }
  13951. }
  13952. ret += "}";
  13953. break;
  13954. }
  13955. } else if (temp.dimensions == 2) {
  13956. ret += "[" + temp.rows + "][" + temp.columns + "] ";
  13957. switch (temp.type) {
  13958. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  13959. ret += "<- {";
  13960. for (var _j7 = 0; _j7 < temp.rows; _j7++) {
  13961. ret += "{";
  13962. for (var k = 0; k < temp.columns; k++) {
  13963. ret += temp.value[_j7][k];
  13964. if (k + 1 < temp.columns) {
  13965. ret += ", ";
  13966. }
  13967. }
  13968. ret += "}";
  13969. if (_j7 + 1 < temp.rows) {
  13970. ret += ", ";
  13971. }
  13972. }
  13973. ret += "}";
  13974. break;
  13975. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  13976. ret += "<- {";
  13977. for (var _j8 = 0; _j8 < temp.rows; _j8++) {
  13978. ret += "{";
  13979. for (var _k = 0; _k < temp.columns; _k++) {
  13980. ret += parseFloat(temp.value[_j8][_k]).toFixed(2);
  13981. if (_k + 1 < temp.columns) {
  13982. ret += ", ";
  13983. }
  13984. }
  13985. ret += "}";
  13986. if (_j8 + 1 < temp.rows) {
  13987. ret += ", ";
  13988. }
  13989. }
  13990. ret += "}";
  13991. break;
  13992. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  13993. ret += "<- {";
  13994. for (var _j9 = 0; _j9 < temp.rows; _j9++) {
  13995. ret += "{";
  13996. for (var _k2 = 0; _k2 < temp.columns; _k2++) {
  13997. ret += '"' + temp.value[_j9][_k2] + '"';
  13998. if (_k2 + 1 < temp.columns) {
  13999. ret += ", ";
  14000. }
  14001. }
  14002. ret += "}";
  14003. if (_j9 + 1 < temp.rows) {
  14004. ret += ", ";
  14005. }
  14006. }
  14007. ret += "}";
  14008. break;
  14009. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  14010. ret += "<- {";
  14011. for (var _j10 = 0; _j10 < temp.rows; _j10++) {
  14012. ret += "{";
  14013. for (var _k3 = 0; _k3 < temp.columns; _k3++) {
  14014. if (temp.value[_j10][_k3]) {
  14015. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
  14016. } else {
  14017. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
  14018. }
  14019. if (_k3 + 1 < temp.columns) {
  14020. ret += ", ";
  14021. }
  14022. }
  14023. ret += "}";
  14024. if (_j10 + 1 < temp.rows) {
  14025. ret += ", ";
  14026. }
  14027. }
  14028. ret += "}";
  14029. break;
  14030. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  14031. ret += "<- {";
  14032. for (var _j11 = 0; _j11 < temp.rows; _j11++) {
  14033. ret += "{";
  14034. for (var _k4 = 0; _k4 < temp.columns; _k4++) {
  14035. ret += "'" + temp.value[_j11][_k4] + "'";
  14036. if (_k4 + 1 < temp.columns) {
  14037. ret += ", ";
  14038. }
  14039. }
  14040. ret += "}";
  14041. if (_j11 + 1 < temp.rows) {
  14042. ret += ", ";
  14043. }
  14044. }
  14045. ret += "}";
  14046. break;
  14047. }
  14048. } else {
  14049. switch (temp.type) {
  14050. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  14051. ret += "<- " + temp.value;
  14052. break;
  14053. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  14054. ret += "<- " + parseFloat(temp.value).toFixed(2);
  14055. break;
  14056. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  14057. ret += '<- "' + temp.value + '"';
  14058. break;
  14059. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  14060. ret += "<- ";
  14061. if (temp.value) {
  14062. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
  14063. } else {
  14064. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
  14065. }
  14066. break;
  14067. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  14068. ret += "<- '" + temp.value + "'";
  14069. break;
  14070. }
  14071. }
  14072. return ret;
  14073. }
  14074. function globalsCode() {
  14075. var ret = "";
  14076. if (window.program_obj.globals) {
  14077. for (var i = 0; i < window.program_obj.globals.length; i++) {
  14078. var temp = window.program_obj.globals[i];
  14079. ret += "\n\t";
  14080. if (temp.is_constant) {
  14081. ret += "const ";
  14082. }
  14083. switch (temp.type) {
  14084. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  14085. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_integer");
  14086. break;
  14087. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  14088. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_real");
  14089. break;
  14090. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  14091. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_text");
  14092. break;
  14093. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  14094. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_boolean");
  14095. break;
  14096. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  14097. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_char");
  14098. break;
  14099. }
  14100. ret += " " + temp.name + " ";
  14101. if (temp.dimensions == 1) {
  14102. ret += "[" + temp.columns + "] ";
  14103. switch (temp.type) {
  14104. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  14105. ret += "<- {";
  14106. for (var j = 0; j < temp.value.length; j++) {
  14107. ret += temp.value[j];
  14108. if (j + 1 < temp.value.length) {
  14109. ret += ", ";
  14110. }
  14111. }
  14112. ret += "}";
  14113. break;
  14114. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  14115. ret += "<- {";
  14116. for (var _j12 = 0; _j12 < temp.value.length; _j12++) {
  14117. ret += parseFloat(temp.value[_j12]).toFixed(2);
  14118. if (_j12 + 1 < temp.value.length) {
  14119. ret += ", ";
  14120. }
  14121. }
  14122. ret += "}";
  14123. break;
  14124. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  14125. ret += "<- {";
  14126. for (var _j13 = 0; _j13 < temp.value.length; _j13++) {
  14127. ret += '"' + temp.value[_j13] + '"';
  14128. if (_j13 + 1 < temp.value.length) {
  14129. ret += ", ";
  14130. }
  14131. }
  14132. ret += "}";
  14133. break;
  14134. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  14135. ret += "<- {";
  14136. for (var _j14 = 0; _j14 < temp.value.length; _j14++) {
  14137. if (temp.value[_j14]) {
  14138. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
  14139. } else {
  14140. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
  14141. }
  14142. if (_j14 + 1 < temp.value.length) {
  14143. ret += ", ";
  14144. }
  14145. }
  14146. ret += "}";
  14147. break;
  14148. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  14149. ret += "<- {";
  14150. for (var _j15 = 0; _j15 < temp.value.length; _j15++) {
  14151. ret += "'" + temp.value[_j15] + "'";
  14152. if (_j15 + 1 < temp.value.length) {
  14153. ret += ", ";
  14154. }
  14155. }
  14156. ret += "}";
  14157. break;
  14158. }
  14159. } else if (temp.dimensions == 2) {
  14160. ret += "[" + temp.rows + "][" + temp.columns + "] ";
  14161. switch (temp.type) {
  14162. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  14163. ret += "<- {";
  14164. for (var _j16 = 0; _j16 < temp.rows; _j16++) {
  14165. ret += "{";
  14166. for (var k = 0; k < temp.columns; k++) {
  14167. ret += temp.value[_j16][k];
  14168. if (k + 1 < temp.columns) {
  14169. ret += ", ";
  14170. }
  14171. }
  14172. ret += "}";
  14173. if (_j16 + 1 < temp.rows) {
  14174. ret += ", ";
  14175. }
  14176. }
  14177. ret += "}";
  14178. break;
  14179. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  14180. ret += "<- {";
  14181. for (var _j17 = 0; _j17 < temp.rows; _j17++) {
  14182. ret += "{";
  14183. for (var _k5 = 0; _k5 < temp.columns; _k5++) {
  14184. ret += parseFloat(temp.value[_j17][_k5]).toFixed(2);
  14185. if (_k5 + 1 < temp.columns) {
  14186. ret += ", ";
  14187. }
  14188. }
  14189. ret += "}";
  14190. if (_j17 + 1 < temp.rows) {
  14191. ret += ", ";
  14192. }
  14193. }
  14194. ret += "}";
  14195. break;
  14196. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  14197. ret += "<- {";
  14198. for (var _j18 = 0; _j18 < temp.rows; _j18++) {
  14199. ret += "{";
  14200. for (var _k6 = 0; _k6 < temp.columns; _k6++) {
  14201. ret += '"' + temp.value[_j18][_k6] + '"';
  14202. if (_k6 + 1 < temp.columns) {
  14203. ret += ", ";
  14204. }
  14205. }
  14206. ret += "}";
  14207. if (_j18 + 1 < temp.rows) {
  14208. ret += ", ";
  14209. }
  14210. }
  14211. ret += "}";
  14212. break;
  14213. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  14214. ret += "<- {";
  14215. for (var _j19 = 0; _j19 < temp.rows; _j19++) {
  14216. ret += "{";
  14217. for (var _k7 = 0; _k7 < temp.columns; _k7++) {
  14218. if (temp.value[_j19][_k7]) {
  14219. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
  14220. } else {
  14221. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
  14222. }
  14223. if (_k7 + 1 < temp.columns) {
  14224. ret += ", ";
  14225. }
  14226. }
  14227. ret += "}";
  14228. if (_j19 + 1 < temp.rows) {
  14229. ret += ", ";
  14230. }
  14231. }
  14232. ret += "}";
  14233. break;
  14234. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  14235. ret += "<- {";
  14236. for (var _j20 = 0; _j20 < temp.rows; _j20++) {
  14237. ret += "{";
  14238. for (var _k8 = 0; _k8 < temp.columns; _k8++) {
  14239. ret += "'" + temp.value[_j20][_k8] + "'";
  14240. if (_k8 + 1 < temp.columns) {
  14241. ret += ", ";
  14242. }
  14243. }
  14244. ret += "}";
  14245. if (_j20 + 1 < temp.rows) {
  14246. ret += ", ";
  14247. }
  14248. }
  14249. ret += "}";
  14250. break;
  14251. }
  14252. } else {
  14253. switch (temp.type) {
  14254. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  14255. ret += "<- " + temp.value;
  14256. break;
  14257. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  14258. ret += "<- " + parseFloat(temp.value).toFixed(2);
  14259. break;
  14260. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  14261. ret += '<- "' + temp.value + '"';
  14262. break;
  14263. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  14264. ret += "<- ";
  14265. if (temp.value) {
  14266. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
  14267. } else {
  14268. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
  14269. }
  14270. break;
  14271. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  14272. ret += "<- '" + temp.value + "'";
  14273. break;
  14274. }
  14275. }
  14276. }
  14277. }
  14278. return ret;
  14279. }
  14280. /***/ }),
  14281. /***/ "./js/visualUI/commands.js":
  14282. /*!*********************************!*\
  14283. !*** ./js/visualUI/commands.js ***!
  14284. \*********************************/
  14285. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  14286. "use strict";
  14287. __webpack_require__.r(__webpack_exports__);
  14288. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  14289. /* harmony export */ "removeCommand": () => (/* binding */ removeCommand),
  14290. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  14291. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand),
  14292. /* harmony export */ "genericCreateCommand": () => (/* binding */ genericCreateCommand)
  14293. /* harmony export */ });
  14294. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14295. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14296. /* harmony import */ var _commands_comment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  14297. /* harmony import */ var _commands_reader__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  14298. /* harmony import */ var _commands_writer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  14299. /* harmony import */ var _commands_attribution__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  14300. /* harmony import */ var _commands_iftrue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  14301. /* harmony import */ var _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  14302. /* harmony import */ var _commands_whiletrue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  14303. /* harmony import */ var _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  14304. /* harmony import */ var _commands_switch__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  14305. /* harmony import */ var _commands_functioncall__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  14306. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14307. /* harmony import */ var _commands_break__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  14308. /* harmony import */ var _commands_return__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  14309. /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./../services/userLog */ "./js/services/userLog.js");
  14310. // let has_element_created_draged = false;
  14311. // let which_element_is_draged = null;
  14312. function removeCommand(command, function_obj, dom_obj) {
  14313. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.REMOVE_COMMAND, command.type, '/', 0);
  14314. if (function_obj.commands.indexOf(command) > -1) {
  14315. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  14316. return true;
  14317. } // Utilize dois parantNode, pois o primeiro é o div de comandos
  14318. try {
  14319. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  14320. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  14321. return true;
  14322. }
  14323. } catch (err) {}
  14324. try {
  14325. if (dom_obj.parent().parent().data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue) {
  14326. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  14327. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  14328. return true;
  14329. }
  14330. }
  14331. } catch (err) {}
  14332. if (dom_obj.parent().data('switchcase')) {
  14333. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  14334. return true;
  14335. }
  14336. return false;
  14337. }
  14338. window.function_container_active = null;
  14339. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  14340. var floatingObject;
  14341. switch (command_type) {
  14342. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]:
  14343. floatingObject = _commands_break__WEBPACK_IMPORTED_MODULE_13__.createFloatingCommand();
  14344. break;
  14345. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment:
  14346. floatingObject = _commands_comment__WEBPACK_IMPORTED_MODULE_2__.createFloatingCommand();
  14347. break;
  14348. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.reader:
  14349. floatingObject = _commands_reader__WEBPACK_IMPORTED_MODULE_3__.createFloatingCommand();
  14350. break;
  14351. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.writer:
  14352. floatingObject = _commands_writer__WEBPACK_IMPORTED_MODULE_4__.createFloatingCommand();
  14353. break;
  14354. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.attribution:
  14355. floatingObject = _commands_attribution__WEBPACK_IMPORTED_MODULE_5__.createFloatingCommand();
  14356. break;
  14357. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue:
  14358. floatingObject = _commands_iftrue__WEBPACK_IMPORTED_MODULE_6__.createFloatingCommand();
  14359. break;
  14360. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes:
  14361. floatingObject = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_7__.createFloatingCommand();
  14362. break;
  14363. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue:
  14364. floatingObject = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_8__.createFloatingCommand();
  14365. break;
  14366. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue:
  14367. floatingObject = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_9__.createFloatingCommand();
  14368. break;
  14369. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]:
  14370. floatingObject = _commands_switch__WEBPACK_IMPORTED_MODULE_10__.createFloatingCommand();
  14371. break;
  14372. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.functioncall:
  14373. floatingObject = _commands_functioncall__WEBPACK_IMPORTED_MODULE_11__.createFloatingCommand();
  14374. break;
  14375. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["return"]:
  14376. floatingObject = _commands_return__WEBPACK_IMPORTED_MODULE_14__.createFloatingCommand();
  14377. break;
  14378. }
  14379. floatingObject.draggable().appendTo("body");
  14380. $('body').mouseup(function (evt) {
  14381. manageCommand(function_obj, function_container, evt, command_type);
  14382. $('body').off('mouseup');
  14383. $('body').off('mouseover');
  14384. });
  14385. if (!function_container.hasClass('function_div') || function_container.length < 1) {
  14386. window.mouse_event = mouse_event;
  14387. function_container = $(mouse_event.originalEvent.srcElement.closest('.function_div'));
  14388. }
  14389. function_container_active = function_container;
  14390. function_container.find('.commands_list_div').on('mousemove', function (evt) {
  14391. addGhostDiv(evt);
  14392. });
  14393. function_container.find('.commands_list_div').find("*").on('mousemove', function (evt) {
  14394. addGhostDiv(evt);
  14395. });
  14396. function_container.on('mouseout', function (event) {
  14397. var el = $(document.elementFromPoint(event.clientX, event.clientY));
  14398. if (el.closest('.commands_list_div').length < 1) {
  14399. window.ghostDiv.remove();
  14400. }
  14401. });
  14402. floatingObject.css("position", "absolute");
  14403. mouse_event.type = "mousedown.draggable";
  14404. mouse_event.target = floatingObject[0];
  14405. floatingObject.css("left", mouse_event.pageX - window.divx);
  14406. floatingObject.css("top", mouse_event.pageY);
  14407. floatingObject.trigger(mouse_event);
  14408. }
  14409. window.divx = 100;
  14410. window.ghostDiv = $('<div class="ghost_div">');
  14411. window.active_container = null;
  14412. function addGhostToEmptyBlock(element, evt) {
  14413. $('.ghost_div').remove();
  14414. var container = element.closest('.command_container');
  14415. if (container.hasClass('switch')) {
  14416. container = $(evt.target).closest('.case_div');
  14417. }
  14418. if (!container.hasClass('dowhiletrue') && !container.hasClass('iftrue') && !container.hasClass('repeatNtimes') && !container.hasClass('case_div') && !container.hasClass('whiletrue')) {
  14419. addGhostToNotEmptyBlock(element, evt);
  14420. return;
  14421. }
  14422. if (window.active_container != null) {
  14423. if (window.active_container.is(container)) {//console.log('é o mesmo, não mudou!');
  14424. } else {
  14425. if (container.length < 1) {
  14426. container = element.closest('.commands_list_div');
  14427. if (window.active_container.is(container)) {//console.log('é o mesmo command list');
  14428. } else {
  14429. //console.log('mudou para um command list');
  14430. window.active_container = container;
  14431. }
  14432. } else {//console.log('mudou para um outro container?');
  14433. }
  14434. }
  14435. }
  14436. window.active_container = container;
  14437. if (container.hasClass('iftrue')) {
  14438. var containerIf = container.find('.commands_if').get(0);
  14439. var containerElse = container.find('.commands_else').get(0);
  14440. var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
  14441. var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
  14442. var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
  14443. var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
  14444. if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
  14445. $(containerIf).append(window.ghostDiv);
  14446. } else {
  14447. $(containerElse).append(window.ghostDiv);
  14448. }
  14449. } else if (container.hasClass('case_div')) {
  14450. container.find('.case_commands_block').append(window.ghostDiv);
  14451. } else {
  14452. container.find('.block_commands').append(window.ghostDiv);
  14453. }
  14454. }
  14455. function addGhostToNotEmptyBlock(element, evt) {
  14456. $('.ghost_div').remove();
  14457. var container = element.closest('.dowhiletrue, .iftrue, .repeatNtimes, .case_div, .whiletrue'); //console.log("\n\nNOT EMPTY: ", container);
  14458. //if (window.active_container != null) {
  14459. //}
  14460. if (container.length < 1) {
  14461. container = element.closest('.commands_list_div');
  14462. window.active_container = container;
  14463. addGhostToFunctionArea(element, evt);
  14464. } else {//console.log('mudou para um outro container?');
  14465. }
  14466. window.active_container = container; // quem está mais próximo? // Essa regra se aplica somente quando o over está sobre um comando
  14467. var allfilhos;
  14468. if (container.hasClass('iftrue')) {
  14469. if ($(evt.target).closest('.data_block_if').length > 0) {
  14470. allfilhos = container.find('.commands_if').children('.command_container');
  14471. } else if ($(evt.target).closest('.data_block_else').length > 0) {
  14472. allfilhos = container.find('.commands_else').children('.command_container');
  14473. } else {
  14474. var containerIf = container.find('.commands_if').get(0);
  14475. var containerElse = container.find('.commands_else').get(0);
  14476. var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
  14477. var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
  14478. var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
  14479. var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
  14480. if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
  14481. allfilhos = $(containerIf).children('.command_container');
  14482. } else {
  14483. allfilhos = $(containerElse).children('.command_container');
  14484. }
  14485. }
  14486. } else if (container.hasClass('case_div')) {
  14487. allfilhos = container.children('.case_commands_block').children('.command_container');
  14488. } else if (container.hasClass('commands_list_div')) {
  14489. allfilhos = container.children('.command_container');
  14490. } else {
  14491. allfilhos = container.children('.block_commands').children('.command_container');
  14492. }
  14493. var topDistances = [];
  14494. var bottomDistances = [];
  14495. for (var i = 0; i < allfilhos.length; i++) {
  14496. var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
  14497. topDistances.push(topD);
  14498. var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
  14499. bottomDistances.push(botD);
  14500. }
  14501. var menorTop = Math.min.apply(null, topDistances);
  14502. var indiceTop = topDistances.indexOf(menorTop);
  14503. var menorBot = Math.min.apply(null, bottomDistances);
  14504. var indiceBot = bottomDistances.indexOf(menorBot);
  14505. if (menorTop < menorBot) {
  14506. window.ghostDiv.insertBefore($(allfilhos.get(indiceTop)));
  14507. } else {
  14508. window.ghostDiv.insertAfter($(allfilhos.get(indiceBot)));
  14509. }
  14510. }
  14511. function addGhostToFunctionArea(undermouse, evt) {
  14512. $('.ghost_div').remove();
  14513. var allfilhos = undermouse.closest('.commands_list_div').children('.command_container');
  14514. var topDistances = [];
  14515. var bottomDistances = [];
  14516. for (var i = 0; i < allfilhos.length; i++) {
  14517. var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
  14518. topDistances.push(topD);
  14519. var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
  14520. bottomDistances.push(botD);
  14521. }
  14522. var menorTop = Math.min.apply(null, topDistances);
  14523. var indiceTop = topDistances.indexOf(menorTop);
  14524. var menorBot = Math.min.apply(null, bottomDistances);
  14525. var indiceBot = bottomDistances.indexOf(menorBot);
  14526. if (menorTop < menorBot) {
  14527. window.ghostDiv.insertBefore($(allfilhos.get(indiceTop)));
  14528. } else {
  14529. window.ghostDiv.insertAfter($(allfilhos.get(indiceBot)));
  14530. }
  14531. }
  14532. function addGhostDiv(evt) {
  14533. var undermouse = $(evt.target);
  14534. if (undermouse.hasClass('ghost_div')) {
  14535. return;
  14536. } else if (undermouse.hasClass('commands_list_div')) {
  14537. addGhostToFunctionArea(undermouse, evt);
  14538. return;
  14539. } else if (undermouse.hasClass('block_commands')) {
  14540. if (undermouse.find('.command_container').length > 0) {
  14541. addGhostToNotEmptyBlock(undermouse, evt);
  14542. } else {
  14543. addGhostToEmptyBlock(undermouse, evt);
  14544. }
  14545. } else if (undermouse.hasClass('case_div')) {
  14546. if (undermouse.find('.case_commands_block').find('.command_container').length > 0) {
  14547. addGhostToNotEmptyBlock(undermouse, evt);
  14548. } else {
  14549. addGhostToEmptyBlock(undermouse, evt);
  14550. }
  14551. } else {
  14552. addGhostToNotEmptyBlock(undermouse, evt);
  14553. }
  14554. }
  14555. function borderMouseDragCommand(function_obj, function_container, evt) {
  14556. function_container.find('.over_command_drag').each(function (index) {
  14557. $(this).removeClass('over_command_drag');
  14558. });
  14559. var prev = null;
  14560. function_container.find('.commands_list_div').each(function (index) {
  14561. prev = $(this);
  14562. if (prev) {
  14563. var objLeft = prev.offset().left;
  14564. var objTop = prev.offset().top;
  14565. var objRight = objLeft + prev.width();
  14566. var objBottom = objTop + prev.height();
  14567. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  14568. prev.addClass("over_command_drag");
  14569. }
  14570. }
  14571. });
  14572. function_container.find('.command_container').each(function (index) {
  14573. var obj = $(this);
  14574. var objLeft = obj.offset().left;
  14575. var objTop = obj.offset().top;
  14576. var objRight = objLeft + obj.width();
  14577. var objBottom = objTop + obj.height();
  14578. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  14579. if (prev) {
  14580. prev.removeClass('over_command_drag');
  14581. }
  14582. obj.addClass("over_command_drag");
  14583. return;
  14584. }
  14585. });
  14586. } // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  14587. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  14588. var createdElement;
  14589. switch (command.type) {
  14590. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment:
  14591. createdElement = _commands_comment__WEBPACK_IMPORTED_MODULE_2__.renderCommand(command, function_obj);
  14592. break;
  14593. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]:
  14594. createdElement = _commands_break__WEBPACK_IMPORTED_MODULE_13__.renderCommand(command, function_obj);
  14595. break;
  14596. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.reader:
  14597. createdElement = _commands_reader__WEBPACK_IMPORTED_MODULE_3__.renderCommand(command, function_obj);
  14598. break;
  14599. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.writer:
  14600. createdElement = _commands_writer__WEBPACK_IMPORTED_MODULE_4__.renderCommand(command, function_obj);
  14601. break;
  14602. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.attribution:
  14603. createdElement = _commands_attribution__WEBPACK_IMPORTED_MODULE_5__.renderCommand(command, function_obj);
  14604. break;
  14605. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.functioncall:
  14606. createdElement = _commands_functioncall__WEBPACK_IMPORTED_MODULE_11__.renderCommand(command, function_obj);
  14607. break;
  14608. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue:
  14609. createdElement = _commands_iftrue__WEBPACK_IMPORTED_MODULE_6__.renderCommand(command, function_obj);
  14610. break;
  14611. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes:
  14612. createdElement = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_7__.renderCommand(command, function_obj);
  14613. break;
  14614. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue:
  14615. createdElement = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_8__.renderCommand(command, function_obj);
  14616. break;
  14617. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue:
  14618. createdElement = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_9__.renderCommand(command, function_obj);
  14619. break;
  14620. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]:
  14621. createdElement = _commands_switch__WEBPACK_IMPORTED_MODULE_10__.renderCommand(command, function_obj);
  14622. break;
  14623. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["return"]:
  14624. createdElement = _commands_return__WEBPACK_IMPORTED_MODULE_14__.renderCommand(command, function_obj);
  14625. break;
  14626. }
  14627. switch (before_after_inside) {
  14628. case 1:
  14629. createdElement.insertBefore(element_reference);
  14630. break;
  14631. case 2:
  14632. createdElement.insertAfter(element_reference);
  14633. break;
  14634. case 3:
  14635. element_reference.append(createdElement);
  14636. break;
  14637. }
  14638. }
  14639. function genericCreateCommand(command_type) {
  14640. switch (command_type) {
  14641. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]:
  14642. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Break();
  14643. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment:
  14644. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Comment(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__.VAR_OR_VALUE_TYPES.only_value, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_comment'), null, null, false));
  14645. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.reader:
  14646. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Reader(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false));
  14647. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.writer:
  14648. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Writer([new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  14649. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.attribution:
  14650. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Attribution(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), []);
  14651. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.functioncall:
  14652. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.FunctionCall(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__.VAR_OR_VALUE_TYPES.only_function, null, null, null, false), null);
  14653. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue:
  14654. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.IfTrue([new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  14655. //(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block)
  14656. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes:
  14657. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.RepeatNTimes(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), null, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__.VAR_OR_VALUE_TYPES.all, null, null, null, true), null, null);
  14658. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue:
  14659. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.WhileTrue([new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null);
  14660. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue:
  14661. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.DoWhileTrue([new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null);
  14662. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]:
  14663. var sc = [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SwitchCase(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__.VAR_OR_VALUE_TYPES.all, null, null, null, true))];
  14664. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Switch(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true), sc);
  14665. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["return"]:
  14666. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Return([new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  14667. }
  14668. }
  14669. function dragTrash(event) {
  14670. $('.ghost_div').remove();
  14671. var trash = $('<i class="ui icon trash alternate outline"></i>');
  14672. $('body').append(trash);
  14673. trash.css('position', 'absolute');
  14674. trash.css('top', event.clientY);
  14675. trash.css('left', event.clientX - 20);
  14676. trash.css('font-size', '3em');
  14677. trash.css('display', 'none');
  14678. function_container_active.find('.commands_list_div').off('mousemove');
  14679. function_container_active.find('.commands_list_div').find("*").off('mousemove');
  14680. trash.fadeIn(200, function () {
  14681. trash.fadeOut(200, function () {
  14682. trash.remove();
  14683. });
  14684. });
  14685. }
  14686. function findSingleElement(searching, query) {
  14687. if (!searching || !query) {
  14688. return '';
  14689. }
  14690. if (searching.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes || searching.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue || searching.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue) {
  14691. if (searching.commands_block) {
  14692. return '' + searching.commands_block.indexOf(query);
  14693. } else {
  14694. return '0';
  14695. }
  14696. } else if (searching.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue) {
  14697. if (searching.commands_block == null) {
  14698. searching.commands_block = [];
  14699. }
  14700. if (searching.commands_else == null) {
  14701. searching.commands_else = [];
  14702. }
  14703. if (searching.commands_block.indexOf(query) >= 0) {
  14704. return 'if[' + searching.commands_block.indexOf(query) + ']';
  14705. } else {
  14706. return 'else[' + searching.commands_else.indexOf(query) + ']';
  14707. }
  14708. } else if (searching.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]) {
  14709. for (var i = 0; i < searching.cases.length; i++) {
  14710. if (searching.cases[i].commands_block.indexOf(query) >= 0) {
  14711. return 'case[' + searching.cases[i].commands_block.indexOf(query) + ']';
  14712. }
  14713. }
  14714. }
  14715. }
  14716. function findPathRecursive(starter_index, hierarquia_bottom_up, function_obj) {
  14717. var index_command = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : -1;
  14718. var actual = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  14719. var full_path = '';
  14720. for (var i = 0; i <= hierarquia_bottom_up.length; i++) {
  14721. full_path += findSingleElement(hierarquia_bottom_up[i], hierarquia_bottom_up[i + 1]) + '-';
  14722. }
  14723. return full_path;
  14724. }
  14725. function manageCommand(function_obj, function_container, event, command_type) {
  14726. $(".created_element").each(function (index) {
  14727. $(this).remove();
  14728. });
  14729. var el = $(document.elementFromPoint(event.clientX, event.clientY));
  14730. if (el.hasClass('ghost_div')) {
  14731. if (el.closest('.command_container').length < 1) {
  14732. el.closest('.commands_list_div').css('height', el.closest('.commands_list_div').css('height') + 30); //$('.ghost_div').remove();
  14733. el = el.closest('.commands_list_div');
  14734. }
  14735. } // Primeiro verificar se ele soltou no espaço da função correta:
  14736. var hier = el.parentsUntil(".all_functions");
  14737. var esta_correto = false;
  14738. var esta_na_div_correta = false;
  14739. if (el.hasClass("commands_list_div")) {
  14740. esta_na_div_correta = true;
  14741. }
  14742. for (var i = 0; i < hier.length; i++) {
  14743. var temp = $(hier[i]);
  14744. if (temp.hasClass("commands_list_div")) {
  14745. esta_na_div_correta = true;
  14746. }
  14747. if (temp.data('fun') == function_obj) {
  14748. esta_correto = true;
  14749. break;
  14750. }
  14751. }
  14752. if (!esta_correto) {
  14753. // has_element_created_draged = false;
  14754. // which_element_is_draged = null;
  14755. dragTrash(event);
  14756. return;
  14757. } else {
  14758. if (!esta_na_div_correta) {
  14759. // has_element_created_draged = false;
  14760. // which_element_is_draged = null;
  14761. dragTrash(event);
  14762. return;
  14763. }
  14764. }
  14765. var hierarquia_bottom_up = null; // Agora é descobrir qual o escopo para adicionar o comando:
  14766. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  14767. if (typeof el.data('fun') !== 'undefined') {
  14768. // Se a lista de comandos estiver vazia, então é o primeiro.
  14769. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  14770. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  14771. // pode adicionar
  14772. el.data('fun').commands = [];
  14773. var new_cmd = genericCreateCommand(command_type);
  14774. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, command_type, '/', 0);
  14775. el.data('fun').commands.push(new_cmd);
  14776. renderCommand(new_cmd, $(function_container).find('.commands_list_div'), 3, function_obj);
  14777. } else {
  14778. // Entra nesse else, caso já existam outros comandos no bloco:
  14779. findNearbyCommandToAddInFunctionScope(el, event, $(function_container).find('.commands_list_div'), function_obj, command_type);
  14780. }
  14781. } else {
  14782. // descobrir em qual comando ele soltou:
  14783. var hier_find = el.parentsUntil(".commands_list_div");
  14784. hierarquia_bottom_up = [];
  14785. if (typeof el.data('command') !== 'undefined') {
  14786. hierarquia_bottom_up.push(el.data('command'));
  14787. }
  14788. for (var i = 0; i < hier_find.length; i++) {
  14789. if (typeof $(hier_find[i]).data('command') !== 'undefined') {
  14790. hierarquia_bottom_up.push($(hier_find[i]).data('command'));
  14791. }
  14792. } // Se for do tipo break, verificar se está no contexto correto:
  14793. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  14794. var is_correct_context = false;
  14795. if (command_type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]) {
  14796. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  14797. if (hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes || hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue || hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue || hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]) {
  14798. is_correct_context = true;
  14799. break;
  14800. }
  14801. }
  14802. if (!is_correct_context) {
  14803. console.error("Context not allowed to insert BREAK COMMAND!");
  14804. return;
  14805. }
  14806. } // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  14807. if (hierarquia_bottom_up.length == 1) {
  14808. var sub_elemento = false;
  14809. for (var i = 0; i < hier_find.length; i++) {
  14810. if (typeof $(hier_find[i]).data('command') !== 'undefined') {
  14811. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  14812. sub_elemento = true;
  14813. break;
  14814. }
  14815. }
  14816. if (!sub_elemento) {
  14817. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  14818. }
  14819. } else {
  14820. // caso exista mais de um elemento na hierarquia:
  14821. if (typeof $(el).data('command') !== 'undefined') {
  14822. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  14823. } else {
  14824. var sub_elemento = false;
  14825. for (var i = 0; i < hier_find.length; i++) {
  14826. if (typeof $(hier_find[i]).data('command') !== 'undefined') {
  14827. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  14828. sub_elemento = true;
  14829. break;
  14830. }
  14831. }
  14832. }
  14833. }
  14834. } // has_element_created_draged = false;
  14835. // which_element_is_draged = null;
  14836. if (hierarquia_bottom_up) {
  14837. var i = hierarquia_bottom_up.length - 1;
  14838. var starter_index = window.program_obj.functions[window.program_obj.functions.indexOf(function_obj)].commands.indexOf(hierarquia_bottom_up[i]);
  14839. var all_str_path = starter_index + '-' + findPathRecursive(starter_index, hierarquia_bottom_up, function_obj);
  14840. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, command_type, '/', all_str_path);
  14841. }
  14842. renderAlgorithm();
  14843. }
  14844. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  14845. var el_jq = $(el);
  14846. var command_parent = el_jq.data('command');
  14847. if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]) {
  14848. if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue) {
  14849. // Se não tiver outro comando ainda no bloco, só adiciona:
  14850. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  14851. command_parent.commands_block = [];
  14852. var recentComand = genericCreateCommand(command_type);
  14853. command_parent.commands_block.push(recentComand);
  14854. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, command_type, '/' + el_jq.data('command').type, 0);
  14855. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  14856. } else {
  14857. // Se já tem algum comando no bloco:
  14858. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  14859. }
  14860. } else {
  14861. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  14862. addCommandToSwitchCase(event, function_obj, command_type);
  14863. }
  14864. } else {
  14865. // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  14866. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  14867. }
  14868. }
  14869. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  14870. var all_sub = $(node_list_commands).find('div.command_container');
  14871. var menor_distancia = 999999999;
  14872. var elemento_menor_distancia = null;
  14873. var antes = true;
  14874. var t_bot;
  14875. var t_top; // Descobrindo o elemento mais próximo:
  14876. for (var i = 0; i < all_sub.length; i++) {
  14877. t_top = all_sub[i].getBoundingClientRect().top;
  14878. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  14879. if (t_top - event.clientY < menor_distancia) {
  14880. menor_distancia = event.clientY - t_top;
  14881. elemento_menor_distancia = all_sub[i];
  14882. }
  14883. }
  14884. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  14885. if (borda_inferior - event.clientY < menor_distancia) {
  14886. var recentComand = genericCreateCommand(command_type);
  14887. command_parent.commands_block.push(recentComand); //
  14888. renderCommand(recentComand, node_list_commands, 3, function_obj);
  14889. } else {
  14890. var recentComand = genericCreateCommand(command_type);
  14891. var index = command_parent.commands_block.indexOf($(elemento_menor_distancia).data('command'));
  14892. if (index > -1) {
  14893. command_parent.commands_block.splice(index, 0, recentComand);
  14894. }
  14895. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  14896. }
  14897. }
  14898. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  14899. var el_jq = $(el);
  14900. var command_parent = $(el.parentNode.parentNode).data('command');
  14901. var command_target = el_jq.data('command');
  14902. var temp_parent = $(el.parentNode.parentNode);
  14903. var is_in_else = false;
  14904. if (!command_parent) {
  14905. command_parent = el_jq.data('command');
  14906. temp_parent = el_jq;
  14907. var hier = el_jq.parentsUntil(".command_container");
  14908. for (var i = 0; i < hier.length; i++) {
  14909. var temp = $(hier[i]);
  14910. if (typeof temp.data('else') != 'undefined') {
  14911. is_in_else = true;
  14912. }
  14913. if (typeof temp.data('command') != 'undefined') {
  14914. command_parent = temp.data('command');
  14915. temp_parent = temp;
  14916. }
  14917. }
  14918. }
  14919. var hier = el_jq.parentsUntil(".command_container");
  14920. for (var i = 0; i < hier.length; i++) {
  14921. var temp = $(hier[i]);
  14922. if (typeof temp.data('else') != 'undefined') {
  14923. is_in_else = true;
  14924. }
  14925. }
  14926. if (command_parent == command_target) {
  14927. var hier = el_jq.parentsUntil(".command_container");
  14928. for (var i = 0; i < hier.length; i++) {
  14929. var temp = $(hier[i]);
  14930. if (typeof temp.data('else') !== 'undefined') {
  14931. is_in_else = true;
  14932. break;
  14933. }
  14934. }
  14935. }
  14936. if (command_parent.type != _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue && command_parent.type != _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]) {
  14937. var hier = temp_parent.parentsUntil(".all_cases_div");
  14938. for (var i = 0; i < hier.length; i++) {
  14939. var temp = $(hier[i]);
  14940. if (typeof temp.data('switchcase') !== 'undefined') {
  14941. command_parent = temp.data('switchcase');
  14942. is_in_else = false;
  14943. break;
  14944. }
  14945. }
  14946. }
  14947. var menor_distancia = 999999999;
  14948. var antes = true;
  14949. var t_bot;
  14950. var t_top;
  14951. t_top = el.getBoundingClientRect().top;
  14952. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  14953. var d_top = event.clientY - t_top; // distancia topo
  14954. var d_bot = t_bot - event.clientY; // distancia baixo
  14955. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  14956. if (d_top < d_bot) {
  14957. var recentComand = genericCreateCommand(command_type);
  14958. if (is_in_else) {
  14959. if (command_parent == command_target) {
  14960. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  14961. command_parent.commands_else = [];
  14962. var recentComand = genericCreateCommand(command_type);
  14963. command_parent.commands_else.push(recentComand);
  14964. renderCommand(recentComand, el_jq, 3, function_obj);
  14965. } else {
  14966. // Se já tem algum comando no bloco:
  14967. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  14968. }
  14969. return;
  14970. }
  14971. var index = command_parent.commands_else.indexOf(command_target);
  14972. if (index > -1) {
  14973. command_parent.commands_else.splice(index, 0, recentComand);
  14974. }
  14975. renderCommand(recentComand, el, 1, function_obj);
  14976. } else {
  14977. if (command_parent == command_target) {
  14978. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  14979. command_parent.commands_block = [];
  14980. var recentComand = genericCreateCommand(command_type);
  14981. command_parent.commands_block.push(recentComand);
  14982. renderCommand(recentComand, el_jq, 3, function_obj);
  14983. } else {
  14984. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  14985. }
  14986. return;
  14987. }
  14988. var index = command_parent.commands_block.indexOf(command_target);
  14989. if (index > -1) {
  14990. command_parent.commands_block.splice(index, 0, recentComand);
  14991. }
  14992. renderCommand(recentComand, el, 1, function_obj);
  14993. }
  14994. } else {
  14995. var recentComand = genericCreateCommand(command_type);
  14996. if (is_in_else) {
  14997. if (command_parent == command_target) {
  14998. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  14999. command_parent.commands_else = [];
  15000. var recentComand = genericCreateCommand(command_type);
  15001. command_parent.commands_else.push(recentComand);
  15002. renderCommand(recentComand, el_jq, 3, function_obj);
  15003. } else {
  15004. // Se já tem algum comando no bloco:
  15005. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  15006. }
  15007. return;
  15008. }
  15009. var index = command_parent.commands_else.indexOf(command_target);
  15010. if (index > -1) {
  15011. command_parent.commands_else.splice(index + 1, 0, recentComand);
  15012. }
  15013. renderCommand(recentComand, el, 2, function_obj);
  15014. } else {
  15015. if (command_parent == command_target) {
  15016. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  15017. command_parent.commands_block = [];
  15018. var recentComand = genericCreateCommand(command_type);
  15019. command_parent.commands_block.push(recentComand);
  15020. renderCommand(recentComand, el_jq, 3, function_obj);
  15021. } else {
  15022. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  15023. }
  15024. return;
  15025. }
  15026. var index = command_parent.commands_block.indexOf(command_target);
  15027. if (index > -1) {
  15028. command_parent.commands_block.splice(index + 1, 0, recentComand);
  15029. }
  15030. renderCommand(recentComand, el, 2, function_obj);
  15031. }
  15032. }
  15033. }
  15034. function insertCommandInBlock(el, event, function_obj, command_type) {
  15035. var el_jq = $(el);
  15036. var command_parent = el_jq.data('command');
  15037. if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue) {
  15038. // Se não tiver outro comando ainda no bloco, só adiciona:
  15039. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  15040. command_parent.commands_block = [];
  15041. var recentComand = genericCreateCommand(command_type);
  15042. command_parent.commands_block.push(recentComand);
  15043. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  15044. } else {
  15045. // Se já tem algum comando no bloco:
  15046. findInBlockCorrectPlace(el, event, function_obj, command_type);
  15047. }
  15048. } else if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue) {
  15049. // no if ou no else?
  15050. var correct_div = $(document.elementFromPoint(event.pageX, event.pageY));
  15051. var is_in_if = true;
  15052. if (correct_div.data('if')) {
  15053. is_in_if = true;
  15054. } else if (correct_div.data('else')) {
  15055. is_in_if = false;
  15056. } else {
  15057. var hier = correct_div.parentsUntil(".command_container");
  15058. for (var i = 0; i < hier.length; i++) {
  15059. var temp = $(hier[i]);
  15060. if (typeof temp.data('if') !== 'undefined') {
  15061. is_in_if = true;
  15062. break;
  15063. }
  15064. if (typeof temp.data('else') !== 'undefined') {
  15065. is_in_if = false;
  15066. break;
  15067. }
  15068. }
  15069. }
  15070. if (is_in_if) {
  15071. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  15072. command_parent.commands_block = [];
  15073. var recentComand = genericCreateCommand(command_type);
  15074. command_parent.commands_block.push(recentComand);
  15075. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  15076. } else {
  15077. // Se já tem algum comando no bloco:
  15078. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  15079. }
  15080. } else {
  15081. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  15082. command_parent.commands_else = [];
  15083. var recentComand = genericCreateCommand(command_type);
  15084. command_parent.commands_else.push(recentComand);
  15085. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  15086. } else {
  15087. // Se já tem algum comando no bloco:
  15088. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  15089. }
  15090. }
  15091. } else {
  15092. // é do tipo switch
  15093. addCommandToSwitchCase(event, function_obj, command_type);
  15094. }
  15095. }
  15096. function addCommandToSwitchCase(event, function_obj, command_type) {
  15097. var el = $(document.elementFromPoint(event.clientX, event.clientY));
  15098. var which_case = el.data('switchcase');
  15099. var case_div = el;
  15100. if (!which_case) {
  15101. var hier_find = el.parentsUntil(".all_cases_div");
  15102. for (var i = 0; i < hier_find.length; i++) {
  15103. if (typeof $(hier_find[i]).data('switchcase') !== 'undefined') {
  15104. which_case = $(hier_find[i]).data('switchcase');
  15105. case_div = $(hier_find[i]);
  15106. break;
  15107. }
  15108. }
  15109. }
  15110. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  15111. which_case.commands_block = [];
  15112. var recentComand = genericCreateCommand(command_type);
  15113. which_case.commands_block.push(recentComand);
  15114. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  15115. } else {
  15116. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  15117. }
  15118. }
  15119. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  15120. var all_sub = case_div.find('div.command_container');
  15121. var menor_distancia = 999999999;
  15122. var elemento_menor_distancia = null;
  15123. var antes = true;
  15124. var t_bot;
  15125. var t_top; // Descobrindo o elemento mais próximo:
  15126. for (var i = 0; i < all_sub.length; i++) {
  15127. t_top = all_sub[i].getBoundingClientRect().top;
  15128. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  15129. if (t_top - event.clientY < menor_distancia) {
  15130. menor_distancia = event.clientY - t_top;
  15131. elemento_menor_distancia = all_sub[i];
  15132. }
  15133. }
  15134. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  15135. if (borda_inferior - event.clientY < menor_distancia) {
  15136. var recentComand = genericCreateCommand(command_type);
  15137. which_case.commands_block.push(recentComand);
  15138. renderCommand(recentComand, $(case_div.find('.case_commands_block')[0]), 3, function_obj);
  15139. } else {
  15140. var recentComand = genericCreateCommand(command_type);
  15141. var index = which_case.commands_block.indexOf($(elemento_menor_distancia).data('command'));
  15142. if (index > -1) {
  15143. which_case.commands_block.splice(index, 0, recentComand);
  15144. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  15145. }
  15146. }
  15147. }
  15148. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  15149. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  15150. var el_jq = $(el);
  15151. var all_sub = el_jq.find('div.command_container');
  15152. var menor_distancia = 999999999;
  15153. var elemento_menor_distancia = null;
  15154. var antes = true;
  15155. var t_bot;
  15156. var t_top; // Descobrindo o elemento mais próximo:
  15157. for (var i = 0; i < all_sub.length; i++) {
  15158. t_top = all_sub[i].getBoundingClientRect().top;
  15159. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  15160. if (t_top - event.clientY < menor_distancia) {
  15161. menor_distancia = event.clientY - t_top;
  15162. elemento_menor_distancia = all_sub[i];
  15163. }
  15164. }
  15165. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  15166. if (borda_inferior - event.clientY < menor_distancia) {
  15167. var recentComand = genericCreateCommand(command_type);
  15168. var command_parent = el_jq.data('command');
  15169. if (is_in_else) {
  15170. command_parent.commands_else.push(recentComand);
  15171. renderCommand(recentComand, el_jq, 3, function_obj);
  15172. } else {
  15173. command_parent.commands_block.push(recentComand);
  15174. renderCommand(recentComand, $(el_jq.find('.block_commands')[0]), 3, function_obj);
  15175. }
  15176. } else {
  15177. var recentComand = genericCreateCommand(command_type);
  15178. var command_parent = el_jq.data('command');
  15179. if (is_in_else) {
  15180. var index = command_parent.commands_else.indexOf($(elemento_menor_distancia).data('command'));
  15181. if (index > -1) {
  15182. command_parent.commands_else.splice(index, 0, recentComand);
  15183. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  15184. }
  15185. } else {
  15186. var index = command_parent.commands_block.indexOf($(elemento_menor_distancia).data('command'));
  15187. if (index > -1) {
  15188. command_parent.commands_block.splice(index, 0, recentComand);
  15189. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  15190. }
  15191. }
  15192. }
  15193. }
  15194. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  15195. switch ($(el).data('command').type) {
  15196. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue:
  15197. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]:
  15198. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes:
  15199. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue:
  15200. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue:
  15201. insertCommandInBlock(el, event, function_obj, command_type);
  15202. return;
  15203. }
  15204. var menor_distancia = 999999999;
  15205. var antes = true;
  15206. var t_bot;
  15207. var t_top;
  15208. t_top = el.getBoundingClientRect().top;
  15209. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  15210. var d_top = event.clientY - t_top; // distancia topo
  15211. var d_bot = t_bot - event.clientY; // distancia baixo
  15212. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  15213. if (d_top < d_bot) {
  15214. var recentComand = genericCreateCommand(command_type);
  15215. var index = function_obj.commands.indexOf($(el).data('command'));
  15216. if (index > -1) {
  15217. function_obj.commands.splice(index, 0, recentComand);
  15218. }
  15219. renderCommand(recentComand, el, 1, function_obj);
  15220. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, command_type, '/', index);
  15221. } else {
  15222. var recentComand = genericCreateCommand(command_type);
  15223. var index = function_obj.commands.indexOf($(el).data('command'));
  15224. if (index > -1) {
  15225. function_obj.commands.splice(index + 1, 0, recentComand);
  15226. }
  15227. renderCommand(recentComand, el, 2, function_obj);
  15228. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, command_type, '/', index);
  15229. }
  15230. }
  15231. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  15232. var all_sub = $(node_list_commands).find('div.command_container');
  15233. var menor_distancia = 999999999;
  15234. var elemento_menor_distancia = null;
  15235. var antes = true;
  15236. var t_bot;
  15237. var t_top; // Descobrindo o elemento mais próximo:
  15238. for (var i = 0; i < all_sub.length; i++) {
  15239. t_top = all_sub[i].getBoundingClientRect().top;
  15240. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  15241. if (t_top - event.clientY < menor_distancia) {
  15242. menor_distancia = event.clientY - t_top;
  15243. elemento_menor_distancia = all_sub[i];
  15244. }
  15245. }
  15246. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  15247. if (borda_inferior - event.clientY < menor_distancia) {
  15248. var recentComand = genericCreateCommand(command_type);
  15249. function_obj.commands.push(recentComand); //
  15250. renderCommand(recentComand, node_list_commands, 3, function_obj);
  15251. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, command_type, '/', function_obj.commands.length - 1);
  15252. } else {
  15253. var recentComand = genericCreateCommand(command_type);
  15254. var index = function_obj.commands.indexOf($(elemento_menor_distancia).data('command'));
  15255. if (index > -1) {
  15256. function_obj.commands.splice(index, 0, recentComand);
  15257. }
  15258. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  15259. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, command_type, '/', index);
  15260. }
  15261. }
  15262. /***/ }),
  15263. /***/ "./js/visualUI/commands/attribution.js":
  15264. /*!*********************************************!*\
  15265. !*** ./js/visualUI/commands/attribution.js ***!
  15266. \*********************************************/
  15267. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  15268. "use strict";
  15269. __webpack_require__.r(__webpack_exports__);
  15270. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  15271. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  15272. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand),
  15273. /* harmony export */ "manageExpressionElements": () => (/* binding */ manageExpressionElements),
  15274. /* harmony export */ "renderMenuOperations": () => (/* binding */ renderMenuOperations)
  15275. /* harmony export */ });
  15276. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15277. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15278. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15279. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15280. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  15281. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
  15282. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../algorithm */ "./js/visualUI/algorithm.js");
  15283. function createFloatingCommand() {
  15284. return $('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x <&#8212; 1 + 1 </span></div>');
  15285. }
  15286. function renderCommand(command, function_obj) {
  15287. var el = $('<div class="ui attribution command_container"><i class="ui icon small arrow left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_attributed"></div> <span class="text_attr_receives span_command_spec">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_receives') + '</span> ' + '<div class="expression_elements"></div> <span class="textual_expression"></span> <i class="ui icon i cursor button_write_expression"></i> <i class="ui icon unlock button_alternate_expression"></i> </div>');
  15288. el.data('command', command);
  15289. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
  15290. if (!command.expression || command.expression.length < 1) {
  15291. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  15292. command.expression.push(exp);
  15293. }
  15294. addHandlers(command, function_obj, el);
  15295. _generic_expression__WEBPACK_IMPORTED_MODULE_4__.renderExpression(command, function_obj, el.find('.expression_elements'), command.expression);
  15296. if (command.lockexpression) {
  15297. if (command.expression) {
  15298. try {
  15299. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  15300. if (text) {
  15301. $(el.find('.expression_elements')[0]).toggle();
  15302. $(el.find('.textual_expression')[0]).text(text);
  15303. $(el.find('.textual_expression')[0]).toggle();
  15304. $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
  15305. }
  15306. } catch (e) {
  15307. command.lockexpression = false;
  15308. }
  15309. }
  15310. }
  15311. el.find('.unlock').popup({
  15312. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
  15313. delay: {
  15314. show: 750,
  15315. hide: 0
  15316. }
  15317. });
  15318. el.find('.lock').popup({
  15319. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
  15320. delay: {
  15321. show: 750,
  15322. hide: 0
  15323. }
  15324. });
  15325. el.find('.button_write_expression').popup({
  15326. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression"),
  15327. delay: {
  15328. show: 750,
  15329. hide: 0
  15330. }
  15331. });
  15332. return el;
  15333. }
  15334. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  15335. var index_to_move = expression_element.itens.indexOf(ref_object);
  15336. switch (selectedItem.data('exp')) {
  15337. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp:
  15338. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ExpressionElement(_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp, [expression_element.itens[index_to_move], _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  15339. expression_element.itens[index_to_move] = exp;
  15340. break;
  15341. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.op_exp:
  15342. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ExpressionElement(_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.op_exp, [_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus, expression_element.itens[index_to_move]]);
  15343. expression_element.itens[index_to_move] = exp;
  15344. break;
  15345. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.par_exp_par:
  15346. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ExpressionElement(_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.par_exp_par, [expression_element.itens[index_to_move]]);
  15347. expression_element.itens[index_to_move] = exp;
  15348. break;
  15349. }
  15350. renderExpressionElements(command, function_obj, dom_object);
  15351. }
  15352. function renderExpressionElements(command, function_obj, el) {
  15353. var expression_div = el.find('.expression_elements');
  15354. var command_container;
  15355. if (el.hasClass("command_container") == false) {
  15356. var hier = el.parentsUntil(".command_container");
  15357. for (var i = 0; i < hier.length; i++) {
  15358. if ($(hier[i]).hasClass("command_container")) {
  15359. command_container = $(hier[i]);
  15360. break;
  15361. }
  15362. if ($(hier[i]).hasClass("expression_elements")) {
  15363. expression_div = $(hier[i]);
  15364. break;
  15365. }
  15366. }
  15367. }
  15368. if (command_container) {
  15369. expression_div = command_container.find('.expression_elements');
  15370. }
  15371. expression_div.text('');
  15372. for (var i = 0; i < command.expression.length; i++) {
  15373. var temp = $('<div class="expression_element"></div>');
  15374. temp.data('ref_element', command.expression[i]);
  15375. temp.data('ref_index', i);
  15376. expression_div.append(temp);
  15377. renderElement(command, function_obj, temp, command.expression[i]);
  15378. }
  15379. }
  15380. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  15381. var context_menu = '<div class="ui dropdown"><div class="text">';
  15382. switch (expression_element.itens[index_op]) {
  15383. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus:
  15384. context_menu += '+';
  15385. break;
  15386. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus:
  15387. context_menu += '-';
  15388. break;
  15389. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.multiplication:
  15390. context_menu += '*';
  15391. break;
  15392. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.division:
  15393. context_menu += '/';
  15394. break;
  15395. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.module:
  15396. context_menu += '%';
  15397. break;
  15398. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.none:
  15399. context_menu += '...';
  15400. break;
  15401. }
  15402. context_menu += '</div><div class="menu">';
  15403. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus + '">+</div>';
  15404. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus + '">-</div>';
  15405. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.multiplication + '">*</div>';
  15406. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.division + '">/</div>';
  15407. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.module + '">%</div>';
  15408. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.none + '" data-text="...">Nenhum</div>';
  15409. context_menu += '</div></div>';
  15410. context_menu = $(context_menu);
  15411. temp_op.append(context_menu);
  15412. context_menu.dropdown({
  15413. onChange: function onChange(value, text, $selectedItem) {
  15414. expression_element.itens[index_op] = value;
  15415. }
  15416. });
  15417. }
  15418. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  15419. if (el.hasClass("command_container") == false) {
  15420. var hier = el.parentsUntil(".commands_list_div");
  15421. for (var i = 0; i < hier.length; i++) {
  15422. if ($(hier[i]).hasClass("command_container")) {
  15423. el = $(hier[i]);
  15424. break;
  15425. }
  15426. }
  15427. }
  15428. if (dom_append_menu.hasClass("expression_elements") == false) {
  15429. var hier = el.parentsUntil(".commands_list_div");
  15430. for (var i = 0; i < hier.length; i++) {
  15431. if ($(hier[i]).hasClass("expression_elements")) {
  15432. dom_append_menu = $(hier[i]);
  15433. break;
  15434. }
  15435. }
  15436. }
  15437. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  15438. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  15439. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  15440. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  15441. context_menu += '</div></div>';
  15442. context_menu = $(context_menu);
  15443. dom_append_menu.append(context_menu);
  15444. context_menu.dropdown({
  15445. onChange: function onChange(value, text, $selectedItem) {
  15446. switch (value) {
  15447. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp:
  15448. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ExpressionElement(_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  15449. expression_append_new_expression.push(exp);
  15450. break;
  15451. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.op_exp:
  15452. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ExpressionElement(_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.op_exp, [_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  15453. expression_append_new_expression.push(exp);
  15454. break;
  15455. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.par_exp_par:
  15456. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ExpressionElement(_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.par_exp_par, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  15457. expression_append_new_expression.push(exp);
  15458. break;
  15459. }
  15460. renderExpressionElements(command, function_obj, el);
  15461. }
  15462. });
  15463. }
  15464. function renderElement(command, function_obj, el, expression_element) {
  15465. switch (expression_element.type_exp) {
  15466. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp:
  15467. var temp_op = $('<div class="component_element"></div>');
  15468. var temp_exp_1 = $('<div class="component_element"></div>');
  15469. var temp_exp_2 = $('<div class="component_element"></div>');
  15470. el.append(temp_exp_1);
  15471. el.append(temp_op);
  15472. el.append(temp_exp_2);
  15473. if (expression_element.itens[0].type) {
  15474. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  15475. } else {
  15476. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  15477. }
  15478. renderOperator(command, function_obj, temp_op, expression_element, 1);
  15479. if (expression_element.itens[2].type) {
  15480. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  15481. } else {
  15482. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  15483. }
  15484. break;
  15485. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.op_exp:
  15486. var temp_op = $('<div class="component_element"></div>');
  15487. var temp_exp = $('<div class="component_element"></div>');
  15488. el.append(temp_op);
  15489. el.append(temp_exp);
  15490. renderOperator(command, function_obj, temp_op, expression_element, 0);
  15491. if (expression_element.itens[1].type) {
  15492. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  15493. } else {
  15494. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  15495. }
  15496. break;
  15497. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.par_exp_par:
  15498. var temp_par_1 = $('<div class="component_element"> ( </div>');
  15499. var temp_exp = $('<div class="component_element"></div>');
  15500. var temp_par_2 = $('<div class="component_element"> ) </div>');
  15501. el.append(temp_par_1);
  15502. el.append(temp_exp);
  15503. for (var j = 0; j < expression_element.itens.length; j++) {
  15504. if (expression_element.itens[j].type) {
  15505. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  15506. } else {
  15507. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  15508. }
  15509. } //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  15510. el.append(temp_par_2);
  15511. break;
  15512. }
  15513. }
  15514. function renderExpression(command, function_obj, el) {
  15515. var expression_div = el.find('.expression_elements');
  15516. expression_div.text('');
  15517. var menu_add_item = $('<div class="menu_add_item"></div>');
  15518. menu_add_item.data('index_add', 0);
  15519. expression_div.append(menu_add_item);
  15520. for (var i = 0; i < command.expression.length; i++) {
  15521. if (command.expression[i].type) {
  15522. var temp = $('<div class="expression_element"></div>');
  15523. temp.data('ref_element', command.expression[i]);
  15524. temp.data('ref_index', i);
  15525. expression_div.append(temp);
  15526. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, command.expression[i], temp, function_obj);
  15527. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  15528. var temp = $('<div class="expression_element">' + command.expression[i] + '</div>');
  15529. temp.data('ref_element', command.expression[i]);
  15530. temp.data('ref_index', i);
  15531. expression_div.append(temp);
  15532. } else {
  15533. var temp = '<div class="expression_element">';
  15534. switch (command.expression[i]) {
  15535. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus:
  15536. temp += '+';
  15537. break;
  15538. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus:
  15539. temp += '-';
  15540. break;
  15541. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.multiplication:
  15542. temp += '*';
  15543. break;
  15544. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.division:
  15545. temp += '/';
  15546. break;
  15547. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.module:
  15548. temp += '%';
  15549. break;
  15550. }
  15551. temp += '</div>';
  15552. temp = $(temp);
  15553. temp.data('ref_element', command.expression[i]);
  15554. temp.data('ref_index', i);
  15555. expression_div.append(temp);
  15556. }
  15557. var menu_add_item_seq = $('<div class="menu_add_item"></div>');
  15558. var index_temp = i + 1;
  15559. menu_add_item_seq.data('index_add', index_temp);
  15560. expression_div.append(menu_add_item_seq);
  15561. }
  15562. addMenuItens(command, function_obj, el);
  15563. }
  15564. function addMenuItens(command, function_obj, expression_div) {
  15565. var divs_expression = expression_div.find('.menu_add_item');
  15566. for (var i = 0; i < divs_expression.length; i++) {
  15567. var temp = $(divs_expression[i]).data('index_add');
  15568. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  15569. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_value') + '</div>';
  15570. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_operator') + '</div>';
  15571. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_parentheses') + '</div>';
  15572. context_menu += '</div></div>';
  15573. context_menu = $(context_menu);
  15574. $(divs_expression[i]).append(context_menu);
  15575. context_menu.dropdown({
  15576. on: 'hover',
  15577. onChange: function onChange(value, text, $selectedItem) {
  15578. switch ($selectedItem.data('option')) {
  15579. case "value":
  15580. command.expression.splice($selectedItem.data('index'), 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  15581. renderExpression(command, function_obj, expression_div);
  15582. break;
  15583. case "operator":
  15584. command.expression.splice($selectedItem.data('index'), 0, _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus);
  15585. renderExpression(command, function_obj, expression_div);
  15586. break;
  15587. case "parentheses":
  15588. command.expression.splice($selectedItem.data('index'), 0, "(");
  15589. command.expression.splice($selectedItem.data('index') + 1, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  15590. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  15591. renderExpression(command, function_obj, expression_div);
  15592. break;
  15593. }
  15594. }
  15595. });
  15596. }
  15597. }
  15598. function addHandlers(command, function_obj, attribution_dom) {
  15599. attribution_dom.find('.button_write_expression').on('click', function () {
  15600. window.expressionEdition = true;
  15601. window.inputExpression = null;
  15602. var afterWhichElement;
  15603. var lockButton = $(attribution_dom.find('.button_alternate_expression')[0]);
  15604. var editButton = $(this);
  15605. afterWhichElement = attribution_dom.find('.expression_elements');
  15606. if (command.lockexpression) {
  15607. afterWhichElement = attribution_dom.find('.textual_expression');
  15608. }
  15609. var text = "";
  15610. if (command.expression) {
  15611. if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
  15612. text = "";
  15613. } else {
  15614. try {
  15615. text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  15616. } catch (ex) {
  15617. text = "";
  15618. }
  15619. }
  15620. }
  15621. var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
  15622. var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
  15623. var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
  15624. input.val(text);
  15625. input.focusout(function (evt) {
  15626. console.log('focosout event!');
  15627. ok_button.click();
  15628. evt.preventDefault();
  15629. return true;
  15630. });
  15631. input.keyup(function (evt) {
  15632. if (evt.keyCode == 27) {
  15633. // esc
  15634. cancel_button.click();
  15635. }
  15636. if (evt.keyCode == 13) {
  15637. // enter
  15638. ok_button.click();
  15639. }
  15640. });
  15641. ok_button.click(function () {
  15642. var parsed = null;
  15643. parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(input.val(), function_obj, input);
  15644. if (parsed) {
  15645. window.expressionEdition = false;
  15646. command.expression = parsed;
  15647. (0,_algorithm__WEBPACK_IMPORTED_MODULE_6__.renderAlgorithm)();
  15648. }
  15649. });
  15650. cancel_button.mousedown(function (evt) {
  15651. var parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(text, function_obj, input);
  15652. if (parsed) {
  15653. window.expressionEdition = false;
  15654. command.expression = parsed;
  15655. (0,_algorithm__WEBPACK_IMPORTED_MODULE_6__.renderAlgorithm)();
  15656. }
  15657. });
  15658. input.insertAfter(afterWhichElement);
  15659. input.focus();
  15660. cancel_button.insertAfter(input);
  15661. ok_button.insertAfter(input);
  15662. var len = text.length;
  15663. input[0].setSelectionRange(len, len);
  15664. afterWhichElement.css('display', 'none');
  15665. lockButton.css('display', 'none');
  15666. editButton.css('display', 'none');
  15667. ok_button.popup({
  15668. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression_confirm"),
  15669. delay: {
  15670. show: 750,
  15671. hide: 0
  15672. }
  15673. });
  15674. cancel_button.popup({
  15675. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression_cancel"),
  15676. delay: {
  15677. show: 750,
  15678. hide: 0
  15679. }
  15680. });
  15681. });
  15682. $(attribution_dom.find('.textual_expression')[0]).toggle();
  15683. attribution_dom.find('.button_alternate_expression').on('click', function () {
  15684. if (command.expression) {
  15685. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  15686. if (text) {
  15687. $(attribution_dom.find('.expression_elements')[0]).toggle();
  15688. $(attribution_dom.find('.textual_expression')[0]).text(text);
  15689. $(attribution_dom.find('.textual_expression')[0]).toggle();
  15690. $(this).toggleClass('unlock').toggleClass('lock');
  15691. command.lockexpression = !command.lockexpression;
  15692. }
  15693. if (command.lockexpression) {
  15694. attribution_dom.find('.lock').popup({
  15695. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
  15696. delay: {
  15697. show: 750,
  15698. hide: 0
  15699. }
  15700. });
  15701. } else {
  15702. attribution_dom.find('.unlock').popup({
  15703. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
  15704. delay: {
  15705. show: 750,
  15706. hide: 0
  15707. }
  15708. });
  15709. }
  15710. }
  15711. });
  15712. attribution_dom.find('.button_remove_command').on('click', function () {
  15713. if (_commands__WEBPACK_IMPORTED_MODULE_3__.removeCommand(command, function_obj, attribution_dom)) {
  15714. attribution_dom.fadeOut(400, function () {
  15715. attribution_dom.remove();
  15716. });
  15717. }
  15718. });
  15719. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  15720. renderExpressionElements(command, function_obj, attribution_dom);
  15721. });
  15722. }
  15723. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  15724. /*console.log("recebido o seguinte DOM: ");
  15725. console.log(dom_object);
  15726. if (dom_object.hasClass('var_attributed')) {
  15727. return;
  15728. } else {
  15729. var hier = dom_object.parentsUntil(".command_container");
  15730. for (var i = 0; i < hier.length; i++) {
  15731. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  15732. return;
  15733. }
  15734. }
  15735. }
  15736. dom_object.find('.context_menu_clear').remove();
  15737. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  15738. for (var tm in Models.ARITHMETIC_TYPES) {
  15739. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  15740. }
  15741. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  15742. menu_operations += '</div></div>';
  15743. menu_operations = $(menu_operations);
  15744. dom_object.append(menu_operations);
  15745. menu_operations.dropdown({
  15746. onChange: function(value, text, $selectedItem) {
  15747. switch ($($selectedItem).data('option')) {
  15748. case "clear":
  15749. $(dom_object).text('');
  15750. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  15751. break;
  15752. default:
  15753. createExpressionAround(command, ref_object, dom_object, function_obj);
  15754. menu_operations.find('.text').text('');
  15755. }
  15756. }
  15757. });*/
  15758. }
  15759. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  15760. $('<span> ( </span>').insertBefore(dom_object);
  15761. $('<span> ) </span>').insertAfter(dom_object);
  15762. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true), dom_object, function_obj);
  15763. }
  15764. /***/ }),
  15765. /***/ "./js/visualUI/commands/break.js":
  15766. /*!***************************************!*\
  15767. !*** ./js/visualUI/commands/break.js ***!
  15768. \***************************************/
  15769. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  15770. "use strict";
  15771. __webpack_require__.r(__webpack_exports__);
  15772. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  15773. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  15774. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  15775. /* harmony export */ });
  15776. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15777. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15778. function createFloatingCommand() {
  15779. return $('<div class="ui comment created_element"> <i class="ui icon small pause"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_break') + ' </span></div>');
  15780. }
  15781. function renderCommand(command, function_obj) {
  15782. var el = $('<div class="ui comment command_container"> <i class="ui icon small pause"></i> <i class="ui icon times red button_remove_command"></i> <span>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_break') + '</span> </div>');
  15783. el.data('command', command);
  15784. addHandlers(command, function_obj, el);
  15785. return el;
  15786. }
  15787. function addHandlers(command, function_obj, break_dom) {
  15788. break_dom.find('.button_remove_command').on('click', function () {
  15789. if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, break_dom)) {
  15790. break_dom.fadeOut(400, function () {
  15791. break_dom.remove();
  15792. });
  15793. }
  15794. });
  15795. }
  15796. /***/ }),
  15797. /***/ "./js/visualUI/commands/comment.js":
  15798. /*!*****************************************!*\
  15799. !*** ./js/visualUI/commands/comment.js ***!
  15800. \*****************************************/
  15801. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  15802. "use strict";
  15803. __webpack_require__.r(__webpack_exports__);
  15804. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  15805. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  15806. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  15807. /* harmony export */ });
  15808. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15809. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15810. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15811. function createFloatingCommand() {
  15812. return $('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span class="span_comment_text" "> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_comment') + ' </span></div>');
  15813. }
  15814. function renderCommand(command, function_obj) {
  15815. var el = $('<div class="ui comment command_container"> <i class="ui icon small quote left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> <div class="div_comment_text">' + '</div> </div>');
  15816. el.data('command', command);
  15817. addHandlers(command, function_obj, el);
  15818. renderTextComment(command, function_obj, el);
  15819. return el;
  15820. }
  15821. function renderTextComment(command, function_obj, el) {
  15822. _variable_value_menu__WEBPACK_IMPORTED_MODULE_1__.renderMenu(command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  15823. }
  15824. function addHandlers(command, function_obj, comment_dom) {
  15825. comment_dom.find('.button_remove_command').on('click', function () {
  15826. if (_commands__WEBPACK_IMPORTED_MODULE_2__.removeCommand(command, function_obj, comment_dom)) {
  15827. comment_dom.fadeOut(400, function () {
  15828. comment_dom.remove();
  15829. });
  15830. }
  15831. });
  15832. }
  15833. /***/ }),
  15834. /***/ "./js/visualUI/commands/conditional_expression.js":
  15835. /*!********************************************************!*\
  15836. !*** ./js/visualUI/commands/conditional_expression.js ***!
  15837. \********************************************************/
  15838. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  15839. "use strict";
  15840. __webpack_require__.r(__webpack_exports__);
  15841. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  15842. /* harmony export */ "renderExpression": () => (/* binding */ renderExpression)
  15843. /* harmony export */ });
  15844. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15845. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15846. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15847. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  15848. expression.dom_object = initial_el_to_render;
  15849. if (expression.expression == null || expression.expression.length < 1) {
  15850. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  15851. } else {
  15852. var main_div = $('<div class="expression_elements"></div>');
  15853. switch (expression.expression.type) {
  15854. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic:
  15855. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  15856. break;
  15857. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic:
  15858. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  15859. break;
  15860. }
  15861. initial_el_to_render.append(main_div);
  15862. var restartMenu = $('<div class="ui restart_expression"><i class="ui icon undo"></i></div>');
  15863. initial_el_to_render.append(restartMenu);
  15864. restartMenu.on('click', function (e) {
  15865. expression.expression = null;
  15866. initial_el_to_render.empty();
  15867. renderExpression(command, expression, function_obj, initial_el_to_render);
  15868. });
  15869. }
  15870. }
  15871. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  15872. var menu_operator = $('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  15873. menu_operator.dropdown({
  15874. values: [{
  15875. name: '>',
  15876. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.greater_than,
  15877. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.greater_than
  15878. }, {
  15879. name: '<',
  15880. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.less_than,
  15881. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.less_than
  15882. }, {
  15883. name: '==',
  15884. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.equals_to,
  15885. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.equals_to
  15886. }, {
  15887. name: '!=',
  15888. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.not_equals_to,
  15889. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.not_equals_to
  15890. }, {
  15891. name: '>=',
  15892. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.greater_than_or_equals_to,
  15893. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.greater_than_or_equals_to
  15894. }, {
  15895. name: '<=',
  15896. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.less_than_or_equals_to,
  15897. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.less_than_or_equals_to
  15898. }],
  15899. onChange: function onChange(value, text, $selectedItem) {
  15900. expression_arithmetic.operator = value;
  15901. }
  15902. });
  15903. element_to_append.append(menu_operator);
  15904. }
  15905. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  15906. var menu_operator = $('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  15907. menu_operator.dropdown({
  15908. values: [{
  15909. name: '==',
  15910. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.equals_to,
  15911. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.equals_to
  15912. }, {
  15913. name: '!=',
  15914. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.not_equals_to,
  15915. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.not_equals_to
  15916. }, {
  15917. name: '&&',
  15918. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.and,
  15919. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.and
  15920. }, {
  15921. name: '||',
  15922. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.or,
  15923. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.or
  15924. }],
  15925. onChange: function onChange(value, text, $selectedItem) {
  15926. if ($selectedItem) {
  15927. expression_logic.operator = value;
  15928. if (expression_logic.second_operand == null) {
  15929. expression_logic.second_operand = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  15930. initial_el_to_render.empty();
  15931. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  15932. }
  15933. }
  15934. }
  15935. });
  15936. element_to_append.append(menu_operator);
  15937. }
  15938. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  15939. var exp_el_par_1 = $(' <span class="span_command_spec"> </span> ');
  15940. var exp_el_expr_el_1 = $('<div class="expression_element"></div>');
  15941. var exp_el_expr_operand = $('<div class="expression_element"></div>');
  15942. var exp_el_expr_el_2 = $('<div class="expression_element"></div>');
  15943. var exp_el_par_2 = $(' <span class="span_command_spec"> </span> ');
  15944. if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic) {
  15945. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  15946. } else if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic) {
  15947. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  15948. } else {
  15949. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  15950. }
  15951. element_to_append.append(exp_el_par_1);
  15952. element_to_append.append(exp_el_expr_el_1);
  15953. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  15954. element_to_append.append(exp_el_expr_operand);
  15955. if (expression_logic.second_operand) {
  15956. if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic) {
  15957. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  15958. } else if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic) {
  15959. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  15960. } else {
  15961. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  15962. }
  15963. element_to_append.append(exp_el_expr_el_2);
  15964. }
  15965. element_to_append.append(exp_el_par_2);
  15966. }
  15967. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  15968. var exp_el_par_1 = $(' <span class="span_command_spec"> </span> ');
  15969. var exp_el_expr_el_1 = $('<div class="expression_element"></div>');
  15970. var exp_el_expr_operand = $('<div class="expression_element"></div>');
  15971. var exp_el_expr_el_2 = $('<div class="expression_element"></div>');
  15972. var exp_el_par_2 = $(' <span class="span_command_spec"> </span> ');
  15973. if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic) {
  15974. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  15975. } else if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic) {
  15976. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  15977. } else {
  15978. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  15979. }
  15980. if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic) {
  15981. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  15982. } else if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic) {
  15983. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  15984. } else {
  15985. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  15986. }
  15987. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  15988. element_to_append.append(exp_el_par_1);
  15989. element_to_append.append(exp_el_expr_el_1);
  15990. element_to_append.append(exp_el_expr_operand);
  15991. element_to_append.append(exp_el_expr_el_2);
  15992. element_to_append.append(exp_el_par_2);
  15993. }
  15994. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  15995. var start_menu = '';
  15996. start_menu += '<div class="ui dropdown menu_start_rendered"><div class="text"><i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('expression_menu_select') + '</i></div><i class="dropdown icon"></i><div class="menu">';
  15997. start_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_logic_expression') + ' (EL == EL and EL)</div>';
  15998. start_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_arithmetic_expression') + ' (EA < EA)</div>';
  15999. start_menu += '</div></div>';
  16000. start_menu = $(start_menu);
  16001. start_menu.dropdown({
  16002. onChange: function onChange(value, text, $selectedItem) {
  16003. switch ($selectedItem.data('exp')) {
  16004. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic:
  16005. expression.expression = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LogicExpression(false, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16006. break;
  16007. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic:
  16008. expression.expression = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ArithmeticExpression(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.less_than);
  16009. break;
  16010. }
  16011. initial_el_to_render.html('');
  16012. renderExpression(command, expression, function_obj, initial_el_to_render);
  16013. },
  16014. selectOnKeydown: false
  16015. });
  16016. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  16017. initial_el_to_render.append(start_menu);
  16018. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  16019. }
  16020. /***/ }),
  16021. /***/ "./js/visualUI/commands/contextualized_menu.js":
  16022. /*!*****************************************************!*\
  16023. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  16024. \*****************************************************/
  16025. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  16026. "use strict";
  16027. __webpack_require__.r(__webpack_exports__);
  16028. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  16029. /* harmony export */ "renderMenu": () => (/* binding */ renderMenu)
  16030. /* harmony export */ });
  16031. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16032. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16033. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16034. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16035. /* harmony import */ var _switch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  16036. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  16037. var menu_div = '<div class="ui dropdown menu_commands pause" ><button><i class="icon code"></i></button> <div class="menu"> ';
  16038. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue) {
  16039. menu_div += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"] + '"><i class="pause icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('btn_break') + ' </a>';
  16040. } else {
  16041. menu_div += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"] + '"><i class="pause icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('btn_break') + ' </a>';
  16042. menu_div += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.switchcase + '"><i class="plus icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('btn_case') + ' </a>';
  16043. }
  16044. menu_div += '</div></div>';
  16045. menu_div = $(menu_div);
  16046. dom_where_render.append(menu_div);
  16047. addHandlers(command, dom_where_render, function_obj, dom_command);
  16048. if (command.collapsed) {
  16049. dom_command.children('.ui.block_commands').toggle();
  16050. }
  16051. }
  16052. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  16053. dom_where_render.find('.menu_commands').dropdown({
  16054. on: 'hover'
  16055. });
  16056. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  16057. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue) {
  16058. if (command.commands_block == null || command.commands_block.length == 0) {
  16059. command.commands_block = [];
  16060. var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_2__.genericCreateCommand($(this).data('command'));
  16061. command.commands_block.push(new_cmd);
  16062. _commands__WEBPACK_IMPORTED_MODULE_2__.renderCommand(new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  16063. } else {
  16064. _commands__WEBPACK_IMPORTED_MODULE_2__.createFloatingCommand(function_obj, dom_command.find('.block_commands'), $(this).data('command'), evt);
  16065. }
  16066. } else {
  16067. switch ($(this).data('command')) {
  16068. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]:
  16069. _commands__WEBPACK_IMPORTED_MODULE_2__.createFloatingCommand(function_obj, dom_command.find('.block_commands'), $(this).data('command'), evt);
  16070. break;
  16071. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.switchcase:
  16072. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  16073. break;
  16074. }
  16075. }
  16076. });
  16077. }
  16078. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  16079. if (command.cases == null) {
  16080. command.cases = [];
  16081. }
  16082. var sc = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SwitchCase(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_3__.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16083. command.cases.push(sc);
  16084. _switch__WEBPACK_IMPORTED_MODULE_4__.renderCase(sc, command, function_obj, dom_command.find('.all_cases_div'));
  16085. }
  16086. /***/ }),
  16087. /***/ "./js/visualUI/commands/dowhiletrue.js":
  16088. /*!*********************************************!*\
  16089. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  16090. \*********************************************/
  16091. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  16092. "use strict";
  16093. __webpack_require__.r(__webpack_exports__);
  16094. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  16095. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  16096. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  16097. /* harmony export */ });
  16098. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16099. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16100. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  16101. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  16102. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  16103. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
  16104. function createFloatingCommand() {
  16105. return $('<div class="ui dowhiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_command_do') + ' <br> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_command_do_until') + '(x < 10) </span></div>');
  16106. }
  16107. function renderCommand(command, function_obj) {
  16108. var ret = '';
  16109. ret += '<div class="ui dowhiletrue command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i> <button class="ui icon button minimize_block_button tiny"><i class="icon window minimize"></i></button> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_command_do') + ' </span>';
  16110. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  16111. ret += '</div>';
  16112. ret += ' <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_command_do_until') + ' </span> <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="textual_expression"></span> <span class="span_command_spec"> ) </span>';
  16113. ret += ' <i class="ui icon i cursor button_write_expression" style="display: inline !important;"></i> <i class="ui icon unlock button_alternate_expression" style="margin-left: 1rem !important;"></i> <div class="ui context_menu"></div> ';
  16114. ret += '</div>';
  16115. var el = $(ret);
  16116. el.data('command', command);
  16117. el.find('.block_commands').data('command', command);
  16118. addHandlers(command, function_obj, el);
  16119. _contextualized_menu__WEBPACK_IMPORTED_MODULE_3__.renderMenu(command, el.find('.context_menu'), function_obj, el); //ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  16120. if (command.expression) {
  16121. _generic_expression__WEBPACK_IMPORTED_MODULE_4__.renderExpression(command, function_obj, el.find('.conditional_expression'), command.expression);
  16122. }
  16123. if (command.commands_block) {
  16124. for (var j = 0; j < command.commands_block.length; j++) {
  16125. _commands__WEBPACK_IMPORTED_MODULE_1__.renderCommand(command.commands_block[j], $(el.find('.block_commands')[0]), 3, function_obj);
  16126. }
  16127. }
  16128. if (command.lockexpression) {
  16129. if (command.expression) {
  16130. try {
  16131. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  16132. if (text) {
  16133. $(el.find('.conditional_expression')[el.find('.conditional_expression').length - 1]).toggle();
  16134. $(el.find('.textual_expression')[el.find('.textual_expression').length - 1]).text(text);
  16135. $(el.find('.textual_expression')[el.find('.textual_expression').length - 1]).toggle();
  16136. $(el.find('.button_alternate_expression')[el.find('.button_alternate_expression').length - 1]).toggleClass('unlock').toggleClass('lock');
  16137. }
  16138. } catch (e) {
  16139. command.lockexpression = false;
  16140. }
  16141. }
  16142. }
  16143. el.find('.unlock').popup({
  16144. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
  16145. delay: {
  16146. show: 750,
  16147. hide: 0
  16148. }
  16149. });
  16150. el.find('.lock').popup({
  16151. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
  16152. delay: {
  16153. show: 750,
  16154. hide: 0
  16155. }
  16156. });
  16157. el.find('.button_write_expression').popup({
  16158. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression"),
  16159. delay: {
  16160. show: 750,
  16161. hide: 0
  16162. }
  16163. });
  16164. return el;
  16165. }
  16166. function addHandlers(command, function_obj, dowhiletrue_dom) {
  16167. dowhiletrue_dom.find('.button_write_expression').on('click', function () {
  16168. window.expressionEdition = true;
  16169. window.inputExpression = null;
  16170. var afterWhichElement;
  16171. var lockButton = $(dowhiletrue_dom.find('.button_write_expression')[dowhiletrue_dom.find('.button_write_expression').length - 1]);
  16172. var editButton = $(this);
  16173. afterWhichElement = $(dowhiletrue_dom.find('.conditional_expression')[dowhiletrue_dom.find('.conditional_expression').length - 1]);
  16174. if (command.lockexpression) {
  16175. afterWhichElement = $(dowhiletrue_dom.find('.textual_expression')[dowhiletrue_dom.find('.textual_expression').length - 1]);
  16176. }
  16177. var text = "";
  16178. if (command.expression) {
  16179. if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
  16180. text = "";
  16181. } else {
  16182. try {
  16183. text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  16184. } catch (ex) {
  16185. text = "";
  16186. }
  16187. }
  16188. }
  16189. var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
  16190. var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
  16191. var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
  16192. input.val(text);
  16193. input.focusout(function (evt) {
  16194. ok_button.click();
  16195. evt.preventDefault();
  16196. return true;
  16197. });
  16198. input.keyup(function (evt) {
  16199. if (evt.keyCode == 27) {
  16200. // esc
  16201. cancel_button.click();
  16202. }
  16203. if (evt.keyCode == 13) {
  16204. // enter
  16205. ok_button.click();
  16206. }
  16207. });
  16208. ok_button.click(function () {
  16209. var parsed = null;
  16210. parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(input.val(), function_obj, input);
  16211. if (parsed) {
  16212. window.expressionEdition = false;
  16213. command.expression = parsed;
  16214. renderAlgorithm();
  16215. }
  16216. });
  16217. cancel_button.mousedown(function (evt) {
  16218. var parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(text, function_obj, input);
  16219. if (parsed) {
  16220. window.expressionEdition = false;
  16221. command.expression = parsed;
  16222. renderAlgorithm();
  16223. }
  16224. });
  16225. input.insertAfter(afterWhichElement);
  16226. input.focus();
  16227. cancel_button.insertAfter(input);
  16228. ok_button.insertAfter(input);
  16229. var len = text.length;
  16230. input[0].setSelectionRange(len, len);
  16231. afterWhichElement.css('display', 'none');
  16232. lockButton.css('display', 'none');
  16233. editButton.css('display', 'none');
  16234. ok_button.popup({
  16235. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_confirm"),
  16236. delay: {
  16237. show: 750,
  16238. hide: 0
  16239. }
  16240. });
  16241. cancel_button.popup({
  16242. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_cancel"),
  16243. delay: {
  16244. show: 750,
  16245. hide: 0
  16246. }
  16247. });
  16248. });
  16249. dowhiletrue_dom.find('.minimize_block_button').on('click', function (evt) {
  16250. dowhiletrue_dom.children('.ui.block_commands').toggle();
  16251. command.collapsed = !command.collapsed;
  16252. });
  16253. $(dowhiletrue_dom.find('.textual_expression')[0]).toggle();
  16254. dowhiletrue_dom.find('.button_alternate_expression').on('click', function () {
  16255. if (command.expression) {
  16256. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  16257. if (text) {
  16258. $(dowhiletrue_dom.find('.conditional_expression')[dowhiletrue_dom.find('.conditional_expression').length - 1]).toggle();
  16259. $(dowhiletrue_dom.find('.textual_expression')[dowhiletrue_dom.find('.textual_expression').length - 1]).text(text);
  16260. $(dowhiletrue_dom.find('.textual_expression')[dowhiletrue_dom.find('.textual_expression').length - 1]).toggle();
  16261. $(this).toggleClass('unlock').toggleClass('lock');
  16262. command.lockexpression = !command.lockexpression;
  16263. }
  16264. }
  16265. if (command.lockexpression) {
  16266. dowhiletrue_dom.find('.lock').popup({
  16267. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
  16268. delay: {
  16269. show: 750,
  16270. hide: 0
  16271. }
  16272. });
  16273. } else {
  16274. dowhiletrue_dom.find('.unlock').popup({
  16275. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
  16276. delay: {
  16277. show: 750,
  16278. hide: 0
  16279. }
  16280. });
  16281. }
  16282. });
  16283. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  16284. if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, dowhiletrue_dom)) {
  16285. dowhiletrue_dom.fadeOut(400, function () {
  16286. dowhiletrue_dom.remove();
  16287. });
  16288. }
  16289. });
  16290. }
  16291. /***/ }),
  16292. /***/ "./js/visualUI/commands/functioncall.js":
  16293. /*!**********************************************!*\
  16294. !*** ./js/visualUI/commands/functioncall.js ***!
  16295. \**********************************************/
  16296. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  16297. "use strict";
  16298. __webpack_require__.r(__webpack_exports__);
  16299. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  16300. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  16301. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  16302. /* harmony export */ });
  16303. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16304. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16305. function createFloatingCommand() {
  16306. return $('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  16307. }
  16308. function renderCommand(command, function_obj) {
  16309. var el = $('<div class="ui functioncall command_container"> <i class="hand point right icon command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> </div>');
  16310. el.data('command', command);
  16311. _variable_value_menu__WEBPACK_IMPORTED_MODULE_0__.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  16312. addHandlers(command, function_obj, el);
  16313. return el;
  16314. }
  16315. function addHandlers(command, function_obj, functioncall_dom) {
  16316. functioncall_dom.find('.button_remove_command').on('click', function () {
  16317. if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, functioncall_dom)) {
  16318. functioncall_dom.fadeOut(400, function () {
  16319. functioncall_dom.remove();
  16320. });
  16321. }
  16322. });
  16323. }
  16324. /***/ }),
  16325. /***/ "./js/visualUI/commands/generic_expression.js":
  16326. /*!****************************************************!*\
  16327. !*** ./js/visualUI/commands/generic_expression.js ***!
  16328. \****************************************************/
  16329. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  16330. "use strict";
  16331. __webpack_require__.r(__webpack_exports__);
  16332. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  16333. /* harmony export */ "renderExpression": () => (/* binding */ renderExpression),
  16334. /* harmony export */ "expressionParserToVisual": () => (/* binding */ expressionParserToVisual),
  16335. /* harmony export */ "searchFunction": () => (/* binding */ searchFunction),
  16336. /* harmony export */ "expressionParserCodeVisual": () => (/* binding */ expressionParserCodeVisual)
  16337. /* harmony export */ });
  16338. /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
  16339. /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__);
  16340. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16341. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16342. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16343. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16344. /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../services/userLog */ "./js/services/userLog.js");
  16345. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  16346. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_6__);
  16347. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils */ "./js/visualUI/utils.js");
  16348. window.timer = false;
  16349. function renderExpression(command, function_obj, div_to_render, expression_array) {
  16350. div_to_render.empty();
  16351. melanke_watchjs__WEBPACK_IMPORTED_MODULE_6___default().unwatch(command, "expression");
  16352. melanke_watchjs__WEBPACK_IMPORTED_MODULE_6___default().watch(command, "expression", function () {
  16353. if (window.timer) return;
  16354. var m = div_to_render.find(".single_element_expression").not(".mouse_distance").not(".add_parentheses");
  16355. var s = "";
  16356. m.each(function (e) {
  16357. if ($(this).hasClass("parentheses_in_expression")) {
  16358. s += $(this).text() + " ";
  16359. } else {
  16360. s += $(this).find(".text").text();
  16361. s += $(this).find(".var_name").text();
  16362. s += $(this).find(".parameters_function_called").text();
  16363. s += $(this).find(".value_rendered").text();
  16364. s += " ";
  16365. }
  16366. });
  16367. if (s) {
  16368. window.timer = true;
  16369. } else {
  16370. return;
  16371. }
  16372. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_5__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_5__.ActionTypes.CHANGE_COMMAND_EXP, command.type, "/", s);
  16373. setTimeout(function () {
  16374. window.timer = false;
  16375. }, 200);
  16376. }, 20, true);
  16377. if (command.type === _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.COMMAND_TYPES.attribution) {
  16378. melanke_watchjs__WEBPACK_IMPORTED_MODULE_6___default().unwatch(command.variable);
  16379. melanke_watchjs__WEBPACK_IMPORTED_MODULE_6___default().watch(command.variable, function () {
  16380. renderExpression(command, function_obj, div_to_render, expression_array);
  16381. }, 0);
  16382. if (command.variable.content) {
  16383. var types_included = [];
  16384. if (command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__.Types.INTEGER || command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__.Types.REAL) {
  16385. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic);
  16386. } else if (command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__.Types.BOOLEAN) {
  16387. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional);
  16388. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic);
  16389. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic);
  16390. } else if (command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__.Types.TEXT) {
  16391. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional);
  16392. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic);
  16393. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic);
  16394. } else {//console.log("NÃO RECONHECI! VEJA: ", command.variable.content.type);
  16395. }
  16396. renderElements(command, function_obj, div_to_render, expression_array, types_included);
  16397. } else {
  16398. div_to_render.text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("var_menu_select_var").toLowerCase());
  16399. }
  16400. } else {
  16401. var _types_included = [];
  16402. _types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional);
  16403. _types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic);
  16404. if (command.type === _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.COMMAND_TYPES.writer) _types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.write_sep);
  16405. _types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic);
  16406. renderElements(command, function_obj, div_to_render, expression_array, _types_included);
  16407. }
  16408. div_to_render.children(".mouse_distance").addClass("mouse_distance_hidden");
  16409. div_to_render.children(".higher_element").on("mousemove", function (evt) {
  16410. if (!window.open_or_close) {
  16411. $(this).css("position", "relative", "!important");
  16412. $(this).children(".mouse_distance").css("opacity", "1");
  16413. }
  16414. });
  16415. div_to_render.children(".higher_element").on("mouseout", function (evt) {
  16416. if (!window.open_or_close) {
  16417. $(this).css("position", "absolute", "!important");
  16418. $(this).children(".mouse_distance").css("opacity", "0");
  16419. }
  16420. });
  16421. var lixeira = $('<div class="lixeira" draggable="true"></div>');
  16422. div_to_render.find(".single_element_expression").on("mousedown", function (evt) {
  16423. window.posX = evt.clientX;
  16424. window.posY = evt.clientY;
  16425. });
  16426. Sortable.create(div_to_render[0], {
  16427. animation: 100,
  16428. ghostClass: "ghost",
  16429. group: {
  16430. name: "shared",
  16431. put: false // Do not allow items to be put into this list
  16432. },
  16433. draggable: ".single_element_expression",
  16434. sort: false,
  16435. filter: ".not_allowed",
  16436. onStart: function onStart() {
  16437. $("body").append(lixeira);
  16438. lixeira.css("display", "block");
  16439. lixeira.css("top", window.posY + 70, "!important");
  16440. lixeira.css("left", window.posX - 20, "!important");
  16441. },
  16442. onMove: function onMove() {
  16443. lixeira.addClass("color_test");
  16444. },
  16445. onEnd: function onEnd() {
  16446. lixeira.remove();
  16447. div_to_render.find(".ghost").removeClass("ghost");
  16448. }
  16449. });
  16450. new Sortable(lixeira[0], {
  16451. group: "shared",
  16452. animation: 150,
  16453. onAdd: function onAdd(evt) {
  16454. lixeira.css("display", "none");
  16455. lixeira.find(".single_element_expression").remove();
  16456. lixeira.css("background-color", "");
  16457. lixeira.remove();
  16458. removeElement(evt, expression_array);
  16459. renderExpression(command, function_obj, div_to_render, expression_array);
  16460. }
  16461. });
  16462. }
  16463. function removeElement(event, expression_array) {
  16464. var indice = $(event.item).data("index");
  16465. var first = expression_array[0];
  16466. if (expression_array[indice].type) {
  16467. // if is alone in expression:
  16468. if (expression_array.length == 1) {
  16469. //function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  16470. expression_array.splice(0, 1);
  16471. } else if (expression_array.length > 1) {
  16472. if (indice > 0 && expression_array[indice - 1].type_op) {
  16473. if (indice < expression_array.length && expression_array[indice - 2] == "(" && expression_array[indice + 1].type_op) {
  16474. expression_array.splice(indice + 1, 1);
  16475. }
  16476. expression_array.splice(indice, 1);
  16477. expression_array.splice(indice - 1, 1);
  16478. if (indice - 2 < expression_array.length && expression_array[indice - 2] == "(" && expression_array[indice - 1] == ")") {
  16479. expression_array.splice(indice - 1, 1);
  16480. expression_array.splice(indice - 2, 1);
  16481. if (indice - 3 >= 0 && indice - 3 < expression_array.length && expression_array[indice - 3].type_op) {
  16482. expression_array.splice(indice - 3, 1);
  16483. }
  16484. }
  16485. } else if (indice < expression_array.length - 1 && expression_array[indice + 1].type_op) {
  16486. expression_array.splice(indice + 1, 1);
  16487. expression_array.splice(indice, 1);
  16488. } else if (indice < expression_array.length - 1 && indice > 0 && expression_array[indice - 1] == "(" && expression_array[indice + 1] == ")") {
  16489. if (indice > 1 && expression_array[indice - 2].type_op) {
  16490. expression_array.splice(indice + 1, 1);
  16491. expression_array.splice(indice, 1);
  16492. expression_array.splice(indice - 1, 1);
  16493. expression_array.splice(indice - 2, 1);
  16494. } else if (indice < expression_array.length - 2 && expression_array[indice + 2].type_op) {
  16495. expression_array.splice(indice + 1, 1);
  16496. expression_array.splice(indice, 1);
  16497. expression_array.splice(indice - 1, 1);
  16498. } else {
  16499. expression_array.splice(indice + 1, 1);
  16500. expression_array.splice(indice, 1);
  16501. expression_array.splice(indice - 1, 1);
  16502. }
  16503. }
  16504. }
  16505. } else if (expression_array[indice].type_op) {// iVProg doesn't support operator remove
  16506. } else {
  16507. var opening = -1;
  16508. var closing = -1;
  16509. if (expression_array[indice] == "(") {
  16510. opening = indice;
  16511. for (var i = indice + 1; i < expression_array.length; i++) {
  16512. if (expression_array[i] == ")") {
  16513. closing = i;
  16514. break;
  16515. }
  16516. }
  16517. } else {
  16518. closing = indice;
  16519. for (var i = indice - 1; i >= 0; i--) {
  16520. if (expression_array[i] == "(") {
  16521. opening = i;
  16522. break;
  16523. }
  16524. }
  16525. }
  16526. if (expression_array[opening + 1].type_op) {
  16527. expression_array.splice(closing, 1);
  16528. expression_array.splice(opening + 1, 1);
  16529. expression_array.splice(opening, 1);
  16530. } else {
  16531. expression_array.splice(closing, 1);
  16532. expression_array.splice(opening, 1);
  16533. }
  16534. } // if expression is empty, add a new var value:
  16535. if (expression_array.length == 0) {
  16536. expression_array.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16537. }
  16538. if (first != expression_array[0] && expression_array[0].type_op) {
  16539. expression_array.splice(0, 1);
  16540. }
  16541. }
  16542. function renderElements(command, function_obj, div_to_render, expression_array, types_included) {
  16543. /*if (expression_array.length > 0) {
  16544. if (!expression_array[0].type_op) {
  16545. renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, 0);
  16546. }
  16547. }*/
  16548. var i = 0;
  16549. for (i = 0; i < expression_array.length; i++) {
  16550. if (expression_array[i].type == "var_value") {
  16551. var div_temp = $('<div class="single_element_expression" data-index="' + i + '"></div>');
  16552. if (i == 0) {
  16553. if (expression_array.length > 0 && !expression_array[0].type_op) {//renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, 0);
  16554. }
  16555. }
  16556. _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, expression_array[i], div_temp, function_obj);
  16557. div_to_render.append(div_temp);
  16558. } else if (expression_array[i] == "(" || expression_array[i] == ")") {
  16559. if (expression_array[i] == ")") {
  16560. renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, i);
  16561. renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
  16562. } else if (expression_array[i] == "(" && !expression_array[i + 1].type_op) {
  16563. renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
  16564. renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, i + 1);
  16565. } else {
  16566. renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
  16567. }
  16568. } else {
  16569. if (i == 0) {} else if (expression_array[i - 1] == "(") {}
  16570. renderOperatorMenu(command, function_obj, div_to_render, expression_array[i], types_included, i, expression_array);
  16571. }
  16572. }
  16573. renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, i, true);
  16574. renderAddParenthesis(command, function_obj, div_to_render, expression_array, types_included);
  16575. }
  16576. window.parentheses_activate = false;
  16577. window.open_or_close = null;
  16578. function renderAddParenthesis(command, function_obj, div_to_render, expression_array, types_included) {
  16579. var addParentheses = $('<div class="single_element_expression add_parentheses not_allowed"><img style="width: 15px; position: relative; top: 3px; left: 1px; height: 15px;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOgAAAEjCAYAAAA48U27AAAasXpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarZtZkhw5km3/sYpeAkYFsByMIm8Hvfw+Fx4kg6zM7HolHaykOz3MzWA63EFh5c5//7/r/osfK8m7XGqzbub5yT33OHjT/Ofn8xp8fn+/n/Pjd+H3z11MX28jr4nX9PmFna/jB5+XX1+o+evz+fvnrq7Pm9i+TvT1C078fpKurPf7a5FfJ0rx83n4+rfrX18Y9u12vv6L6+u0Xyf/89+5EoxdOF+KLp4Ukv/8/blSYhWpp8Grvb9L1CeJ9+n9HVL71/g5/Wutvw7gz3d/xM//WFn6FQ73iezXAfZHnL4+D+WPz9PPy8TfVhTizyvH7yuyEZr//vMtfvfudu/53N3I5giXfd3Uj1t57zhwEs70vmb8qfxXeF/fn86f5odfZG1zq9P5yT96iMT6hhx2GOGG815XWCwxxxMrrzGumN5nLdXY43pJyfoTbqyO/OzUyNUic4mP48+1hHfdrutxscaVd+DIGDhZ4Bu//XF/fvCf/vntRPeqDkLw7RMnyoJ1RZUsy1Dm9DdHkZBwv2JaXnyD+7z4P3+U2EQGywtz4waHn59TzBJ+1VZ6eU6+OA7N/tMvoe6vExAirl1YTEhkwFtIJVjwNcYaAnFs5Gew8phynGQgFFfiZpUxp2Qkp0Vdm+/U8I6NJX4+Bl5IRKFpKqmhgUhWziUb/dYooeFKKrmUYqWWVnoZlixbMbNqwqlRU821VKu1ttrraKnlVpq12lrrbfTYEzBWXLdee+u9j8FFRx6ca3D84IMZZ5p5lmmzzjb7HIvyWXmVZauutvoaO+60gQC3bdfddt/jhEMpnXzKsVNPO/2MS63ddPMt12697fY7fmYtfLXtb1n7M3P/nLXwlbX4EqXj6q+s8XGtP04RBCdFOSNjMQcyXpUBCjoqZ76FnKMyp5z5HpNL4BarLErODsoYGcwnxHLDz9z9ytzf5s0R3f/fvMW/ypxT6v4vMueUum+Z+9e8/UXW9nhw+yEydSExBSET7cdBIzZWA1MBNoQnLSu+tlhBoVpHT7kH8KX0vLhLP2s0Cvr61M7xdR+XzqKg2rht2eGnzjt3PzeectfiZhrRJnRXnGmWeqz68rC5/T0gBidKNzRX2/BllkZgbl473ZpL6H53fTndlNpSUy6gjTscu/ZZRIuF/4kWdqrNzwUe8WbPRcAnd0Zci59mmYWUGnqD71jvukQszVvWSW2wsHnGui3M47tdv2/LrtmYZJHc+11KZmGA6lo11DQF87OtRAI5AyyQsg+ndwqje2qFFShDy2bYbrIc3uTc5g6cydRG2UfST/SlCf769RKsk5AyKRLyeR3XynM3i34OI4aUUAPiCSjHkS3uzOi0um+t5cx2k41LYR2+3/JWco8fc7sNxrU74febzi6QnmpkDH/SDGeullbNkaBE1kA8aYA21BidFqMdLLQ4qHyHpLCknvaLAp35hnWhTjhuQ3W1ndx2o75ZYxcAL0D0VhZFpIPdRp4PQHydNyK289mdAjI6f8509wEH6nqkQnXNFjbNfcOk5SYRqcsqSydFRGar+roLvebNre/FvQbUUgynkdmdRz91IGEW/7DmqVxascOXJGVpbay8iXFjbDW7HsSeE2x5K9/8R92RlUjR3jRi3aOudK2ONSj3swEYosIdLTXhruH2XZe7FViZCeAIjbR0An6BmMZHrexKzZK601F80eqsZLAfiqqXdMlt4H43qyjm4ljQkz9U2x7cAPdTYjulNJTDEZjdQyufDVI2muX4u200NfdWhsvhNbTrwJV9uBsfy2rT1Nwcdo/tsTdg5QtkTlNIMMbwwDEszkY15UCr62SURqUgF6GnrnoK0+omImDfAcWo0RYhi3qAjYys9CtXQkyt3NAJ4/le7u69OZuiKNw0nQjs2bZpO64qONwNKOFNo4CR6wOMArG5y2sLPOxUSCmSfgjL5QFC8I8bDqVPMuJtAbMsDxS/xWqIi0YiTlRBjpSpn5DLLUgv1n4AJ2eUiB9vjf/wenum9TprPoTzgjzlltxQcUb7D+rEFc8r51+DNs1n3mxAz7nw4t5UM/hSIxAY70J3UBZzcaJN8CO33EgOt3g2WVNhEgAliw6Fx1YQ7NxQAUGKEKKgFiA+r5DTop6SVPIzzRLBoOvPnMcFOsSPA/NXoYM4hSWSypoA896oaE5Ookal4WKcVBGZOYTxtk6XAcEnjunoo7FXSnTgZSkZDj5GT4IX1G5l5RmWf/W+VVo5URhg+i4TOEZO0Vkdq+RCW0N9RsyjJd1HXT2Jj3KjndQCZ3RbIv65BrmBN9ZeKkQOV+TOpDoREVTnHplqKUlgwc/y/SRrZd3RyyFfTd2/LJZGFSAkAIgMpKVBMqOWGZYrFa1BpsYCZDuVh/Hw7dR0pkJOyy2jktPqh45q9O2MhaXFNNecWleGy1p3yWYEmULvFFb2hOSACiDYqqxmTGxAXcUSyyN8m+uPGgUqRcVFNYeZSc1x75xJfEUfdwl+qnx8p41ZLxFiPf0SshMn58NkrPYoFAZNyIbgAH5KiMuS3AaoDvVLPRfonSuNAaoY5QiCj77boq8NWAYb+fpGLKsGPX2PFzlHodwXT9XV8KkZZIiJaWpGhFq+/0xx79V95zxWB6FepYuTnQgg+IaGI98mVKWNGyAWIRBQ/f2p1GAAbqejbSCJQaI5ydFJbCaamxI/kSDXgqTrFWJIaDE8+qqUB3Cy6aVLUR60U1zbSVHcgkJZH6xDHE4o1IygnGieqyEGxfMIAXofYTSVWgJR0QHrKnuVFpGqsM1XOjhPHaJs4t0xS2bEPCZCrbDk6PFziDQAAjTiJBPseLJMkAowO6rjwiJoLrhwokWopzCRqVOEg0AMWulGD6sbNnGDvWjElxb+4s6oN4IN9yNGYN9dUoZao52IVsEpdUnoSx0+UEGr4IFDiQ9KEpjWgbwUVM2DWnaT2tf7ghLGvD6dZ2qZQ73GjPjsCen00WdfOg1B1vaxXigRGp5ujMEVaSJ14ubALTifcDeozb03lhhoQfTtjM+hUZGZRpxUN5naxBuZFERs7kwxMNp1b+QSij9cgGDkPShn6AcctIY1N/nrCn48FUemrX7XktmV3xb9d6+lgKz5zgqe5TX7Tuds2mHuBXkFVLHLT/cYSlN1DEgFhY7b2PuePqNyNhbqv3cWPSkcIL5kBC+iZkPt3M9d9brtDQGnfugbpgF8NqkFPUs7nwGW7BBNjN6hZmeRHiWun5ViGKCANhe3xiXR9DT6TiAbbY4+seUl3jqdxCIQ0hJy5BI9SEWNg4yDWJEdHg6AH+lD1zduLpvYX30Fvx1ACQz1ZbCyFJK4AO0NDmhcBSVD2XvQJ+Nu7KyKjGp38jp3Js4Txiy4AKXroEzAZd9B9+03YF2feDlrUu0wAxAFw1C3aJiL7k3XjYK34LR030sRGfq8BrX1TNAGDE83gQkRjlwxIk9NoM21N5VxLram4WnpKVYJo4A8c2GvEDKN66EqUL/5iO4q5D1REbNFMARu8wAEMS2h4Cmg+eH+F+D7q9cp4jOFGpdEG+AkS3T8ljYDHfpKE74lZ7fbvhHhfQ0XA8dt4XiRWLqAFFYEDPKFm8Vn3I6ptImq5UqAVqWPqSgaclICpsY+YX/JGizHSmUQJXRKtEejInIMKuIwnxxw2UB10m1Lzd2JoqOCj5BOINdlFNKgvS1KQBx5golqCLiL8WYJCWknKHU9ofBx6bPyrV5BNeS3EVO6QMNO1OAAGPB7NALsG9TUNdP/Xg4H6OZ7SDc3aClYF26EX3elFeGxOXPdAYPMxaljEn6VW3w6TRI3MlLnxsL+aO0DjHDd7xBlUnAjoRe6BsWQHt5z424QUiwAQXxuTsATMLsWNp8eXdkqsibNOWBk1bpmBnQ/eiJLL2B1YCZNGmD8jcsqBfnVNOhdwEP4Xhb/QR1dAWeuA6Mx8CtSvTseFzWpQCpezB3VjP5ba2AhUOg0OVDEr7LEFcte2xBeJV7hdfdj42uoNvRcrA5bYF4ThrpkwjyKrc/9aBNBjTajfnBs+JuqlMQgbZgk+9AhaL6K/SUp3XFtg9H5oICbVN6VR+r3iax2SW3r6PUMyhS6irsos3JC0jo0uQaZ8LAXWUNdKJeA6sIe1osSg64w/gcUOm1zGPp410syLwIBy08mep6qWs350EzgkxPuAsTwsCEbB9jExWkTLCDV0KlrAxMewZSj1V18FaX0TLQBTJqswIBu8KUCrABy9CuW6+UGFoWf6TcPX65UATPEJhFGBeADKLMCPVXlhUwgaHCQBwleqaAG9WnYA5thjMbAxCCoeTuxr8imVbDdROMKSGY99WnV9AMO3R+4+O++hotSIO1BUpgK7m5kgZOdjJPs+oyF3MoLVoVuItRWj/QG2l+OeEcKCmOIQJmiN0RSWShmNyGdWelM4CV1MReqFLU/T/3AYU4Z80vwK0Att2AjLsgWH09MdsaCHA1ZHir1hUduHCafuTUTglsznzQh1JYVyfT11D7NQmfTr01CGy6k+jFw40Et4nGBDsApGh9pSIYzgvkjsUADEBp4p5hOupTAFHtFgKUuurqhyrhJrOilJLqpThRCzS7/o+i7XzQWuVSm4N6qISOKrj/ZJzV3BSH7rw95Bzgd8Uu+YEK2LEMd8C8JuOiFCBDaGxYA1F6vE6TsJaOsChYrHYl+V9HcOg3yRNoCraJqWxKR8DJWjYaa3mqEEqwZFIG/IeUBz5o0BcBAgEndIVSQeOA1/EoB34thle6+05f8bm0k0+4dXvT8A+S5v/kFxQg8HY2TML9UJOqCrqv8G55tpF/sERqW8UJVO7rZyForA2KBpS5E+voZOnmvyEkkL+KbuuOMWN2F2R3aaaEINjoVbM2cwf3TKaj4InhG1wB3pukv+m+gp1gv8nAi6yB3j7X2DurCN2+0GiWrzYutkR6RsohtwOmxeIqMwt7gx4Emn2dpMsQaLnPX7xD3xzG/jsCU1DfToCpQFxRJ1pyWk9z8/PvvJeF+1kSQ+GHh6D3YICMrwSTxe4HsybMGCp+03a6BWwb58msimPwkZ4BfKobJPbSRlZ63rNkyCej+kOxtRqBYuqEAIRrM8doCobQJUjaueaozze8bDhGBh3a2z3wv/6/zm99fU3N2icLVjK8MNc9uH1uFNMXukAUU0esuJeRq0i4s8KaJEzc+F3yxd6+APxhCilGWqgSv7yylXadDZ/MGLzPWoXZgA3JjlN/LHMSpXT1x6sAdoTm5abwnuMiH5FIDAPj9kBCocbYWuhmSDmYoaFFKH3wlM3AgRcp/lNl2dNKNGgUHAlg6Kq1P9M8KhgpOxKtYhdQX+F27DEOnN8/GTinxoLZuNQbS/yhuaHhB+YFrmg6N10MBGT2GXz1gKxOBSSwii+CGrG9GbmgcfDCn9Ti0yf7CEaItwQ9MCpw0HLnG92RUKe7ONy8qDq2IR2U1CbmNekgRSPLDUb6ULNqEEpC5fQpIN9CxaBzk8cEywTJjtACGpeVaHmjieEc6I9LBjRjhWUgwIeTQ2UvQ+f69UeCPEnoV9KY1vxXR35YQOP8iyx38axkN97dl9FVEXPlTRnOPlOkJhE0nmKhzdBY2TGYUtHCJHPKDj0M8fYQskN6wmCdA36FzXiShRtbopdEiJK6x2o17robiKJLEcXGihGUAOzVXJa6I9xPj0IRuQMoUw7h1DjQwiJD2wS1RpT6HxsWRYBhW6dLtClDRMqCpWsJMdFu4DWyLYT3BNoq0JYAs6Bt0NdJqoakIkLgam9nRh3cSoxG1rYefQaWnFoOSizL7rA2ttmCtiaaaODPgJInOub/tz/qQxR0FyeLykwDfFcBXVo/y2OHP3oRJSFlkV28tI2vK21hR/yAW+z4Ukju6G/N0EgDFgiVde/8gX1AFUAnxaHwgn0ZIkCAZKYu81WfYDozPbubQz+CBVNT6q0kEIkriflm3TvOg51OmqAyrDxBqwIWVJy/HsZw3NATZUf50AapGaj0N7U1QZU2XxglrwwckME1w0L3cnLR5WHn1SYYcbgHlQ7dJHVMLHPrwAOFZuEiUvjKkEQ6Ptt0iU1LGa6WQsF5wx0ENFBQbN00P4xLEjJqtIUGyjN7ZT2qRvvN2iAztQQKWkAczqd+1dwhiXxrynKLfX7WHTW4ev0MpwK8aH9MYFA7X1RswEry1OV/8UWxBGWEJVDYuBXhMHmm3tOHBl6emC0IklPUo+p/SvJ/13FMbbTQm5YYNWJ1DqC5MDURHdyQac2qzcVDfJFlb4fQVcaoEAEnWg6qISkCVVhnV/kKEAXlEMI+kHzj4AVy8VnsBxHYQAgs69Eq7eZqWGy6ajKrYABtbbxca+UnTWHbAsaZejbp7BJzgp68zfzsv3abNfQoeXaaReFxcJ1b+gPXt5OWK9kQR1MRA2w77hdq/LO43qtd20Rk4b67EjWCUh/yhjBJ6ARD3EkrEiCRj9NGgx3S7tFysYXbNmVEOmFRgRGwXtUMWRQgkaeCQITpIa9aI5wbYoBZ8eH17mVgOlnUDqjS2H7J5brwWVh9dALYl6HMQZkMFZnqLxuGyAIrbaBRoUU5KKLaRHVvcaDmnjkqBPw7ldbCu2BQMHIHT80IqGmAf0J00DVkj1Je+SChcjfaoAyEuyiiAa/IsELR88e/TRKMckQFoSxRoEbZryJK1PZomaB/gWPRkS/F8ZEKbH6Gnjdoq2iC/l+4HE8C5qZ3DLwRzc2vi9m8PEbrH0MruYRJGJR0rFQnX6rRZSV1tPFkhchEopaj0MEb3b/MEyAO9LkRAb3VkWwfHQAPcK/kHPvGEaB2n/eS0C5JPfbY8AKmNN4VuD/wz1W0ekU0/kY1M5vrcECGttjpeXQ80YDqj85am8p/0jAFOsra+fxgoDQO4NERG62ryQehy1lMJVhrLYeUwJIhneBHkTAFIyBTthPTe2jKjCMGQQXFDlW8zaHSLINIx6uI9TdQXzhNZQuFDPumi/KU+lqGEirRF1b4qZ7EKKY5MMUzN91G0qOak7WV+UymgUva3LAy3/ynhHXm4/TvE+6+DPof8OIClz9gpKwdGXw05NdKJ4BHFqT0TDf5or904WJt/+kI65+dvPp/7r09x4q7ngfiI6LmSbK+KCodcJ8psk2X6m/oWiGVMTh+w+YxohTww5KAemENzPgvRtR0tERNTxrYaZhxMTmm8rVCRr/pqa+wBYj/fFCRuYLm6S8IeWSo4IccxQawHa+VOy+O3PKuRupYsAX9FhcPC1qMgOQJ34AxkPzWpJ2FBOnctd1BfWiIa6dhZKNV9tUMGqGf+WWA503BeZEAlIqUpNcyRtr2bxZ5oG8NKucQxY68dEWLaziPSFE7A5KCw6BYkFWhETdaA6eVe1zoUIi4SFirAXkEf7DEc0pSqxczst58X0pSPr8gbTeFw1Z7O7Nr7L2VS5Agv3zU7qW/ChaLpevJhOCRcxGLrwZyFe00ShQVRpx2eBt7OTxcCe8j5RF60LxxvowGgfCJveqDlwv23PX0b9UARgLT1tAgcCKg16gI38X2+ALmTGQ3wkMGsAAjxEg/LQ0dyC3r2JLSOTjTRek3vISJ6j0rQzJ73NLUkA1gCXyHaKXoLYy0PCwM7GtVHYk+7EQuPjqWX2oFTkfv0x4RgatdDn6gVVCkNEVfnHWC6Zpga0xdFEi9y3vZz/ZJ8iBh6sO+EpffwWRA2f7XVSK35BYA1hHHSzFmPoPQKdk+XA3456ymzSbQXugnz1SX4OU5pyVvPniXkPSe0maFJvaJ5P4O68sThr2Fdex0XgaWMncF2Uwmosvh5aCf+7KlvLYUWKJ2be5NIx82QUaoxDO0RkwPq7QAcS9NwHOI+7ykvDErUeKwTKu0Doq2ORsifp0eWwSJyV7r0yPGg6jLCdyQ/qwYVNwKkXc81QMOz8l1Sqi1UeGLO52O0HYDWckhmwPNj9Qxpif+RPChqtXYjHlFj04wFAnXoNYInB/BAEIskOuV/qTs9OpOQGHpgpGhGCWUQk6anGOhubaNMkO3u5wSq8peCBNLYZcbNbQMaOCgE+yC4h6JLBxWqJ/7IsLY/3+Zpk22kX99DR7jaZ7x46SklPZgEtOBOiIvm2RVLaXHODAClqefrNNMB46ES9Dz9PULAH2x7vaiBZTVt+Ohxifd0D+Xl9PTV1OM6zQZuBKaNEiUggl8IkojUxq3Xq+0GAcDQbJ41ovaQoVyWTAEL3rXaVHwoGzB7In8KgkgO/YAAoyCCaFTUrlp2JY3r9QAf8SLo5waiSIVg6/XoOWUfPEUx3wb3rYXuBsWSniKBFge64SIqIeaQgacWjyeFsVmmqrP+yU26o82/g0nA7X/4OaHntH9KgGESIAkX2KwPzYFWgFq0CXA02NHRGhrLTTnVf8/aD3r+Od5nG5bo8GrOtjVvhjGADWEPmpFzTk35fdMOUtGeIqgN9yuWjZsDish2EA29saMMYtOuA0aNUPB69CzLMT3rA5nLo4ZGxhb2OLugh4T1QBHZEoBEgTrr5x/FtBGBm4JWpRvxECjNQ1/DLW1YBwq49I42REeEVs/cNNHLVEpK0VYfSB370wEUtNT/fTtxehAOXrE5MMOo+gHVXxZ5XYUEWOmTCRKu+DdZKtT6J2pH+u7zMGj+2K6/PrHTmZFCoNs7sWbAxdrXoAM/FDX61R4XzFHPBmejdHxRE0MfiL+lmcBwkK/cPNUtoXWh01W69mKgPm0vPXuHPBsbINva9FR5kHoZbc3mDvDa9EAcYH9Mj1NphF/04EddtDlYCXN3aATYwe8iDjwcpL2BqF6cVqGENMbGfpUNi+hhJD15kXpASmqIFkIpA0+WsVqdLszEXNH7PNuTiB/Vg/Oqg/vS4ASl+ClIjZo/yEttocbuwX97Pc82QJwDnIMWiImsjYuZc2ifspZe69qZAwsdQRCzvHxAmPXqwUcKTVu8UaERSkOBVfYKkb+XJEhqtExGMXNm/X8ZRnHBss+yI5Y+o8zOK8aV+G2EFIKFkAB2VTN8SKj3ni2gUE1EhBjCN2A8ktMOPQV/QugDsc0dY4/CM+aqGQRZ258pFrfI4jEzS0yUMObYTQilyYMpRgSdGuydXNdrQxa/qM5whf8DWb3GXCqgM7cAAAGEaUNDUElDQyBwcm9maWxlAAAokX2RPUjDQBzFX1NrRSoKBhRxyFCdLIiKOGoVilAh1AqtOpiPfkGThiTFxVFwLTj4sVh1cHHW1cFVEAQ/QFxcnRRdpMT/JYUWMR4c9+PdvcfdO4CrlxXN6hgHNN02U4m4kMmuCuFXdCKEPvAYkBTLmBPFJHzH1z0CbL2LsSz/c3+OHjVnKUBAIJ5VDNMm3iCe3rQNxvvEvFKUVOJz4jGTLkj8yHTZ4zfGBZc5lsmb6dQ8MU8sFNpYbmOlaGrEU8RRVdMpn8t4rDLeYqyVq0rznuyFkZy+ssx0msNIYBFLECFARhUllGEjRqtOioUU7cd9/EOuXySXTK4SFHIsoAINkusH+4Pf3Vr5yQkvKRIHQi+O8zEChHeBRs1xvo8dp3ECBJ+BK73lr9SBmU/Say0tegT0bgMX1y1N3gMud4DBJ0MyJVcK0uTyeeD9jL4pC/TfAt1rXm/NfZw+AGnqKnkDHBwCowXKXvd5d1d7b/+eafb3AxZ8coJmdd3gAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH4wYFECEioUMxaQAAHgNJREFUeF7t3Xm4nVV59/HvOgMZSMKQwXAQODs0QmQKU2QeLCAiin0FqW/r++JQx2odKwJqqx5RK6iFFrWVCh0EHAEVWuDibRVQKK+nKMrFYMIUpkAgA2Q4yeof+xx6kpyz72evda+19nB/rst/cn4neO08v+d+9jOsx3nvyck5J0WaMQP4LfBSKRjpPO/9kBTqZs65q4HXSblIN3jvT5JCqaxZs4aDDjqIkZERKQrA0qVLpYioRwq0uM+QvpwPARdKIcNHgY1SKNKJzrk3SaFUZsyYwbHHHivFXlSr1aSIKGtBlafngcD7pJCCs733L0ihbue9vxe4RMopuNA5t4MUSuW1r32tFNlCbEmzFVS5nD3A14FeKRjp58AVUsi86C+BlVIo0nzgc1IolZNOOokpU6ZIMTXZCqrsvcChUkjBh3zuL+ltzHv/DPBZKafgXc65HP/+25g6dSonnHCCFNtCzBTNUlDl6TlAno3g297726SQ2cbFwANSKFIP8DXnXOojqAk1e5gbI0tBlX0VmCWFIq0DzpZCZlve+w3Ax6ScgoOAP5VCKRx//PFsv/32UmwLoVM0eUGVp+cpwOlSSMGF3vuHpJCZmPf+e8BPpZyCzzjnBqSQtv7+fk4++WQppiJpQZXLOR34Gymk4HHgfClkRB8CUn9/n0n9iCq7kMPckCmatKDKPgEMSiEFf+G9XyOFTGPe+/8ErpRyCk53zr1KCmk74ogjmDZtmhSLlqygytNzT+p75NTuB74phUxlnwCq3XYT5yvOuX4ppKmvr4+jjjpKim2j2SmarKDKvgxsJ4UUfMJ7n2OD6gre+/uBS6Wcgr0pcMLomGOOkSLRXIrLfMrT81XA9VJIwTBwkF331OWc25X6kclUKRvpOWCh9/4pKahl+fLlQVMUqt+n2+oTtB/4ihRSco6VU5/3/lHynNzbgcx3GA0MDDA4OCjFoqgXVHl6vp/64UtqP/XeXyeFTLDzgVVSSMFbnXMHSSFNoYe5Vb+LqhZUuZzzgE9KISUflwImnPf+aeACKaegh8yXXUILWpVqQZV9nvR3DAH8yHt/ixQy0S4Ecnw/PCrnI2mHHXYYvb1hdxxWmaJqBVWenocAZ0khBZuBc6SQiTd6bTnXDSBfdM5Nl0Iapk+fzpIlS6RYMLWCKvtrQLXxk7jKe/8rKWTU/C2wXAopeCkZ76U++uijpcikpCmqUlDl6XkGcLgUUuDJ81SMGeW9Xw98Ucop+bBzbhcppKGZVRaapVJQRf3kO1X+Pe/93VLIqPsG8IQUUjCd+gPkyS1atIjZs2dLsUk1mqLRBVWenu8Cfk8KKfDU1zMymY0uH/MlKafkrc65RVJIQ6opGl1QRTOp37uZww+993dJIZPMJcAKKaSgl0wnpmIvt0w2RaMKqjw9PwbMlUJKbHoW5L1fS76VEk9zzh0phWIdd9xxUiRIVEEVDQAflEJKrvXe/1IKmeQuBp6RQkqSn5iaNWsW+++/vxRraKIpGlxQ5en5aepf6nP4tBQw6XnvV5Pvrp8jnHN/IIVixVxumUxwQRW9nDw3JQBcN/ogsWkNX6X+FEoO5zvn+qRQjNjvobDtFA0qqPL0/Dzp17cdY9c9W4j3/jnyPOkCsBfwNikU48ADD1RfZSGooIoOA5pf3CXMrd77W6WQye4iYL0UUvIJ51yyVaf7+vpUDnPHT9GmC6o8PXN+H/wrKWDy894/DvyTlFOyK/AOKRRD4zB3vKYLquhI4EQppORe4BopZIr5EulXABzzcedcstUdtC+3NFVQ5emZ81rkBd77zVLIlOG9vwf4sZRTsgv1O9aSGBgYEG+Ar2Ls72iqoIqOBY6XQkqeBC6XQqa4nF9Bzk75OJrmYW7lgipPz5zfPS/23q+TQqYs7/1/ALdLOSUvAd4thUJpFbRWq1Vf1U+xoL8P3CiFlDwP7D665IZpcc65M4CrpJySJ4EFo7cdqlq3bh377LMPVbvVSKUJqlhOyPQI0KhLrZxt5fvA76SQknnUX2OpburUqey1115SrJJKBVV0EvWztzl48i3ZaRR47zeR7/Y/gI8652ZIoRAHHnigFKlELKjy9My1Sh/Ub+tL/Z5Ko+8yQP2wcxJzSHRGd/HixVKkErGgio4k3/SEfLeQGUWjt//lunEB4IPOOfXXimQpqPL0zLn27AOALUTdvnLuXAeAN0uhZi1cuJCZM2dKMVGuCbov9Zfv5nKJvcahfY2utJjjBcBjPuqcU+9C7POh0KCgytPzbPIsown1Sys53qhl0so5RfcC1J8X1ThRpL7XmMAewJlSSNG/eO9XSiHT8r4PPCaFFH1MCjSrXQr6USDpg7JbybnnNYl47zdSX6Izl0Odc6+UQs045JBDpIhowoIqHt7OBd4qhRTd4r0flkKmbXyDPG/oHqM6RWfOnMkee+whxRpKPUH/DNB9xLyxr0kB0z6898uBq6WcopOcc/HHpePEXm7ZpqCK03MaCW9InsBzwPekkGk7/yAFlH1ECjRDvaCK/hjYWQopumJ01XLTWa4nzwuXxpzhnJsvhaqKPVG0RUEVpyfA+6SAMru00oFG78/N+TxvP4q3/y1atIi+vvBzpKkm6HHAflJI0d3e+1zPEpr8cu9836l1+19/fz8HHHCAFJtUqoK+Xwooy/0PaDLy3t8H/EzKKZoPvFEKVaVSUMXD292B10khRRuBf5RCpu3l3gmrfUWL+R6aYoK+l3wLUQP82Hv/lBQybe8qYI0UUrTEOfcKKVRFdEEVp+c04O1SSFnuPaspYHRpklzLoYxR+ao2MDAQ/IJf7Qma+9LKk9hjZd3kW1JAmdoll4MPPliKTEi7oDlvTAD4rvc+561gpqyfAY9IIUX9wJ9IoSpCb1joUTy8PRgIP9gO820pYDrH6DO+V0o5ZW91CiUJLqgUaELSN0dN4GHgFilkOk7unfIgcIIUkixevDjoXI9WQacB/1sKKbvSVk3oPt77O4H7pJyy6OEzdepU9t57bym2Da2CngHsIIWUXSEFTMfK/W//eudc2GnYcRYtWiRFtqFV0Og9TJPuG92Tmu6U+zB3CgoLi+25555SZBsaBV0I6LyMorrce1DTQrz3vwXuknLKoofQggULpMg2NAoa/X88QO49qGk9ubeBfWPvLCpR0D7g/0ohZXeP7kFNd8t9VxFE3iW3YMECenqaq1xz6W2dTP3O/5xyLoFhWpT3/nfAr6WcsjOdc8FL+PT29rL77rtLsS3EFjT3pRWwgpr/kXtbmAmcKoUaafYwN6ag08n7WBnU10m9QwqZrpG7oBA5lHIW9HXA9lJI2bV2c4IZ5z+BR6WQslc754Kv+ecs6JukQAIl9pimRY3urK+RcsqmAG+QQpNp9lpoaEF3pH6CKKc1wE1SyHSdH0qBBIIPc3NN0DcAKosqNeHfvPfrpZDpOjdTXxM5p+NDnxOdPXs2M2ZUf6l3aEHt8Na0hNF3uOR+aL+HiBeCLVy4UIq8KKSg86kvq5mTJ/8/gmkfP5ICCQQPqWa+h4YU9A3kXRQMYNgWBjMN3Eh9J57TK5xzQW9GauZ7aEhBT5MCCfybFDDdy3v/BPArKZdAUBdSFnQH8h/eAtwgBUzXK7ETb7mCvpr6Qko5vUDeVcVNeypR0GOccztJoa3VarXKN81XS/2PoD1GpP+wyyumgp9S35nn1Ae8Rgptrbe3t/KLfZspaD/1CZqbHd4akfd+HfWS5hY0tKoe5jZT0GPJv+4QWEFNdSW2lZOdc1Ok0NZSFDRoTxHpCe997qUtTPsq8T10BvBKKbS1qtdCmylo7kfLAP6fFDBmzOjOfIWUS6Dp4aU9Qfel/lrB3OzsrWlWicXMm36IW7ugJ0qBRKygplkltpldnXNNLXq78847V7ppvpULuor8Syua9leioBDQkcHBQSlSqaD95F/3FuA27/1mKWTMVu4EnpdCCTRd0Dlz5kiRSgU9nPxLm0CZ7xKmzY0+fna7lEvgWOdcU3fZzZ07V4pUKmjTewYlpQ5VTPsrse3MBJpa2Fprgka/ei3ARuAXUsiYSZS4owiaHGYaBd0BOFTIpPBL732J7xGmM9wGbJJCCTRVUI1D3OPJ/3A22PQ0Ebz3q4HfSLkEljSzJKdGQY8Vfp6KvVrQxPr/UiCBXuBoKTRGo6BHCj9PpcSHazpLqZ38EVJgTOx30GnA4gY/T+UFwN5eZmK1fEFnzZpFf3/jKzONCnoo+VdPALjLez8ihYwRDFPmRNGSZq6Hzps3r+HPGxW08p5AWak9n+kgo1cB7pFyCTR15Ckd5rZiQe37p9FSamdfuTvSiaJGBT2swc9SKvWhms5TaluqfHI1tKAvA+RzwPrWA3dLIWMqKlXQyhM09BD38En+PLV7Rm92NkZDicWsof58aKUFDkInaInb+8AurxhF3vtV5H/B75glUgDCC3rAJH+emhXUaCu1TVU6kzt79uyGP5+ooA7Yf4I/z6HE/ZOms5XapioVNGSC1oBZE/x5DqX2dqZztXRBd9lll4Y/n6igpQ5vNwH3SSFjmlRqp7+rc0682Xa77bZj++0nX7BkooJWan4CD3jvN0ghY5pUaoJCxS41utTSShO01J7OdDDv/QrKLGYNFQva6Hto3wR/ZgU1neY3lFmZslJBL7vsMjZunPjy/9YF3QEYnCCXw/1SwJhA91OmoAf84T/FbdZbF3TvCVN5LJMCxgRaJgUSedmVb17YWxsaDn7sbevvoAsnTOWxTAoYE2iZFEhkO6Dam3on0SoF3Qw8JIWMCbRMCiQU1alWKehyu0neJLRUCiQU1alWKegyKWBMhOVAqWvsUZ2ygpqON/oSroelXCJRnRpf0LnUL7OUsEwKGBNpmRRIRK2gUX9RpGVSwJhIy6RAIoNLz11ceZW/rbVKQR+RAsZEKrWN9RFx88/4glZaoiGRJ6WAMZGekAIJBXdrfEF3nTSVXskPz3SHkttYcLfGF3Rg0lRaHnhKChkTqe0LGvyXRFppNymYDEoWNHj4tcIELfnBme5R8jxH8PAbK2gf0PgtLulYQU1yo0twviDlEoku6Hy2nKY5WUFNLqWmaHRBg/8CBaU+NNN9Sg2D+UvPXRw0AMd+qfHaf2k9LQWMUVJqbaJeAr9CjhW08fLWaa2SAsYoWS0FEgrq2FhBd2yYSqvkh2a6S8lhENSxVihoyQ/NdJeSwyCoY1ZQ001KbmtBHWuFgpbcq5nuYgUNUPJDM92l5DAI6thYQUutpABlPzTTXUoOg6iCBv2ykpIfmukuJbe1oI6NFbTU+0AB1koBY5SU3NaCjlLHCjqlYSote9TM5FJyWwvq2FhBgxc1iuRHl0Q0JocRKZBQUMfGCrpdw1Q6JfdopvuU3N6iChr0ywpK7tFM9ylZ0KAhaAU13aTk9hbUsR7AUX8cpoSSezTTfUpub8ETNOgXlZTco5nuU3J7C56gQb+opOQezXSfkttb0CDsodxaRADBrwY3JkDJ7S3oa2QPZcd+nxQwRlHbHS32EPiLSkp+YKb7lBwIQT0rXdCSH5jpPiUHQtAbvse+f5YqackPzHSfkgMhqGOlC1ryAzPdp+RAsAlqjKDkQAjq2FhBg9qtoOQHZrpPyYEQVdCgX9bgnLOSmlxKFjRoCI4VtNRbnyDwDgtjApQs6DopMJGxgj7XMJXWDClgjJKZUiChZ6XARMYKGvTLSkquh2S6S8ltLahjVlDTTUpua0Eda4WCljzsMN2l5LYW1LGxM6hBv6yk5F7NJHTKu598t3PubVJOk9/kz/zJ1+c9MMmPS25rQR2zgpqE3K7AwVJKU0+Pn9bgxyW3taCOtcIhbskPzXSXkttaUMdaoaAlvxeY7lJyWwvq2FhBn2qYSitoSXxjApScoCukwETGCvpYw1Rac6WAMUrmSYFE1teGhp+WQhMZK+ijDVNplfrQTPd5iRRIZLkUmMxYQVcA6xsFEyr1oZku4pxzwBwpl0jwABy/ol+pw1wrqMlhNuUeb4yeoBDxl0SygpocSm5nKhM0+C+JNN05t70UMiZS2xe01ASFsh+e6Q4lt7HgbrXCBIWyH57pDiW3seBujS/osslCGZT88Ex3KLmNPSgFJjO+oPdNmkpvdylgTKRS29h64GEpNJnxBb1/0lR6NSlgTKRBKZDIA7Wh4c1SaDLjC7qGctdCB6WAMZEGpUAiUUemW796MOovizAoBYwJ5ZzbDthFyiUS1SkrqOkGewBOCiUS1alWKeiOzjl77MykMigFEorqVKsUFOxEkUlnUAokFNWpVirooBQwJtCgFEjkBSJuUoBtC3ovMDJRMINBKWBMoEEpkMhvakPDXgo1snVB1wP3TBTMYC8pYEygUtvWsBSQbF1QUPhLAy2SAsY0a/RB7b2lXCL/JQUkVlDT6XYHSj3OGN2liQoa3fpA85xzO0shY5pUasfvUehSK01QKPdhms71cimQyNLa0PAqKSSZqKAriHjANFKpD9N0rlI7/ejpCRMXFMpN0VIfpulcpbYplQ5ZQU2nK7VNqXRosoLeMcmfp2aHuEaNc+4lQKkTj7dLgSomK+itk/x5ars753aSQsZUtFgKJLK0NjT8uBSqYrKCPglM9hLU1A6SAsZUlPXdpOOoDbjJCgqK/5EmWUGNllLbklp3WrGgpfZ6pvOU2pbUumMFNR1p9K60QSmXwGrgV1KoqkYF/TUQfSdEgD1tdQWjoNTh7e21oeFNUqiqRgXdDPyiwc9TccCBUsgYQakjMdUjz0YFBbhF+HkqpT5c0zlKTVDVzkgFvVn4eSpWUBOrxDa0kcwFvQ1YK2RSOFwKGDMZ59xcYE8pl8DPa0PDa6RQM6SCbgT+XcikMOic21UKGTOJo6RAIjdIgWZJBQW4UQokUupDNu2v1LZjBTWmghLbznMkeMikTwpQv+j6ODBfCior8SG3hYef3cBN961i2cr1PL12hGeeH2GTj1rdMZH8l7M3rH92CmUu092sef1zTJWCAtwE/JEUUra/c26W977EzRIt6fI7V3DZHStY+sx6KdoS9i5Q0KeX334A0C/lEkhypFm1oDeQv6A91M/m/qsU7HQ337+K8657hMdWb5SiXe/5VY+WmJ6Q4PsnVPsOCon+4xV0/WHuxT97grddtdTKWdGGdStL3KDwcG1o+F4pFKLqBF1OfQmH3A/AdnVBz/7xw1z1X89IMTPOyMa1+0uZBH4kBUJVnaAAV0uBBA5zzk2TQp3o0tufsnIG8H7TDCmTQLJutHpBpwJHS6FO88CKdXzuplIrn5omrSbhLbHNvnX4QepL6ed0gff+I1KoU5z67if29a5H7XlC08Y2u0ObmaAA10iBBE6UAsZ0qmYLWuIwdz/nXO6bJIxpCc0W9N+p39KUkwNOkEKdYP3IZiliukyzBd0I/EQKJdAVh7n3rmiPO4RMPs0WFMoc5nZFQR9fZTcjmC2FFPRHwPNSSNkuzrn9pFC7e2zVBiliukxIQdcC10qhBF4jBdrdyhfUH4YwbS6koADflgIJnCYF2p2nFR8ZMyWFFvQ64FkppOwVo2+rMqZrhBZ0A/B9KaTMAa+VQsZ0ktCCAvyLFEig4w9zjRkvpqA3U18KJacTnHPTpZAxnaLHh69lsxm4SgopmwqcJIWM6RQxExTsMNeYpGIL+gvgHimk7FTnXK8UMqYT9ABEHOYCfFMKKJsDHCeFjOkEsRMU4HLqN9Hn9CYpYEwneLGgEVP0SfLf+ve/nHMl1j41JiuNCQr5D3N3Al4lhYxpd1oFvR54RAops8Nc0/G2KGjEYe5m4FtSSNnrunVJTtM9tCYo1A9zgxseYAZwqhQypp1tU9CIKbqM+kuWcvpDKWBMO9OcoACXSAFlpzjnZkkhY9rVhAWNmKJXU1/cOpepwJlSyJh2pT1BNwF/K4WUvUUKGNOutAsK8PfAC1JI0eHOub2lkDHtaNLXD3rvca7ZV7cA8Azwz8DbpaCitwAfk0LtYLvekcc2bJ7yQSnXDrzzp+DzLpn61KO3MbIu/qXsM3ZacOWsnV/2cymX0ka36aGq7wdt1kXkLej/cc6d670fkYKtbnhgxdPAV6RcO9j74YE5zuUt6OMPXMfDd39NikmeBt5SGxrOeSQ4oYaHuBEni+6i/pqIXOYDr5ZCxlT0961QTkjzHXTMRVJAmZ0sMhpKnOiclFjQiCn6Q+AhKaToVOfcXClkjODq2tBwzu22IbGgETYBX5VCivqBN0shYwQXSIGcKhU0Yop+g/pZ3Vze4QJPPRsD/LQ2NHyrFMqpUkEjrAH+Rgop2osueZeoSeILUiC3ygWNmKJ/Td63ob1XChgzgV/VhoZ/LIVyWnru4uoFjbACuFQKKTrVObe7FDJmK1+UAiU0VdCIKfolINdNBL3Au6SQMeM8CFwhhXJaeu5ioMmCRngQuFIKKXq7c26KFDJm1AW1oeFcA6QpTRc0Yop+nnwrLswF3iiFjKH+FSz3oneVNV3QCL8GfiKFFNnJIlPFRbWh4ZwnMUVjh7cQWNCIKfpZKaDoFc65Q6SQ6WqryH9LalOCChrh59SX6MylIx7bMsl8pTY0vFIK5TR+ekJEQSOm6CelgKI3Oud2k0KmKz0LfFkKlRZc0Ah3ALkuCPcBH5BCpit9uTY0/KwUymnr6QmRBY2Yop+SAor+xDm3gxQyXWUlbfJQfFRBI9wJXCOFlMwE3imFTFe5oDY0HL8uiqKJpicoFDRiiv4F+a6Lvt/ehmZGPU39/vC2EF3QCL+kvo5uDrtiL1sydV+qDQ2vlkI5TTY9QamgEVP0U+Sboh+RAqbjraDFr3tuTaWgEe4CviOFlOznnGvpd4o67FnzxM6vDQ2vlUI5NZqeoFjQiCl6DrBRCik5RwqUtMPUXiliwj1I3sUDVKgVNMIDwNelkJJjnHPHSqFSZm+fapliA5xXGxpeL4VykqYnKBc0Yop+Gsj1xT3nnUxNmWMFTWWY+tsO2o5qQSG4pE+R74n2VzrnjpRCJew3fxr9PfY9NIE/rw0NB22YqVSZnpCgoBEuBJZLISUtOUVnTOnl6AUzpZhpzg21oeEbpFCrSlLQwCn6PPWbF3I4yTm3RAqVcNahtva2Ig/8uRTKrer0hEQFjXAp8FsppKQlp+hRtRkcutv2UsxU88+1oeFhKdTKkhU0cIpuAs6WQkpe45w7SAqVcM7vD0gRI1sPnCeFcmtmekLCgka4hnxvRmvJKXrAwHTee+RLpJhp7KLa0PCDUqjVJS1o4BSF+jOcm6WQgtNadVmUDx87nzMO2FmKmYk9AXxGCuXW7PSExAWF4JIOA38nhZR8TgqU8oXX7MZHjtvFbgBs3sdb7XGyUMkLGuE86g/Wpnaic+54KVTKe46YxzfPXMAuM+1puSp6+6bfDXxLyuUWMj0hU0EDp+gK8q28cL4UKOm4PWdyy/tezqdPfim1nW097kbmDCw5v9VuSojhAsvTtMC3AvZRP9zdRwoqeL33PtfzqVEefnYDN923imUr17Ni7Qgrnx9hU6Z/x2asumWHzzrHuVJOk/Ob95tx5OpfS7mtLXtmPU+uSbO4fOj0hHoBsvDeh5R0BPgz4EYpqGDIOXet9z7Hyakou+24HWcdOkeKFXfKLU9JkSSu+OPfkyLb+NS/Pso/3rlCimWX5RB3TOC0vgn4gRRSsA/wR1LImGbETE/IXNAIHwbWSSEFf2lrF+kZ2bh2RynTyWLLCQUKGjhFl1J/hWFqNeAdUshUs/bZpcdIGdNYz8aNuRYziPY56kVN7ZPOuVlSyDTmnFu8Yf1z+0q5TqUxPQF6brwxx/mXLQVO0ReA90ghBfNo8aVR2sSF4Js+K2i21HPttddKmSQCS3o9cJUUUvAB59ygFDITc86dBrTszR+paU1PGJ2ga9askXKt5APUXxuX0hTgC1LIbGv0JFuu1TE6Xt/IyAjXX389p59+upRVFzhFH3POnQNcLAUjvdE591Xv/a1S0GzhPcDLpFAnqw3pPYLaA/Cd7+RamlbNJdTfkpbal13A3RXdyjm3Ey36CF+76gG44447uPfee6Vsyxi92+ed1B/wTmkJ9sqIZnwKsGfkFL14HfSyyy5rlGs53vtfkuclOJ93zk2TQt3OObeQPGfZu8qLBf3BD37A6tW5lqZV80ngESkUaTfgQ1LI8FeA3YWl7MWCrlu3ju9+97uNsi3He7/Ge7+b994l/t+Q9P+l23nvX7/15zb3pUfZ5xZpi6dZLr/8cs4666yQp06M2Ubf5r5vbOwbuV7KaerftPl3Uqad/DepALQulhENnAAAAABJRU5ErkJggg=="></div>');
  16580. div_to_render.append(addParentheses);
  16581. addParentheses.popup({
  16582. content: "Adicionar parênteses",
  16583. delay: {
  16584. show: 750,
  16585. hide: 0
  16586. }
  16587. });
  16588. addParentheses.on("click", function (mouse_event) {
  16589. // verificar se já está ativado
  16590. if (window.parentheses_activate) {
  16591. return;
  16592. }
  16593. div_to_render.find(".usepointer").off("click");
  16594. window.parentheses_activate = true;
  16595. window.open_or_close = "open";
  16596. div_to_render.find(".dropdown").addClass("disabled");
  16597. div_to_render.find(".ghost_element").addClass("temp_class");
  16598. div_to_render.find(".ghost_element").removeClass("ghost_element");
  16599. var floatingObject = $('<div class="floating_parenthesis"> ( </div>');
  16600. floatingObject.draggable().appendTo("body");
  16601. floatingObject.css("position", "absolute");
  16602. mouse_event.type = "mousedown.draggable";
  16603. mouse_event.target = floatingObject[0];
  16604. floatingObject.css("left", mouse_event.pageX + 10);
  16605. floatingObject.css("top", mouse_event.pageY + 10);
  16606. floatingObject.trigger(mouse_event);
  16607. div_to_render.on("mousemove", function (evt) {
  16608. var actual_target = null;
  16609. if ($(evt.target).hasClass("single_element_expression")) {
  16610. actual_target = $(evt.target);
  16611. } else {
  16612. actual_target = $(evt.target).closest(".single_element_expression");
  16613. }
  16614. if ($(evt.target).hasClass("temp_class") || actual_target.length < 1 || actual_target.hasClass("add_parentheses") || actual_target.hasClass("rendered_parentheses") || $(evt.target).hasClass("expression_elements")) {
  16615. return;
  16616. }
  16617. renderGhostParentheses(actual_target, command, function_obj, div_to_render, expression_array);
  16618. });
  16619. div_to_render.on("mouseleave", function () {
  16620. /*window.open_parentheses.remove();
  16621. window.close_parentheses.remove();*/
  16622. });
  16623. var floating;
  16624. $("body").on("mouseup", function (evt) {
  16625. if (window.open_or_close == "open") {
  16626. window.open_or_close = "close";
  16627. floatingObject.remove();
  16628. var comando_que_esta = $(evt.target).closest(".command_container");
  16629. var comando_certo = div_to_render.closest(".command_container");
  16630. if (!comando_que_esta.is(comando_certo)) {
  16631. window.parentheses_activate = false;
  16632. div_to_render.find(".temp_class").addClass("ghost_element");
  16633. div_to_render.find(".temp_class").removeClass("temp_class");
  16634. div_to_render.off("mousemove");
  16635. div_to_render.off("mouseleave");
  16636. $("body").off("mouseup");
  16637. window.open_parentheses.remove();
  16638. window.close_parentheses.remove();
  16639. window.inserir_open = -1;
  16640. window.inserir_close = -1;
  16641. window.open_or_close = null;
  16642. renderExpression(command, function_obj, div_to_render, expression_array);
  16643. return;
  16644. }
  16645. window.open_parentheses.addClass("parentheses_fixed");
  16646. floating = $('<div class="floating_parenthesis"> ) </div>');
  16647. floating.draggable().appendTo("body");
  16648. floating.css("position", "absolute");
  16649. floating.css("left", evt.pageX + 10);
  16650. floating.css("top", evt.pageY + 10);
  16651. $("body").on("mousemove", function (evts) {
  16652. floating.css("left", evts.pageX + 10);
  16653. floating.css("top", evts.pageY + 10);
  16654. });
  16655. } else {
  16656. floating.remove();
  16657. window.open_parentheses.removeClass("parentheses_fixed");
  16658. div_to_render.off("mousemove");
  16659. div_to_render.off("mouseleave");
  16660. $("body").off("mouseup");
  16661. setTimeout(function () {
  16662. window.parentheses_activate = false;
  16663. }, 50);
  16664. var comando_que_esta = $(evt.target).closest(".command_container");
  16665. var comando_certo = div_to_render.closest(".command_container");
  16666. var is_correct = false;
  16667. if (comando_que_esta.is(comando_certo)) {
  16668. is_correct = true;
  16669. }
  16670. if (is_correct) {
  16671. expression_array.splice(window.inserir_open, 0, "(");
  16672. expression_array.splice(window.inserir_close, 0, ")");
  16673. }
  16674. window.inserir_open = -1;
  16675. window.inserir_close = -1;
  16676. window.open_or_close = null;
  16677. renderExpression(command, function_obj, div_to_render, expression_array);
  16678. }
  16679. });
  16680. });
  16681. }
  16682. window.open_parentheses = $('<div class="parentheses_ghost">(</div>');
  16683. window.close_parentheses = $('<div class="parentheses_ghost">)</div>');
  16684. window.inserir_open = -1;
  16685. window.inserir_close = -1;
  16686. function renderGhostParentheses(actual_target, command, function_obj, div_to_render, expression_array) {
  16687. /*window.open_parentheses.remove();
  16688. window.close_parentheses.remove();*/
  16689. var index_in_array = actual_target.data("index");
  16690. if (expression_array[index_in_array] == "(" || expression_array[index_in_array] == ")") {
  16691. return;
  16692. }
  16693. if (window.open_or_close == "close") {
  16694. if (index_in_array < window.inserir_open) {
  16695. return;
  16696. }
  16697. } // Tratando a situação quando é na primeira posição:
  16698. if (index_in_array == 0) {
  16699. if (expression_array[index_in_array].type == "var_value") {
  16700. if (window.open_or_close == "open") {
  16701. window.open_parentheses.insertBefore(actual_target);
  16702. window.inserir_open = index_in_array;
  16703. }
  16704. /*if (expression_array.length == 1) {
  16705. if (window.open_or_close == "close") {
  16706. window.close_parentheses.insertAfter(actual_target);
  16707. window.inserir_close = index_in_array + 2;
  16708. }*/
  16709. //} else {
  16710. var count_opened = 0;
  16711. var count_closed = 0;
  16712. for (var i = 0; i < expression_array.length; i++) {
  16713. if (expression_array[i] == "(") {
  16714. count_opened++;
  16715. }
  16716. if (expression_array[i] == ")") {
  16717. count_closed++;
  16718. }
  16719. if (count_opened != count_closed) {} else {
  16720. if (count_opened > 0) {
  16721. if (window.open_or_close == "close") {
  16722. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  16723. window.inserir_close = i + 2;
  16724. }
  16725. break;
  16726. } else {
  16727. if (expression_array[i].type == "var_value") {
  16728. if (window.open_or_close == "close") {
  16729. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  16730. window.inserir_close = i + 2;
  16731. }
  16732. break;
  16733. }
  16734. }
  16735. }
  16736. } //}
  16737. } else if (expression_array[index_in_array].type_op) {
  16738. if (window.open_or_close == "open") {
  16739. window.open_parentheses.insertBefore(actual_target);
  16740. window.inserir_open = index_in_array;
  16741. }
  16742. var count_opened = 0;
  16743. var count_closed = 0;
  16744. for (var i = 1; i < expression_array.length; i++) {
  16745. // $('.slide-link[data-slide="0"]')
  16746. if (expression_array[i] == "(") {
  16747. count_opened++;
  16748. }
  16749. if (expression_array[i] == ")") {
  16750. count_closed++;
  16751. }
  16752. if (count_opened != count_closed) {} else {
  16753. if (count_opened > 0) {
  16754. if (expression_array[i].type == "var_value") {
  16755. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  16756. window.inserir_close = i + 2;
  16757. }
  16758. break;
  16759. } else {
  16760. if (expression_array[i].type == "var_value") {
  16761. if (expression_array[i].type == "var_value") {
  16762. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  16763. window.inserir_close = i + 2;
  16764. }
  16765. break;
  16766. }
  16767. }
  16768. }
  16769. }
  16770. }
  16771. return;
  16772. } // Tratando quando não é no índice 0:
  16773. if (expression_array[index_in_array].type == "var_value") {
  16774. if (window.open_or_close == "open") {
  16775. window.open_parentheses.insertBefore(actual_target);
  16776. window.inserir_open = index_in_array;
  16777. }
  16778. if (window.open_or_close == "close") {
  16779. window.close_parentheses.insertAfter(actual_target);
  16780. window.inserir_close = index_in_array + 2;
  16781. }
  16782. return;
  16783. }
  16784. if (expression_array[index_in_array].type_op) {
  16785. // buscar para a esquerda primeiro:
  16786. if (expression_array[index_in_array - 1] == "(") {
  16787. if (window.open_or_close == "open") {
  16788. window.open_parentheses.insertBefore(actual_target);
  16789. window.inserir_open = index_in_array;
  16790. }
  16791. } else if (expression_array[index_in_array - 1] == ")") {
  16792. // buscar a abertura
  16793. var count_opened = 0;
  16794. var count_closed = 0;
  16795. for (var j = index_in_array - 1; j >= 0; j--) {
  16796. if (expression_array[j] == "(") {
  16797. count_opened++;
  16798. }
  16799. if (expression_array[j] == ")") {
  16800. count_closed++;
  16801. }
  16802. if (count_opened != count_closed) {} else {
  16803. if (count_closed > 0) {
  16804. if (window.open_or_close == "open") {
  16805. window.open_parentheses.insertBefore(div_to_render.find('.single_element_expression[data-index="' + j + '"]'));
  16806. window.inserir_open = j;
  16807. }
  16808. break;
  16809. }
  16810. }
  16811. }
  16812. } else if (expression_array[index_in_array - 1].type == "var_value") {
  16813. if (window.open_or_close == "open") {
  16814. window.open_parentheses.insertBefore(div_to_render.find('.single_element_expression[data-index="' + (index_in_array - 1) + '"]'));
  16815. window.inserir_open = index_in_array - 1;
  16816. }
  16817. } // buscar para a direita agora:
  16818. if (expression_array[index_in_array + 1] == "(") {
  16819. // buscar o fechamento:
  16820. var count_opened = 0;
  16821. var count_closed = 0;
  16822. for (var j = index_in_array + 1; j < expression_array.length; j++) {
  16823. if (expression_array[j] == "(") {
  16824. count_opened++;
  16825. }
  16826. if (expression_array[j] == ")") {
  16827. count_closed++;
  16828. }
  16829. if (count_opened != count_closed) {} else {
  16830. if (count_opened > 0) {
  16831. if (window.open_or_close == "close") {
  16832. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + j + '"]'));
  16833. window.inserir_close = j + 2;
  16834. }
  16835. break;
  16836. }
  16837. }
  16838. }
  16839. } else if (expression_array[index_in_array + 1].type == "var_value") {
  16840. if (window.open_or_close == "close") {
  16841. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + (index_in_array + 1) + '"]'));
  16842. window.inserir_close = index_in_array + 3;
  16843. }
  16844. }
  16845. }
  16846. }
  16847. function renderParenthesis(div_to_render, expression_content, command, function_obj, position, expression_array) {
  16848. var ghost_parenthesis = $('<div class="single_element_expression parentheses_in_expression" data-index="' + position + '">' + expression_content + "</div>");
  16849. div_to_render.append(ghost_parenthesis);
  16850. }
  16851. function renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, position) {
  16852. var menu_final = '<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
  16853. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
  16854. if (types_included.length > 1) {
  16855. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_arithmetic_expression") + '<div class="menu">';
  16856. menu_final += getArithmeticOperators();
  16857. menu_final += "</div></div>";
  16858. } else {
  16859. menu_final += getArithmeticOperators();
  16860. }
  16861. }
  16862. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic) >= 0) {
  16863. if (types_included.length > 1) {
  16864. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_logic_expression") + '<div class="menu">';
  16865. menu_final += getLogicOperators();
  16866. menu_final += "</div></div>";
  16867. } else {
  16868. menu_final += getLogicOperators();
  16869. }
  16870. }
  16871. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional) >= 0) {
  16872. if (types_included.length > 1) {
  16873. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_relational_expression") + '<div class="menu">';
  16874. menu_final += getRelationalOperators();
  16875. menu_final += "</div></div>";
  16876. } else {
  16877. menu_final += getRelationalOperators();
  16878. }
  16879. }
  16880. menu_final += "</div></div>";
  16881. menu_final = $(menu_final);
  16882. var div_temp = $('<div class="single_element_expression ghost_element mouse_distance"></div>');
  16883. div_temp.append(menu_final);
  16884. var div_higher = $('<div class="higher_element"></div>');
  16885. div_higher.append(div_temp);
  16886. div_to_render.append(div_higher);
  16887. menu_final.dropdown("set selected", _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.minus);
  16888. div_temp.on("click", function () {
  16889. if (!window.open_or_close) {
  16890. var sera = position;
  16891. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
  16892. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.minus));
  16893. } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic) >= 0) {
  16894. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.LOGIC_COMPARISON.equals_to));
  16895. } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional) >= 0) {
  16896. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_COMPARISON.greater_than));
  16897. }
  16898. renderExpression(command, function_obj, div_to_render, expression_array);
  16899. }
  16900. });
  16901. }
  16902. function renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, position) {
  16903. var is_last = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
  16904. var menu_final = '<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
  16905. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
  16906. if (types_included.length > 1) {
  16907. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_arithmetic_expression") + '<div class="menu">';
  16908. menu_final += getArithmeticOperators();
  16909. menu_final += "</div></div>";
  16910. } else {
  16911. menu_final += getArithmeticOperators();
  16912. }
  16913. }
  16914. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic) >= 0) {
  16915. if (types_included.length > 1) {
  16916. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_logic_expression") + '<div class="menu">';
  16917. menu_final += getLogicOperators();
  16918. menu_final += "</div></div>";
  16919. } else {
  16920. menu_final += getLogicOperators();
  16921. }
  16922. }
  16923. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional) >= 0) {
  16924. if (types_included.length > 1) {
  16925. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_relational_expression") + '<div class="menu">';
  16926. menu_final += getRelationalOperators();
  16927. menu_final += "</div></div>";
  16928. } else {
  16929. menu_final += getRelationalOperators();
  16930. }
  16931. }
  16932. menu_final += "</div></div>";
  16933. menu_final = $(menu_final);
  16934. var div_temp = $('<div class="simple_add mouse_distance"></div>');
  16935. var div_higher = $('<div class="higher_element"></div>');
  16936. var button = $('<button class="ui button green add_expression"><i class="plus circle inverted icon"></i></button>');
  16937. div_temp.append(button);
  16938. if (!is_last) {
  16939. div_higher.append(div_temp);
  16940. div_to_render.append(div_higher); //div_temp.append(menu_final);
  16941. div_temp.css("opacity", "0", "!important");
  16942. } else {
  16943. div_temp.removeClass("mouse_distance");
  16944. div_temp.css("opacity", "1", "!important"); //div_temp.append(menu_final);
  16945. div_to_render.append(div_temp);
  16946. }
  16947. menu_final.dropdown("set selected", _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.plus);
  16948. div_temp.on("click", function () {
  16949. var sera = position;
  16950. if (expression_array[sera] == ")" && expression_array[sera - 1] == "(") {
  16951. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16952. renderExpression(command, function_obj, div_to_render, expression_array);
  16953. return;
  16954. }
  16955. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
  16956. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.plus));
  16957. expression_array.splice(sera + 1, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16958. } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic) >= 0) {
  16959. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.LOGIC_COMPARISON.equals_to));
  16960. expression_array.splice(sera + 1, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16961. } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional) >= 0) {
  16962. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_COMPARISON.greater_than));
  16963. expression_array.splice(sera + 1, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16964. }
  16965. renderExpression(command, function_obj, div_to_render, expression_array);
  16966. });
  16967. }
  16968. function renderOperatorMenu(command, function_obj, div_to_render, expression_element, types_included, position, expression_array) {
  16969. var menu_final = '<div class="ui dropdown"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
  16970. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.write_sep) >= 0) {
  16971. menu_final += getSeparator();
  16972. }
  16973. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
  16974. if (types_included.length > 1) {
  16975. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_arithmetic_expression") + '<div class="menu">';
  16976. menu_final += getArithmeticOperators();
  16977. menu_final += "</div></div>";
  16978. } else {
  16979. menu_final += getArithmeticOperators();
  16980. }
  16981. }
  16982. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic) >= 0) {
  16983. if (types_included.length > 1) {
  16984. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_logic_expression") + '<div class="menu">';
  16985. menu_final += getLogicOperators();
  16986. menu_final += "</div></div>";
  16987. } else {
  16988. menu_final += getLogicOperators();
  16989. }
  16990. }
  16991. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional) >= 0) {
  16992. if (types_included.length > 1) {
  16993. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_relational_expression") + '<div class="menu">';
  16994. menu_final += getRelationalOperators();
  16995. menu_final += "</div></div>";
  16996. } else {
  16997. menu_final += getRelationalOperators();
  16998. }
  16999. }
  17000. menu_final += "</div></div>";
  17001. menu_final = $(menu_final);
  17002. menu_final.find(".ivprog-write-sep").popup({
  17003. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("write_seprator_menu_tooltip"),
  17004. delay: {
  17005. show: 500,
  17006. hide: 0
  17007. }
  17008. });
  17009. var div_temp = $('<div class="single_element_expression not_allowed" data-index="' + position + '"></div>');
  17010. div_temp.append(menu_final);
  17011. div_to_render.append(div_temp);
  17012. menu_final.dropdown({
  17013. onChange: function onChange(_value, _text, $selectedItem) {
  17014. expression_element.item = $selectedItem.data("value");
  17015. expression_element.type_op = $selectedItem.data("type");
  17016. }
  17017. });
  17018. menu_final.dropdown("set selected", expression_element.item);
  17019. }
  17020. function getArithmeticOperators() {
  17021. var arithmetic_operators;
  17022. arithmetic_operators = '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.plus + '">+</div>';
  17023. arithmetic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.minus + '">-</div>';
  17024. arithmetic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.multiplication + '">*</div>';
  17025. arithmetic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.division + '">/</div>';
  17026. arithmetic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.module + '">%</div>';
  17027. return arithmetic_operators;
  17028. }
  17029. function getLogicOperators() {
  17030. var logic_operators;
  17031. logic_operators = '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.LOGIC_COMPARISON.equals_to + '">==</div>';
  17032. logic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.LOGIC_COMPARISON.not_equals_to + '">!=</div>';
  17033. logic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.LOGIC_COMPARISON.and + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("logic_operator_and") + "</div>";
  17034. logic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.LOGIC_COMPARISON.or + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("logic_operator_or") + "</div>";
  17035. logic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.LOGIC_COMPARISON.not + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("logic_operator_not") + "</div>";
  17036. return logic_operators;
  17037. }
  17038. function getRelationalOperators() {
  17039. var relational_operators;
  17040. relational_operators = '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_COMPARISON.greater_than + '">></div>';
  17041. relational_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_COMPARISON.less_than + '"><</div>';
  17042. relational_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_COMPARISON.equals_to + '">==</div>';
  17043. relational_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_COMPARISON.not_equals_to + '">!=</div>';
  17044. relational_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_COMPARISON.greater_than_or_equals_to + '">>=</div>';
  17045. relational_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_COMPARISON.less_than_or_equals_to + '"><=</div>';
  17046. return relational_operators;
  17047. }
  17048. function getSeparator() {
  17049. return "<div class=\"item ivprog-write-sep\" data-type=\"".concat(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.write_sep, "\" data-value=\"").concat(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.write_sep, "\">").concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("write_seprator_menu_text"), "</div>");
  17050. }
  17051. function getVariable(function_obj, search) {
  17052. if (search == ")" || search == "(") {
  17053. return search;
  17054. }
  17055. if (search.instance == "operator") {
  17056. var obj;
  17057. switch (search.value) {
  17058. case '+':
  17059. obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.plus);
  17060. break;
  17061. case '-':
  17062. obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.minus);
  17063. break;
  17064. case '*':
  17065. obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.multiplication);
  17066. break;
  17067. case '/':
  17068. obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.division);
  17069. break;
  17070. case '%':
  17071. obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.module);
  17072. break;
  17073. case '>':
  17074. obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_COMPARISON.greater_than);
  17075. break;
  17076. case '<':
  17077. obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_COMPARISON.less_than);
  17078. break;
  17079. case '>=':
  17080. obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_COMPARISON.greater_than_or_equals_to);
  17081. break;
  17082. case '<=':
  17083. obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_COMPARISON.less_than_or_equals_to);
  17084. break;
  17085. case '==':
  17086. obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_COMPARISON.equals_to);
  17087. break;
  17088. case '!=':
  17089. obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_COMPARISON.not_equals_to);
  17090. break;
  17091. case 'and':
  17092. obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.LOGIC_COMPARISON.and);
  17093. break;
  17094. case 'or':
  17095. obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.LOGIC_COMPARISON.or);
  17096. break;
  17097. case 'not':
  17098. obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ExpressionOperator(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.LOGIC_COMPARISON.not);
  17099. break;
  17100. }
  17101. return obj;
  17102. }
  17103. if (search.instance == "expression" && search.type == "const") {
  17104. if (search.value === true) {
  17105. var obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('logic_value_true'), null, null, true);
  17106. return obj;
  17107. }
  17108. if (search.value === false) {
  17109. var obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('logic_value_false'), null, null, true);
  17110. return obj;
  17111. }
  17112. var obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, search.value, null, null, true);
  17113. return obj;
  17114. }
  17115. var variavel = null;
  17116. if (search.instance == "expression" && search.type == "var") {
  17117. // 1. Procurar a variável na função:
  17118. for (var j = 0; j < function_obj.variables_list.length; j++) {
  17119. if (function_obj.variables_list[j].name == search.value) {
  17120. variavel = function_obj.variables_list[j];
  17121. break;
  17122. }
  17123. } // 2. Procurar a variável nas gloais:
  17124. if (!variavel) for (var j = 0; j < program_obj.globals.length; j++) {
  17125. if (program_obj.globals[j].name == search.value) {
  17126. variavel = program_obj.globals[j];
  17127. break;
  17128. }
  17129. } // 3. Procurar na lista de parâmetros:
  17130. if (!variavel) for (var j = 0; j < function_obj.parameters_list.length; j++) {
  17131. if (function_obj.parameters_list[j].name == search.value) {
  17132. variavel = function_obj.parameters_list[j];
  17133. break;
  17134. }
  17135. }
  17136. }
  17137. if (search.instance == "expression" && search.type == "var" && !search.line) {
  17138. var obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, variavel, null, null, true);
  17139. return obj;
  17140. }
  17141. if (search.instance == "expression" && search.type == "var" && search["class"] == "vector") {
  17142. var obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, variavel, null, getVariable(function_obj, search.line[0]), true);
  17143. return obj;
  17144. }
  17145. if (search.instance == "expression" && search.type == "var" && search["class"] == "matrix") {
  17146. var obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, variavel, getVariable(function_obj, search.line[0]), getVariable(function_obj, search.column[0]), true);
  17147. return obj;
  17148. }
  17149. if (search.instance == "expression" && search.type == "function") {
  17150. var obj = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, variavel, null, null, true); // Procurar a função para referência:
  17151. for (var i = 0; i < program_obj.functions.length; i++) {
  17152. if (program_obj.functions[i].name == search.value) {
  17153. obj.function_called = program_obj.functions[i];
  17154. }
  17155. } // Se ainda não foi encontrada, procurar na biblioteca do iVProg:
  17156. if (!obj.function_called) {
  17157. for (var i = 0; i < window.system_functions.length; i++) {
  17158. if (search.value.split(".")[1] && search.value.split(".")[1] == window.system_functions[i].identifier) {
  17159. obj.function_called = window.system_functions[i];
  17160. } else if (search.value == window.system_functions[i].identifier) {
  17161. obj.function_called = window.system_functions[i];
  17162. }
  17163. }
  17164. }
  17165. obj.parameters_list = [];
  17166. for (var i = 0; i < search.params.length; i++) {
  17167. obj.parameters_list.push(getVariable(function_obj, search.params[i][0]));
  17168. }
  17169. return obj;
  17170. }
  17171. }
  17172. function expressionParserToVisual(text, function_obj, input_field) {
  17173. if (text.trim().length == 0) {
  17174. return [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, null, null, null, true)];
  17175. }
  17176. var var_not_found = [];
  17177. var fun_not_found = [];
  17178. var parsed;
  17179. try {
  17180. parsed = ivprogCore.parseExpression(text);
  17181. } catch (ex) {
  17182. _utils__WEBPACK_IMPORTED_MODULE_7__.renderErrorMessage(input_field, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('expression_invalid'));
  17183. }
  17184. if (!parsed) return null;
  17185. for (var i = 0; i < parsed.length; i++) {
  17186. var variavel = null;
  17187. if (parsed[i].instance == "expression" && parsed[i].type == "var") {
  17188. // 1. Procurar a variável na função:
  17189. for (var j = 0; j < function_obj.variables_list.length; j++) {
  17190. if (function_obj.variables_list[j].name == parsed[i].value) {
  17191. variavel = function_obj.variables_list[j];
  17192. break;
  17193. }
  17194. } // 2. Procurar a variável nas globais:
  17195. if (!variavel) for (var j = 0; j < program_obj.globals.length; j++) {
  17196. if (program_obj.globals[j].name == parsed[i].value) {
  17197. variavel = program_obj.globals[j];
  17198. break;
  17199. }
  17200. } // 3. Procurar a variável nos parâmetros:
  17201. if (!variavel) for (var j = 0; j < function_obj.parameters_list.length; j++) {
  17202. if (function_obj.parameters_list[j].name == parsed[i].value) {
  17203. variavel = function_obj.parameters_list[j];
  17204. break;
  17205. }
  17206. }
  17207. if (!variavel) var_not_found.push(parsed[i].value);
  17208. }
  17209. var funcao;
  17210. if (parsed[i].instance == "expression" && parsed[i].type == "function") {
  17211. // Procurar a função para referência:
  17212. for (var j = 0; j < program_obj.functions.length; j++) {
  17213. if (program_obj.functions[j].name == parsed[i].value) {
  17214. funcao = program_obj.functions[j];
  17215. }
  17216. } // Se ainda não encontrou, procurar na biblioteca do iVProg:
  17217. if (!funcao) {
  17218. for (var j = 0; j < window.system_functions.length; j++) {
  17219. if (parsed[i].value.split(".")[1] && parsed[i].value.split(".")[1] == window.system_functions[j].identifier) {
  17220. funcao = window.system_functions[j];
  17221. } else if (parsed[i].value == window.system_functions[j].identifier) {
  17222. funcao = window.system_functions[j];
  17223. }
  17224. }
  17225. }
  17226. if (!funcao) {
  17227. fun_not_found.push(parsed[i].value);
  17228. }
  17229. }
  17230. }
  17231. if (fun_not_found.length > 0) {
  17232. var uniqueWords = _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(new Set(fun_not_found));
  17233. _utils__WEBPACK_IMPORTED_MODULE_7__.renderErrorMessage(input_field, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('expression_undeclared_function') + " " + uniqueWords.join(", "));
  17234. return null;
  17235. }
  17236. if (var_not_found.length > 0) {
  17237. var _uniqueWords = _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(new Set(var_not_found));
  17238. _utils__WEBPACK_IMPORTED_MODULE_7__.renderErrorMessage(input_field, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('expression_undelcared_variable') + " " + _uniqueWords.join(", "));
  17239. return null;
  17240. }
  17241. var exp_obj = [];
  17242. for (var i = 0; i < parsed.length; i++) {
  17243. exp_obj.push(getVariable(function_obj, parsed[i]));
  17244. }
  17245. return exp_obj;
  17246. }
  17247. function searchFunction(function_name) {
  17248. for (var j = 0; j < program_obj.functions.length; j++) {
  17249. if (program_obj.functions[j].name == function_name) {
  17250. return program_obj.functions[j];
  17251. }
  17252. } // Se ainda não encontrou, procurar na biblioteca do iVProg:
  17253. for (var j = 0; j < window.system_functions.length; j++) {
  17254. if (function_name.split(".")[1] && function_name.split(".")[1] == window.system_functions[j].identifier) {
  17255. return window.system_functions[j];
  17256. } else if (function_name == window.system_functions[j].identifier) {
  17257. return window.system_functions[j];
  17258. }
  17259. }
  17260. }
  17261. function expressionParserCodeVisual(parsed, function_obj) {
  17262. if (!parsed) return null;
  17263. var var_not_found = [];
  17264. var fun_not_found = [];
  17265. for (var i = 0; i < parsed.length; i++) {
  17266. var variavel = null;
  17267. if (parsed[i].instance == "expression" && parsed[i].type == "var") {
  17268. // 1. Procurar a variável na função:
  17269. for (var j = 0; j < function_obj.variables_list.length; j++) {
  17270. if (function_obj.variables_list[j].name == parsed[i].value) {
  17271. variavel = function_obj.variables_list[j];
  17272. break;
  17273. }
  17274. } // 2. Procurar a variável nas globais:
  17275. if (!variavel) for (var j = 0; j < program_obj.globals.length; j++) {
  17276. if (program_obj.globals[j].name == parsed[i].value) {
  17277. variavel = program_obj.globals[j];
  17278. break;
  17279. }
  17280. } // 3. Procurar a variável nos parâmetros:
  17281. if (!variavel) for (var j = 0; j < function_obj.parameters_list.length; j++) {
  17282. if (function_obj.parameters_list[j].name == parsed[i].value) {
  17283. variavel = function_obj.parameters_list[j];
  17284. break;
  17285. }
  17286. }
  17287. if (!variavel) var_not_found.push(parsed[i].value);
  17288. }
  17289. var funcao;
  17290. if (parsed[i].instance == "expression" && parsed[i].type == "function") {
  17291. // Procurar a função para referência:
  17292. for (var j = 0; j < program_obj.functions.length; j++) {
  17293. if (program_obj.functions[j].name == parsed[i].value) {
  17294. funcao = program_obj.functions[j];
  17295. }
  17296. } // Se ainda não encontrou, procurar na biblioteca do iVProg:
  17297. if (!funcao) {
  17298. for (var j = 0; j < window.system_functions.length; j++) {
  17299. if (parsed[i].value.split(".")[1] && parsed[i].value.split(".")[1] == window.system_functions[j].identifier) {
  17300. funcao = window.system_functions[j];
  17301. } else if (parsed[i].value == window.system_functions[j].identifier) {
  17302. funcao = window.system_functions[j];
  17303. }
  17304. }
  17305. }
  17306. if (!funcao) {
  17307. fun_not_found.push(parsed[i].value);
  17308. }
  17309. }
  17310. }
  17311. var exp_obj = [];
  17312. for (var i = 0; i < parsed.length; i++) {
  17313. exp_obj.push(getVariable(function_obj, parsed[i]));
  17314. }
  17315. return exp_obj;
  17316. }
  17317. /***/ }),
  17318. /***/ "./js/visualUI/commands/iftrue.js":
  17319. /*!****************************************!*\
  17320. !*** ./js/visualUI/commands/iftrue.js ***!
  17321. \****************************************/
  17322. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17323. "use strict";
  17324. __webpack_require__.r(__webpack_exports__);
  17325. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17326. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  17327. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  17328. /* harmony export */ });
  17329. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17330. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17331. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  17332. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
  17333. function createFloatingCommand() {
  17334. return $('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  17335. }
  17336. function renderCommand(command, function_obj) {
  17337. var ret = '';
  17338. ret += '<div class="ui iftrue command_container"><div class="ui data_block_if" data-if="true"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i> <button class="ui icon button minimize_block_button tiny"><i class="icon window minimize"></i></button>';
  17339. ret += '<span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_if') + '</span>';
  17340. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="textual_expression"></span> <span class="span_command_spec"> ) </span> ';
  17341. ret += ' <i class="ui icon i cursor button_write_expression" style="margin-right: 1rem !important;"></i> ';
  17342. ret += '<i class="ui icon unlock button_alternate_expression"></i>';
  17343. ret += '<span> </span> ';
  17344. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  17345. ret += '</div></div>';
  17346. ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_else') + ' </span>';
  17347. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  17348. ret += '</div>';
  17349. ret += '<span></span></div>';
  17350. ret += '</div>';
  17351. var el = $(ret);
  17352. el.data('command', command);
  17353. el.find('.block_commands').data('command', command);
  17354. el.find('.data_block_if').data('command', command);
  17355. el.find('.data_block_else').data('command', command);
  17356. el.find('.commands_if').data('command', command);
  17357. addHandlers(command, function_obj, el); //ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17358. _generic_expression__WEBPACK_IMPORTED_MODULE_2__.renderExpression(command, function_obj, el.find('.conditional_expression'), command.expression);
  17359. if (command.commands_block) {
  17360. for (var j = 0; j < command.commands_block.length; j++) {
  17361. _commands__WEBPACK_IMPORTED_MODULE_1__.renderCommand(command.commands_block[j], $(el.find('.commands_if')[0]), 3, function_obj);
  17362. }
  17363. }
  17364. if (command.commands_else) {
  17365. for (var j = 0; j < command.commands_else.length; j++) {
  17366. _commands__WEBPACK_IMPORTED_MODULE_1__.renderCommand(command.commands_else[j], $(el.find('.commands_else')[0]), 3, function_obj);
  17367. }
  17368. }
  17369. if (command.collapsed) {
  17370. el.children('.data_block_else').toggle();
  17371. $(el.find('.block_commands')[0]).toggle();
  17372. }
  17373. if (command.lockexpression) {
  17374. if (command.expression) {
  17375. try {
  17376. var text = _code_generator__WEBPACK_IMPORTED_MODULE_3__.elementExpressionCode(command.expression);
  17377. if (text) {
  17378. $(el.find('.conditional_expression')[0]).toggle();
  17379. $(el.find('.textual_expression')[0]).text(text);
  17380. $(el.find('.textual_expression')[0]).toggle();
  17381. $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
  17382. }
  17383. } catch (e) {
  17384. command.lockexpression = false;
  17385. }
  17386. }
  17387. }
  17388. el.find('.unlock').popup({
  17389. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
  17390. delay: {
  17391. show: 750,
  17392. hide: 0
  17393. }
  17394. });
  17395. el.find('.lock').popup({
  17396. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
  17397. delay: {
  17398. show: 750,
  17399. hide: 0
  17400. }
  17401. });
  17402. el.find('.button_write_expression').popup({
  17403. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression"),
  17404. delay: {
  17405. show: 750,
  17406. hide: 0
  17407. }
  17408. });
  17409. return el;
  17410. }
  17411. function addHandlers(command, function_obj, iftrue_dom) {
  17412. iftrue_dom.find('.button_write_expression').on('click', function () {
  17413. window.expressionEdition = true;
  17414. window.inputExpression = null;
  17415. var afterWhichElement;
  17416. var lockButton = $(iftrue_dom.find('.button_alternate_expression')[0]);
  17417. var editButton = $(this);
  17418. afterWhichElement = $(iftrue_dom.find('.conditional_expression')[0]);
  17419. if (command.lockexpression) {
  17420. afterWhichElement = $(iftrue_dom.find('.textual_expression')[0]);
  17421. }
  17422. var text = "";
  17423. if (command.expression) {
  17424. if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
  17425. text = "";
  17426. } else {
  17427. try {
  17428. text = _code_generator__WEBPACK_IMPORTED_MODULE_3__.elementExpressionCode(command.expression);
  17429. } catch (ex) {
  17430. text = "";
  17431. }
  17432. }
  17433. }
  17434. var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
  17435. var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
  17436. var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
  17437. input.val(text);
  17438. input.focusout(function (evt) {
  17439. ok_button.click();
  17440. evt.preventDefault();
  17441. return true;
  17442. });
  17443. input.keyup(function (evt) {
  17444. if (evt.keyCode == 27) {
  17445. // esc
  17446. cancel_button.click();
  17447. }
  17448. if (evt.keyCode == 13) {
  17449. // enter
  17450. ok_button.click();
  17451. }
  17452. });
  17453. ok_button.click(function () {
  17454. var parsed = null;
  17455. parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_2__.expressionParserToVisual(input.val(), function_obj, input);
  17456. if (parsed) {
  17457. window.expressionEdition = false;
  17458. command.expression = parsed;
  17459. renderAlgorithm();
  17460. }
  17461. });
  17462. cancel_button.mousedown(function (evt) {
  17463. var parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_2__.expressionParserToVisual(text, function_obj, input);
  17464. if (parsed) {
  17465. window.expressionEdition = false;
  17466. command.expression = parsed;
  17467. renderAlgorithm();
  17468. }
  17469. });
  17470. input.insertAfter(afterWhichElement);
  17471. input.focus();
  17472. cancel_button.insertAfter(input);
  17473. ok_button.insertAfter(input);
  17474. var len = text.length;
  17475. input[0].setSelectionRange(len, len);
  17476. afterWhichElement.css('display', 'none');
  17477. lockButton.css('display', 'none');
  17478. editButton.css('display', 'none');
  17479. ok_button.popup({
  17480. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_confirm"),
  17481. delay: {
  17482. show: 750,
  17483. hide: 0
  17484. }
  17485. });
  17486. cancel_button.popup({
  17487. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_cancel"),
  17488. delay: {
  17489. show: 750,
  17490. hide: 0
  17491. }
  17492. });
  17493. });
  17494. $(iftrue_dom.find('.textual_expression')[0]).toggle();
  17495. iftrue_dom.find('.button_alternate_expression').on('click', function () {
  17496. if (command.expression) {
  17497. var text = _code_generator__WEBPACK_IMPORTED_MODULE_3__.elementExpressionCode(command.expression);
  17498. if (text) {
  17499. $(iftrue_dom.find('.conditional_expression')[0]).toggle();
  17500. $(iftrue_dom.find('.textual_expression')[0]).text(text);
  17501. $(iftrue_dom.find('.textual_expression')[0]).toggle();
  17502. $(this).toggleClass('unlock').toggleClass('lock');
  17503. command.lockexpression = !command.lockexpression;
  17504. }
  17505. }
  17506. if (command.lockexpression) {
  17507. iftrue_dom.find('.lock').popup({
  17508. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
  17509. delay: {
  17510. show: 750,
  17511. hide: 0
  17512. }
  17513. });
  17514. } else {
  17515. iftrue_dom.find('.unlock').popup({
  17516. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
  17517. delay: {
  17518. show: 750,
  17519. hide: 0
  17520. }
  17521. });
  17522. }
  17523. });
  17524. iftrue_dom.find('.button_remove_command').on('click', function () {
  17525. if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, iftrue_dom)) {
  17526. iftrue_dom.fadeOut(400, function () {
  17527. iftrue_dom.remove();
  17528. });
  17529. }
  17530. });
  17531. iftrue_dom.find('.minimize_block_button').on('click', function () {
  17532. iftrue_dom.children('.data_block_else').toggle();
  17533. $(iftrue_dom.find('.block_commands')[0]).toggle();
  17534. command.collapsed = !command.collapsed;
  17535. });
  17536. }
  17537. /***/ }),
  17538. /***/ "./js/visualUI/commands/reader.js":
  17539. /*!****************************************!*\
  17540. !*** ./js/visualUI/commands/reader.js ***!
  17541. \****************************************/
  17542. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17543. "use strict";
  17544. __webpack_require__.r(__webpack_exports__);
  17545. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17546. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  17547. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  17548. /* harmony export */ });
  17549. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17550. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17551. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17552. function createFloatingCommand() {
  17553. return $('<div class="ui reader created_element"> <i class="ui icon small download"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_command_read') + ' var </span></div>');
  17554. }
  17555. function renderCommand(command, function_obj) {
  17556. var el = '<div class="ui reader command_container"> <i class="ui icon small download command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_command_read') + ' ( </span> <div class="var_value_menu_div"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  17557. el = $(el);
  17558. el.data('command', command);
  17559. _variable_value_menu__WEBPACK_IMPORTED_MODULE_1__.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17560. addHandlers(command, function_obj, el);
  17561. return el;
  17562. }
  17563. function addHandlers(command, function_obj, reader_dom) {
  17564. reader_dom.find('.button_remove_command').on('click', function () {
  17565. if (_commands__WEBPACK_IMPORTED_MODULE_2__.removeCommand(command, function_obj, reader_dom)) {
  17566. reader_dom.fadeOut(400, function () {
  17567. reader_dom.remove();
  17568. });
  17569. }
  17570. });
  17571. }
  17572. /***/ }),
  17573. /***/ "./js/visualUI/commands/repeatNtimes.js":
  17574. /*!**********************************************!*\
  17575. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  17576. \**********************************************/
  17577. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17578. "use strict";
  17579. __webpack_require__.r(__webpack_exports__);
  17580. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17581. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  17582. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand),
  17583. /* harmony export */ "manageExpressionElements": () => (/* binding */ manageExpressionElements),
  17584. /* harmony export */ "manageClearExpressionElements": () => (/* binding */ manageClearExpressionElements)
  17585. /* harmony export */ });
  17586. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17587. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17588. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17589. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17590. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17591. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17592. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  17593. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
  17594. function createFloatingCommand() {
  17595. return $('<div class="ui repeatNtimes created_element"> <i class="ui icon small sync"></i> <span> repita_para i de 0 ate 10 passo 1 <br> </span></div>');
  17596. }
  17597. function renderCommand(command, function_obj) {
  17598. var ret = "<div class=\"ui repeatNtimes command_container\"> \n\t\t<i class=\"ui icon small sync command_drag\"></i>\n\t\t<i class=\"ui icon times red button_remove_command\"></i>\n\t\t<button class=\"ui icon button minimize_block_button tiny\"><i class=\"icon window minimize\"></i></button>\n\t\t<span class=\"span_command_spec\"> ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_for'), "\n\t\t</span> <div class=\"ui attribution_expression\">\n\t\t<div class=\"ui variable_attribution\"></div>\n\t\t<span class=\"text_receives span_command_spec\" style=\"margin-left: 10px;margin-right: 20px;\"></span>\n\t\t<div class=\"ui var_value_expression div_expression_st\"></div>\n\t\t</div>\n\t\t<span class=\"span_command_spec separator_character\" style=\"margin-left: 25px; margin-right: 15px;\">\n\t\t").concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_for_to"), " </span>\n\t\t<div class=\"conditional_expression\"></div> <div class=\"pass_button\"></div> \n\t\t<div class=\"ui incrementation_field\"><span class=\"text_inc_receives span_command_spec\"></span>\n\t\t<div class=\"ui first_operand\"></div><div class=\"ui operator\"></div>\n\t\t<div class=\"ui second_operand\"></div></div> <span class=\"span_command_spec\"> </span>\n\t\t<span class=\"textual_expression\"></span> <i class=\"ui icon unlock button_alternate_expression\"></i>\n\t\t<div class=\"ui context_menu\"></div>");
  17599. ret += '<div class="ui block_commands">';
  17600. ret += '</div>';
  17601. ret += '<span> </span>';
  17602. ret += '</div>';
  17603. var el = $(ret);
  17604. el.data('command', command);
  17605. el.find('.block_commands').data('command', command);
  17606. addHandlers(command, function_obj, el);
  17607. _contextualized_menu__WEBPACK_IMPORTED_MODULE_5__.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17608. _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.var_attribution, el.find('.variable_attribution'), function_obj); //ConditionalExpressionManagement.renderExpression(command, command.expression2, function_obj, el.find('.conditional_expression'));
  17609. _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression2, el.find('.conditional_expression'), function_obj); //GenericExpressionManagement.renderExpression(command, function_obj, el.find('.conditional_expression'), command.expression2);
  17610. //VariableValueMenu.renderMenu(command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  17611. //angle double right
  17612. if (!command.expression1) {
  17613. command.expression1 = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, "0", null, null, true);
  17614. }
  17615. el.find('.text_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_for_from"));
  17616. _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression1, el.find('.var_value_expression'), function_obj);
  17617. if (!command.expression3) {
  17618. el.find('.pass_button').html('<button class="ui">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_for_pass") + '<i class="ui icon angle double right"></i></button>');
  17619. el.find('.pass_button').find('button').on('click', function () {
  17620. togglePasso(command);
  17621. });
  17622. /*var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp,
  17623. [command.var_attribution,
  17624. Models.ARITHMETIC_TYPES.plus,
  17625. new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "1", null, null, true)]);
  17626. command.expression3 = exp;
  17627. command.var_incrementation = command.var_attribution;*/
  17628. } else {
  17629. el.find('.pass_button').html('<button class="ui">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_for_pass") + '<i class="ui icon angle double left"></i></button>');
  17630. el.find('.pass_button').find('button').on('click', function () {
  17631. togglePasso(command);
  17632. });
  17633. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  17634. _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  17635. }
  17636. if (command.commands_block) {
  17637. for (var j = 0; j < command.commands_block.length; j++) {
  17638. _commands__WEBPACK_IMPORTED_MODULE_2__.renderCommand(command.commands_block[j], $(el.find('.block_commands')[0]), 3, function_obj);
  17639. }
  17640. }
  17641. if (command.lockexpression) {
  17642. try {
  17643. var text = _code_generator__WEBPACK_IMPORTED_MODULE_7__.repeatNtimesHeader(command);
  17644. if (text) {
  17645. $(el.find('.textual_expression')[0]).html(text);
  17646. $(el.find('.textual_expression')[0]).toggle();
  17647. $(el.find('.attribution_expression')[0]).toggle();
  17648. $(el.find('.span_command_spec.separator_character')[0]).toggle();
  17649. $(el.find('.conditional_expression')[0]).toggle();
  17650. $(el.find('.pass_button')[0]).toggle();
  17651. $(el.find('.incrementation_field')[0]).toggle();
  17652. $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
  17653. }
  17654. } catch (e) {
  17655. command.lockexpression = false;
  17656. }
  17657. }
  17658. el.find('.unlock').popup({
  17659. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
  17660. delay: {
  17661. show: 750,
  17662. hide: 0
  17663. }
  17664. });
  17665. el.find('.lock').popup({
  17666. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
  17667. delay: {
  17668. show: 750,
  17669. hide: 0
  17670. }
  17671. });
  17672. return el;
  17673. }
  17674. function togglePasso(command) {
  17675. if (!command.expression3) {
  17676. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ExpressionElement(_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp, [command.var_attribution, _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, "1", null, null, true)]);
  17677. command.expression3 = exp;
  17678. command.var_incrementation = command.var_attribution;
  17679. } else {
  17680. command.expression3 = null;
  17681. }
  17682. renderAlgorithm();
  17683. }
  17684. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17685. if (dom_object.hasClass('variable_attribution')) {
  17686. if (!command.expression3) {
  17687. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ExpressionElement(_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp, [command.var_attribution, _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, "1", null, null, true)]);
  17688. command.expression3 = exp;
  17689. command.var_incrementation = command.var_attribution;
  17690. var cond_exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ArithmeticExpression(command.var_attribution, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.less_than);
  17691. command.expression2.expression = cond_exp;
  17692. }
  17693. dom_object.parent().find('.text_receives').text('de');
  17694. command.expression1 = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, "0", null, null, true);
  17695. dom_object.parent().find('.var_value_expression').empty();
  17696. _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  17697. renderAlgorithm();
  17698. }
  17699. if (dom_object.hasClass('incrementation_variable')) {
  17700. dom_object.parent().find('.text_inc_receives').text('de');
  17701. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ExpressionElement(_ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  17702. command.expression3 = exp;
  17703. _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  17704. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  17705. _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  17706. }
  17707. }
  17708. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17709. if (dom_object.hasClass('variable_attribution')) {
  17710. $(dom_object).parent().find('.text_receives').text('');
  17711. command.expression1 = null;
  17712. $(dom_object).parent().find('.var_value_expression').empty();
  17713. }
  17714. if (dom_object.hasClass('incrementation_variable')) {
  17715. $(dom_object).parent().find('.text_inc_receives').text('');
  17716. command.expression3 = null;
  17717. $(dom_object).parent().find('.first_operand').empty();
  17718. $(dom_object).parent().find('.operator').empty();
  17719. $(dom_object).parent().find('.second_operand').empty();
  17720. }
  17721. }
  17722. function addHandlers(command, function_obj, repeatNtimes_dom) {
  17723. repeatNtimes_dom.find('.minimize_block_button').on('click', function (evt) {
  17724. repeatNtimes_dom.children('.ui.block_commands').toggle();
  17725. command.collapsed = !command.collapsed;
  17726. });
  17727. $(repeatNtimes_dom.find('.textual_expression')[0]).toggle();
  17728. repeatNtimes_dom.find('.button_alternate_expression').on('click', function () {
  17729. var text = _code_generator__WEBPACK_IMPORTED_MODULE_7__.repeatNtimesHeader(command);
  17730. if (text) {
  17731. $(repeatNtimes_dom.find('.textual_expression')[0]).html(text);
  17732. $(repeatNtimes_dom.find('.textual_expression')[0]).toggle();
  17733. $(repeatNtimes_dom.find('.attribution_expression')[0]).toggle();
  17734. $(repeatNtimes_dom.find('.span_command_spec.separator_character')[0]).toggle();
  17735. $(repeatNtimes_dom.find('.conditional_expression')[0]).toggle();
  17736. $(repeatNtimes_dom.find('.pass_button')[0]).toggle();
  17737. $(repeatNtimes_dom.find('.incrementation_field')[0]).toggle();
  17738. $(repeatNtimes_dom.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
  17739. command.lockexpression = !command.lockexpression;
  17740. }
  17741. if (command.lockexpression) {
  17742. repeatNtimes_dom.find('.lock').popup({
  17743. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
  17744. delay: {
  17745. show: 750,
  17746. hide: 0
  17747. }
  17748. });
  17749. } else {
  17750. repeatNtimes_dom.find('.unlock').popup({
  17751. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
  17752. delay: {
  17753. show: 750,
  17754. hide: 0
  17755. }
  17756. });
  17757. }
  17758. });
  17759. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  17760. if (_commands__WEBPACK_IMPORTED_MODULE_2__.removeCommand(command, function_obj, repeatNtimes_dom)) {
  17761. repeatNtimes_dom.fadeOut(400, function () {
  17762. repeatNtimes_dom.remove();
  17763. });
  17764. }
  17765. });
  17766. }
  17767. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  17768. var menu_operator = $('<div class="ui dropdown"><div class="text"></div></div>');
  17769. menu_operator.dropdown({
  17770. values: [{
  17771. name: '+',
  17772. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus,
  17773. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus
  17774. }, {
  17775. name: '-',
  17776. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus,
  17777. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus
  17778. }],
  17779. onChange: function onChange(value, text, $selectedItem) {
  17780. expression_element.itens[index_op] = value;
  17781. }
  17782. });
  17783. temp_op.append(menu_operator);
  17784. }
  17785. /***/ }),
  17786. /***/ "./js/visualUI/commands/return.js":
  17787. /*!****************************************!*\
  17788. !*** ./js/visualUI/commands/return.js ***!
  17789. \****************************************/
  17790. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17791. "use strict";
  17792. __webpack_require__.r(__webpack_exports__);
  17793. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17794. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  17795. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  17796. /* harmony export */ });
  17797. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17798. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17799. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17800. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17801. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  17802. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17803. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
  17804. function createFloatingCommand() {
  17805. return $('<div class="ui return created_element"> <i class="ui icon small reply"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_return') + ' </span></div>');
  17806. }
  17807. function renderCommand(command, function_obj) {
  17808. var el = $('<div class="ui return command_container"> <i class="ui icon small reply command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_return') + ' </span> <div class="expression_elements"></div><span class="textual_expression" style="display: none; margin-left: 1rem;"></span></div>');
  17809. el.data('command', command);
  17810. if (function_obj.return_type != _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID) {
  17811. if (!command.variable_value_menu) {
  17812. command.variable_value_menu = [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_5__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true)];
  17813. }
  17814. _generic_expression__WEBPACK_IMPORTED_MODULE_4__.renderExpression(command, function_obj, el.find('.expression_elements'), command.variable_value_menu);
  17815. el.append($('<i class="ui icon unlock button_alternate_expression" style="margin-left: 1rem;"></i>'));
  17816. if (command.lockexpression) {
  17817. if (command.variable_value_menu) {
  17818. try {
  17819. var text = _code_generator__WEBPACK_IMPORTED_MODULE_6__.elementExpressionCode(command.variable_value_menu);
  17820. if (text) {
  17821. $(el.find('.expression_elements')[0]).toggle();
  17822. $(el.find('.textual_expression')[0]).text(text);
  17823. $(el.find('.textual_expression')[0]).toggle();
  17824. $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
  17825. }
  17826. } catch (e) {
  17827. command.lockexpression = false;
  17828. }
  17829. }
  17830. }
  17831. } else {
  17832. el.find('.expression_elements').remove();
  17833. command.variable_value_menu = null;
  17834. }
  17835. addHandlers(command, function_obj, el);
  17836. return el;
  17837. }
  17838. function addHandlers(command, function_obj, return_dom) {
  17839. return_dom.find('.button_alternate_expression').on('click', function () {
  17840. if (command.variable_value_menu) {
  17841. var text = _code_generator__WEBPACK_IMPORTED_MODULE_6__.elementExpressionCode(command.variable_value_menu);
  17842. if (text) {
  17843. $(return_dom.find('.expression_elements')[0]).toggle();
  17844. $(return_dom.find('.textual_expression')[0]).text(text);
  17845. $(return_dom.find('.textual_expression')[0]).toggle();
  17846. $(this).toggleClass('unlock').toggleClass('lock');
  17847. command.lockexpression = !command.lockexpression;
  17848. }
  17849. }
  17850. });
  17851. return_dom.find('.button_remove_command').on('click', function () {
  17852. if (_commands__WEBPACK_IMPORTED_MODULE_3__.removeCommand(command, function_obj, return_dom)) {
  17853. return_dom.fadeOut(400, function () {
  17854. return_dom.remove();
  17855. });
  17856. }
  17857. });
  17858. }
  17859. /***/ }),
  17860. /***/ "./js/visualUI/commands/switch.js":
  17861. /*!****************************************!*\
  17862. !*** ./js/visualUI/commands/switch.js ***!
  17863. \****************************************/
  17864. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17865. "use strict";
  17866. __webpack_require__.r(__webpack_exports__);
  17867. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17868. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  17869. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand),
  17870. /* harmony export */ "renderCase": () => (/* binding */ renderCase)
  17871. /* harmony export */ });
  17872. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17873. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17874. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17875. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17876. function createFloatingCommand() {
  17877. return $('<div class="ui switch created_element"> <i class="ui icon small random"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_code_switch') + ' ( x ) { <br> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_code_case') + ' 1: <br> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_code_case') + ' 2: <br> } </span></div>');
  17878. }
  17879. function renderCommand(command, function_obj) {
  17880. var ret = '';
  17881. ret += '<div class="ui switch command_container"> <i class="ui icon small random command_drag" ></i> <i class="ui icon times red button_remove_command"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_code_switch') + ' ( <div class="ui variable_to_switch"></div> ) <div class="ui context_menu"></div> <div class="ui all_cases_div"></div></span>';
  17882. ret += '</div>';
  17883. var el = $(ret);
  17884. el.data('command', command);
  17885. addHandlers(command, function_obj, el);
  17886. _contextualized_menu__WEBPACK_IMPORTED_MODULE_3__.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17887. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, command.variable, el.find('.variable_to_switch'), function_obj);
  17888. if (command.cases) {
  17889. for (var i = 0; i < command.cases.length; i++) {
  17890. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  17891. }
  17892. }
  17893. return el;
  17894. }
  17895. function renderCase(switchcase, command, function_obj, el) {
  17896. var casediv = $('<div class="ui case_div"><i class="ui icon times red button_remove_command"></i><span>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_code_case') + '</span> <div class="ui variable_case"></div>: <div class="case_commands_block"></div></div>');
  17897. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  17898. casediv.data('switchcase', switchcase);
  17899. casediv.find('.case_commands_block').data('switchcase', switchcase);
  17900. el.append(casediv);
  17901. if (switchcase.commands_block) {
  17902. for (var j = 0; j < switchcase.commands_block.length; j++) {
  17903. _commands__WEBPACK_IMPORTED_MODULE_1__.renderCommand(switchcase.commands_block[j], $(casediv.find('.case_commands_block')[0]), 3, function_obj);
  17904. }
  17905. }
  17906. casediv.find('.button_remove_command').on('click', function () {
  17907. for (var i = 0; i < command.cases.length; i++) {
  17908. if (switchcase == command.cases[i]) {
  17909. delete command.cases[i];
  17910. command.cases.splice(i, 1);
  17911. casediv.remove();
  17912. break;
  17913. }
  17914. }
  17915. });
  17916. }
  17917. function addHandlers(command, function_obj, switch_dom) {
  17918. switch_dom.find('.button_remove_command').on('click', function () {
  17919. if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, switch_dom)) {
  17920. switch_dom.fadeOut(400, function () {
  17921. switch_dom.remove();
  17922. });
  17923. }
  17924. });
  17925. }
  17926. /***/ }),
  17927. /***/ "./js/visualUI/commands/variable_value_menu.js":
  17928. /*!*****************************************************!*\
  17929. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  17930. \*****************************************************/
  17931. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17932. "use strict";
  17933. __webpack_require__.r(__webpack_exports__);
  17934. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17935. /* harmony export */ "VAR_OR_VALUE_TYPES": () => (/* binding */ VAR_OR_VALUE_TYPES),
  17936. /* harmony export */ "renderMenu": () => (/* binding */ renderMenu)
  17937. /* harmony export */ });
  17938. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17939. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17940. /* harmony import */ var _attribution__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  17941. /* harmony import */ var _repeatNtimes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17942. var VAR_OR_VALUE_TYPES = Object.freeze({
  17943. only_variable: 1,
  17944. only_value: 2,
  17945. only_function: 3,
  17946. variable_and_function: 4,
  17947. variable_and_value_opt: 5,
  17948. value_and_function: 6,
  17949. all: 7
  17950. });
  17951. function renderMenu(command, ref_object, dom_object, function_obj) {
  17952. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  17953. var expression_element = arguments.length > 5 ? arguments[5] : undefined;
  17954. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  17955. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  17956. if (ref_object.function_called) {
  17957. if (ref_object.function_called.parameters_list) {
  17958. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  17959. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  17960. ref_object.parameters_list.pop();
  17961. } else {
  17962. ref_object.parameters_list.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17963. }
  17964. }
  17965. }
  17966. } // Verificar agora, quando trata-se de chamada de função, se a passagem de parâmetro é
  17967. // por referência ou por cópia:
  17968. var index_references = [];
  17969. if (ref_object.function_called) {
  17970. if (ref_object.function_called.parameters_list) {
  17971. for (var i = 0; i < ref_object.function_called.parameters_list.length; i++) {
  17972. if (ref_object.function_called.parameters_list[i].reference) {
  17973. index_references.push(i);
  17974. ref_object.parameters_list[i].reference = true;
  17975. ref_object.parameters_list[i].variable_and_value = VAR_OR_VALUE_TYPES.only_variable;
  17976. if (ref_object.parameters_list[i].column) ref_object.parameters_list[i].column.reference_parent = true;
  17977. if (ref_object.parameters_list[i].row) ref_object.parameters_list[i].row.reference_parent = true;
  17978. } else {
  17979. ref_object.parameters_list[i].reference = false;
  17980. ref_object.parameters_list[i].variable_and_value = VAR_OR_VALUE_TYPES.all;
  17981. if (ref_object.parameters_list[i].column) ref_object.parameters_list[i].column.reference_parent = false;
  17982. if (ref_object.parameters_list[i].row) ref_object.parameters_list[i].row.reference_parent = false;
  17983. }
  17984. ref_object.parameters_list[i].reference_dimensions = ref_object.function_called.parameters_list[i].dimensions;
  17985. }
  17986. }
  17987. }
  17988. var menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17989. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  17990. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_vars">';
  17991. menu_var_or_value += "</div>";
  17992. }
  17993. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_value_opt || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all) {
  17994. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("variable");
  17995. menu_var_or_value += '<div class="menu menu_only_vars">';
  17996. menu_var_or_value += "</div></div>";
  17997. }
  17998. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  17999. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  18000. }
  18001. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_value_opt || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.value_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all) {
  18002. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_value") + "</div>";
  18003. }
  18004. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  18005. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_functions">';
  18006. menu_var_or_value += "</div>";
  18007. }
  18008. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.value_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all) {
  18009. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_function");
  18010. menu_var_or_value += '<div class="menu menu_only_functions">';
  18011. menu_var_or_value += "</div></div>";
  18012. /* if (command.type == Models.COMMAND_TYPES.attribution) {
  18013. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18014. menu_var_or_value += '<div class="menu">';
  18015. menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18016. menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18017. menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18018. menu_var_or_value += '</div></div>';
  18019. }*/
  18020. }
  18021. menu_var_or_value += "</div></div>";
  18022. menu_var_or_value = $(menu_var_or_value);
  18023. menu_var_or_value.find('.width-dynamic').on('input', function () {
  18024. var input_field = $(this);
  18025. var inputWidth = input_field.textWidth() + 10;
  18026. inputWidth = inputWidth < 50 ? 50 : inputWidth;
  18027. input_field.css({
  18028. width: inputWidth
  18029. });
  18030. }).trigger('input');
  18031. dom_object.append(menu_var_or_value);
  18032. ref_object.dom_object = menu_var_or_value;
  18033. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18034. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  18035. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  18036. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  18037. if (ref_object.content || ref_object.function_called) {
  18038. if (ref_object.content) {
  18039. // Verificar se a variável ainda existe:
  18040. var variable_fun = isVarInProgram(ref_object.content, function_obj);
  18041. if (variable_fun) {
  18042. ref_object.content = variable_fun;
  18043. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18044. } else {
  18045. if (ref_object.content && ref_object.content.type) {
  18046. ref_object.content = null;
  18047. appendSelectText(ref_object, menu_var_or_value);
  18048. } else {
  18049. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18050. }
  18051. }
  18052. } else if (ref_object.function_called) {
  18053. // Verificar se a função ainda existe:
  18054. var ret_function = isFunctionInProgram(ref_object.function_called);
  18055. if (ret_function) {
  18056. ref_object.function_called = ret_function;
  18057. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18058. } else {
  18059. ref_object.content = null;
  18060. ref_object.row = null;
  18061. ref_object.column = null;
  18062. delete ref_object.function_called;
  18063. delete ref_object.parameters_list;
  18064. appendSelectText(ref_object, menu_var_or_value);
  18065. }
  18066. }
  18067. } else {
  18068. appendSelectText(ref_object, menu_var_or_value);
  18069. }
  18070. }
  18071. function appendSelectText(ref_object, menu_var_or_value) {
  18072. // if (ref_object.reference_parent) {
  18073. // menu_var_or_value
  18074. // .find(".text")
  18075. // .append("<i>Opcional</i>");
  18076. // return;
  18077. // }
  18078. switch (ref_object.variable_and_value) {
  18079. case VAR_OR_VALUE_TYPES.only_variable:
  18080. menu_var_or_value.find(".text").append("<i>" + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("var_menu_select_var") + "</i>");
  18081. break;
  18082. case VAR_OR_VALUE_TYPES.all:
  18083. menu_var_or_value.find(".text").append("<i>" + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("var_menu_select_all") + "</i>");
  18084. break;
  18085. case VAR_OR_VALUE_TYPES.variable_and_function:
  18086. menu_var_or_value.find(".text").append("<i>" + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("var_menu_select_all") + "</i>");
  18087. break;
  18088. case VAR_OR_VALUE_TYPES.only_function:
  18089. menu_var_or_value.find(".text").append("<i>" + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("var_menu_select_function") + "</i>");
  18090. break;
  18091. }
  18092. }
  18093. function isFunctionInProgram(function_called_obj) {
  18094. if (function_called_obj.name) {
  18095. if (window.program_obj.functions) {
  18096. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18097. if (window.program_obj.functions[i] == function_called_obj) {
  18098. return window.program_obj.functions[i];
  18099. }
  18100. }
  18101. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18102. if (window.program_obj.functions[i].name == function_called_obj.name) {
  18103. return window.program_obj.functions[i];
  18104. }
  18105. }
  18106. }
  18107. } else if (function_called_obj.identifier) {
  18108. for (var i = 0; i < window.system_functions.length; i++) {
  18109. if (window.system_functions[i].identifier == function_called_obj.identifier) {
  18110. return window.system_functions[i];
  18111. }
  18112. }
  18113. }
  18114. return null;
  18115. }
  18116. function isVarInProgram(var_obj, function_obj) {
  18117. // Verify in locals:
  18118. if (function_obj.variables_list) {
  18119. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18120. if (function_obj.variables_list[i] == var_obj) {
  18121. return function_obj.variables_list[i];
  18122. }
  18123. }
  18124. } // Verify in parameters:
  18125. if (function_obj.parameters_list) {
  18126. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18127. if (function_obj.parameters_list[i] == var_obj) {
  18128. return function_obj.parameters_list[i];
  18129. }
  18130. }
  18131. } // Verify in globals:
  18132. if (window.program_obj.globals) {
  18133. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18134. if (window.program_obj.globals[i] == var_obj) {
  18135. return window.program_obj.globals[i];
  18136. }
  18137. }
  18138. } // If not found, verify if the reference was lost
  18139. if (var_obj) {
  18140. if (function_obj.variables_list) {
  18141. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18142. if (function_obj.variables_list[i].name == var_obj.name) {
  18143. return function_obj.variables_list[i];
  18144. }
  18145. }
  18146. }
  18147. if (function_obj.parameters_list) {
  18148. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18149. if (function_obj.parameters_list[i].name == var_obj.name) {
  18150. return function_obj.parameters_list[i];
  18151. }
  18152. }
  18153. }
  18154. if (window.program_obj.globals) {
  18155. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18156. if (window.program_obj.globals[i].name == var_obj.name) {
  18157. return window.program_obj.globals[i];
  18158. }
  18159. }
  18160. }
  18161. }
  18162. return null;
  18163. }
  18164. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  18165. if (ref_object.function_called) {
  18166. menu_var_or_value.remove();
  18167. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18168. } else if (ref_object.content.type) {
  18169. menu_var_or_value.remove();
  18170. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18171. } else {
  18172. menu_var_or_value.remove();
  18173. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18174. }
  18175. }
  18176. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  18177. if (variable_obj.content || variable_obj.function_called) {
  18178. // Verificar se a variável ainda existe:
  18179. var var_fun = isVarInProgram(variable_obj.content, function_obj);
  18180. if (var_fun) {
  18181. variable_obj.content = var_fun;
  18182. } else {
  18183. if (variable_obj.content && variable_obj.content.type) {
  18184. variable_obj.content = null;
  18185. appendSelectText(variable_obj, menu_var_or_value);
  18186. }
  18187. }
  18188. } else {
  18189. appendSelectText(variable_obj, menu_var_or_value);
  18190. }
  18191. if (variable_obj.content == null && variable_obj.function_called == null) {
  18192. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18193. return;
  18194. }
  18195. var ret = "";
  18196. if (variable_obj.function_called) {
  18197. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  18198. menu_var_or_value.find(".text").text(" ");
  18199. dom_object.find(".menu_var_or_value_dom").remove();
  18200. var parameters_menu;
  18201. if (variable_obj.function_called.name) {
  18202. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + " <span> ( </span>";
  18203. } else {
  18204. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.translateInternalFunction(variable_obj.function_called.identifier, variable_obj.function_called.category) + "</i> <span> ( </span>";
  18205. }
  18206. parameters_menu += "<span> ) </span></div>";
  18207. parameters_menu = $(parameters_menu);
  18208. dom_object.append(parameters_menu);
  18209. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18210. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18211. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18212. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18213. context_menu += '<div class="menu">';
  18214. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18215. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18216. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18217. context_menu += '</div></div>';
  18218. }*/
  18219. context_menu += "</div></div>";
  18220. context_menu = $(context_menu);
  18221. context_menu.insertAfter(dom_object.find(".parameters_function_called"));
  18222. context_menu.dropdown({
  18223. onChange: function onChange(value, text, $selectedItem) {
  18224. if ($selectedItem.data("clear")) {
  18225. dom_object.text("");
  18226. variable_obj.content = null;
  18227. variable_obj.row = null;
  18228. variable_obj.column = null;
  18229. delete variable_obj.function_called;
  18230. delete variable_obj.parameters_list;
  18231. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18232. }
  18233. if ($selectedItem.data("exp")) {
  18234. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18235. }
  18236. },
  18237. selectOnKeydown: false
  18238. });
  18239. } else {
  18240. menu_var_or_value.find(".text").text(" ");
  18241. dom_object.find(".menu_var_or_value_dom").remove();
  18242. var parameters_menu;
  18243. if (variable_obj.function_called.name) {
  18244. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + " <span> ( </span>";
  18245. } else {
  18246. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.translateInternalFunction(variable_obj.function_called.identifier, variable_obj.function_called.category) + "</i> <span> ( </span>";
  18247. }
  18248. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  18249. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18250. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  18251. parameters_menu += " , ";
  18252. }
  18253. }
  18254. parameters_menu += "<span> ) </span></div>";
  18255. parameters_menu = $(parameters_menu);
  18256. dom_object.append(parameters_menu);
  18257. for (var _j = 0; _j < variable_obj.function_called.parameters_list.length; _j++) {
  18258. renderMenu(command, variable_obj.parameters_list[_j], parameters_menu.find(".parameter_" + _j), function_obj, 2, expression_element);
  18259. }
  18260. var _context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18261. _context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18262. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18263. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18264. context_menu += '<div class="menu">';
  18265. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18266. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18267. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18268. context_menu += '</div></div>';
  18269. }*/
  18270. _context_menu += "</div></div>";
  18271. _context_menu = $(_context_menu);
  18272. _context_menu.insertAfter(parameters_menu);
  18273. _context_menu.dropdown({
  18274. onChange: function onChange(value, text, $selectedItem) {
  18275. if ($selectedItem.data("clear")) {
  18276. dom_object.text("");
  18277. variable_obj.content = null;
  18278. variable_obj.row = null;
  18279. variable_obj.column = null;
  18280. delete variable_obj.function_called;
  18281. delete variable_obj.parameters_list;
  18282. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18283. }
  18284. if ($selectedItem.data("exp")) {
  18285. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18286. }
  18287. },
  18288. selectOnKeydown: false
  18289. });
  18290. }
  18291. } else if (variable_obj.content.type) {
  18292. var variable_render = "";
  18293. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  18294. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + "</span>";
  18295. if (variable_obj.reference_dimensions >= 1) variable_render += '';else variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18296. variable_render += "</div>";
  18297. variable_render = $(variable_render);
  18298. dom_object.append(variable_render);
  18299. var _context_menu2 = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18300. _context_menu2 += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18301. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18302. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18303. context_menu += '<div class="menu">';
  18304. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18305. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18306. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18307. context_menu += '</div></div>';
  18308. }*/
  18309. _context_menu2 += "</div></div>";
  18310. _context_menu2 = $(_context_menu2);
  18311. variable_render.append(_context_menu2);
  18312. _context_menu2.dropdown({
  18313. onChange: function onChange(value, text, $selectedItem) {
  18314. if ($selectedItem.data("clear")) {
  18315. dom_object.text("");
  18316. variable_obj.content = null;
  18317. variable_obj.row = null;
  18318. variable_obj.column = null;
  18319. delete variable_obj.function_called;
  18320. delete variable_obj.parameters_list;
  18321. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18322. }
  18323. if ($selectedItem.data("exp")) {
  18324. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18325. }
  18326. },
  18327. selectOnKeydown: false
  18328. });
  18329. if (!variable_obj.column) {
  18330. var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18331. if (variable_obj.reference) temp.reference_parent = true;
  18332. variable_obj.column = temp;
  18333. }
  18334. variableValueMenuCode(command, variable_obj.column, $(variable_render.find(".column_container")), function_obj, menu_var_or_value, expression_element);
  18335. } else if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  18336. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + "</span>";
  18337. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  18338. if (variable_obj.reference_dimensions == 0) variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  18339. variable_render += "</div>";
  18340. variable_render = $(variable_render);
  18341. dom_object.append(variable_render);
  18342. var _context_menu3 = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18343. _context_menu3 += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18344. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18345. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18346. context_menu += '<div class="menu">';
  18347. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18348. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18349. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18350. context_menu += '</div></div>';
  18351. }*/
  18352. _context_menu3 += "</div></div>";
  18353. _context_menu3 = $(_context_menu3);
  18354. variable_render.append(_context_menu3);
  18355. _context_menu3.dropdown({
  18356. onChange: function onChange(value, text, $selectedItem) {
  18357. if ($selectedItem.data("clear")) {
  18358. dom_object.text("");
  18359. variable_obj.content = null;
  18360. variable_obj.row = null;
  18361. variable_obj.column = null;
  18362. delete variable_obj.function_called;
  18363. delete variable_obj.parameters_list;
  18364. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18365. }
  18366. if ($selectedItem.data("exp")) {
  18367. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18368. }
  18369. },
  18370. selectOnKeydown: false
  18371. });
  18372. if (!variable_obj.column) {
  18373. var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18374. if (variable_obj.reference) temp.reference_parent = true;
  18375. variable_obj.column = temp;
  18376. }
  18377. if (!variable_obj.row) {
  18378. var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18379. if (variable_obj.reference) temp.reference_parent = true;
  18380. variable_obj.row = temp;
  18381. }
  18382. variableValueMenuCode(command, variable_obj.row, $(variable_render.find(".row_container")), function_obj, menu_var_or_value, expression_element);
  18383. if (variable_obj.reference_dimensions == 1) {
  18384. variable_obj.column = null;
  18385. } else {
  18386. variableValueMenuCode(command, variable_obj.column, $(variable_render.find(".column_container")), function_obj, menu_var_or_value, expression_element);
  18387. }
  18388. } else {
  18389. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + "</span>";
  18390. variable_render += "</div>";
  18391. variable_render = $(variable_render);
  18392. dom_object.append(variable_render);
  18393. var _context_menu4 = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18394. _context_menu4 += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18395. /*if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18396. console.log('dom_object6');
  18397. console.log(dom_object);
  18398. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18399. context_menu += '<div class="menu">';
  18400. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18401. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18402. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18403. context_menu += '</div></div>';
  18404. }*/
  18405. _context_menu4 += "</div></div>";
  18406. _context_menu4 = $(_context_menu4);
  18407. variable_render.append(_context_menu4);
  18408. _context_menu4.dropdown({
  18409. onChange: function onChange(value, text, $selectedItem) {
  18410. if ($selectedItem.data("clear")) {
  18411. dom_object.text("");
  18412. variable_obj.content = null;
  18413. variable_obj.row = null;
  18414. variable_obj.column = null;
  18415. delete variable_obj.function_called;
  18416. delete variable_obj.parameters_list;
  18417. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18418. }
  18419. if ($selectedItem.data("exp")) {
  18420. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18421. }
  18422. },
  18423. selectOnKeydown: false
  18424. });
  18425. }
  18426. } else {
  18427. var _variable_render;
  18428. _variable_render = '<div class="variable_rendered"> <span class="var_name">';
  18429. if (isNaN(variable_obj.content)) {
  18430. _variable_render += variable_obj.content.split(" ").join("&nbsp;");
  18431. } else {
  18432. _variable_render += variable_obj.content;
  18433. }
  18434. _variable_render += "</span>";
  18435. _variable_render += "</div>";
  18436. _variable_render = $(_variable_render);
  18437. dom_object.append(_variable_render);
  18438. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18439. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18440. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18441. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18442. context_menu += '<div class="menu">';
  18443. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18444. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18445. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18446. context_menu += '</div></div>';
  18447. }*/
  18448. context_menu += "</div></div>";
  18449. context_menu = $(context_menu);
  18450. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18451. context_menu.insertAfter(_variable_render);
  18452. }
  18453. context_menu.dropdown({
  18454. onChange: function onChange(value, text, $selectedItem) {
  18455. if ($selectedItem.data("clear")) {
  18456. dom_object.text("");
  18457. variable_obj.content = null;
  18458. variable_obj.row = null;
  18459. variable_obj.column = null;
  18460. delete variable_obj.function_called;
  18461. delete variable_obj.parameters_list;
  18462. dom_object.find(".value_rendered").remove();
  18463. dom_object.find(".context_menu_clear").remove();
  18464. dom_object.find(".width-dynamic-minus").remove();
  18465. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18466. }
  18467. if ($selectedItem.data("exp")) {
  18468. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18469. }
  18470. },
  18471. selectOnKeydown: false
  18472. });
  18473. _variable_render.on("click", function (e) {
  18474. _variable_render.remove();
  18475. _variable_render.empty();
  18476. _variable_render.remove();
  18477. dom_object.empty();
  18478. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18479. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  18480. });
  18481. }
  18482. }
  18483. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18484. var sub_menu = menu_var_or_value.find(".menu_only_functions");
  18485. sub_menu.append('<div class="divider"></div><div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_header_ivprog_functions") + "</div>");
  18486. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_menu_functions_math") + '<div class="menu menu_math_functions"></div></div>');
  18487. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_menu_functions_text") + '<div class="menu menu_text_functions"></div></div>');
  18488. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_menu_functions_array") + '<div class="menu menu_arrangement_functions"></div></div>');
  18489. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_menu_functions_conversion") + '<div class="menu menu_conversion_functions"></div></div>'); // Insert Math functions:
  18490. for (var i = 0; i < window.system_functions.length; i++) {
  18491. var t = $('<div class="item"></div>');
  18492. t.data("function_reference", window.system_functions[i]);
  18493. t.data("option", VAR_OR_VALUE_TYPES.only_function);
  18494. t.text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.translateInternalFunction(window.system_functions[i].identifier));
  18495. switch (window.system_functions[i].category) {
  18496. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SYSTEM_FUNCTIONS_CATEGORIES.math:
  18497. sub_menu.find(".menu_math_functions").append(t);
  18498. break;
  18499. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SYSTEM_FUNCTIONS_CATEGORIES.text:
  18500. sub_menu.find(".menu_text_functions").append(t);
  18501. break;
  18502. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SYSTEM_FUNCTIONS_CATEGORIES.arrangement:
  18503. sub_menu.find(".menu_arrangement_functions").append(t);
  18504. break;
  18505. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SYSTEM_FUNCTIONS_CATEGORIES.conversion:
  18506. sub_menu.find(".menu_conversion_functions").append(t);
  18507. break;
  18508. }
  18509. }
  18510. }
  18511. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18512. var sub_menu = menu_var_or_value.find(".menu_only_functions");
  18513. sub_menu.text("");
  18514. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18515. var temp = $('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + " </div>");
  18516. temp.data("function_reference", window.program_obj.functions[i]);
  18517. sub_menu.append(temp);
  18518. }
  18519. }
  18520. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18521. var sub_menu = menu_var_or_value.find(".menu_only_vars");
  18522. sub_menu.text("");
  18523. var is_there = false;
  18524. if (window.program_obj.globals) {
  18525. if (ref_object.include_constant) {
  18526. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18527. var temp = $('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + " </div>");
  18528. temp.data("variable_reference", window.program_obj.globals[i]);
  18529. sub_menu.append(temp);
  18530. is_there = true;
  18531. }
  18532. } else {
  18533. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18534. if (!window.program_obj.globals[i].is_constant) {
  18535. var temp = $('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + " </div>");
  18536. temp.data("variable_reference", window.program_obj.globals[i]);
  18537. sub_menu.append(temp);
  18538. is_there = true;
  18539. }
  18540. }
  18541. }
  18542. }
  18543. if (function_obj.parameters_list) {
  18544. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18545. var temp = $('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + " </div>");
  18546. temp.data("variable_reference", function_obj.parameters_list[i]);
  18547. sub_menu.append(temp);
  18548. is_there = true;
  18549. }
  18550. }
  18551. if (function_obj.variables_list) {
  18552. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18553. var temp = $('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + " </div>");
  18554. temp.data("variable_reference", function_obj.variables_list[i]);
  18555. sub_menu.append(temp);
  18556. is_there = true;
  18557. }
  18558. }
  18559. if (!is_there) {
  18560. sub_menu.append($('<div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_no_variable") + "</div>"));
  18561. sub_menu.append($('<div class="item disabled">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_no_variable_instruction") + "</div>"));
  18562. }
  18563. }
  18564. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18565. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18566. menu_var_or_value.dropdown({
  18567. onChange: function onChange(value, text, $selectedItem) {
  18568. dom_object.find(".var_name").remove();
  18569. switch ($selectedItem.data("option")) {
  18570. case VAR_OR_VALUE_TYPES.only_function:
  18571. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, $($selectedItem).data("function_reference"), expression_element);
  18572. break;
  18573. case VAR_OR_VALUE_TYPES.only_value:
  18574. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18575. break;
  18576. case VAR_OR_VALUE_TYPES.only_variable:
  18577. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, $($selectedItem).data("variable_reference"), expression_element);
  18578. break;
  18579. }
  18580. if ($selectedItem.data("exp")) {
  18581. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18582. }
  18583. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes) {
  18584. _repeatNtimes__WEBPACK_IMPORTED_MODULE_3__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18585. }
  18586. },
  18587. selectOnKeydown: false
  18588. });
  18589. }
  18590. dom_object.find(".width-dynamic").on("input", function () {
  18591. var inputWidth = $(this).textWidth() + 10;
  18592. $(this).focus();
  18593. var tmpStr = $(this).val();
  18594. $(this).val("");
  18595. $(this).val(tmpStr);
  18596. $(this).css({
  18597. width: inputWidth
  18598. });
  18599. }).trigger("input");
  18600. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment) {
  18601. dom_object.parent().on("click", function (e) {
  18602. dom_object.find(".value_rendered").remove();
  18603. dom_object.find(".value_rendered").empty();
  18604. dom_object.find(".value_rendered").remove();
  18605. dom_object.empty();
  18606. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18607. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18608. });
  18609. }
  18610. }
  18611. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  18612. ref_object.function_called = function_selected;
  18613. ref_object.parameters_list = [];
  18614. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  18615. menu_var_or_value.find(".text").text(" ");
  18616. dom_object.find(".menu_var_or_value_dom").remove();
  18617. var parameters_menu;
  18618. if (function_selected.name) {
  18619. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + " <span> ( </span>";
  18620. } else {
  18621. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.translateInternalFunction(function_selected.identifier, function_selected.category) + "</i> <span> ( </span>";
  18622. }
  18623. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18624. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18625. if (j + 1 != function_selected.parameters_list.length) {
  18626. parameters_menu += " , ";
  18627. }
  18628. }
  18629. parameters_menu += "<span> ) </span></div>";
  18630. parameters_menu = $(parameters_menu);
  18631. dom_object.append(parameters_menu);
  18632. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18633. var temp;
  18634. if (function_selected.parameters_list[j].dimensions > 0) {
  18635. temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, function_selected.parameters_list[j].dimensions);
  18636. } else {
  18637. temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18638. }
  18639. if (function_selected.parameters_list[j].reference == true) {
  18640. temp.reference = true;
  18641. temp.variable_and_value = VAR_OR_VALUE_TYPES.only_variable;
  18642. } else {
  18643. temp.reference = false;
  18644. temp.variable_and_value = VAR_OR_VALUE_TYPES.all;
  18645. }
  18646. temp.reference_dimensions = function_selected.parameters_list[j].dimensions;
  18647. ref_object.parameters_list.push(temp);
  18648. renderMenu(command, temp, parameters_menu.find(".parameter_" + j), function_obj, 2, expression_element);
  18649. }
  18650. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18651. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18652. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18653. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18654. context_menu += '<div class="menu">';
  18655. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18656. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18657. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18658. context_menu += '</div></div>';
  18659. }*/
  18660. context_menu += "</div></div>";
  18661. context_menu = $(context_menu);
  18662. context_menu.insertAfter(dom_object.find(".parameters_function_called"));
  18663. context_menu.dropdown({
  18664. onChange: function onChange(value, text, $selectedItem) {
  18665. if ($selectedItem.data("clear")) {
  18666. dom_object.text("");
  18667. ref_object.content = null;
  18668. ref_object.row = null;
  18669. ref_object.column = null;
  18670. delete ref_object.function_called;
  18671. delete ref_object.parameters_list;
  18672. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18673. }
  18674. if ($selectedItem.data("exp")) {
  18675. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18676. }
  18677. },
  18678. selectOnKeydown: false
  18679. });
  18680. } else {
  18681. menu_var_or_value.find(".text").text(" ");
  18682. dom_object.find(".menu_var_or_value_dom").remove();
  18683. var parameters_menu;
  18684. if (function_selected.name) {
  18685. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + " <span> ( </span>";
  18686. } else {
  18687. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.translateInternalFunction(function_selected.identifier, function_selected.category) + "</i> <span> ( </span>";
  18688. }
  18689. parameters_menu += "<span> ) </span></div>";
  18690. parameters_menu = $(parameters_menu);
  18691. dom_object.append(parameters_menu);
  18692. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18693. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18694. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18695. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18696. context_menu += '<div class="menu">';
  18697. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18698. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18699. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18700. context_menu += '</div></div>';
  18701. }*/
  18702. context_menu += "</div></div>";
  18703. context_menu = $(context_menu);
  18704. context_menu.insertAfter(dom_object.find(".parameters_function_called"));
  18705. context_menu.dropdown({
  18706. onChange: function onChange(value, text, $selectedItem) {
  18707. if ($selectedItem.data("clear")) {
  18708. dom_object.text("");
  18709. ref_object.content = null;
  18710. ref_object.row = null;
  18711. ref_object.column = null;
  18712. delete ref_object.function_called;
  18713. delete ref_object.parameters_list;
  18714. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18715. }
  18716. if ($selectedItem.data("exp")) {
  18717. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18718. }
  18719. },
  18720. selectOnKeydown: false
  18721. });
  18722. }
  18723. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18724. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18725. }*/
  18726. }
  18727. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  18728. ref_object.content = variable_selected;
  18729. menu_var_or_value.find(".text").text(" ");
  18730. dom_object.find(".menu_var_or_value_dom").remove();
  18731. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + "</span>";
  18732. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  18733. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18734. }
  18735. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  18736. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  18737. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18738. }
  18739. variable_render += "</div>";
  18740. variable_render = $(variable_render);
  18741. dom_object.append(variable_render);
  18742. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  18743. var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18744. if (ref_object.reference) temp.reference_parent = true;
  18745. ref_object.column = temp;
  18746. renderMenu(command, ref_object.column, variable_render.find(".column_container"), function_obj, 2, expression_element);
  18747. }
  18748. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  18749. var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18750. if (ref_object.reference) temp.reference_parent = true;
  18751. ref_object.row = temp;
  18752. renderMenu(command, ref_object.row, variable_render.find(".row_container"), function_obj, 2, expression_element);
  18753. var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18754. if (ref_object.reference) temp.reference_parent = true;
  18755. ref_object.column = temp;
  18756. renderMenu(command, ref_object.column, variable_render.find(".column_container"), function_obj, 2, expression_element);
  18757. }
  18758. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18759. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18760. /*if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18761. console.log("dom_object 10: ");
  18762. console.log(dom_object);
  18763. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18764. context_menu += '<div class="menu">';
  18765. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18766. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18767. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18768. context_menu += '</div></div>';
  18769. }*/
  18770. context_menu += "</div></div>";
  18771. context_menu = $(context_menu);
  18772. context_menu.insertAfter(dom_object.find(".variable_rendered"));
  18773. context_menu.dropdown({
  18774. onChange: function onChange(value, text, $selectedItem) {
  18775. if ($selectedItem.data("clear")) {
  18776. dom_object.text("");
  18777. ref_object.content = null;
  18778. ref_object.row = null;
  18779. ref_object.column = null;
  18780. delete ref_object.function_called;
  18781. delete ref_object.parameters_list;
  18782. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18783. }
  18784. if ($selectedItem.data("exp")) {
  18785. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18786. }
  18787. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes) {
  18788. _repeatNtimes__WEBPACK_IMPORTED_MODULE_3__.manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18789. }
  18790. },
  18791. selectOnKeydown: false
  18792. });
  18793. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18794. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  18795. }*/
  18796. }
  18797. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18798. if (ref_object.content == null) {
  18799. ref_object.content = "";
  18800. }
  18801. menu_var_or_value.find(".text").text(" ");
  18802. var field = $('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  18803. field.insertBefore(dom_object.find(".menu_var_or_value_dom"));
  18804. field.on('input', function () {
  18805. var input_field = $(this);
  18806. var inputWidth = input_field.textWidth() + 10;
  18807. inputWidth = inputWidth < 50 ? 50 : inputWidth;
  18808. input_field.css({
  18809. width: inputWidth
  18810. });
  18811. }).trigger('input');
  18812. var rendered = $('<div class="value_rendered"></div>');
  18813. rendered.insertBefore(field);
  18814. field.focus();
  18815. field.val(ref_object.content);
  18816. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18817. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18818. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18819. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18820. context_menu += '<div class="menu">';
  18821. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18822. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18823. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18824. context_menu += '</div></div>';
  18825. }*/
  18826. context_menu += "</div></div>";
  18827. context_menu = $(context_menu);
  18828. dom_object.find(".menu_var_or_value_dom").remove();
  18829. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18830. context_menu.insertAfter(field);
  18831. }
  18832. context_menu.dropdown({
  18833. onChange: function onChange(value, text, $selectedItem) {
  18834. if ($selectedItem.data("clear")) {
  18835. dom_object.text("");
  18836. dom_object.find(".value_rendered").remove();
  18837. dom_object.find(".context_menu_clear").remove();
  18838. dom_object.find(".width-dynamic-minus").remove();
  18839. ref_object.content = null;
  18840. ref_object.row = null;
  18841. ref_object.column = null;
  18842. delete ref_object.function_called;
  18843. delete ref_object.parameters_list;
  18844. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18845. }
  18846. if ($selectedItem.data("exp")) {
  18847. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18848. }
  18849. },
  18850. selectOnKeydown: false
  18851. });
  18852. dom_object.find(".width-dynamic-minus").focusout(function () {
  18853. /*if (
  18854. $(this)
  18855. .val()
  18856. .trim()
  18857. ) {
  18858. ref_object.content = $(this)
  18859. .val()
  18860. .trim();
  18861. }*/
  18862. ref_object.content = $(this).val();
  18863. if (isNaN(ref_object.content)) {
  18864. rendered.html(ref_object.content.split(" ").join("&nbsp;"));
  18865. } else {
  18866. rendered.text(ref_object.content);
  18867. }
  18868. $(this).remove();
  18869. });
  18870. dom_object.find(".width-dynamic-minus").on("keydown", function (e) {
  18871. var code = e.keyCode || e.which;
  18872. if (code == 13) {
  18873. /*if (
  18874. $(this)
  18875. .val()
  18876. .trim()
  18877. ) {
  18878. ref_object.content = $(this)
  18879. .val()
  18880. .trim();
  18881. }*/
  18882. ref_object.content = $(this).val();
  18883. if (isNaN(ref_object.content)) {
  18884. rendered.html(ref_object.content.split(" ").join("&nbsp;"));
  18885. } else {
  18886. rendered.text(ref_object.content);
  18887. }
  18888. $(this).remove();
  18889. }
  18890. if (code == 27) {
  18891. if (isNaN(ref_object.content)) {
  18892. rendered.html(ref_object.content.split(" ").join("&nbsp;"));
  18893. } else {
  18894. rendered.text(ref_object.content);
  18895. }
  18896. $(this).remove();
  18897. }
  18898. });
  18899. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment) {
  18900. /*rendered.parent().on('click', function(e) {
  18901. rendered.parent().off();
  18902. console.log("TTT14");
  18903. rendered.remove();
  18904. rendered.empty();
  18905. rendered.remove();
  18906. dom_object.empty();
  18907. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18908. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element)
  18909. });*/
  18910. }
  18911. rendered.on("click", function (e) {
  18912. rendered.empty();
  18913. rendered.remove();
  18914. dom_object.empty();
  18915. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18916. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18917. });
  18918. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18919. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18920. }*/
  18921. }
  18922. $.fn.textWidth = function (text, font) {
  18923. if (!$.fn.textWidth.fakeEl) $.fn.textWidth.fakeEl = $("<span>").hide().appendTo(document.body);
  18924. $.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr("placeholder")).css("font", font || this.css("font"));
  18925. return $.fn.textWidth.fakeEl.width();
  18926. };
  18927. /***/ }),
  18928. /***/ "./js/visualUI/commands/whiletrue.js":
  18929. /*!*******************************************!*\
  18930. !*** ./js/visualUI/commands/whiletrue.js ***!
  18931. \*******************************************/
  18932. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18933. "use strict";
  18934. __webpack_require__.r(__webpack_exports__);
  18935. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18936. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  18937. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  18938. /* harmony export */ });
  18939. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18940. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18941. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  18942. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  18943. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  18944. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
  18945. function createFloatingCommand() {
  18946. return $('<div class="ui whiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_command_while') + ' ( x < 10 ) <br> </span></div>');
  18947. }
  18948. function renderCommand(command, function_obj) {
  18949. var ret = '';
  18950. ret += '<div class="ui whiletrue command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i><button class="ui icon button minimize_block_button tiny"><i class="icon window minimize"></i></button> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_command_while') + ' </span>';
  18951. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="textual_expression"></span> <span class="span_command_spec"> ) </span>';
  18952. ret += ' </span>';
  18953. ret += ' <i class="ui icon i cursor button_write_expression" style="margin-right: 1rem !important;"></i> <i class="ui icon unlock button_alternate_expression"></i> <div class="ui context_menu"></div>';
  18954. ret += '<div class="ui block_commands">';
  18955. ret += '</div>';
  18956. ret += '<span> </span>';
  18957. ret += '</div>';
  18958. var el = $(ret);
  18959. el.data('command', command);
  18960. el.find('.block_commands').data('command', command);
  18961. addHandlers(command, function_obj, el);
  18962. _contextualized_menu__WEBPACK_IMPORTED_MODULE_3__.renderMenu(command, el.find('.context_menu'), function_obj, el); //ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  18963. _generic_expression__WEBPACK_IMPORTED_MODULE_4__.renderExpression(command, function_obj, el.find('.conditional_expression'), command.expression);
  18964. if (command.commands_block) {
  18965. for (var j = 0; j < command.commands_block.length; j++) {
  18966. _commands__WEBPACK_IMPORTED_MODULE_1__.renderCommand(command.commands_block[j], $(el.find('.block_commands')[0]), 3, function_obj);
  18967. }
  18968. }
  18969. if (command.lockexpression) {
  18970. if (command.expression) {
  18971. try {
  18972. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  18973. if (text) {
  18974. $(el.find('.conditional_expression')[0]).toggle();
  18975. $(el.find('.textual_expression')[0]).text(text);
  18976. $(el.find('.textual_expression')[0]).toggle();
  18977. $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
  18978. }
  18979. } catch (e) {
  18980. command.lockexpression = false;
  18981. }
  18982. }
  18983. }
  18984. el.find('.unlock').popup({
  18985. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
  18986. delay: {
  18987. show: 750,
  18988. hide: 0
  18989. }
  18990. });
  18991. el.find('.lock').popup({
  18992. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
  18993. delay: {
  18994. show: 750,
  18995. hide: 0
  18996. }
  18997. });
  18998. el.find('.button_write_expression').popup({
  18999. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression"),
  19000. delay: {
  19001. show: 750,
  19002. hide: 0
  19003. }
  19004. });
  19005. return el;
  19006. }
  19007. function addHandlers(command, function_obj, whiletrue_dom) {
  19008. whiletrue_dom.find('.button_write_expression').on('click', function () {
  19009. window.expressionEdition = true;
  19010. window.inputExpression = null;
  19011. var afterWhichElement;
  19012. var lockButton = $(whiletrue_dom.find('.button_alternate_expression')[0]);
  19013. var editButton = $(this);
  19014. afterWhichElement = $(whiletrue_dom.find('.conditional_expression')[0]);
  19015. if (command.lockexpression) {
  19016. afterWhichElement = $(whiletrue_dom.find('.textual_expression')[0]);
  19017. }
  19018. var text = "";
  19019. if (command.expression) {
  19020. if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
  19021. text = "";
  19022. } else {
  19023. try {
  19024. text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  19025. } catch (ex) {
  19026. text = "";
  19027. }
  19028. }
  19029. }
  19030. var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
  19031. var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
  19032. var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
  19033. input.val(text);
  19034. input.focusout(function (evt) {
  19035. console.log('focosout event!');
  19036. ok_button.click();
  19037. evt.preventDefault();
  19038. return true;
  19039. });
  19040. input.keyup(function (evt) {
  19041. if (evt.keyCode == 27) {
  19042. // esc
  19043. cancel_button.click();
  19044. }
  19045. if (evt.keyCode == 13) {
  19046. // enter
  19047. ok_button.click();
  19048. }
  19049. });
  19050. ok_button.click(function () {
  19051. var parsed = null;
  19052. parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(input.val(), function_obj, input);
  19053. if (parsed) {
  19054. window.expressionEdition = false;
  19055. command.expression = parsed;
  19056. renderAlgorithm();
  19057. }
  19058. });
  19059. cancel_button.mousedown(function (evt) {
  19060. var parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(text, function_obj, input);
  19061. if (parsed) {
  19062. window.expressionEdition = false;
  19063. command.expression = parsed;
  19064. renderAlgorithm();
  19065. }
  19066. });
  19067. input.insertAfter(afterWhichElement);
  19068. input.focus();
  19069. cancel_button.insertAfter(input);
  19070. ok_button.insertAfter(input);
  19071. var len = text.length;
  19072. input[0].setSelectionRange(len, len);
  19073. afterWhichElement.css('display', 'none');
  19074. lockButton.css('display', 'none');
  19075. editButton.css('display', 'none');
  19076. ok_button.popup({
  19077. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_confirm"),
  19078. delay: {
  19079. show: 750,
  19080. hide: 0
  19081. }
  19082. });
  19083. cancel_button.popup({
  19084. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_cancel"),
  19085. delay: {
  19086. show: 750,
  19087. hide: 0
  19088. }
  19089. });
  19090. });
  19091. whiletrue_dom.find('.minimize_block_button').on('click', function (evt) {
  19092. whiletrue_dom.children('.ui.block_commands').toggle();
  19093. command.collapsed = !command.collapsed;
  19094. });
  19095. $(whiletrue_dom.find('.textual_expression')[0]).toggle();
  19096. whiletrue_dom.find('.button_alternate_expression').on('click', function () {
  19097. if (command.expression) {
  19098. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  19099. if (text) {
  19100. $(whiletrue_dom.find('.conditional_expression')[0]).toggle();
  19101. $(whiletrue_dom.find('.textual_expression')[0]).text(text);
  19102. $(whiletrue_dom.find('.textual_expression')[0]).toggle();
  19103. $(this).toggleClass('unlock').toggleClass('lock');
  19104. command.lockexpression = !command.lockexpression;
  19105. }
  19106. }
  19107. if (command.lockexpression) {
  19108. whiletrue_dom.find('.lock').popup({
  19109. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
  19110. delay: {
  19111. show: 750,
  19112. hide: 0
  19113. }
  19114. });
  19115. } else {
  19116. whiletrue_dom.find('.unlock').popup({
  19117. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
  19118. delay: {
  19119. show: 750,
  19120. hide: 0
  19121. }
  19122. });
  19123. }
  19124. });
  19125. whiletrue_dom.find('.button_remove_command').on('click', function () {
  19126. if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, whiletrue_dom)) {
  19127. whiletrue_dom.fadeOut(400, function () {
  19128. whiletrue_dom.remove();
  19129. });
  19130. }
  19131. });
  19132. }
  19133. /***/ }),
  19134. /***/ "./js/visualUI/commands/writer.js":
  19135. /*!****************************************!*\
  19136. !*** ./js/visualUI/commands/writer.js ***!
  19137. \****************************************/
  19138. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  19139. "use strict";
  19140. __webpack_require__.r(__webpack_exports__);
  19141. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  19142. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  19143. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand),
  19144. /* harmony export */ "addContent": () => (/* binding */ addContent)
  19145. /* harmony export */ });
  19146. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19147. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19148. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  19149. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  19150. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  19151. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
  19152. function createFloatingCommand() {
  19153. return $('<div class="ui writer created_element"> <i class="ui icon small upload"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_command_write") + " var </span></div>");
  19154. }
  19155. function renderCommand(command, function_obj) {
  19156. var ret = "<div class=\"ui writer command_container\">\n <i class=\"ui icon small upload command_drag\"></i>\n <i class=\"ui icon times red button_remove_command\"></i>\n <span class=\"span_command_spec\">".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_command_write"), "\n ( </span><div class=\"all_elements_write\"></div> <span class=\"textual_expression\"></span>\n <span class=\"close_parentheses span_command_spec\">)</span>\n <img data-state=\"").concat(command.newline ? "on" : "false", "\" src=\"").concat(command.newline ? "img/new_line.svg" : "img/no_new_line.svg", "\" class=\"ivprog_newline_btn\"/> \n <i class=\"ui icon i cursor button_write_expression\" style=\"margin-left: 3rem !important; margin-right: -1.1rem !important;\"></i> \n <i class=\"ui icon unlock button_alternate_expression\"></i>\n </div>");
  19157. var el = $(ret);
  19158. el.data("command", command); //renderExpression (command, function_obj, div_to_render, expression_array)
  19159. _generic_expression__WEBPACK_IMPORTED_MODULE_4__.renderExpression(command, function_obj, el.find(".all_elements_write"), command.content);
  19160. addHandlers(command, function_obj, el);
  19161. if (command.content && command.lockexpression) {
  19162. try {
  19163. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.content);
  19164. if (text) {
  19165. $(el.find('.all_elements_write')[0]).toggle();
  19166. $(el.find('.textual_expression')[0]).text(text);
  19167. $(el.find('.textual_expression')[0]).toggle();
  19168. $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
  19169. }
  19170. } catch (e) {
  19171. command.lockexpression = false;
  19172. }
  19173. }
  19174. el.find('.unlock').popup({
  19175. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
  19176. delay: {
  19177. show: 750,
  19178. hide: 0
  19179. }
  19180. });
  19181. el.find('.lock').popup({
  19182. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
  19183. delay: {
  19184. show: 750,
  19185. hide: 0
  19186. }
  19187. });
  19188. el.find('.button_write_expression').popup({
  19189. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression"),
  19190. delay: {
  19191. show: 750,
  19192. hide: 0
  19193. }
  19194. });
  19195. return el;
  19196. }
  19197. function addHandlersManager(command, _function_obj, _writer_dom, item_div, content_element) {
  19198. item_div.find(".times").on("click", function () {
  19199. for (var i = 0; i < command.content.length; i++) {
  19200. if (command.content[i] == content_element) {
  19201. delete command.content[i];
  19202. command.content.splice(i, 1);
  19203. item_div.children().off();
  19204. item_div.off();
  19205. item_div.fadeOut();
  19206. if (command.content.length > 0) {
  19207. item_div.next(".icon_add_item_to_writer").fadeOut();
  19208. }
  19209. break;
  19210. }
  19211. }
  19212. });
  19213. }
  19214. function addHandlers(command, function_obj, writer_dom) {
  19215. $(writer_dom.find('.textual_expression')[0]).toggle();
  19216. writer_dom.find('.button_write_expression').on('click', function () {
  19217. window.expressionEdition = true;
  19218. window.inputExpression = null;
  19219. var afterWhichElement;
  19220. var lockButton = $(writer_dom.find('.button_alternate_expression')[0]);
  19221. var editButton = $(this);
  19222. afterWhichElement = writer_dom.find('.all_elements_write');
  19223. if (command.lockexpression) {
  19224. afterWhichElement = writer_dom.find('.textual_expression');
  19225. }
  19226. var text = "";
  19227. if (command.content) {
  19228. if (command.content.length == 1 && command.content[0].content == null && !command.content[0].function_called) {
  19229. text = "";
  19230. } else {
  19231. try {
  19232. text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.content);
  19233. } catch (ex) {
  19234. text = "";
  19235. }
  19236. }
  19237. }
  19238. var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
  19239. var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
  19240. var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
  19241. input.val(text);
  19242. input.focusout(function (evt) {
  19243. ok_button.click();
  19244. evt.preventDefault();
  19245. return true;
  19246. });
  19247. input.keyup(function (evt) {
  19248. if (evt.keyCode == 27) {
  19249. // esc
  19250. cancel_button.click();
  19251. }
  19252. if (evt.keyCode == 13) {
  19253. // enter
  19254. ok_button.click();
  19255. }
  19256. });
  19257. ok_button.click(function () {
  19258. var parsed = null;
  19259. parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(input.val(), function_obj, input);
  19260. if (parsed) {
  19261. window.expressionEdition = false;
  19262. command.content = parsed;
  19263. renderAlgorithm();
  19264. }
  19265. });
  19266. cancel_button.mousedown(function (evt) {
  19267. var parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(text, function_obj, input);
  19268. if (parsed) {
  19269. window.expressionEdition = false;
  19270. command.content = parsed;
  19271. renderAlgorithm();
  19272. }
  19273. });
  19274. input.insertAfter(afterWhichElement);
  19275. input.focus();
  19276. cancel_button.insertAfter(input);
  19277. ok_button.insertAfter(input);
  19278. var len = text.length;
  19279. input[0].setSelectionRange(len, len);
  19280. afterWhichElement.css('display', 'none');
  19281. lockButton.css('display', 'none');
  19282. editButton.css('display', 'none');
  19283. ok_button.popup({
  19284. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression_confirm"),
  19285. delay: {
  19286. show: 750,
  19287. hide: 0
  19288. }
  19289. });
  19290. cancel_button.popup({
  19291. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression_cancel"),
  19292. delay: {
  19293. show: 750,
  19294. hide: 0
  19295. }
  19296. });
  19297. });
  19298. writer_dom.find('.button_alternate_expression').on('click', function () {
  19299. if (command.content) {
  19300. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.content);
  19301. if (text) {
  19302. $(writer_dom.find('.all_elements_write')[0]).toggle();
  19303. $(writer_dom.find('.textual_expression')[0]).text(text);
  19304. $(writer_dom.find('.textual_expression')[0]).toggle();
  19305. $(this).toggleClass('unlock').toggleClass('lock');
  19306. command.lockexpression = !command.lockexpression;
  19307. }
  19308. if (command.lockexpression) {
  19309. writer_dom.find('.lock').popup({
  19310. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
  19311. delay: {
  19312. show: 750,
  19313. hide: 0
  19314. }
  19315. });
  19316. } else {
  19317. writer_dom.find('.unlock').popup({
  19318. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
  19319. delay: {
  19320. show: 750,
  19321. hide: 0
  19322. }
  19323. });
  19324. }
  19325. }
  19326. });
  19327. writer_dom.find(".button_remove_command").on("click", function () {
  19328. if (_commands__WEBPACK_IMPORTED_MODULE_3__.removeCommand(command, function_obj, writer_dom)) {
  19329. writer_dom.fadeOut(400, function () {
  19330. writer_dom.remove();
  19331. });
  19332. }
  19333. });
  19334. Sortable.create(writer_dom.find(".all_elements_write")[0], {
  19335. handle: ".ellipsis",
  19336. animation: 100,
  19337. ghostClass: "ghost",
  19338. group: "writer_" + Math.floor(Math.random() * 10000000),
  19339. draggable: ".div_parent_handler",
  19340. onEnd: function onEnd(evt) {
  19341. command.content.splice(evt.newIndex, 0, command.content.splice(evt.oldIndex, 1)[0]);
  19342. writer_dom.empty();
  19343. writer_dom.replaceWith(renderCommand(command, function_obj));
  19344. }
  19345. }); // Attach event handles for the newline button
  19346. var newlineBtn = writer_dom.find(".ivprog_newline_btn");
  19347. newlineBtn.on("click", function () {
  19348. var state = this.dataset.state;
  19349. if (state === "on") {
  19350. this.dataset.state = "off";
  19351. command.newline = false;
  19352. this.setAttribute("src", "img/no_new_line.svg");
  19353. } else {
  19354. this.dataset.state = "on";
  19355. command.newline = true;
  19356. this.setAttribute("src", "img/new_line.svg");
  19357. }
  19358. writer_dom.data("command", command);
  19359. setPopup(newlineBtn, command.newline);
  19360. }); // Attach jquery popup
  19361. setPopup(newlineBtn, command.newline);
  19362. }
  19363. function setPopup(element, state) {
  19364. if (element.popup("exists")) {
  19365. element.popup("destroy");
  19366. }
  19367. var content = state ? _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("write_command_newline_on") : _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("write_command_newline_off");
  19368. element.popup({
  19369. content: content,
  19370. delay: {
  19371. show: 750,
  19372. hide: 0
  19373. }
  19374. });
  19375. }
  19376. function _addHandlerIconAdd(dom_object, command, function_obj) {
  19377. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  19378. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  19379. var icon_add_item = $('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  19380. if (!insert_after) {
  19381. dom_object.append(icon_add_item);
  19382. } else {
  19383. icon_add_item.insertAfter(after_which);
  19384. }
  19385. icon_add_item.on("click", function (_event) {
  19386. var div_parent_with_handler = $('<div class="div_parent_handler" style="display:none;"></div>');
  19387. var new_div_item = $('<div class="var_value_menu_div"></div>');
  19388. div_parent_with_handler.append($('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  19389. div_parent_with_handler.append(new_div_item);
  19390. div_parent_with_handler.append($('<i class="white inverted icon times handler"></i>'));
  19391. div_parent_with_handler.insertAfter(icon_add_item);
  19392. var new_related_menu = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  19393. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, new_related_menu, new_div_item, function_obj);
  19394. addHandlerIconAdd(dom_object, command, function_obj, true, div_parent_with_handler);
  19395. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  19396. var pos = 1;
  19397. dom_object.find(".icon_add_item_to_writer").each(function () {
  19398. if ($(this).get(0) === icon_add_item.get(0)) {
  19399. command.content.splice(pos, 0, new_related_menu);
  19400. } else {
  19401. pos++;
  19402. }
  19403. });
  19404. if (command.content.length == 1) {
  19405. icon_add_item.remove();
  19406. }
  19407. div_parent_with_handler.fadeIn();
  19408. });
  19409. }
  19410. function addContent(command, _ref_object, dom_object, _menu_var_or_value, function_obj, _ref_object_content) {
  19411. if (dom_object.hasClass("var_value_menu_div")) {
  19412. var icon_add_item = $('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  19413. icon_add_item.insertAfter(dom_object);
  19414. icon_add_item.on("click", function (_event) {
  19415. var div_parent_with_handler = $('<div class="div_parent_handler"></div>');
  19416. div_parent_with_handler.append($('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  19417. div_parent_with_handler.append(new_div_item);
  19418. div_parent_with_handler.append($('<i class="white inverted icon times handler"></i>'));
  19419. div_parent_with_handler.insertAfter(icon_add_item);
  19420. var new_related_menu = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(_variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  19421. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, new_related_menu, new_div_item, function_obj);
  19422. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  19423. command.content.push(new_related_menu);
  19424. if (command.content.length == 1) {
  19425. icon_add_item.remove();
  19426. }
  19427. });
  19428. }
  19429. }
  19430. /***/ }),
  19431. /***/ "./js/visualUI/functions.js":
  19432. /*!**********************************!*\
  19433. !*** ./js/visualUI/functions.js ***!
  19434. \**********************************/
  19435. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  19436. "use strict";
  19437. __webpack_require__.r(__webpack_exports__);
  19438. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  19439. /* harmony export */ "renderFunction": () => (/* binding */ renderFunction),
  19440. /* harmony export */ "initVisualUI": () => (/* binding */ initVisualUI),
  19441. /* harmony export */ "setTestCases": () => (/* binding */ setTestCases),
  19442. /* harmony export */ "getTestCases": () => (/* binding */ getTestCases),
  19443. /* harmony export */ "addFunctionChangeListener": () => (/* binding */ addFunctionChangeListener),
  19444. /* harmony export */ "addGlobalChangeListener": () => (/* binding */ addGlobalChangeListener),
  19445. /* harmony export */ "removeGlobalListener": () => (/* binding */ removeGlobalListener),
  19446. /* harmony export */ "removeFunctionListener": () => (/* binding */ removeFunctionListener)
  19447. /* harmony export */ });
  19448. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19449. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19450. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19451. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  19452. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  19453. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  19454. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  19455. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  19456. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  19457. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  19458. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  19459. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_10__);
  19460. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  19461. /* harmony import */ var _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  19462. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  19463. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  19464. /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./../services/userLog */ "./js/services/userLog.js");
  19465. /* harmony import */ var _ima_version_json__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./../../.ima_version.json */ "./.ima_version.json");
  19466. /* harmony import */ var _text_editor__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./text_editor */ "./js/visualUI/text_editor.js");
  19467. /* harmony import */ var _util_utils__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./../util/utils */ "./js/util/utils.js");
  19468. /* harmony import */ var _processor_modes__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../processor/modes */ "./js/processor/modes.ts");
  19469. var counter_new_functions = 0;
  19470. var counter_new_parameters = 0;
  19471. var ivprog_version = _ima_version_json__WEBPACK_IMPORTED_MODULE_16__.version;
  19472. var globalChangeListeners = [];
  19473. var functionsChangeListeners = [];
  19474. var proc = null;
  19475. var domConsole = null;
  19476. var _testCases = [];
  19477. var isRunning = false;
  19478. window.studentGrade = null;
  19479. window.LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings;
  19480. var program = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.Program();
  19481. window.system_functions = []; // Adding math functions:
  19482. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$sin', _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19483. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$cos', _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19484. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$tan', _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19485. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$sqrt', _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19486. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$pow', _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19487. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$log', _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19488. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$abs', _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19489. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$negate', _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19490. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$invert', _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19491. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$max', _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19492. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$min', _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19493. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$rand', _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL, 0, [], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.math)); // Adding text functions:
  19494. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$substring', _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.text));
  19495. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$length', _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.text));
  19496. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$uppercase', _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.text));
  19497. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$lowercase', _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.text));
  19498. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$charAt', _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.text)); // Adding arrangement functions:
  19499. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$numElements', _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, 1)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  19500. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$matrixLines', _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, 2)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  19501. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$matrixColumns', _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, 2)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.arrangement)); // Adding conversion functions:
  19502. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$isReal', _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19503. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$isInt', _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19504. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$isBool', _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19505. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$castReal', _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19506. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$castInt', _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19507. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$castBool', _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19508. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$castString', _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19509. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SystemFunction('$castChar', _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.VariableValueMenu(_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19510. console.log(' ___ ___ ________ \n / / / / / ____/ \n / / / / / / \n / / / / ______ ___ / /__ \n / / / / / \\ / / / ___/ \n / /______ / / / /\\ \\/ / / / \n / / / / / / \\ / / /____ \n/__________/ /___/ /___/ \\___/ /________/ \n\n Laboratório de Informática na Educação\n http://line.ime.usp.br');
  19511. var mainFunction = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.Function(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("start"), _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID, 0, [], true, false);
  19512. mainFunction.function_comment = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.Comment(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_comment_main'));
  19513. program.addFunction(mainFunction);
  19514. window.program_obj = program;
  19515. window.generator = _code_generator__WEBPACK_IMPORTED_MODULE_6__.generate;
  19516. window.runCodeAssessment = runCodeAssessment;
  19517. window.renderAlgorithm = _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm;
  19518. window.insertContext = false;
  19519. window.watchW = (melanke_watchjs__WEBPACK_IMPORTED_MODULE_10___default());
  19520. melanke_watchjs__WEBPACK_IMPORTED_MODULE_10___default().watch(window.program_obj.globals, function () {
  19521. if (window.insertContext) {
  19522. setTimeout(function () {
  19523. _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm();
  19524. globalChangeListeners.forEach(function (x) {
  19525. return x();
  19526. });
  19527. }, 300);
  19528. window.insertContext = false;
  19529. } else {
  19530. _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm();
  19531. globalChangeListeners.forEach(function (x) {
  19532. return x();
  19533. });
  19534. }
  19535. }, 1);
  19536. melanke_watchjs__WEBPACK_IMPORTED_MODULE_10___default().watch(window.program_obj.functions, function () {
  19537. if (window.insertContext) {
  19538. setTimeout(function () {
  19539. _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm();
  19540. functionsChangeListeners.forEach(function (x) {
  19541. return x();
  19542. });
  19543. }, 300);
  19544. window.insertContext = false;
  19545. } else {
  19546. _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm();
  19547. functionsChangeListeners.forEach(function (x) {
  19548. return x();
  19549. });
  19550. }
  19551. }, 1);
  19552. function addFunctionHandler() {
  19553. if (window.program_obj.functions) {
  19554. var in_use = false;
  19555. do {
  19556. in_use = false;
  19557. var temp_name = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('new_function') + '_' + counter_new_functions;
  19558. window.program_obj.functions.forEach(function (el) {
  19559. if (temp_name == el.name) {
  19560. in_use = true;
  19561. }
  19562. });
  19563. if (in_use) counter_new_functions++;
  19564. } while (in_use);
  19565. }
  19566. var new_function = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.Function(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("new_function") + "_" + counter_new_functions, _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID, 0, [], false, false, [], new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.Comment(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_comment_start')));
  19567. program.addFunction(new_function);
  19568. counter_new_functions++;
  19569. window.insertContext = true;
  19570. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(new_function.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_FUNCTION); // var newe = renderFunction(new_function);
  19571. renderFunction(new_function);
  19572. /*newe.css('display', 'none');
  19573. newe.fadeIn();*/
  19574. }
  19575. function addParameter(function_obj, function_container
  19576. /*, is_from_click = false*/
  19577. ) {
  19578. if (function_obj.parameters_list == null) {
  19579. function_obj.parameters_list = [];
  19580. }
  19581. if (function_obj.parameters_list) {
  19582. var in_use = false;
  19583. do {
  19584. in_use = false;
  19585. var temp_name = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('new_parameter') + '_' + counter_new_parameters;
  19586. function_obj.parameters_list.forEach(function (el) {
  19587. if (temp_name == el.name) {
  19588. in_use = true;
  19589. }
  19590. });
  19591. if (in_use) counter_new_parameters++;
  19592. } while (in_use);
  19593. }
  19594. var new_parameter = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.Variable(_types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("new_parameter") + "_" + counter_new_parameters);
  19595. function_obj.parameters_list.push(new_parameter);
  19596. counter_new_parameters++;
  19597. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_FUNCTION_PARAM, new_parameter.name, _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER, 0); //var newe = renderParameter(function_obj, new_parameter, function_container);
  19598. renderParameter(function_obj, new_parameter, function_container); // if (is_from_click) {
  19599. // newe.css('display', 'none');
  19600. // newe.fadeIn();
  19601. // }
  19602. }
  19603. function updateReturnType(function_obj, new_type) {
  19604. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19605. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.CHANGE_FUNCTION_RETURN, new_type, new_dimensions);
  19606. function_obj.return_type = new_type;
  19607. function_obj.return_dimensions = new_dimensions;
  19608. }
  19609. function removeFunction(function_obj) {
  19610. var index = program.functions.indexOf(function_obj);
  19611. if (index > -1) {
  19612. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.REMOVE_FUNCTION);
  19613. program.functions.splice(index, 1);
  19614. }
  19615. }
  19616. function minimizeFunction(function_obj) {
  19617. function_obj.is_hidden = !function_obj.is_hidden;
  19618. }
  19619. function addHandlers(function_obj, function_container) {
  19620. function_container.find('.ui.dropdown.function_return').dropdown({
  19621. onChange: function onChange(value, text, $selectedItem) {
  19622. if ($selectedItem.data('dimensions')) {
  19623. updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19624. } else {
  19625. updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')]);
  19626. }
  19627. },
  19628. selectOnKeydown: false
  19629. });
  19630. function_container.find(".name_function_updated").on('click', function (e) {
  19631. enableNameFunctionUpdate(function_obj, function_container);
  19632. });
  19633. function_container.find(".add_parameter_button").on('click', function (e) {
  19634. window.insertContext = true;
  19635. addParameter(function_obj, function_container, true);
  19636. });
  19637. function_container.find('.menu_commands').dropdown({
  19638. on: 'hover'
  19639. });
  19640. function_container.find('.menu_commands a').on('click', function (evt) {
  19641. if (function_obj.commands == null || function_obj.commands.length == 0) {
  19642. function_obj.commands = [];
  19643. var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_5__.genericCreateCommand($(this).data('command'));
  19644. function_obj.commands.push(new_cmd);
  19645. _commands__WEBPACK_IMPORTED_MODULE_5__.renderCommand(new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  19646. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, $(this).data('command'), '/', 0);
  19647. } else {
  19648. _commands__WEBPACK_IMPORTED_MODULE_5__.createFloatingCommand(function_obj, function_container, $(this).data('command'), evt);
  19649. }
  19650. });
  19651. function_container.find('.add_var_button_function').on('click', function (e) {
  19652. window.insertContext = true;
  19653. _variables__WEBPACK_IMPORTED_MODULE_4__.addVariable(function_obj, function_container, true);
  19654. });
  19655. function_container.find('.remove_function_button').on('click', function (e) {
  19656. removeFunction(function_obj);
  19657. function_container.fadeOut();
  19658. });
  19659. function_container.find('.minimize_function_button').on('click', function (e) {
  19660. minimizeFunction(function_obj);
  19661. if (function_obj.is_hidden) {
  19662. function_container.find(".add_var_button_function").toggle();
  19663. function_container.find(".inline_add_command").toggle();
  19664. function_container.find(".function_area").slideToggle();
  19665. } else {
  19666. function_container.find(".function_area").slideToggle(function () {
  19667. function_container.find(".add_var_button_function").toggle();
  19668. function_container.find(".inline_add_command").toggle();
  19669. });
  19670. }
  19671. });
  19672. } // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  19673. function renderFunctionReturn(function_obj, function_element) {
  19674. var ret = '<div class="ui dropdown function_return">';
  19675. if (function_obj.return_dimensions == 1) {
  19676. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("vector") + ': ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(function_obj.return_type.toLowerCase()));
  19677. ret += ' [ ] </div>';
  19678. } else if (function_obj.return_dimensions == 2) {
  19679. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("matrix") + ': ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(function_obj.return_type.toLowerCase()));
  19680. ret += ' [ ] [ ] </div>';
  19681. } else {
  19682. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(function_obj.return_type.toLowerCase())) + '</div>';
  19683. }
  19684. ret += '<div class="menu">';
  19685. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  19686. ret += '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions < 1 ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + '</div>';
  19687. }
  19688. ret += '<div class="item ' + (function_obj.return_dimensions == 1 ? ' selected ' : '') + '">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('vector') + '<div class="menu">';
  19689. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  19690. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  19691. continue;
  19692. }
  19693. ret += '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions == 1 ? ' selected ' : '') + '" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + ' [ ] " data-type="' + tm + '" data-dimensions="1"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + '</div>';
  19694. }
  19695. ret += '</div></div>';
  19696. ret += '<div class="item ' + (function_obj.return_dimensions == 2 ? ' selected ' : '') + '">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('matrix') + '<div class="menu">';
  19697. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  19698. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  19699. continue;
  19700. }
  19701. ret += '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions == 2 ? ' selected ' : '') + '" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('matrix') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + ' [ ] " data-type="' + tm + '" data-dimensions="2"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + '</div>';
  19702. }
  19703. ret += '</div></div>';
  19704. ret += '</div></div>';
  19705. ret = $(ret);
  19706. function_element.find('.function_return').append(ret);
  19707. }
  19708. var cont = 0;
  19709. function renderFunction(function_obj) {
  19710. var appender = '<div class="ui secondary segment function_div list-group-item function_cont_' + cont + '">';
  19711. if (function_obj.function_comment) {//appender += renderComment(function_obj.function_comment, sequence, true, -1);
  19712. }
  19713. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  19714. appender += (function_obj.is_main ? '<div class="div_start_minimize_v"> </div>' : '<button class="ui icon button large remove_function_button"><i class="red icon times"></i></button>') + '<button class="ui icon button tiny minimize_function_button"><i class="icon window minimize"></i></button>';
  19715. appender += '<div class="function_signature_div">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("function") + ' ';
  19716. if (function_obj.is_main) {
  19717. appender += '<div class="function_name_div"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('type_void') + ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="span_name_function" >' + function_obj.name + '</span> </div> ' + ' <span class="parethesis_function">( </span> <div class="ui large labels parameters_list">';
  19718. } else {
  19719. appender += '<div class="ui function_return"></div>';
  19720. appender += '<div class="function_name_div function_name_div_updated"><span class="span_name_function name_function_updated">' + function_obj.name + '</span> </div> ' + ' <span class="parethesis_function"> ( </span> <i class="ui icon plus square outline add_parameter_button"></i> <div class="ui large labels parameters_list container_parameters_list">';
  19721. }
  19722. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  19723. appender += '<div class="ui add_var_context add_var_button_function" style="float: left;"> <div class="ui icon button purple"> ';
  19724. appender += '<i class="icons"><i class="icon superscript" style="margin-top: -2px;margin-bottom: 2px;margin-left: 1px;margin-right: 1px;"></i><i class="corner add icon inverted" style="font-size: 9px;padding-top: 6px;padding-left: 9px;"></i></i>';
  19725. appender += '</div></div>';
  19726. appender += '<div class="ui top attached segment variables_list_div"></div>';
  19727. appender += '<div class="ui bottom attached segment commands_list_div commands_cont_' + cont + '">' + '<div class="ui rail" style="width: 35px; margin-left: -36px;"><div class="ui sticky sticky_cont_' + cont + '" style="top: 50px !important;">';
  19728. appender += '<div class="ui icon button dropdown menu_commands orange" > ' + '<i class="icons"><i class="icon code" style="margin-top: -1px;margin-bottom: 1px;margin-right: 0px;"></i><i class="corner add icon inverted" style="font-size: 9px;padding-top: 6px;padding-left: 9px;"></i></i>' + '<div class="menu"> ';
  19729. appender += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.reader + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_read_var') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.writer + '"><i class="upload icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_write_var') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.comment + '"><i class="quote left icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_comment') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.attribution + '"><i class="arrow left icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_attribution') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.functioncall + '"><i class="hand point right icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_functioncall') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.iftrue + '" ><i class="random icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_iftrue') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.repeatNtimes + '"><i class="sync icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_repeatNtimes') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.whiletrue + '"><i class="sync icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_whiletrue') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.dowhiletrue + '"><i class="sync icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_dowhiletrue') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES["switch"] + '"><i class="list icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_switch') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES["return"] + '"><i class="reply icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_btn_return') + '</a>' + '</div></div>';
  19730. appender += '</div></div>' + '</div>';
  19731. appender += '</div></div>';
  19732. appender = $(appender);
  19733. $('.all_functions').append(appender);
  19734. appender.data('fun', function_obj);
  19735. appender.find('.commands_list_div').data('fun', function_obj);
  19736. renderFunctionReturn(function_obj, appender);
  19737. addHandlers(function_obj, appender); // Rendering parameters:
  19738. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  19739. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  19740. } // Rendering variables:
  19741. for (var j = 0; j < function_obj.variables_list.length; j++) {
  19742. _variables__WEBPACK_IMPORTED_MODULE_4__.renderVariable(appender, function_obj.variables_list[j], function_obj);
  19743. } // Rendering commands:
  19744. for (var j = 0; j < function_obj.commands.length; j++) {
  19745. _commands__WEBPACK_IMPORTED_MODULE_5__.renderCommand(function_obj.commands[j], $(appender.find('.commands_list_div')[0]), 3, function_obj);
  19746. }
  19747. appender.find('.minimize_function_button').popup({
  19748. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_hide_function"),
  19749. delay: {
  19750. show: 750,
  19751. hide: 0
  19752. }
  19753. });
  19754. appender.find('.move_function').popup({
  19755. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("btn_drag_and_drop_function"),
  19756. delay: {
  19757. show: 1000,
  19758. hide: 0
  19759. }
  19760. });
  19761. appender.find('.remove_function_button').popup({
  19762. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("btn_delete_function"),
  19763. delay: {
  19764. show: 750,
  19765. hide: 0
  19766. }
  19767. });
  19768. appender.find('.add_var_button_function').popup({
  19769. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("btn_add_var"),
  19770. delay: {
  19771. show: 750,
  19772. hide: 0
  19773. }
  19774. });
  19775. appender.find('a[data-command="attribution"]').popup({
  19776. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_attribution"),
  19777. position: 'right center',
  19778. delay: {
  19779. show: 750,
  19780. hide: 0
  19781. }
  19782. });
  19783. appender.find('a[data-command="functioncall"]').popup({
  19784. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_call_function"),
  19785. position: 'right center',
  19786. delay: {
  19787. show: 750,
  19788. hide: 0
  19789. }
  19790. });
  19791. appender.find('a[data-command="iftrue"]').popup({
  19792. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_if_else"),
  19793. position: 'right center',
  19794. delay: {
  19795. show: 750,
  19796. hide: 0
  19797. }
  19798. });
  19799. appender.find('a[data-command="comment"]').popup({
  19800. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_comments"),
  19801. position: 'right center',
  19802. delay: {
  19803. show: 750,
  19804. hide: 0
  19805. }
  19806. });
  19807. appender.find('a[data-command="reader"]').popup({
  19808. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_read"),
  19809. position: 'right center',
  19810. delay: {
  19811. show: 750,
  19812. hide: 0
  19813. }
  19814. });
  19815. appender.find('a[data-command="writer"]').popup({
  19816. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_write"),
  19817. position: 'right center',
  19818. delay: {
  19819. show: 750,
  19820. hide: 0
  19821. }
  19822. });
  19823. appender.find('a[data-command="repeatNtimes"]').popup({
  19824. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_repeat_n_times"),
  19825. position: 'right center',
  19826. delay: {
  19827. show: 750,
  19828. hide: 0
  19829. }
  19830. });
  19831. appender.find('a[data-command="whiletrue"]').popup({
  19832. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_repeat_whiletrue"),
  19833. position: 'right center',
  19834. delay: {
  19835. show: 750,
  19836. hide: 0
  19837. }
  19838. });
  19839. appender.find('a[data-command="dowhiletrue"]').popup({
  19840. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_repeat_dowhiletrue"),
  19841. position: 'right center',
  19842. delay: {
  19843. show: 750,
  19844. hide: 0
  19845. }
  19846. });
  19847. appender.find('a[data-command="switch"]').popup({
  19848. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_repeat_switch"),
  19849. position: 'right center',
  19850. delay: {
  19851. show: 750,
  19852. hide: 0
  19853. }
  19854. });
  19855. appender.find('a[data-command="return"]').popup({
  19856. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_repeat_return"),
  19857. position: 'right center',
  19858. delay: {
  19859. show: 750,
  19860. hide: 0
  19861. }
  19862. });
  19863. var function_index = program.functions.indexOf(function_obj);
  19864. Sortable.create(appender.find(".variables_list_div")[0], {
  19865. handle: '.ellipsis',
  19866. animation: 100,
  19867. ghostClass: 'ghost',
  19868. group: 'local_vars_drag_' + function_index,
  19869. onEnd: function onEnd(evt) {
  19870. updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  19871. }
  19872. });
  19873. addSortableHandler(appender.find(".commands_list_div")[0], function_index);
  19874. if (!function_obj.is_main) {
  19875. Sortable.create(appender.find(".container_parameters_list")[0], {
  19876. handle: '.ellipsis',
  19877. animation: 100,
  19878. ghostClass: 'ghost',
  19879. group: 'parameters_drag_' + program.functions.indexOf(function_obj),
  19880. onEnd: function onEnd(evt) {
  19881. updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
  19882. }
  19883. });
  19884. }
  19885. if (function_obj.commands.length > 0) {
  19886. var teste = '.ui.sticky.sticky_cont_' + cont;
  19887. $(teste).sticky({
  19888. context: '.ui.bottom.attached.segment.commands_list_div.commands_cont_' + cont,
  19889. scrollContext: '.ivprog_visual_panel',
  19890. observeChanges: true,
  19891. offset: 40,
  19892. onStick: function onStick(evt) {
  19893. $(teste).css('top', '20px', 'important');
  19894. },
  19895. onBottom: function onBottom(evt) {
  19896. $(teste).css('top', '20px', 'important');
  19897. },
  19898. onUnstick: function onUnstick(evt) {
  19899. $(teste).css('top', '20px', 'important');
  19900. },
  19901. onReposition: function onReposition(evt) {
  19902. $(teste).css('top', '20px', 'important');
  19903. },
  19904. onScroll: function onScroll(evt) {
  19905. $(teste).css('top', '20px', 'important');
  19906. if (!isVisible($(teste), $(teste).parent())) {
  19907. $(teste).removeClass('fixed');
  19908. }
  19909. },
  19910. onTop: function onTop(evt) {
  19911. $(teste).css('top', '20px', 'important');
  19912. }
  19913. });
  19914. }
  19915. cont++;
  19916. appender.find('.add_parameter_button').popup({
  19917. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_add_parameters"),
  19918. delay: {
  19919. show: 750,
  19920. hide: 0
  19921. }
  19922. });
  19923. return appender;
  19924. }
  19925. function isVisible(element, container) {
  19926. var elementTop = $(element).offset().top,
  19927. elementHeight = $(element).height(),
  19928. containerTop = $(container).offset().top,
  19929. containerHeight = $(container).height() - 30;
  19930. return elementTop - containerTop + elementHeight > 0 && elementTop - containerTop < containerHeight;
  19931. }
  19932. window.evento_drag;
  19933. function updateProgramObjDrag() {
  19934. var nodes = Array.prototype.slice.call($('.all_functions').children());
  19935. var function_index;
  19936. var start_index;
  19937. var function_obj;
  19938. $(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  19939. var ref = $(this);
  19940. if (ref.hasClass('function_div')) {
  19941. function_index = nodes.indexOf(this);
  19942. start_index = index;
  19943. function_obj = ref;
  19944. }
  19945. });
  19946. var path_target = [];
  19947. $(evento_drag.item).parentsUntil(".all_functions").each(function () {
  19948. if ($(this).hasClass('command_container')) {
  19949. path_target.push(this);
  19950. }
  19951. });
  19952. if (path_target.length == 0) {//console.log('soltou na raiz, na posição: ' + evento_drag.newIndex + ' mas ainda não sei de onde saiu ');
  19953. } else {//console.log('soltou dentro de algum bloco, sequência vem logo abaixo (de baixo pra cima): ');
  19954. //console.log(path_target);
  19955. }
  19956. var index_each = [];
  19957. var path_relative = [];
  19958. for (var i = path_target.length - 1; i >= 0; i--) {
  19959. if (i == path_target.length - 1) {
  19960. // está na raiz
  19961. var indice_na_raiz = function_obj.find('.command_container').index(path_target[i]);
  19962. } else {
  19963. if ($(path_target[i + 1]).hasClass('iftrue')) {
  19964. if ($(path_target[i]).parent().hasClass('commands_if')) {
  19965. path_relative.push('if');
  19966. index_each.push($(path_target[i]).parent().find('.command_container').index(path_target[i]));
  19967. } else {
  19968. path_relative.push('else');
  19969. index_each.push($(path_target[i]).parent().find('.command_container').index(path_target[i]));
  19970. }
  19971. } else if ($(path_target[i + 1]).hasClass('dowhiletrue')) {
  19972. path_relative.push('dowhiletrue');
  19973. index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19974. } else if ($(path_target[i + 1]).hasClass('repeatNtimes')) {
  19975. path_relative.push('repeatNtimes');
  19976. index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19977. } else if ($(path_target[i + 1]).hasClass('whiletrue')) {
  19978. path_relative.push('whiletrue');
  19979. index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19980. } else if ($(path_target[i + 1]).hasClass('switch')) {
  19981. path_relative.push('switch'); //index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19982. }
  19983. }
  19984. } // var index_in_block = -1;
  19985. var is_in_else = $(evento_drag.item).parent().hasClass('commands_else'); // index_in_block = $(evento_drag.item).parent().find('.command_container').index(evento_drag.item);
  19986. var is_in_case_switch = $(evento_drag.item).parent().hasClass('case_commands_block'); // encontrar o elemento na árvore:
  19987. var command_start_point = window.program_obj.functions[function_index].commands[indice_na_raiz];
  19988. var block_to_insert = command_start_point;
  19989. for (var i = 0; i < index_each.length; i++) {
  19990. if (path_relative[i] == "else") {
  19991. block_to_insert = block_to_insert.commands_else[index_each[i]];
  19992. } else if (path_relative[i] == "switch") {} else {
  19993. block_to_insert = block_to_insert.commands_block[index_each[i]];
  19994. }
  19995. } //console.log('command_start_point', command_start_point);
  19996. //console.log('block_to_insert', block_to_insert);
  19997. // agora tem que alocar o comando na árvore, mas considerar as quatro situações:
  19998. // (1) se está em um else ou (2) se está em switch ou (3) será um caso padrão ou (4) se será na raiz.
  19999. if (path_target.length == 0) {
  20000. // soltou na raiz:
  20001. window.program_obj.functions[function_index].commands.splice(evento_drag.newIndex - 1, 0, command_in_drag);
  20002. } else if (is_in_else) {
  20003. if (block_to_insert.commands_else) {
  20004. block_to_insert.commands_else.splice(evento_drag.newIndex, 0, command_in_drag);
  20005. } else {
  20006. block_to_insert.commands_else = [];
  20007. block_to_insert.commands_else.push(command_in_drag);
  20008. }
  20009. } else if (is_in_case_switch) {} else {
  20010. // verificar se tem alguma coisa no bloco:
  20011. if (block_to_insert.commands_block) {
  20012. block_to_insert.commands_block.splice(evento_drag.newIndex, 0, command_in_drag);
  20013. } else {
  20014. block_to_insert.commands_block = [];
  20015. block_to_insert.commands_block.push(command_in_drag);
  20016. }
  20017. }
  20018. window.draging = false;
  20019. renderAlgorithm();
  20020. }
  20021. function prepareDragHandler(evt) {
  20022. window.draging = true;
  20023. var nodes = Array.prototype.slice.call($('.all_functions').children());
  20024. var function_index;
  20025. var function_obj;
  20026. $(evt.item).parentsUntil(".all_functions").each(function (index) {
  20027. if ($(this).hasClass('function_div')) {
  20028. function_index = nodes.indexOf(this);
  20029. function_obj = window.program_obj.functions[function_index];
  20030. }
  20031. });
  20032. command_in_drag = $(evt.item).data("command"); //console.log('$(evt.item).parent(): ');
  20033. //console.log($(evt.item).parent());
  20034. // descobrir qual das quatro situações:
  20035. if ($(evt.item).parent().hasClass('commands_list_div')) {
  20036. // está na raiz:
  20037. if (function_obj.commands.indexOf(command_in_drag) > -1) {
  20038. function_obj.commands.splice(function_obj.commands.indexOf(command_in_drag), 1);
  20039. }
  20040. } else if ($(evt.item).parent().hasClass('commands_else')) {
  20041. // está no else:
  20042. if ($(evt.item).parent().data('command').commands_else.indexOf(command_in_drag) > -1) {
  20043. $(evt.item).parent().data('command').commands_else.splice($(evt.item).parent().data('command').commands_else.indexOf(command_in_drag), 1);
  20044. }
  20045. } else if ($(evt.item).parent().hasClass('case_commands_block')) {// está em um switch:
  20046. } else {
  20047. // caso padrão:
  20048. if ($(evt.item).parent().data('command').commands_block.indexOf(command_in_drag) > -1) {
  20049. $(evt.item).parent().data('command').commands_block.splice($(evt.item).parent().data('command').commands_block.indexOf(command_in_drag), 1);
  20050. }
  20051. }
  20052. }
  20053. var command_in_drag;
  20054. function addSortableHandler(element, id_function) {
  20055. var n_group = 'commands_drag_' + id_function;
  20056. Sortable.create(element, {
  20057. handle: '.command_drag',
  20058. ghostClass: 'ghost',
  20059. animation: 300,
  20060. group: {
  20061. name: n_group
  20062. },
  20063. onEnd: function onEnd(evt) {
  20064. var nodes = Array.prototype.slice.call($('.all_functions').children());
  20065. var function_index;
  20066. var function_obj;
  20067. $(evt.item).parentsUntil(".all_functions").each(function (index) {
  20068. if ($(this).hasClass('function_div')) {
  20069. function_index = nodes.indexOf(this);
  20070. function_obj = window.program_obj.functions[function_index];
  20071. }
  20072. });
  20073. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.MOVE_COMMAND, $(evt.item).data('command').type, '/', 'from: ' + evt.oldIndex + ' to: ' + evt.newIndex); //updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  20074. var itemEl = evt.item; // dragged HTMLElement
  20075. evt.to; // target list
  20076. evt.from; // previous list
  20077. evt.oldIndex; // element's old index within old parent
  20078. evt.newIndex; // element's new index within new parent
  20079. //console.log('::EVT::');
  20080. //console.log(evt);
  20081. window.evento_drag = evt;
  20082. try {
  20083. updateProgramObjDrag();
  20084. } catch (e) {
  20085. console.error(e);
  20086. window.draging = false;
  20087. }
  20088. },
  20089. onStart: function onStart(evt) {
  20090. //console.log("START::EVT::");
  20091. //console.log(evt);
  20092. //console.log("\n\ncommand_in_drag");
  20093. try {
  20094. prepareDragHandler(evt);
  20095. } catch (e) {
  20096. window.draging = false;
  20097. }
  20098. }
  20099. });
  20100. element = $(element);
  20101. element.find(".iftrue").each(function (index) {
  20102. addSortableHandler($(this).find(".block_commands")[0], id_function);
  20103. addSortableHandler($(this).find(".block_commands")[1], id_function);
  20104. });
  20105. element.find(".repeatNtimes").each(function (index) {
  20106. addSortableHandler($(this).find(".block_commands")[0], id_function);
  20107. });
  20108. element.find(".dowhiletrue").each(function (index) {
  20109. addSortableHandler($(this).find(".block_commands")[0], id_function);
  20110. });
  20111. element.find(".whiletrue").each(function (index) {
  20112. addSortableHandler($(this).find(".block_commands")[0], id_function);
  20113. });
  20114. element.find(".switch").each(function (index) {
  20115. $(this).find(".case_div").each(function (index) {
  20116. addSortableHandler($(this).find(".case_commands_block")[0], id_function);
  20117. });
  20118. });
  20119. }
  20120. function initVisualUI() {
  20121. // MUST USE CONST, LET, OR VAR !!!!!!
  20122. // const mainDiv = $('#visual-main-div');
  20123. // fill mainDiv with functions and globals...
  20124. // renderAlgorithm()...
  20125. domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_8__.DOMConsole("ivprog-term-div");
  20126. domConsole.hide();
  20127. $(document.getElementById("ivprog-term-div")).draggable();
  20128. $('.add_function_button').on('click', function () {
  20129. addFunctionHandler();
  20130. }).popup({
  20131. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_add_function"),
  20132. delay: {
  20133. show: 750,
  20134. hide: 0
  20135. }
  20136. });
  20137. $('.add_global_button').on('click', function () {
  20138. window.insertContext = true;
  20139. _globals__WEBPACK_IMPORTED_MODULE_3__.addGlobal(program, true);
  20140. });
  20141. $('#run_button').on('click', function () {
  20142. showStopButton();
  20143. runCode();
  20144. });
  20145. $('#download_file_button').on('click', function () {
  20146. downloadFile();
  20147. });
  20148. $('#upload_file_button').on('click', function () {
  20149. $('#ivph_file').click().off('change').change(uploadFile);
  20150. });
  20151. $('#stop_button').on('click', function () {
  20152. showRunButton();
  20153. stopExecution();
  20154. });
  20155. $('.visual_coding_button').on('click', function () {
  20156. toggleVisualCoding();
  20157. });
  20158. $('.textual_coding_button').on('click', function () {
  20159. toggleTextualCoding();
  20160. });
  20161. $('.assessment').on('click', function () {
  20162. is_iassign = true;
  20163. runCodeAssessment();
  20164. });
  20165. $('.div_toggle_console').on('click', function () {
  20166. toggleConsole();
  20167. });
  20168. $('.expand_button').on('click', function () {
  20169. full_screen();
  20170. });
  20171. $('.help_button').on('click', function () {
  20172. window.open('https://www.usp.br/line/ivprog/', '_blank');
  20173. });
  20174. $('.main_title h2').prop('title', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_ivprog_description'));
  20175. var time_show = 750;
  20176. $('.visual_coding_button').popup({
  20177. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_visual"),
  20178. delay: {
  20179. show: time_show,
  20180. hide: 0
  20181. }
  20182. });
  20183. $('.textual_coding_button').popup({
  20184. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_textual"),
  20185. delay: {
  20186. show: time_show,
  20187. hide: 0
  20188. }
  20189. });
  20190. $('.upload_file_button').popup({
  20191. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_upload"),
  20192. delay: {
  20193. show: time_show,
  20194. hide: 0
  20195. }
  20196. });
  20197. $('.download_file_button').popup({
  20198. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_download"),
  20199. delay: {
  20200. show: time_show,
  20201. hide: 0
  20202. }
  20203. });
  20204. $('.undo_button').popup({
  20205. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_undo"),
  20206. delay: {
  20207. show: time_show,
  20208. hide: 0
  20209. }
  20210. });
  20211. $('.redo_button').popup({
  20212. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_redo"),
  20213. delay: {
  20214. show: time_show,
  20215. hide: 0
  20216. }
  20217. });
  20218. $('.run_button').popup({
  20219. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_run"),
  20220. delay: {
  20221. show: time_show,
  20222. hide: 0
  20223. }
  20224. });
  20225. $('.assessment_button').popup({
  20226. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_evaluate"),
  20227. delay: {
  20228. show: time_show,
  20229. hide: 0
  20230. }
  20231. });
  20232. $('.help_button').popup({
  20233. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_help") + ' - ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_ivprog_version") + ' ' + ivprog_version,
  20234. delay: {
  20235. show: time_show,
  20236. hide: 0
  20237. }
  20238. });
  20239. $('.add_global_button').popup({
  20240. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_add_global"),
  20241. delay: {
  20242. show: time_show,
  20243. hide: 0
  20244. }
  20245. });
  20246. $('.div_toggle_console').popup({
  20247. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_console"),
  20248. delay: {
  20249. show: time_show,
  20250. hide: 0
  20251. }
  20252. });
  20253. Sortable.create(listWithHandle, {
  20254. handle: '.glyphicon-move',
  20255. animation: 100,
  20256. ghostClass: 'ghost',
  20257. group: 'functions_divs_drag',
  20258. onEnd: function onEnd(evt) {
  20259. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  20260. }
  20261. });
  20262. var listGlobalsHandle = document.getElementById("listGlobalsHandle");
  20263. Sortable.create(listGlobalsHandle, {
  20264. handle: '.ellipsis',
  20265. animation: 100,
  20266. ghostClass: 'ghost',
  20267. group: 'globals_divs_drag',
  20268. onEnd: function onEnd(evt) {
  20269. updateSequenceGlobals(evt.oldIndex, evt.newIndex);
  20270. }
  20271. });
  20272. }
  20273. function setTestCases(testCases) {
  20274. _testCases = testCases;
  20275. }
  20276. function getTestCases() {
  20277. // Deep clone of test cases to avoid unauthorized modification
  20278. // TODO: It may be not possible to use this once custom test are fully implemented
  20279. return JSON.parse(JSON.stringify(_testCases));
  20280. }
  20281. var is_iassign = false;
  20282. function updateSequenceParameters(oldIndex, newIndex, function_obj) {
  20283. function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
  20284. }
  20285. function updateSequenceLocals(oldIndex, newIndex, function_obj) {
  20286. function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
  20287. }
  20288. function updateSequenceGlobals(oldIndex, newIndex) {
  20289. program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
  20290. }
  20291. function updateSequenceFunction(oldIndex, newIndex) {
  20292. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  20293. }
  20294. function runCodeAssessment() {
  20295. if (isRunning) {
  20296. // cannot run assessment or it's already running
  20297. return -1;
  20298. }
  20299. var strCode = null;
  20300. is_iassign = false;
  20301. window.studentGrade = null;
  20302. if (settingsProgrammingTypes == "textual") {
  20303. strCode = _text_editor__WEBPACK_IMPORTED_MODULE_17__.getCode();
  20304. } else {
  20305. strCode = _code_generator__WEBPACK_IMPORTED_MODULE_6__.generate();
  20306. }
  20307. if (strCode == null) {
  20308. // No code, so no assessment
  20309. return -1;
  20310. }
  20311. toggleConsole(true);
  20312. try {
  20313. var data = _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_11__.SemanticAnalyser.analyseFromSource(strCode);
  20314. isRunning = true;
  20315. var runner = new _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_12__.IVProgAssessment(data, _testCases, domConsole);
  20316. runner.runTest().then(function (grade) {
  20317. if (!is_iassign) {
  20318. parent.getEvaluationCallback(grade);
  20319. } else {
  20320. is_iassign = false;
  20321. }
  20322. isRunning = false;
  20323. })["catch"](function (err) {
  20324. console.log(err);
  20325. isRunning = false;
  20326. });
  20327. } catch (error) {
  20328. isRunning = false;
  20329. domConsole.err(error.message);
  20330. console.log(error);
  20331. if (!is_iassign) {
  20332. parent.getEvaluationCallback(0);
  20333. } else {
  20334. is_iassign = false;
  20335. }
  20336. }
  20337. return 0;
  20338. }
  20339. function runCode() {
  20340. if (isRunning) {
  20341. return;
  20342. }
  20343. var strCode = null;
  20344. if (settingsProgrammingTypes == "textual") {
  20345. strCode = _text_editor__WEBPACK_IMPORTED_MODULE_17__.getCode();
  20346. } else {
  20347. strCode = _code_generator__WEBPACK_IMPORTED_MODULE_6__.generate();
  20348. }
  20349. if (strCode == null) {
  20350. return;
  20351. }
  20352. toggleConsole(true); // if(domConsole == null)
  20353. // domConsole = new DOMConsole("#ivprog-term");
  20354. //$("#ivprog-term").slideDown(500);
  20355. try {
  20356. var data = _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_11__.SemanticAnalyser.analyseFromSource(strCode);
  20357. proc = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_9__.IVProgProcessor(data);
  20358. proc.registerInput(domConsole);
  20359. proc.registerOutput(domConsole);
  20360. $("#ivprog-term").addClass('ivprog-term-active');
  20361. isRunning = true;
  20362. proc.interpretAST().then(function (_) {
  20363. scheduleCall(function () {
  20364. if (domConsole.pending_writes.length == 0) {
  20365. if (proc.mode === _processor_modes__WEBPACK_IMPORTED_MODULE_19__.Modes.ABORT) {
  20366. domConsole.info(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getMessage("aborted_execution"));
  20367. } else {
  20368. domConsole.info(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getMessage("success_execution"));
  20369. }
  20370. $("#ivprog-term").removeClass('ivprog-term-active');
  20371. isRunning = false;
  20372. proc = null;
  20373. showRunButton();
  20374. return true;
  20375. }
  20376. return false;
  20377. }, 100);
  20378. })["catch"](function (err) {
  20379. scheduleCall(function () {
  20380. if (domConsole.pending_writes.length == 0) {
  20381. if (err instanceof Error) {
  20382. domConsole.err(err.message);
  20383. } else {
  20384. domConsole.err(err);
  20385. }
  20386. $("#ivprog-term").removeClass('ivprog-term-active');
  20387. isRunning = false;
  20388. proc = null;
  20389. showRunButton();
  20390. return true;
  20391. }
  20392. return false;
  20393. }, 100);
  20394. });
  20395. } catch (error) {
  20396. scheduleCall(function () {
  20397. if (domConsole.pending_writes.length == 0) {
  20398. isRunning = false;
  20399. proc = null;
  20400. showRunButton();
  20401. domConsole.err(error.message);
  20402. console.log(error);
  20403. return true;
  20404. }
  20405. return false;
  20406. }, 100);
  20407. }
  20408. }
  20409. function toggleConsole(is_running) {
  20410. if (is_running) {
  20411. $('.ivprog-term-div').css('display', 'block');
  20412. $('#ivprog-term').css('min-height', '160px');
  20413. if (domConsole != null) domConsole.focus(); //$('#ivprog-term').css('margin-top', '-170px');
  20414. return;
  20415. } else {
  20416. domConsole.hide();
  20417. return;
  20418. }
  20419. if ($('#ivprog-term').css('min-height') == '160px') {
  20420. // esconder
  20421. $('.ivprog-term-div').css('display', 'none');
  20422. $('#ivprog-term').css('min-height', '0'); //$('#ivprog-term').css('margin-top', '-30px');
  20423. //$('#ivprog-term').css('padding', '5px');
  20424. } else {
  20425. // mostrar
  20426. $('.ivprog-term-div').css('display', 'block');
  20427. $('#ivprog-term').css('min-height', '160px'); //$('#ivprog-term').css('margin-top', '-170px');
  20428. }
  20429. } // function waitToCloseConsole () {
  20430. // domConsole.info("Aperte qualquer tecla para fechar...");
  20431. // const p = new Promise((resolve, _) => {
  20432. // domConsole.requestInput(resolve, true);
  20433. // });
  20434. // p.then( _ => {
  20435. // domConsole.dispose();
  20436. // domConsole = null;
  20437. // $("#ivprog-term").hide();
  20438. // })
  20439. // }
  20440. function toggleTextualCoding() {
  20441. var code = null;
  20442. if (settingsProgrammingTypes != "textual") {
  20443. code = _code_generator__WEBPACK_IMPORTED_MODULE_6__.generate();
  20444. if (code == null) {
  20445. return;
  20446. }
  20447. }
  20448. $('.ivprog_visual_panel').css('display', 'none');
  20449. $('.ivprog_textual_panel').css('display', 'block');
  20450. $('.ivprog_textual_panel').removeClass('loading');
  20451. _text_editor__WEBPACK_IMPORTED_MODULE_17__.updateEditor();
  20452. if (code != null) _text_editor__WEBPACK_IMPORTED_MODULE_17__.setCode(code); //$('.ivprog_textual_code').text(code);
  20453. $('.visual_coding_button').removeClass('active');
  20454. $('.textual_coding_button').addClass('active');
  20455. }
  20456. function toggleVisualCoding() {
  20457. $('.ivprog_textual_panel').addClass('loading');
  20458. $('.ivprog_textual_panel').css('display', 'none');
  20459. $('.ivprog_visual_panel').css('display', 'block');
  20460. $('.textual_coding_button').removeClass('active');
  20461. $('.visual_coding_button').addClass('active');
  20462. }
  20463. function removeParameter(function_obj, parameter_obj, parameter_container) {
  20464. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(parameter_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.REMOVE_FUNCTION_PARAM, function_obj.name);
  20465. var index = function_obj.parameters_list.indexOf(parameter_obj);
  20466. if (index > -1) {
  20467. window.insertContext = true;
  20468. function_obj.parameters_list.splice(index, 1);
  20469. }
  20470. $(parameter_container).fadeOut();
  20471. }
  20472. function updateParameterType(parameter_obj, new_type, function_name) {
  20473. var new_dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  20474. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(parameter_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.CHANGE_PARAM_TYPE, function_name, new_type, new_dimensions);
  20475. parameter_obj.type = new_type;
  20476. parameter_obj.dimensions = new_dimensions;
  20477. if (new_dimensions > 0) {
  20478. parameter_obj.rows = new_dimensions;
  20479. parameter_obj.columns = 2;
  20480. }
  20481. }
  20482. function renderParameter(function_obj, parameter_obj, function_container) {
  20483. var ret = "";
  20484. ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
  20485. if (parameter_obj.reference) ret += '<input type="checkbox" checked class="by_reference">';else ret += '<input type="checkbox" class="by_copy">';
  20486. ret += '<div class="ui dropdown parameter_type">';
  20487. if (parameter_obj.dimensions > 0) {
  20488. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(parameter_obj.type.toLowerCase()));
  20489. if (parameter_obj.dimensions == 1) {
  20490. ret += ' [ ] ';
  20491. } else {
  20492. ret += ' [ ] [ ] ';
  20493. }
  20494. ret += '</div>';
  20495. } else {
  20496. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(parameter_obj.type.toLowerCase())) + '</div>';
  20497. }
  20498. ret += '<div class="menu">';
  20499. for (var _tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  20500. if (_tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  20501. continue;
  20502. }
  20503. ret += '<div class="item ' + (parameter_obj.type == _tm.toLowerCase() && parameter_obj.dimensions == 0 ? ' selected ' : '') + '" data-type="' + _tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(_tm.toLowerCase())) + '</div>';
  20504. }
  20505. ret += '<div class="item ' + (parameter_obj.dimensions == 1 ? ' selected ' : '') + '">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('vector') + '<div class="menu">';
  20506. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  20507. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  20508. continue;
  20509. }
  20510. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() && parameter_obj.dimensions == 1 ? ' selected ' : '') + '" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + ' [ ] " data-type="' + tm + '" data-dimensions="1"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + '</div>';
  20511. }
  20512. ret += '</div></div>';
  20513. ret += '<div class="item ' + (parameter_obj.dimensions == 2 ? ' selected ' : '') + '">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('matrix') + '<div class="menu">';
  20514. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  20515. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  20516. continue;
  20517. }
  20518. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() && parameter_obj.dimensions == 2 ? ' selected ' : '') + '" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('matrix') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + ' [ ] " data-type="' + tm + '" data-dimensions="2"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + '</div>';
  20519. }
  20520. ret += '</div></div>';
  20521. ret += '</div></div>';
  20522. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  20523. ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
  20524. ret = $(ret);
  20525. function_container.find('.container_parameters_list').append(ret);
  20526. ret.find('.remove_parameter').on('click', function (e) {
  20527. removeParameter(function_obj, parameter_obj, ret);
  20528. });
  20529. ret.find('.ui.dropdown.parameter_type').dropdown({
  20530. onChange: function onChange(_, __, $selectedItem) {
  20531. if ($selectedItem.data('dimensions')) {
  20532. updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], function_obj.name, $selectedItem.data('dimensions'));
  20533. } else {
  20534. updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], function_obj.name);
  20535. }
  20536. },
  20537. selectOnKeydown: false
  20538. });
  20539. ret.find('.parameter_div_edit').on('click', function (e) {
  20540. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.ENTER_CHANGE_PARAM_NAME, parameter_obj.name);
  20541. enableNameParameterUpdate(parameter_obj, ret, function_obj);
  20542. });
  20543. ret.find('input:checkbox').change(function () {
  20544. parameter_obj.reference = this.checked;
  20545. _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm();
  20546. });
  20547. ret.find('.by_reference').popup({
  20548. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_parameter_reference"),
  20549. delay: {
  20550. show: 750,
  20551. hide: 0
  20552. }
  20553. });
  20554. ret.find('.by_copy').popup({
  20555. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_parameter_copy"),
  20556. delay: {
  20557. show: 750,
  20558. hide: 0
  20559. }
  20560. });
  20561. return ret;
  20562. }
  20563. function updateParameterName(parameter_var, new_name, parameter_obj_dom, function_obj) {
  20564. if (parameter_var.name == new_name) {
  20565. return;
  20566. }
  20567. if ((0,_util_utils__WEBPACK_IMPORTED_MODULE_18__.isValidIdentifier)(new_name)) {
  20568. if (variableNameAlreadyExists(new_name, function_obj)) {
  20569. _utils__WEBPACK_IMPORTED_MODULE_14__.renderErrorMessage(parameter_obj_dom.find('.parameter_div_edit'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getError('inform_valid_param_duplicated', [new_name, function_obj.name]));
  20570. } else {
  20571. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.RENAME_FUNCTION_PARAM, parameter_var.name, new_name);
  20572. parameter_var.name = new_name;
  20573. }
  20574. } else {
  20575. _utils__WEBPACK_IMPORTED_MODULE_14__.renderErrorMessage(parameter_obj_dom.find('.parameter_div_edit'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getError('inform_valid_identifier'));
  20576. }
  20577. }
  20578. function variableNameAlreadyExists(name_var, function_obj) {
  20579. if (function_obj.parameters_list) {
  20580. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  20581. if (function_obj.parameters_list[i].name == name_var) {
  20582. return true;
  20583. }
  20584. }
  20585. }
  20586. if (function_obj.variables_list) {
  20587. for (var i = 0; i < function_obj.variables_list.length; i++) {
  20588. if (function_obj.variables_list[i].name == name_var) {
  20589. return true;
  20590. }
  20591. }
  20592. }
  20593. return false;
  20594. }
  20595. function updateFunctionName(function_var, new_name, function_obj_dom) {
  20596. if (function_var.name == new_name) {
  20597. return;
  20598. }
  20599. if ((0,_util_utils__WEBPACK_IMPORTED_MODULE_18__.isValidIdentifier)(new_name)) {
  20600. if (functionNameAlreadyExists(new_name)) {
  20601. _utils__WEBPACK_IMPORTED_MODULE_14__.renderErrorMessage(function_obj_dom.find('.function_name_div'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getError('inform_valid_function_duplicated', [new_name]));
  20602. } else {
  20603. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.RENAME_FUNCTION, new_name);
  20604. function_var.name = new_name;
  20605. }
  20606. } else {
  20607. _utils__WEBPACK_IMPORTED_MODULE_14__.renderErrorMessage(function_obj_dom.find('.function_name_div'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getError('inform_valid_identifier'));
  20608. }
  20609. }
  20610. function functionNameAlreadyExists(function_name) {
  20611. for (var i = 0; i < window.program_obj.functions.length; i++) {
  20612. if (window.program_obj.functions[i].name == function_name) {
  20613. return true;
  20614. }
  20615. }
  20616. return false;
  20617. }
  20618. var opened_name_parameter = false;
  20619. var opened_input_parameter = null;
  20620. function enableNameParameterUpdate(parameter_obj, parent_node, function_obj) {
  20621. if (opened_name_parameter) {
  20622. opened_input_parameter.focus();
  20623. return;
  20624. }
  20625. opened_name_parameter = true;
  20626. parent_node = $(parent_node);
  20627. var input_field;
  20628. parent_node.find('.span_name_parameter').text('');
  20629. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parameter_obj.name + "' />");
  20630. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  20631. input_field.on('input', function () {
  20632. var inputWidth = input_field.textWidth() + 10;
  20633. opened_input_parameter = input_field;
  20634. input_field.focus();
  20635. var tmpStr = input_field.val();
  20636. input_field.val('');
  20637. input_field.val(tmpStr);
  20638. input_field.css({
  20639. width: inputWidth
  20640. });
  20641. }).trigger('input');
  20642. input_field.focusout(function () {
  20643. /// update array:
  20644. if (input_field.val().trim()) {
  20645. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  20646. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  20647. }
  20648. input_field.off();
  20649. input_field.remove(); /// update elements:
  20650. opened_name_parameter = false;
  20651. opened_input_parameter = false;
  20652. });
  20653. input_field.on('keydown', function (e) {
  20654. var code = e.keyCode || e.which;
  20655. if (code == 13) {
  20656. if (input_field.val().trim()) {
  20657. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  20658. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  20659. }
  20660. input_field.off();
  20661. input_field.remove(); /// update elements:
  20662. opened_name_parameter = false;
  20663. opened_input_parameter = false;
  20664. }
  20665. if (code == 27) {
  20666. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  20667. input_field.off();
  20668. input_field.remove(); /// update elements:
  20669. opened_name_parameter = false;
  20670. opened_input_parameter = false;
  20671. }
  20672. });
  20673. input_field.select();
  20674. }
  20675. var opened_name_function = false;
  20676. var opened_input = null;
  20677. var previousPadding = null;
  20678. function enableNameFunctionUpdate(function_obj, parent_node) {
  20679. if (opened_name_function) {
  20680. opened_input.focus();
  20681. return;
  20682. }
  20683. parent_node = $(parent_node);
  20684. parent_node.find('.span_name_function').text('');
  20685. var input_field;
  20686. if (!previousPadding) {
  20687. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  20688. }
  20689. parent_node.find('.span_name_function').css('padding-left', '0');
  20690. parent_node.find('.span_name_function').css('padding-right', '0');
  20691. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + function_obj.name + "' />");
  20692. input_field.insertBefore(parent_node.find('.span_name_function'));
  20693. input_field.on('input', function () {
  20694. var inputWidth = input_field.textWidth() + 10;
  20695. opened_input = input_field;
  20696. input_field.focus();
  20697. var tmpStr = input_field.val();
  20698. input_field.val('');
  20699. input_field.val(tmpStr);
  20700. input_field.css({
  20701. width: inputWidth
  20702. });
  20703. }).trigger('input');
  20704. input_field.focusout(function () {
  20705. /// update array:
  20706. if (input_field.val().trim()) {
  20707. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  20708. }
  20709. input_field.off();
  20710. input_field.remove();
  20711. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  20712. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  20713. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  20714. opened_name_function = false;
  20715. opened_input = false;
  20716. });
  20717. input_field.on('keydown', function (e) {
  20718. var code = e.keyCode || e.which;
  20719. if (code == 13) {
  20720. if (input_field.val().trim()) {
  20721. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  20722. }
  20723. input_field.off();
  20724. input_field.remove();
  20725. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  20726. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  20727. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  20728. opened_name_function = false;
  20729. opened_input = false;
  20730. }
  20731. if (code == 27) {
  20732. input_field.off();
  20733. input_field.remove();
  20734. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  20735. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  20736. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  20737. opened_name_function = false;
  20738. opened_input = false;
  20739. }
  20740. });
  20741. input_field.select();
  20742. }
  20743. function addFunctionChangeListener(callback) {
  20744. functionsChangeListeners.push(callback);
  20745. return functionsChangeListeners.length - 1;
  20746. }
  20747. function addGlobalChangeListener(callback) {
  20748. globalChangeListeners.push(callback);
  20749. return globalChangeListeners.length - 1;
  20750. }
  20751. function removeGlobalListener(index) {
  20752. globalChangeListeners.splice(index, 1);
  20753. }
  20754. function removeFunctionListener(index) {
  20755. functionsChangeListeners.splice(index);
  20756. }
  20757. function scheduleCall(callback, time) {
  20758. var scheduled_call = function scheduled_call() {
  20759. var id = setInterval(function () {
  20760. if (callback()) {
  20761. clearInterval(id);
  20762. }
  20763. }, time);
  20764. };
  20765. scheduled_call();
  20766. }
  20767. function showRunButton() {
  20768. document.getElementById('run_button').style.display = 'inline';
  20769. document.getElementById('stop_button').style.display = 'none';
  20770. }
  20771. function showStopButton() {
  20772. document.getElementById('run_button').style.display = 'none';
  20773. document.getElementById('stop_button').style.display = 'inline';
  20774. }
  20775. function stopExecution() {
  20776. domConsole.clearPendingWrites();
  20777. domConsole.cancelPendingInputRequests();
  20778. if (!isRunning) {
  20779. return;
  20780. }
  20781. proc.mode = _processor_modes__WEBPACK_IMPORTED_MODULE_19__.Modes.ABORT;
  20782. }
  20783. function downloadFile() {
  20784. var contentToSend = '{}\n::algorithm::';
  20785. contentToSend = generator();
  20786. var date = new Date();
  20787. var temp = date.toISOString().split('T')[0] + "_" + date.toTimeString().split(' ')[0].replaceAll(':', '-');
  20788. var blob = new Blob([contentToSend], {
  20789. type: "text/plain;charset=utf-8"
  20790. });
  20791. saveAs(blob, "ivprog-exported_" + temp + ".ivph");
  20792. }
  20793. function uploadFile(evt) {
  20794. var oFReader = new FileReader();
  20795. oFReader.readAsText(document.getElementById("ivph_file").files[0]);
  20796. oFReader.onload = function (oFREvent) {
  20797. var txt = oFREvent.target.result;
  20798. try {
  20799. ivprogCore.setPreviousAlgorithm(txt);
  20800. window.renderAlgorithm();
  20801. } catch (e) {
  20802. showInvalidFile();
  20803. }
  20804. };
  20805. }
  20806. /***/ }),
  20807. /***/ "./js/visualUI/globals.js":
  20808. /*!********************************!*\
  20809. !*** ./js/visualUI/globals.js ***!
  20810. \********************************/
  20811. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  20812. "use strict";
  20813. __webpack_require__.r(__webpack_exports__);
  20814. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  20815. /* harmony export */ "addGlobal": () => (/* binding */ addGlobal),
  20816. /* harmony export */ "renderGlobal": () => (/* binding */ renderGlobal)
  20817. /* harmony export */ });
  20818. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20819. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  20820. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  20821. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  20822. /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../services/userLog */ "./js/services/userLog.js");
  20823. var counter_new_globals = 0;
  20824. function addGlobal(program) {
  20825. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  20826. // Verify if the next global name is in use:
  20827. if (program.globals) {
  20828. var in_use = false;
  20829. do {
  20830. in_use = false;
  20831. var temp_name = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals;
  20832. program.globals.forEach(function (el) {
  20833. if (temp_name == el.name) {
  20834. in_use = true;
  20835. }
  20836. });
  20837. if (in_use) counter_new_globals++;
  20838. } while (in_use);
  20839. }
  20840. var new_global = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.Variable(_types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals, 0);
  20841. counter_new_globals++;
  20842. program.addGlobal(new_global);
  20843. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(new_global.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.INSERT_GLOBAL_VAR);
  20844. var newe = renderGlobal(new_global);
  20845. if (is_from_click) {
  20846. newe.css('display', 'none');
  20847. newe.fadeIn();
  20848. }
  20849. }
  20850. function toggleConstant(global_var) {
  20851. global_var.is_constant = !global_var.is_constant;
  20852. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.SET_GLOBAL_CONST);
  20853. }
  20854. function updateName(global_var, new_name, global_obj_dom) {
  20855. if (global_var.name == new_name) {
  20856. return;
  20857. }
  20858. if (isValidIdentifier(new_name)) {
  20859. if (globalNameAlreadyExists(new_name)) {
  20860. _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(global_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('inform_valid_global_duplicated'));
  20861. } else {
  20862. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.RENAME_GLOBAL_VAR, new_name);
  20863. global_var.name = new_name;
  20864. }
  20865. } else {
  20866. _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(global_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('inform_valid_name'));
  20867. }
  20868. }
  20869. function globalNameAlreadyExists(global_name) {
  20870. for (var i = 0; i < window.program_obj.globals.length; i++) {
  20871. if (window.program_obj.globals[i].name == global_name) {
  20872. return true;
  20873. }
  20874. }
  20875. return false;
  20876. }
  20877. function isValidIdentifier(identifier_str) {
  20878. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  20879. }
  20880. function updateType(global_var, new_type) {
  20881. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20882. global_var.type = new_type;
  20883. global_var.dimensions = new_dimensions;
  20884. if (new_dimensions > 0) {
  20885. global_var.rows = new_dimensions;
  20886. global_var.columns = 2;
  20887. }
  20888. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_TYPE, new_type, new_dimensions, global_var.rows, global_var.columns);
  20889. updateInitialValues(global_var);
  20890. }
  20891. function removeGlobal(global_var, global_container) {
  20892. var index = window.program_obj.globals.indexOf(global_var);
  20893. if (index > -1) {
  20894. window.insertContext = true;
  20895. window.program_obj.globals.splice(index, 1);
  20896. }
  20897. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.REMOVE_GLOBAL_VAR);
  20898. global_container.children().off();
  20899. global_container.off();
  20900. global_container.fadeOut();
  20901. }
  20902. function updateInitialValues(global_var) {
  20903. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  20904. if (global_var.dimensions == 0) {
  20905. global_var.value = 0;
  20906. }
  20907. if (global_var.dimensions == 1) {
  20908. global_var.value = [0, 0];
  20909. }
  20910. if (global_var.dimensions == 2) {
  20911. global_var.value = [[0, 0], [0, 0]];
  20912. }
  20913. }
  20914. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  20915. if (global_var.dimensions == 0) {
  20916. global_var.value = 0.0;
  20917. }
  20918. if (global_var.dimensions == 1) {
  20919. global_var.value = [0.0, 0.0];
  20920. }
  20921. if (global_var.dimensions == 2) {
  20922. global_var.value = [[0.0, 0.0], [0.0, 0.0]];
  20923. }
  20924. }
  20925. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  20926. if (global_var.dimensions == 0) {
  20927. global_var.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value');
  20928. }
  20929. if (global_var.dimensions == 1) {
  20930. global_var.value = [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value')];
  20931. }
  20932. if (global_var.dimensions == 2) {
  20933. global_var.value = [[_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value')], [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value')]];
  20934. }
  20935. }
  20936. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  20937. if (global_var.dimensions == 0) {
  20938. global_var.value = true;
  20939. }
  20940. if (global_var.dimensions == 1) {
  20941. global_var.value = [true, true];
  20942. }
  20943. if (global_var.dimensions == 2) {
  20944. global_var.value = [[true, true], [true, true]];
  20945. }
  20946. }
  20947. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  20948. if (global_var.dimensions == 0) {
  20949. global_var.value = 'A';
  20950. }
  20951. if (global_var.dimensions == 1) {
  20952. global_var.value = ['A', 'A'];
  20953. }
  20954. if (global_var.dimensions == 2) {
  20955. global_var.value = [['A', 'A'], ['A', 'A']];
  20956. }
  20957. }
  20958. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.name, global_var.value);
  20959. }
  20960. function alternateBooleanGlobalValue(global_var, value_container) {
  20961. global_var.value = !global_var.value;
  20962. $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(global_var.value)));
  20963. }
  20964. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  20965. global_var.value[index] = !global_var.value[index];
  20966. $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(global_var.value[index])));
  20967. }
  20968. function removeGlobalColumnVector(global_var) {
  20969. if (global_var.columns == 0) {
  20970. return;
  20971. }
  20972. global_var.columns--;
  20973. global_var.value.splice(global_var.value.length - 1, 1);
  20974. }
  20975. function addGlobalColumnVector(global_var) {
  20976. global_var.columns++;
  20977. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  20978. global_var.value.push(0);
  20979. }
  20980. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  20981. global_var.value.push(0.0);
  20982. }
  20983. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  20984. global_var.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
  20985. }
  20986. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  20987. global_var.value.push(true);
  20988. }
  20989. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  20990. global_var.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
  20991. }
  20992. }
  20993. function removeColumnGlobalMatrix(global_var) {
  20994. if (global_var.columns == 0) {
  20995. return;
  20996. }
  20997. global_var.columns--;
  20998. for (var i = 0; i < global_var.rows; i++) {
  20999. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  21000. }
  21001. }
  21002. function addColumnGlobalMatrix(global_var) {
  21003. global_var.columns++;
  21004. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21005. for (var i = 0; i < global_var.rows; i++) {
  21006. global_var.value[i].push(0);
  21007. }
  21008. }
  21009. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21010. for (var i = 0; i < global_var.rows; i++) {
  21011. global_var.value[i].push(0.0);
  21012. }
  21013. }
  21014. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21015. for (var i = 0; i < global_var.rows; i++) {
  21016. global_var.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
  21017. }
  21018. }
  21019. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  21020. for (var i = 0; i < global_var.rows; i++) {
  21021. global_var.value[i].push(true);
  21022. }
  21023. }
  21024. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  21025. for (var i = 0; i < global_var.rows; i++) {
  21026. global_var.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
  21027. }
  21028. }
  21029. }
  21030. function removeLineGlobalMatrix(global_var) {
  21031. if (global_var.rows == 0) {
  21032. return;
  21033. }
  21034. global_var.rows--;
  21035. global_var.value.splice(global_var.value.length - 1, 1);
  21036. }
  21037. function addLineGlobalMatrix(global_var) {
  21038. global_var.rows++;
  21039. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21040. var n_l = [];
  21041. for (var i = 0; i < global_var.columns; i++) {
  21042. n_l.push(0);
  21043. }
  21044. global_var.value.push(n_l);
  21045. }
  21046. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21047. var n_l = [];
  21048. for (i = 0; i < global_var.columns; i++) {
  21049. n_l.push(0.0);
  21050. }
  21051. global_var.value.push(n_l);
  21052. }
  21053. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21054. var n_l = [];
  21055. for (i = 0; i < global_var.columns; i++) {
  21056. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
  21057. }
  21058. global_var.value.push(n_l);
  21059. }
  21060. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  21061. var n_l = [];
  21062. for (i = 0; i < global_var.columns; i++) {
  21063. n_l.push(true);
  21064. }
  21065. global_var.value.push(n_l);
  21066. }
  21067. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  21068. var n_l = [];
  21069. for (i = 0; i < global_var.columns; i++) {
  21070. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
  21071. }
  21072. global_var.value.push(n_l);
  21073. }
  21074. }
  21075. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  21076. global_var.value[row][index] = !global_var.value[row][index];
  21077. $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(global_var.value[row][index])));
  21078. }
  21079. function renderValues(global_var, global_container) {
  21080. var ret = "";
  21081. var j = 0;
  21082. if (global_var.dimensions == 0) {
  21083. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21084. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + parseFloat(global_var.value).toFixed(1) + '</span> </div> ';
  21085. } else {
  21086. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  21087. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(global_var.value)) + '</span> </div> ';
  21088. } else {
  21089. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  21090. }
  21091. }
  21092. } else {
  21093. ret += '<table class="tabela_var">';
  21094. if (global_var.dimensions == 1) {
  21095. ret += '<tr>';
  21096. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21097. for (var k = 0; k < global_var.columns; k++) {
  21098. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + parseFloat(global_var.value[k]).toFixed(1) + '</span></td>';
  21099. }
  21100. } else {
  21101. for (var k = 0; k < global_var.columns; k++) {
  21102. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  21103. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(global_var.value[k])) + '</span></td>';
  21104. } else {
  21105. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  21106. }
  21107. }
  21108. }
  21109. ret += '</tr>';
  21110. ret += '</table>';
  21111. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_vector_column"></i>' + ' <i class="ui icon plus square outline add_global_vector_column"></i></div>';
  21112. }
  21113. if (global_var.dimensions == 2) {
  21114. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21115. for (var l = 0; l < global_var.rows; l++) {
  21116. ret += '<tr>';
  21117. for (var k = 0; k < global_var.columns; k++) {
  21118. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + parseFloat(global_var.value[l][k]).toFixed(1) + '</span>' + '</td>';
  21119. }
  21120. ret += '</tr>';
  21121. }
  21122. } else {
  21123. for (var l = 0; l < global_var.rows; l++) {
  21124. ret += '<tr>';
  21125. for (var k = 0; k < global_var.columns; k++) {
  21126. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  21127. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(global_var.value[l][k])) + '</span></td>';
  21128. } else {
  21129. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  21130. }
  21131. }
  21132. ret += '</tr>';
  21133. }
  21134. }
  21135. if (global_var.rows == 0) {
  21136. ret += '<tr><td></td></tr>';
  21137. }
  21138. ret += '<tr><td colspan="' + global_var.columns + '" class="tr_manage_lines"><i class="ui icon minus square outline remove_global_matrix_line"></i>' + ' <i class="ui icon plus square outline add_global_matrix_line"></i></td></tr>';
  21139. ret += '</table>';
  21140. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_matrix_column"></i>' + ' <i class="ui icon plus square outline add_global_matrix_column"></i></div>';
  21141. }
  21142. }
  21143. global_container.find(".div_valor_var").html('');
  21144. ret = $(ret);
  21145. ret.find('.span_value_variable').data('associatedOject', global_var);
  21146. ret.find(".boolean_simple_type").on('click', function (e) {
  21147. alternateBooleanGlobalValue(global_var, this.parentNode);
  21148. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21149. });
  21150. ret.find(".simple_var").on('click', function (e) {
  21151. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_GLOBAL_VALUE);
  21152. enableGlobalValueUpdate(global_var, this.parentNode);
  21153. });
  21154. ret.find(".boolean_vector_var").on('click', function (e) {
  21155. alternateBooleanGlobalVectorValue(global_var, $(this).data('index'), this.parentNode);
  21156. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21157. });
  21158. ret.find(".vector_var").on('click', function (e) {
  21159. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_GLOBAL_VALUE);
  21160. enableGlobalVectorValueUpdate(global_var, $(this).data('index'), this.parentNode);
  21161. });
  21162. ret.find(".remove_global_vector_column").on('click', function (e) {
  21163. removeGlobalColumnVector(global_var);
  21164. global_container.find(".div_valor_var").html('');
  21165. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_TYPE, global_var.type, global_var.dimensions, global_var.rows, global_var.columns);
  21166. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21167. renderValues(global_var, global_container);
  21168. });
  21169. ret.find(".add_global_vector_column").on('click', function (e) {
  21170. addGlobalColumnVector(global_var);
  21171. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_TYPE, global_var.type, global_var.dimensions, global_var.rows, global_var.columns);
  21172. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21173. global_container.find(".div_valor_var").html('');
  21174. renderValues(global_var, global_container);
  21175. });
  21176. ret.find(".remove_global_matrix_column").on('click', function (e) {
  21177. removeColumnGlobalMatrix(global_var);
  21178. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_TYPE, global_var.type, global_var.dimensions, global_var.rows, global_var.columns);
  21179. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21180. global_container.find(".div_valor_var").html('');
  21181. renderValues(global_var, global_container);
  21182. });
  21183. ret.find(".add_global_matrix_column").on('click', function (e) {
  21184. addColumnGlobalMatrix(global_var);
  21185. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_TYPE, global_var.type, global_var.dimensions, global_var.rows, global_var.columns);
  21186. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21187. global_container.find(".div_valor_var").html('');
  21188. renderValues(global_var, global_container);
  21189. });
  21190. ret.find(".remove_global_matrix_line").on('click', function (e) {
  21191. removeLineGlobalMatrix(global_var);
  21192. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_TYPE, global_var.type, global_var.dimensions, global_var.rows, global_var.columns);
  21193. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21194. global_container.find(".div_valor_var").html('');
  21195. renderValues(global_var, global_container);
  21196. });
  21197. ret.find(".add_global_matrix_line").on('click', function (e) {
  21198. addLineGlobalMatrix(global_var);
  21199. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_TYPE, global_var.type, global_var.dimensions, global_var.rows, global_var.columns);
  21200. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21201. global_container.find(".div_valor_var").html('');
  21202. renderValues(global_var, global_container);
  21203. });
  21204. ret.find(".boolean_matrix_var").on('click', function (e) {
  21205. alternateBooleanGlobalMatrixValue(global_var, $(this).data('row'), $(this).data('index'), this.parentNode);
  21206. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21207. });
  21208. ret.find(".matrix_var").on('click', function (e) {
  21209. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_GLOBAL_VALUE);
  21210. enableGlobalMatrixValueUpdate(global_var, $(this).data('row'), $(this).data('index'), this.parentNode);
  21211. });
  21212. global_container.find(".div_valor_var").append(ret);
  21213. updateColumnsAndRowsText(global_container, global_var);
  21214. }
  21215. function addHandlers(global_container) {
  21216. var global_var = global_container.data('associatedOject'); // Manage constant option:
  21217. global_container.find(".alternate_constant").on('click', function (e) {
  21218. toggleConstant(global_var);
  21219. $(this).removeClass("on off");
  21220. if (global_var.is_constant) {
  21221. $(this).addClass("on");
  21222. } else {
  21223. $(this).addClass("off");
  21224. }
  21225. }); // Manage global name:
  21226. global_container.find(".editing_name_var").on('click', function (e) {
  21227. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_GLOBAL_NAME);
  21228. enableNameUpdate(global_container);
  21229. }); // Menu to change type:
  21230. global_container.find('.ui.dropdown.global_type').dropdown({
  21231. onChange: function onChange(_, __, $selectedItem) {
  21232. if ($selectedItem.data('dimensions')) {
  21233. updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  21234. } else {
  21235. updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')]);
  21236. }
  21237. renderValues(global_var, global_container);
  21238. },
  21239. selectOnKeydown: false
  21240. }); // Remove global:
  21241. global_container.find(".remove_global").on('click', function (e) {
  21242. removeGlobal(global_var, global_container);
  21243. });
  21244. global_container.find(".ellipsis").popup({
  21245. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_move_var"),
  21246. delay: {
  21247. show: 750,
  21248. hide: 0
  21249. }
  21250. });
  21251. global_container.find(".remove_global").popup({
  21252. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_remove_var"),
  21253. delay: {
  21254. show: 750,
  21255. hide: 0
  21256. }
  21257. });
  21258. }
  21259. function updateColumnsAndRowsText(global_container, global_var) {
  21260. var prev = global_container.find('.text').text().split('[');
  21261. if (prev.length == 2) {
  21262. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  21263. global_container.find('.text').empty();
  21264. global_container.find('.text').text(ff);
  21265. }
  21266. if (prev.length == 3) {
  21267. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  21268. global_container.find('.text').empty();
  21269. global_container.find('.text').text(ff);
  21270. }
  21271. }
  21272. function renderGlobal(global_var) {
  21273. var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  21274. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  21275. element += '<div class="ui dropdown global_type">';
  21276. if (global_var.dimensions == 1) {
  21277. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('vector') + ': ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(global_var.type));
  21278. element += ' [ <span class="dimensions_0"></span> ] ';
  21279. element += '</div>';
  21280. } else if (global_var.dimensions == 2) {
  21281. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('matrix') + ': ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(global_var.type));
  21282. element += ' [ <span class="dimensions_0"></span> ] [ <span class="dimensions_1"></span> ] ';
  21283. element += '</div>';
  21284. } else {
  21285. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(global_var.type.toLowerCase())) + '</div>';
  21286. }
  21287. element += '<div class="menu">';
  21288. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  21289. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  21290. continue;
  21291. }
  21292. element += '<div class="item ' + (global_var.type == tm.toLowerCase() && global_var.dimensions == 0 ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + '</div>';
  21293. }
  21294. element += '<div class="item ' + (global_var.dimensions == 1 ? ' selected ' : '') + '">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('vector') + '<div class="menu">';
  21295. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  21296. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  21297. continue;
  21298. }
  21299. element += '<div class="item ' + (global_var.type == tm.toLowerCase() && global_var.dimensions == 1 ? ' selected ' : '') + '" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + ' [ ] " data-type="' + tm + '" data-dimensions="1"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + '</div>';
  21300. }
  21301. element += '</div></div>';
  21302. element += '<div class="item ' + (global_var.dimensions == 2 ? ' selected ' : '') + '">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('matrix') + '<div class="menu">';
  21303. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  21304. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  21305. continue;
  21306. }
  21307. element += '<div class="item ' + (global_var.type == tm.toLowerCase() && global_var.dimensions == 2 ? ' selected ' : '') + '" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('matrix') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + ' [ ] " data-type="' + tm + '" data-dimensions="2"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + '</div>';
  21308. }
  21309. element += '</div></div>';
  21310. element += '</div></div> <div class="editing_name_var"> <span class="span_name_variable enable_edit_name_parameter">' + global_var.name + '</span> </div> <span class="character_equals"> <&#8212; </span> ';
  21311. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  21312. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  21313. var complete_element = $(element);
  21314. complete_element.data('associatedOject', global_var);
  21315. $('.list_globals').append(complete_element);
  21316. addHandlers(complete_element);
  21317. renderValues(global_var, complete_element);
  21318. if (global_var.dimensions == 1) {
  21319. complete_element.find('.dimensions_0').text(global_var.columns);
  21320. }
  21321. if (global_var.dimensions == 2) {
  21322. complete_element.find('.dimensions_0').text(global_var.columns);
  21323. complete_element.find('.dimensions_1').text(global_var.rows);
  21324. }
  21325. return complete_element;
  21326. }
  21327. var opened_name_value_matrix_global_v = false;
  21328. var opened_input_value_matrix_global_v = null;
  21329. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  21330. if (opened_name_value_matrix_global_v) {
  21331. opened_input_value_matrix_global_v.focus();
  21332. return;
  21333. }
  21334. parent_node = $(parent_node);
  21335. opened_name_value_matrix_global_v = true;
  21336. parent_node.find('.span_value_variable').text('');
  21337. var input_field;
  21338. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21339. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parseFloat(global_var.value[row][index]).toFixed(1) + "' />");
  21340. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21341. } else {
  21342. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index] + "' />");
  21343. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21344. }
  21345. input_field.on('input', function () {
  21346. var inputWidth = input_field.textWidth() + 10;
  21347. opened_input_value_matrix_global_v = input_field;
  21348. input_field.focus();
  21349. var tmpStr = input_field.val();
  21350. input_field.val('');
  21351. input_field.val(tmpStr);
  21352. input_field.css({
  21353. width: inputWidth
  21354. });
  21355. }).trigger('input');
  21356. input_field.focusout(function () {
  21357. /// update array:
  21358. if (input_field.val().trim()) {
  21359. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21360. global_var.value[row][index] = parseFloat(input_field.val().trim());
  21361. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[row][index]).toFixed(1));
  21362. } else {
  21363. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21364. global_var.value[row][index] = parseInt(input_field.val().trim());
  21365. } else {
  21366. global_var.value[row][index] = input_field.val().trim();
  21367. }
  21368. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21369. }
  21370. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21371. } else {
  21372. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21373. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  21374. } else {
  21375. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21376. }
  21377. }
  21378. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21379. global_var.value[row][index] = input_field.val();
  21380. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21381. }
  21382. input_field.off();
  21383. input_field.remove(); /// update elements:
  21384. opened_name_value_matrix_global_v = false;
  21385. opened_input_value_matrix_global_v = false;
  21386. });
  21387. input_field.on('keydown', function (e) {
  21388. var code = e.keyCode || e.which;
  21389. if (code == 13) {
  21390. if (input_field.val().trim()) {
  21391. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21392. global_var.value[row][index] = parseFloat(input_field.val().trim());
  21393. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[row][index]).toFixed(1));
  21394. } else {
  21395. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21396. global_var.value[row][index] = parseInt(input_field.val().trim());
  21397. } else {
  21398. global_var.value[row][index] = input_field.val().trim();
  21399. }
  21400. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21401. }
  21402. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21403. } else {
  21404. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21405. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[row][index]).toFixed(1));
  21406. } else {
  21407. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21408. }
  21409. }
  21410. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21411. global_var.value[row][index] = input_field.val();
  21412. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21413. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21414. }
  21415. input_field.off();
  21416. input_field.remove(); /// update elements:
  21417. opened_name_value_matrix_global_v = false;
  21418. opened_input_value_matrix_global_v = false;
  21419. }
  21420. if (code == 27) {
  21421. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21422. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[row][index]).toFixed(1));
  21423. } else {
  21424. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21425. }
  21426. input_field.off();
  21427. input_field.remove(); /// update elements:
  21428. opened_name_value_matrix_global_v = false;
  21429. opened_input_value_matrix_global_v = false;
  21430. }
  21431. });
  21432. input_field.select();
  21433. }
  21434. var opened_name_value_global_var = false;
  21435. var opened_input_value_global_ar = null;
  21436. function enableGlobalValueUpdate(global_var, parent_node) {
  21437. if (opened_name_value_global_var) {
  21438. opened_input_value_global_ar.focus();
  21439. return;
  21440. }
  21441. parent_node = $(parent_node);
  21442. opened_name_value_global_var = true;
  21443. parent_node.find('.span_value_variable').text('');
  21444. var input_field;
  21445. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21446. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parseFloat(global_var.value).toFixed(1) + "' />");
  21447. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21448. } else {
  21449. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value + "' />");
  21450. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21451. }
  21452. input_field.on('input', function () {
  21453. var inputWidth = input_field.textWidth() + 10;
  21454. opened_input_value_global_ar = input_field;
  21455. input_field.focus();
  21456. var tmpStr = input_field.val();
  21457. input_field.val('');
  21458. input_field.val(tmpStr);
  21459. input_field.css({
  21460. width: inputWidth
  21461. });
  21462. }).trigger('input');
  21463. input_field.focusout(function () {
  21464. var changed = false; /// update array:
  21465. if (input_field.val().trim()) {
  21466. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21467. global_var.value = parseFloat(input_field.val().trim());
  21468. parent_node.find('.span_value_variable').text(parseFloat(global_var.value).toFixed(1));
  21469. } else {
  21470. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21471. global_var.value = parseInt(input_field.val().trim());
  21472. } else if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  21473. global_var.value = input_field.val().charAt(0);
  21474. } else {
  21475. global_var.value = input_field.val().trim();
  21476. }
  21477. parent_node.find('.span_value_variable').text(global_var.value);
  21478. }
  21479. changed = true;
  21480. } else {
  21481. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21482. parent_node.find('.span_value_variable').text(parseFloat(global_var.value).toFixed(1));
  21483. } else {
  21484. parent_node.find('.span_value_variable').text(global_var.value);
  21485. }
  21486. }
  21487. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21488. global_var.value = input_field.val();
  21489. changed = true;
  21490. parent_node.find('.span_value_variable').text(global_var.value);
  21491. }
  21492. if (changed) {
  21493. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21494. }
  21495. input_field.off();
  21496. input_field.remove(); /// update elements:
  21497. opened_name_value_global_var = false;
  21498. opened_input_value_global_ar = false;
  21499. });
  21500. input_field.on('keydown', function (e) {
  21501. var code = e.keyCode || e.which;
  21502. var changed = true;
  21503. if (code == 13) {
  21504. if (input_field.val().trim()) {
  21505. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21506. global_var.value = parseFloat(input_field.val().trim());
  21507. parent_node.find('.span_value_variable').text(parseFloat(global_var.value).toFixed(1));
  21508. } else {
  21509. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21510. global_var.value = parseInt(input_field.val().trim());
  21511. } else if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  21512. global_var.value = input_field.val().charAt(0);
  21513. } else {
  21514. global_var.value = input_field.val().trim();
  21515. }
  21516. parent_node.find('.span_value_variable').text(global_var.value);
  21517. }
  21518. changed = true;
  21519. } else {
  21520. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21521. parent_node.find('.span_value_variable').text(parseFloat(global_var.value).toFixed(1));
  21522. } else {
  21523. parent_node.find('.span_value_variable').text(global_var.value);
  21524. }
  21525. }
  21526. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21527. global_var.value = input_field.val();
  21528. changed = true;
  21529. parent_node.find('.span_value_variable').text(global_var.value);
  21530. }
  21531. if (changed) {
  21532. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21533. }
  21534. input_field.off();
  21535. input_field.remove(); /// update elements:
  21536. opened_name_value_global_var = false;
  21537. opened_input_value_global_ar = false;
  21538. }
  21539. if (code == 27) {
  21540. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21541. parent_node.find('.span_value_variable').text(parseFloat(global_var.value).toFixed(1));
  21542. } else {
  21543. parent_node.find('.span_value_variable').text(global_var.value);
  21544. }
  21545. input_field.off();
  21546. input_field.remove(); /// update elements:
  21547. opened_name_value_global_var = false;
  21548. opened_input_value_global_ar = false;
  21549. }
  21550. });
  21551. input_field.select();
  21552. }
  21553. var opened_name_global = false;
  21554. var opened_input_global = null;
  21555. function enableNameUpdate(global_container) {
  21556. var global_var = global_container.data('associatedOject');
  21557. if (opened_name_global) {
  21558. opened_input_global.focus();
  21559. return;
  21560. }
  21561. opened_name_global = true;
  21562. global_container.find('.span_name_variable').text('');
  21563. var input_name = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.name + "' />");
  21564. input_name.insertBefore(global_container.find('.span_name_variable'));
  21565. input_name.on('input', function () {
  21566. var inputWidth = input_name.textWidth() + 10;
  21567. opened_input_global = input_name;
  21568. opened_input_global.focus();
  21569. opened_input_global.css({
  21570. width: inputWidth
  21571. });
  21572. }).trigger('input');
  21573. input_name.focusout(function () {
  21574. /// update array:
  21575. if (input_name.val().trim().length > 0) {
  21576. updateName(global_var, input_name.val().trim(), global_container);
  21577. global_container.find('.span_name_variable').text(global_var.name);
  21578. } else {
  21579. global_container.find('.span_name_variable').text(global_var.name);
  21580. }
  21581. input_name.off();
  21582. input_name.remove(); /// update elements:
  21583. opened_name_global = false;
  21584. opened_input_global = false;
  21585. });
  21586. input_name.on('keydown', function (e) {
  21587. var code = e.keyCode || e.which;
  21588. if (code == 13) {
  21589. if (input_name.val().trim()) {
  21590. updateName(global_var, input_name.val().trim(), global_container);
  21591. global_container.find('.span_name_variable').text(global_var.name);
  21592. } else {
  21593. global_container.find('.span_name_variable').text(global_var.name);
  21594. }
  21595. input_name.off();
  21596. input_name.remove(); /// update elements:
  21597. opened_name_global = false;
  21598. opened_input_global = false;
  21599. }
  21600. if (code == 27) {
  21601. global_container.find('.span_name_variable').text(global_var.name);
  21602. input_name.off();
  21603. input_name.remove(); /// update elements:
  21604. opened_name_global = false;
  21605. opened_input_global = false;
  21606. }
  21607. });
  21608. input_name.select();
  21609. }
  21610. var opened_name_value_vector_global_ = false;
  21611. var opened_input_value_vector_global_ = null;
  21612. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  21613. if (opened_name_value_vector_global_) {
  21614. opened_input_value_vector_global_.focus();
  21615. return;
  21616. }
  21617. parent_node = $(parent_node);
  21618. opened_name_value_vector_global_ = true;
  21619. parent_node.find('.span_value_variable').text('');
  21620. var input_field;
  21621. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21622. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parseFloat(global_var.value[index]).toFixed(1) + "' />");
  21623. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21624. } else {
  21625. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index] + "' />");
  21626. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21627. }
  21628. input_field.on('input', function () {
  21629. var inputWidth = input_field.textWidth() + 10;
  21630. opened_input_value_vector_global_ = input_field;
  21631. input_field.focus();
  21632. var tmpStr = input_field.val();
  21633. input_field.val('');
  21634. input_field.val(tmpStr);
  21635. input_field.css({
  21636. width: inputWidth
  21637. });
  21638. }).trigger('input');
  21639. input_field.focusout(function () {
  21640. var changed = false; /// update array:
  21641. if (input_field.val().trim()) {
  21642. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21643. global_var.value[index] = parseFloat(input_field.val().trim());
  21644. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[index]).toFixed(1));
  21645. } else {
  21646. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21647. global_var.value[index] = parseInt(input_field.val().trim());
  21648. } else {
  21649. global_var.value[index] = input_field.val().trim();
  21650. }
  21651. parent_node.find('.span_value_variable').text(global_var.value[index]);
  21652. }
  21653. changed = true;
  21654. } else {
  21655. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21656. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[index]).toFixed(1));
  21657. } else {
  21658. parent_node.find('.span_value_variable').text(global_var.value[index]);
  21659. }
  21660. }
  21661. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21662. global_var.value[index] = input_field.val();
  21663. changed = true;
  21664. parent_node.find('.span_value_variable').text(global_var.value[index]);
  21665. }
  21666. if (changed) {
  21667. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21668. }
  21669. input_field.off();
  21670. input_field.remove(); /// update elements:
  21671. opened_name_value_vector_global_ = false;
  21672. opened_input_value_vector_global_ = false;
  21673. });
  21674. input_field.on('keydown', function (e) {
  21675. var code = e.keyCode || e.which;
  21676. var changed = false;
  21677. if (code == 13) {
  21678. if (input_field.val().trim()) {
  21679. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21680. global_var.value[index] = parseFloat(input_field.val().trim());
  21681. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[index]).toFixed(1));
  21682. } else {
  21683. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21684. global_var.value[index] = parseInt(input_field.val().trim());
  21685. } else {
  21686. global_var.value[index] = input_field.val().trim();
  21687. }
  21688. parent_node.find('.span_value_variable').text(global_var.value[index]);
  21689. }
  21690. changed = true;
  21691. } else {
  21692. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21693. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[index]).toFixed(1));
  21694. } else {
  21695. parent_node.find('.span_value_variable').text(global_var.value[index]);
  21696. }
  21697. }
  21698. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21699. global_var.value[index] = input_field.val();
  21700. changed = true;
  21701. parent_node.find('.span_value_variable').text(global_var.value[index]);
  21702. }
  21703. if (changed) {
  21704. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21705. }
  21706. input_field.off();
  21707. input_field.remove(); /// update elements:
  21708. opened_name_value_vector_global_ = false;
  21709. opened_input_value_vector_global_ = false;
  21710. }
  21711. if (code == 27) {
  21712. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21713. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[index]).toFixed(1));
  21714. } else {
  21715. parent_node.find('.span_value_variable').text(global_var.value[index]);
  21716. }
  21717. input_field.off();
  21718. input_field.remove(); /// update elements:
  21719. opened_name_value_vector_global_ = false;
  21720. opened_input_value_vector_global_ = false;
  21721. }
  21722. });
  21723. input_field.select();
  21724. }
  21725. $.fn.textWidth = function (text, font) {
  21726. if (!$.fn.textWidth.fakeEl) $.fn.textWidth.fakeEl = $('<span>').hide().appendTo(document.body);
  21727. $.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  21728. return $.fn.textWidth.fakeEl.width();
  21729. };
  21730. /***/ }),
  21731. /***/ "./js/visualUI/ivprog_elements.js":
  21732. /*!****************************************!*\
  21733. !*** ./js/visualUI/ivprog_elements.js ***!
  21734. \****************************************/
  21735. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  21736. "use strict";
  21737. __webpack_require__.r(__webpack_exports__);
  21738. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  21739. /* harmony export */ "COMMAND_TYPES": () => (/* binding */ COMMAND_TYPES),
  21740. /* harmony export */ "ARITHMETIC_TYPES": () => (/* binding */ ARITHMETIC_TYPES),
  21741. /* harmony export */ "EXPRESSION_ELEMENTS": () => (/* binding */ EXPRESSION_ELEMENTS),
  21742. /* harmony export */ "EXPRESSION_TYPES": () => (/* binding */ EXPRESSION_TYPES),
  21743. /* harmony export */ "ARITHMETIC_COMPARISON": () => (/* binding */ ARITHMETIC_COMPARISON),
  21744. /* harmony export */ "LOGIC_COMPARISON": () => (/* binding */ LOGIC_COMPARISON),
  21745. /* harmony export */ "SYSTEM_FUNCTIONS_CATEGORIES": () => (/* binding */ SYSTEM_FUNCTIONS_CATEGORIES),
  21746. /* harmony export */ "Variable": () => (/* binding */ Variable),
  21747. /* harmony export */ "Function": () => (/* binding */ Function),
  21748. /* harmony export */ "SystemFunction": () => (/* binding */ SystemFunction),
  21749. /* harmony export */ "Comment": () => (/* binding */ Comment),
  21750. /* harmony export */ "Break": () => (/* binding */ Break),
  21751. /* harmony export */ "Reader": () => (/* binding */ Reader),
  21752. /* harmony export */ "Writer": () => (/* binding */ Writer),
  21753. /* harmony export */ "Attribution": () => (/* binding */ Attribution),
  21754. /* harmony export */ "ExpressionOperator": () => (/* binding */ ExpressionOperator),
  21755. /* harmony export */ "ExpressionElement": () => (/* binding */ ExpressionElement),
  21756. /* harmony export */ "ConditionalExpression": () => (/* binding */ ConditionalExpression),
  21757. /* harmony export */ "LogicExpression": () => (/* binding */ LogicExpression),
  21758. /* harmony export */ "ArithmeticExpression": () => (/* binding */ ArithmeticExpression),
  21759. /* harmony export */ "IfTrue": () => (/* binding */ IfTrue),
  21760. /* harmony export */ "RepeatNTimes": () => (/* binding */ RepeatNTimes),
  21761. /* harmony export */ "WhileTrue": () => (/* binding */ WhileTrue),
  21762. /* harmony export */ "DoWhileTrue": () => (/* binding */ DoWhileTrue),
  21763. /* harmony export */ "Switch": () => (/* binding */ Switch),
  21764. /* harmony export */ "Return": () => (/* binding */ Return),
  21765. /* harmony export */ "SwitchCase": () => (/* binding */ SwitchCase),
  21766. /* harmony export */ "FunctionCall": () => (/* binding */ FunctionCall),
  21767. /* harmony export */ "VariableValueMenu": () => (/* binding */ VariableValueMenu),
  21768. /* harmony export */ "FunctionCallMenu": () => (/* binding */ FunctionCallMenu),
  21769. /* harmony export */ "Program": () => (/* binding */ Program)
  21770. /* harmony export */ });
  21771. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  21772. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_0__);
  21773. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  21774. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
  21775. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  21776. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  21777. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_3__);
  21778. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  21779. var COMMAND_TYPES = Object.freeze({
  21780. "function": "function",
  21781. comment: "comment",
  21782. reader: "reader",
  21783. writer: "writer",
  21784. attribution: "attribution",
  21785. iftrue: "iftrue",
  21786. repeatNtimes: "repeatNtimes",
  21787. whiletrue: "whiletrue",
  21788. dowhiletrue: "dowhiletrue",
  21789. "switch": "switch",
  21790. switchcase: "switchcase",
  21791. functioncall: "functioncall",
  21792. "break": "break",
  21793. "return": "return"
  21794. });
  21795. var ARITHMETIC_TYPES = Object.freeze({
  21796. plus: "plus",
  21797. minus: "minus",
  21798. multiplication: "multiplication",
  21799. division: "division",
  21800. module: "module",
  21801. none: "none"
  21802. });
  21803. var EXPRESSION_ELEMENTS = Object.freeze({
  21804. exp_op_exp: "exp_op_exp",
  21805. op_exp: "op_exp",
  21806. par_exp_par: "par_exp_par",
  21807. start_point: "start_point"
  21808. });
  21809. var EXPRESSION_TYPES = Object.freeze({
  21810. exp_conditional: "exp_conditional",
  21811. exp_logic: "exp_logic",
  21812. exp_arithmetic: "exp_arithmetic",
  21813. write_sep: "write_separator"
  21814. });
  21815. var ARITHMETIC_COMPARISON = Object.freeze({
  21816. greater_than: "greater_than",
  21817. less_than: "less_than",
  21818. equals_to: "equals_to",
  21819. not_equals_to: "not_equals_to",
  21820. greater_than_or_equals_to: "greater_than_or_equals_to",
  21821. less_than_or_equals_to: "less_than_or_equals_to"
  21822. });
  21823. var LOGIC_COMPARISON = Object.freeze({
  21824. equals_to: "equals_to",
  21825. not_equals_to: "not_equals_to",
  21826. and: "and",
  21827. or: "or",
  21828. not: "not"
  21829. });
  21830. var SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({
  21831. math: "$mathLib",
  21832. text: "$strLib",
  21833. arrangement: "$arrayLib",
  21834. conversion: "$langLib"
  21835. });
  21836. var Variable = function Variable(type, name, value) {
  21837. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  21838. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  21839. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  21840. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  21841. var reference = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
  21842. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Variable);
  21843. this.type = type;
  21844. this.name = name;
  21845. this.value = value;
  21846. this.dimensions = dimensions;
  21847. this.is_constant = is_constant;
  21848. this.rows = rows;
  21849. this.columns = columns;
  21850. this.reference = reference;
  21851. };
  21852. var Function = function Function(name) {
  21853. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types__WEBPACK_IMPORTED_MODULE_2__.Types.VOID;
  21854. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  21855. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  21856. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  21857. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  21858. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  21859. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  21860. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  21861. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Function);
  21862. this.type = COMMAND_TYPES["function"];
  21863. this.name = name;
  21864. this.return_type = return_type;
  21865. this.return_dimensions = return_dimensions;
  21866. this.parameters_list = parameters_list;
  21867. this.is_main = is_main;
  21868. this.is_hidden = is_hidden;
  21869. this.variables_list = variables_list;
  21870. this.function_comment = function_comment;
  21871. this.commands = commands;
  21872. };
  21873. var SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  21874. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  21875. var category = arguments.length > 5 ? arguments[5] : undefined;
  21876. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, SystemFunction);
  21877. this.type = COMMAND_TYPES["function"];
  21878. this.identifier = identifier;
  21879. this.return_type = return_type;
  21880. this.return_dimensions = return_dimensions;
  21881. this.parameters_list = parameters_list;
  21882. this.function_comment = function_comment;
  21883. this.category = category;
  21884. };
  21885. var Comment = function Comment(comment_text) {
  21886. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Comment);
  21887. this.type = COMMAND_TYPES.comment;
  21888. this.comment_text = comment_text;
  21889. };
  21890. var Break = function Break() {
  21891. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Break);
  21892. this.type = COMMAND_TYPES["break"];
  21893. };
  21894. var Reader = function Reader() {
  21895. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  21896. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Reader);
  21897. this.type = COMMAND_TYPES.reader;
  21898. this.variable_value_menu = variable_value_menu;
  21899. };
  21900. var Writer = function Writer(content) {
  21901. var newline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  21902. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Writer);
  21903. this.type = COMMAND_TYPES.writer;
  21904. this.content = content;
  21905. this.newline = newline;
  21906. };
  21907. var Attribution = function Attribution(variable) {
  21908. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21909. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Attribution);
  21910. this.type = COMMAND_TYPES.attribution;
  21911. this.variable = variable;
  21912. this.expression = expression;
  21913. };
  21914. var ExpressionOperator = function ExpressionOperator(type_op, item) {
  21915. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, ExpressionOperator);
  21916. this.type_op = type_op; // Logic, Arithmetic OR Relational
  21917. this.item = item;
  21918. };
  21919. var ExpressionElement = function ExpressionElement(type_exp) {
  21920. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21921. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, ExpressionElement);
  21922. this.type_exp = type_exp;
  21923. this.itens = itens;
  21924. };
  21925. var ConditionalExpression = function ConditionalExpression(expression) {
  21926. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, ConditionalExpression);
  21927. this.type = EXPRESSION_TYPES.exp_conditional;
  21928. this.expression = expression;
  21929. };
  21930. var LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  21931. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, LogicExpression);
  21932. this.type = EXPRESSION_TYPES.exp_logic;
  21933. this.has_neg = has_neg;
  21934. this.first_operand = first_operand;
  21935. this.second_operand = second_operand;
  21936. this.operator = operator;
  21937. };
  21938. var ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  21939. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, ArithmeticExpression);
  21940. this.type = EXPRESSION_TYPES.exp_arithmetic;
  21941. this.first_operand = first_operand;
  21942. this.second_operand = second_operand;
  21943. this.operator = operator;
  21944. };
  21945. var IfTrue = function IfTrue(expression, commands_block, commands_else) {
  21946. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, IfTrue);
  21947. this.type = COMMAND_TYPES.iftrue;
  21948. this.expression = expression;
  21949. this.commands_block = commands_block;
  21950. this.commands_else = commands_else;
  21951. };
  21952. var RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  21953. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, RepeatNTimes);
  21954. this.type = COMMAND_TYPES.repeatNtimes;
  21955. this.var_attribution = var_attribution;
  21956. this.var_incrementation = var_incrementation;
  21957. this.expression1 = expression1;
  21958. this.expression2 = expression2;
  21959. this.expression3 = expression3;
  21960. this.commands_block = commands_block;
  21961. };
  21962. var WhileTrue = function WhileTrue(expression, commands_block) {
  21963. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, WhileTrue);
  21964. this.type = COMMAND_TYPES.whiletrue;
  21965. this.expression = expression;
  21966. this.commands_block = commands_block;
  21967. };
  21968. var DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  21969. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, DoWhileTrue);
  21970. this.type = COMMAND_TYPES.dowhiletrue;
  21971. this.expression = expression;
  21972. this.commands_block = commands_block;
  21973. };
  21974. var Switch = function Switch(variable) {
  21975. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21976. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Switch);
  21977. this.type = COMMAND_TYPES["switch"];
  21978. this.variable = variable;
  21979. this.cases = cases;
  21980. };
  21981. var Return = function Return(variable_value_menu) {
  21982. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Return);
  21983. this.type = COMMAND_TYPES["return"];
  21984. this.variable_value_menu = variable_value_menu;
  21985. };
  21986. var SwitchCase = function SwitchCase(variable_value_menu) {
  21987. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21988. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, SwitchCase);
  21989. this.type = COMMAND_TYPES.switchcase;
  21990. this.variable_value_menu = variable_value_menu;
  21991. this.commands_block = commands_block;
  21992. };
  21993. var FunctionCall = function FunctionCall(function_called, parameters_list) {
  21994. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, FunctionCall);
  21995. this.type = COMMAND_TYPES.functioncall;
  21996. this.function_called = function_called;
  21997. this.parameters_list = parameters_list;
  21998. };
  21999. var VariableValueMenu = function VariableValueMenu() {
  22000. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  22001. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  22002. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  22003. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  22004. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  22005. var dimensions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  22006. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, VariableValueMenu);
  22007. this.type = "var_value";
  22008. this.variable_and_value = variable_and_value;
  22009. this.content = content;
  22010. this.row = row;
  22011. this.column = column;
  22012. this.include_constant = include_constant;
  22013. this.dimensions = dimensions;
  22014. };
  22015. var FunctionCallMenu = function FunctionCallMenu() {
  22016. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  22017. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  22018. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, FunctionCallMenu);
  22019. this.type = "function_call";
  22020. this.function_called = function_called;
  22021. this.parameters_list = parameters_list;
  22022. };
  22023. var Program = /*#__PURE__*/function () {
  22024. function Program() {
  22025. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Program);
  22026. this.functions = [];
  22027. this.globals = [];
  22028. }
  22029. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_0___default()(Program, [{
  22030. key: "addFunction",
  22031. value: function addFunction(function_to_add) {
  22032. melanke_watchjs__WEBPACK_IMPORTED_MODULE_3___default().watch(function_to_add.parameters_list, function () {
  22033. if (window.insertContext) {
  22034. setTimeout(function () {
  22035. _algorithm__WEBPACK_IMPORTED_MODULE_4__.renderAlgorithm();
  22036. }, 300);
  22037. window.insertContext = false;
  22038. } else {
  22039. _algorithm__WEBPACK_IMPORTED_MODULE_4__.renderAlgorithm();
  22040. }
  22041. }, 1);
  22042. melanke_watchjs__WEBPACK_IMPORTED_MODULE_3___default().watch(function_to_add.variables_list, function () {
  22043. if (window.insertContext) {
  22044. setTimeout(function () {
  22045. _algorithm__WEBPACK_IMPORTED_MODULE_4__.renderAlgorithm();
  22046. }, 300);
  22047. window.insertContext = false;
  22048. } else {
  22049. _algorithm__WEBPACK_IMPORTED_MODULE_4__.renderAlgorithm();
  22050. }
  22051. }, 1);
  22052. this.functions.push(function_to_add);
  22053. }
  22054. }, {
  22055. key: "addVariable",
  22056. value: function addVariable(function_to_receive, variable) {
  22057. if (this.functions[function_to_receive].variable === null) {
  22058. this.functions[function_to_receive].variables_list = [];
  22059. }
  22060. this.functions[function_to_receive].variables_list.push(variable);
  22061. }
  22062. }, {
  22063. key: "addGlobal",
  22064. value: function addGlobal(variable) {
  22065. this.globals.push(variable);
  22066. }
  22067. }]);
  22068. return Program;
  22069. }();
  22070. /***/ }),
  22071. /***/ "./js/visualUI/text_editor.js":
  22072. /*!************************************!*\
  22073. !*** ./js/visualUI/text_editor.js ***!
  22074. \************************************/
  22075. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  22076. "use strict";
  22077. __webpack_require__.r(__webpack_exports__);
  22078. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  22079. /* harmony export */ "initTextEditor": () => (/* binding */ initTextEditor),
  22080. /* harmony export */ "disable": () => (/* binding */ disable),
  22081. /* harmony export */ "updateEditor": () => (/* binding */ updateEditor),
  22082. /* harmony export */ "setCode": () => (/* binding */ setCode),
  22083. /* harmony export */ "getCode": () => (/* binding */ getCode)
  22084. /* harmony export */ });
  22085. /* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! codemirror */ "./node_modules/codemirror/lib/codemirror.js");
  22086. /* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(codemirror__WEBPACK_IMPORTED_MODULE_0__);
  22087. /* harmony import */ var codemirror_addon_edit_closebrackets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! codemirror/addon/edit/closebrackets */ "./node_modules/codemirror/addon/edit/closebrackets.js");
  22088. /* harmony import */ var codemirror_addon_edit_closebrackets__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(codemirror_addon_edit_closebrackets__WEBPACK_IMPORTED_MODULE_1__);
  22089. /* harmony import */ var codemirror_addon_edit_matchbrackets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! codemirror/addon/edit/matchbrackets */ "./node_modules/codemirror/addon/edit/matchbrackets.js");
  22090. /* harmony import */ var codemirror_addon_edit_matchbrackets__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(codemirror_addon_edit_matchbrackets__WEBPACK_IMPORTED_MODULE_2__);
  22091. /* harmony import */ var codemirror_addon_selection_active_line__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! codemirror/addon/selection/active-line */ "./node_modules/codemirror/addon/selection/active-line.js");
  22092. /* harmony import */ var codemirror_addon_selection_active_line__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(codemirror_addon_selection_active_line__WEBPACK_IMPORTED_MODULE_3__);
  22093. /* harmony import */ var _util_editorMode2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../util/editorMode2 */ "./js/util/editorMode2.js");
  22094. // import "codemirror/addon/hint/show-hint";
  22095. // import "codemirror/addon/hint/anyword-hint";
  22096. (0,_util_editorMode2__WEBPACK_IMPORTED_MODULE_4__.CodeEditorMode)(codemirror__WEBPACK_IMPORTED_MODULE_0__);
  22097. var codeEditor = null;
  22098. function initTextEditor(element) {
  22099. var id = element;
  22100. if (element[0] == '#') {
  22101. id = element.substring(1);
  22102. }
  22103. codeEditor = codemirror__WEBPACK_IMPORTED_MODULE_0__.fromTextArea(document.getElementById(id), {
  22104. theme: "ttcn",
  22105. value: "",
  22106. mode: "text/x-ivprog",
  22107. indentUnit: 4,
  22108. lineNumbers: true,
  22109. matchBrackets: true,
  22110. autoCloseBrackets: true,
  22111. fixedGutter: true,
  22112. styleActiveLine: true,
  22113. readOnly: true
  22114. });
  22115. }
  22116. function disable(flag) {
  22117. codeEditor.setOption("readOnly", flag);
  22118. updateEditor();
  22119. }
  22120. function updateEditor() {
  22121. codeEditor.refresh();
  22122. }
  22123. function setCode(code) {
  22124. codeEditor.setValue(code);
  22125. }
  22126. function getCode() {
  22127. return codeEditor.getValue();
  22128. }
  22129. /***/ }),
  22130. /***/ "./js/visualUI/types.js":
  22131. /*!******************************!*\
  22132. !*** ./js/visualUI/types.js ***!
  22133. \******************************/
  22134. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  22135. "use strict";
  22136. __webpack_require__.r(__webpack_exports__);
  22137. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  22138. /* harmony export */ "Types": () => (/* binding */ Types)
  22139. /* harmony export */ });
  22140. var Types = Object.freeze({
  22141. INTEGER: "integer",
  22142. REAL: "real",
  22143. TEXT: "text",
  22144. CHAR: 'char',
  22145. BOOLEAN: "boolean",
  22146. VOID: "void"
  22147. });
  22148. /***/ }),
  22149. /***/ "./js/visualUI/utils.js":
  22150. /*!******************************!*\
  22151. !*** ./js/visualUI/utils.js ***!
  22152. \******************************/
  22153. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  22154. "use strict";
  22155. __webpack_require__.r(__webpack_exports__);
  22156. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  22157. /* harmony export */ "renderErrorMessage": () => (/* binding */ renderErrorMessage)
  22158. /* harmony export */ });
  22159. function renderErrorMessage(dom_obj_target, message_text) {
  22160. dom_obj_target.popup({
  22161. html: '<i class="ui icon inverted exclamation triangle yellow"></i>' + message_text,
  22162. transition: "fade up",
  22163. on: 'click',
  22164. closable: true,
  22165. movePopup: true,
  22166. boundary: window,
  22167. preserve: false,
  22168. target: false,
  22169. className: {
  22170. popup: 'ui popup invalid-identifier'
  22171. },
  22172. onHidden: function onHidden($module) {
  22173. dom_obj_target.popup('destroy');
  22174. }
  22175. }).popup('toggle');
  22176. }
  22177. /***/ }),
  22178. /***/ "./js/visualUI/variables.js":
  22179. /*!**********************************!*\
  22180. !*** ./js/visualUI/variables.js ***!
  22181. \**********************************/
  22182. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  22183. "use strict";
  22184. __webpack_require__.r(__webpack_exports__);
  22185. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  22186. /* harmony export */ "addVariable": () => (/* binding */ addVariable),
  22187. /* harmony export */ "renderVariable": () => (/* binding */ renderVariable)
  22188. /* harmony export */ });
  22189. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  22190. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22191. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22192. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  22193. /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../services/userLog */ "./js/services/userLog.js");
  22194. /* harmony import */ var _util_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../util/utils */ "./js/util/utils.js");
  22195. var counter_new_variables = 0;
  22196. function addVariable(function_obj, function_container) {
  22197. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  22198. // Verify if the next variable name is in use:
  22199. if (function_obj.variables_list) {
  22200. var in_use = false;
  22201. do {
  22202. in_use = false;
  22203. var temp_name = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('new_variable') + '_' + counter_new_variables;
  22204. function_obj.variables_list.forEach(function (el) {
  22205. if (temp_name == el.name) {
  22206. in_use = true;
  22207. }
  22208. });
  22209. if (in_use) counter_new_variables++;
  22210. } while (in_use);
  22211. }
  22212. var new_var = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.Variable(_types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('new_variable') + '_' + counter_new_variables, 0);
  22213. if (function_obj.variables_list == null) {
  22214. function_obj.variables_list = [];
  22215. }
  22216. function_obj.variables_list.push(new_var);
  22217. counter_new_variables++;
  22218. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.INSERT_FUNCTION_VAR, new_var.name, _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER, 0);
  22219. var newe = renderVariable(function_container, new_var, function_obj);
  22220. if (is_in_click) {
  22221. newe.css('display', 'none');
  22222. newe.fadeIn();
  22223. }
  22224. }
  22225. function updateName(variable_obj, new_name, variable_obj_dom, function_obj) {
  22226. if (variable_obj.name == new_name) {
  22227. return;
  22228. }
  22229. if ((0,_util_utils__WEBPACK_IMPORTED_MODULE_5__.isValidIdentifier)(new_name)) {
  22230. if (variableNameAlreadyExists(new_name, function_obj)) {
  22231. _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(variable_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getError('inform_valid_variable_duplicated', [new_name, function_obj.name]));
  22232. } else {
  22233. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.RENAME_FUNCTION_VAR, variable_obj.name, new_name);
  22234. variable_obj.name = new_name;
  22235. }
  22236. } else {
  22237. _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(variable_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getError('inform_valid_identifier'));
  22238. }
  22239. }
  22240. function variableNameAlreadyExists(name_var, function_obj) {
  22241. if (function_obj.parameters_list) {
  22242. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  22243. if (function_obj.parameters_list[i].name == name_var) {
  22244. return true;
  22245. }
  22246. }
  22247. }
  22248. if (function_obj.variables_list) {
  22249. for (var i = 0; i < function_obj.variables_list.length; i++) {
  22250. if (function_obj.variables_list[i].name == name_var) {
  22251. return true;
  22252. }
  22253. }
  22254. }
  22255. return false;
  22256. }
  22257. function removeVariable(variable_obj, variable_container, function_name) {
  22258. var function_associated = variable_container.data('associatedFunction');
  22259. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.REMOVE_FUNCTION_VAR, variable_obj.name);
  22260. var index = function_associated.variables_list.indexOf(variable_obj);
  22261. if (index > -1) {
  22262. window.insertContext = true;
  22263. delete function_associated.variables_list[index];
  22264. function_associated.variables_list.splice(index, 1);
  22265. }
  22266. variable_container.children().off();
  22267. variable_container.off();
  22268. variable_container.fadeOut();
  22269. }
  22270. function updateType(variable_obj, new_type, function_name) {
  22271. var new_dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  22272. variable_obj.type = new_type;
  22273. variable_obj.dimensions = new_dimensions;
  22274. if (new_dimensions > 0) {
  22275. variable_obj.rows = new_dimensions;
  22276. variable_obj.columns = 2;
  22277. }
  22278. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_TYPE, variable_obj.name, new_type, new_dimensions, variable_obj.rows, variable_obj.columns);
  22279. updateInitialValues(variable_obj, function_name);
  22280. }
  22281. function addHandlers(variable_obj, variable_container, function_obj) {
  22282. // Manage variable name:
  22283. variable_container.find(".editing_name_var").on('click', function (e) {
  22284. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_VAR_NAME, variable_obj.name);
  22285. enableNameUpdate(variable_obj, variable_container, function_obj);
  22286. }); // Menu to change type:
  22287. variable_container.find('.ui.dropdown.variable_type').dropdown({
  22288. onChange: function onChange(_, __, $selectedItem) {
  22289. if ($selectedItem.data('dimensions')) {
  22290. updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], function_obj.name, $selectedItem.data('dimensions'));
  22291. } else {
  22292. updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], function_obj.name);
  22293. }
  22294. renderValues(variable_obj, variable_container, function_obj.name);
  22295. },
  22296. selectOnKeydown: false
  22297. }); // Remove variable:
  22298. variable_container.find(".remove_variable").on('click', function (e) {
  22299. removeVariable(variable_obj, variable_container, function_obj.name);
  22300. });
  22301. variable_container.find(".ellipsis").popup({
  22302. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_move_var"),
  22303. delay: {
  22304. show: 750,
  22305. hide: 0
  22306. }
  22307. });
  22308. variable_container.find(".remove_variable").popup({
  22309. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_remove_var"),
  22310. delay: {
  22311. show: 750,
  22312. hide: 0
  22313. }
  22314. });
  22315. }
  22316. function renderVariable(function_container, new_var, function_obj) {
  22317. var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
  22318. element += '<div class="ui dropdown variable_type">';
  22319. if (new_var.dimensions == 1) {
  22320. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('vector') + ': ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(new_var.type.toLowerCase()));
  22321. element += ' [ ] </div>';
  22322. } else if (new_var.dimensions == 2) {
  22323. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('matrix') + ': ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(new_var.type.toLowerCase()));
  22324. element += ' [ ] [ ] </div>';
  22325. } else {
  22326. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(new_var.type.toLowerCase())) + '</div>';
  22327. }
  22328. element += '<div class="menu">';
  22329. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  22330. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  22331. continue;
  22332. }
  22333. element += '<div class="item ' + (new_var.type == tm.toLowerCase() && new_var.dimensions == 0 ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + '</div>';
  22334. }
  22335. element += '<div class="item ' + (new_var.dimensions == 1 ? ' selected ' : '') + '">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('vector') + '<div class="menu">';
  22336. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  22337. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  22338. continue;
  22339. }
  22340. element += '<div class="item ' + (new_var.type == tm.toLowerCase() && new_var.dimensions == 1 ? ' selected ' : '') + '" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + ' [ ] " data-type="' + tm + '" data-dimensions="1"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + '</div>';
  22341. }
  22342. element += '</div></div>';
  22343. element += '<div class="item ' + (new_var.dimensions == 2 ? ' selected ' : '') + '">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('matrix') + '<div class="menu">';
  22344. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  22345. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  22346. continue;
  22347. }
  22348. element += '<div class="item ' + (new_var.type == tm.toLowerCase() && new_var.dimensions == 2 ? ' selected ' : '') + '" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('matrix') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + ' [ ] " data-type="' + tm + '" data-dimensions="2"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(tm.toLowerCase())) + '</div>';
  22349. }
  22350. element += '</div></div>';
  22351. element += '</div></div> ';
  22352. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  22353. element += ' <span class="character_equals"> <&#8212; </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  22354. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  22355. element = $(element);
  22356. element.data('associatedFunction', function_obj);
  22357. function_container.find('.variables_list_div').append(element);
  22358. addHandlers(new_var, element, function_obj);
  22359. renderValues(new_var, element, function_obj.name);
  22360. return element;
  22361. }
  22362. function updateColumnsAndRowsText(variable_container, variable_var) {
  22363. var prev = variable_container.find('.text').text().split('[');
  22364. if (prev.length == 2) {
  22365. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  22366. variable_container.find('.text').empty();
  22367. variable_container.find('.text').text(ff);
  22368. }
  22369. if (prev.length == 3) {
  22370. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  22371. variable_container.find('.text').empty();
  22372. variable_container.find('.text').text(ff);
  22373. }
  22374. }
  22375. function renderValues(new_var, variable_container, function_name) {
  22376. var ret = "";
  22377. var j = 0;
  22378. if (new_var.dimensions == 0) {
  22379. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22380. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  22381. } else {
  22382. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  22383. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(new_var.value)) + '</span> </div> ';
  22384. } else {
  22385. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  22386. }
  22387. }
  22388. } else {
  22389. ret += '<table class="tabela_var">';
  22390. if (new_var.dimensions == 1) {
  22391. ret += '<tr>';
  22392. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22393. for (var k = 0; k < new_var.columns; k++) {
  22394. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  22395. }
  22396. } else {
  22397. for (var k = 0; k < new_var.columns; k++) {
  22398. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  22399. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(new_var.value[k])) + '</span></td>';
  22400. } else {
  22401. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  22402. }
  22403. }
  22404. }
  22405. ret += '</tr>';
  22406. ret += '</table>';
  22407. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_vector_column"></i>' + ' <i class="ui icon plus square outline add_global_vector_column"></i></div>';
  22408. }
  22409. if (new_var.dimensions == 2) {
  22410. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22411. for (var l = 0; l < new_var.rows; l++) {
  22412. ret += '<tr>';
  22413. for (var k = 0; k < new_var.columns; k++) {
  22414. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  22415. }
  22416. ret += '</tr>';
  22417. }
  22418. } else {
  22419. for (var l = 0; l < new_var.rows; l++) {
  22420. ret += '<tr>';
  22421. for (var k = 0; k < new_var.columns; k++) {
  22422. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  22423. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(new_var.value[l][k])) + '</span></td>';
  22424. } else {
  22425. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  22426. }
  22427. }
  22428. ret += '</tr>';
  22429. }
  22430. }
  22431. if (new_var.rows == 0) {
  22432. ret += '<tr><td></td></tr>';
  22433. }
  22434. ret += '<tr><td colspan="' + new_var.columns + '" class="tr_manage_lines"><i class="ui icon minus square outline remove_global_matrix_line"></i>' + ' <i class="ui icon plus square outline add_global_matrix_line"></i></td></tr>';
  22435. ret += '</table>';
  22436. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_matrix_column"></i>' + ' <i class="ui icon plus square outline add_global_matrix_column"></i></div>';
  22437. }
  22438. }
  22439. $(variable_container).find(".div_valor_var").html('');
  22440. ret = $(ret);
  22441. $(ret).find('.span_value_variable').data('associatedOject', new_var);
  22442. $(ret).find(".boolean_simple_type").on('click', function (e) {
  22443. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, new_var.name, new_var.value);
  22444. alternateBooleanValue(new_var, this.parentNode);
  22445. });
  22446. $(ret).find(".simple_var").on('click', function (e) {
  22447. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_VAR_VALUE, new_var.name);
  22448. enableValueUpdate(new_var, this.parentNode, function_name);
  22449. });
  22450. $(ret).find(".boolean_vector_var").on('click', function (e) {
  22451. alternateBooleanVectorValue(new_var, $(this).data('index'), this.parentNode);
  22452. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, new_var.name, new_var.value);
  22453. });
  22454. $(ret).find(".vector_var").on('click', function (e) {
  22455. enableVectorValueUpdate(new_var, $(this).data('index'), this.parentNode, function_name);
  22456. });
  22457. $(ret).find(".remove_global_vector_column").on('click', function (e) {
  22458. removeColumnVector(new_var);
  22459. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_TYPE, new_var.name, new_var.type, new_var.dimensions, new_var.rows, new_var.columns);
  22460. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, new_var.name, new_var.value);
  22461. $(variable_container).find(".div_valor_var").html('');
  22462. renderValues(new_var, variable_container, function_name);
  22463. });
  22464. $(ret).find(".add_global_vector_column").on('click', function (e) {
  22465. addColumnVector(new_var);
  22466. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_TYPE, new_var.name, new_var.type, new_var.dimensions, new_var.rows, new_var.columns);
  22467. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, new_var.name, new_var.value);
  22468. $(variable_container).find(".div_valor_var").html('');
  22469. renderValues(new_var, variable_container, function_name);
  22470. });
  22471. $(ret).find(".remove_global_matrix_column").on('click', function (e) {
  22472. removeColumnMatrix(new_var);
  22473. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_TYPE, new_var.name, new_var.type, new_var.dimensions, new_var.rows, new_var.columns);
  22474. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, new_var.name, new_var.value);
  22475. $(variable_container).find(".div_valor_var").html('');
  22476. renderValues(new_var, variable_container, function_name);
  22477. });
  22478. $(ret).find(".add_global_matrix_column").on('click', function (e) {
  22479. addColumnMatrix(new_var);
  22480. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_TYPE, new_var.name, new_var.type, new_var.dimensions, new_var.rows, new_var.columns);
  22481. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, new_var.name, new_var.value);
  22482. $(variable_container).find(".div_valor_var").html('');
  22483. renderValues(new_var, variable_container, function_name);
  22484. });
  22485. $(ret).find(".remove_global_matrix_line").on('click', function (e) {
  22486. removeLineMatrix(new_var);
  22487. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_TYPE, new_var.name, new_var.type, new_var.dimensions, new_var.rows, new_var.columns);
  22488. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, new_var.name, new_var.value);
  22489. $(variable_container).find(".div_valor_var").html('');
  22490. renderValues(new_var, variable_container, function_name);
  22491. });
  22492. $(ret).find(".add_global_matrix_line").on('click', function (e) {
  22493. addLineMatrix(new_var);
  22494. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_TYPE, new_var.name, new_var.type, new_var.dimensions, new_var.rows, new_var.columns);
  22495. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, new_var.name, new_var.value);
  22496. $(variable_container).find(".div_valor_var").html('');
  22497. renderValues(new_var, variable_container, function_name);
  22498. });
  22499. $(ret).find(".boolean_matrix_var").on('click', function (e) {
  22500. alternateBooleanMatrixValue(new_var, $(this).data('row'), $(this).data('index'), this.parentNode);
  22501. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, new_var.name, new_var.value);
  22502. });
  22503. $(ret).find(".matrix_var").on('click', function (e) {
  22504. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_VAR_VALUE, new_var.name);
  22505. enableMatrixValueUpdate(new_var, $(this).data('row'), $(this).data('index'), this.parentNode, function_name);
  22506. });
  22507. $(variable_container).find(".div_valor_var").append(ret);
  22508. updateColumnsAndRowsText(variable_container, new_var);
  22509. }
  22510. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  22511. var_obj.value[row][index] = !var_obj.value[row][index];
  22512. $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(var_obj.value[row][index])));
  22513. }
  22514. function addLineMatrix(var_obj) {
  22515. var_obj.rows++;
  22516. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22517. var n_l = [];
  22518. for (var i = 0; i < var_obj.columns; i++) {
  22519. n_l.push(0);
  22520. }
  22521. var_obj.value.push(n_l);
  22522. }
  22523. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22524. var n_l = [];
  22525. for (i = 0; i < var_obj.columns; i++) {
  22526. n_l.push(0.0);
  22527. }
  22528. var_obj.value.push(n_l);
  22529. }
  22530. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22531. var n_l = [];
  22532. for (i = 0; i < var_obj.columns; i++) {
  22533. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
  22534. }
  22535. var_obj.value.push(n_l);
  22536. }
  22537. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  22538. var n_l = [];
  22539. for (i = 0; i < var_obj.columns; i++) {
  22540. n_l.push(true);
  22541. }
  22542. var_obj.value.push(n_l);
  22543. }
  22544. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  22545. var n_l = [];
  22546. for (i = 0; i < var_obj.columns; i++) {
  22547. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
  22548. }
  22549. var_obj.value.push(n_l);
  22550. }
  22551. }
  22552. function removeLineMatrix(var_obj) {
  22553. if (var_obj.rows == 0) {
  22554. return;
  22555. }
  22556. var_obj.rows--;
  22557. var_obj.value.splice(var_obj.value.length - 1, 1);
  22558. }
  22559. function addColumnMatrix(var_obj) {
  22560. var_obj.columns++;
  22561. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22562. for (var i = 0; i < var_obj.rows; i++) {
  22563. var_obj.value[i].push(0);
  22564. }
  22565. }
  22566. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22567. for (var i = 0; i < var_obj.rows; i++) {
  22568. var_obj.value[i].push(0.0);
  22569. }
  22570. }
  22571. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22572. for (var i = 0; i < var_obj.rows; i++) {
  22573. var_obj.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
  22574. }
  22575. }
  22576. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  22577. for (var i = 0; i < var_obj.rows; i++) {
  22578. var_obj.value[i].push(true);
  22579. }
  22580. }
  22581. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  22582. for (var i = 0; i < var_obj.rows; i++) {
  22583. var_obj.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
  22584. }
  22585. }
  22586. }
  22587. function removeColumnMatrix(var_obj) {
  22588. if (var_obj.columns == 0) {
  22589. return;
  22590. }
  22591. var_obj.columns--;
  22592. for (var i = 0; i < var_obj.rows; i++) {
  22593. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  22594. }
  22595. }
  22596. function addColumnVector(var_obj) {
  22597. var_obj.columns++;
  22598. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22599. var_obj.value.push(0);
  22600. }
  22601. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22602. var_obj.value.push(0.0);
  22603. }
  22604. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22605. var_obj.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
  22606. }
  22607. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  22608. var_obj.value.push(true);
  22609. }
  22610. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  22611. var_obj.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
  22612. }
  22613. }
  22614. function removeColumnVector(var_obj) {
  22615. if (var_obj.columns == 0) {
  22616. return;
  22617. }
  22618. var_obj.columns--;
  22619. var_obj.value.splice(var_obj.value.length - 1, 1);
  22620. }
  22621. function alternateBooleanValue(var_obj, value_container) {
  22622. var_obj.value = !var_obj.value;
  22623. $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(var_obj.value)));
  22624. }
  22625. function alternateBooleanVectorValue(var_obj, index, value_container) {
  22626. var_obj.value[index] = !var_obj.value[index];
  22627. $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(var_obj.value[index])));
  22628. }
  22629. function updateInitialValues(variable_obj, function_name) {
  22630. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22631. if (variable_obj.dimensions == 0) {
  22632. variable_obj.value = 0;
  22633. }
  22634. if (variable_obj.dimensions == 1) {
  22635. variable_obj.value = [0, 0];
  22636. }
  22637. if (variable_obj.dimensions == 2) {
  22638. variable_obj.value = [[0, 0], [0, 0]];
  22639. }
  22640. }
  22641. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22642. if (variable_obj.dimensions == 0) {
  22643. variable_obj.value = 0.0;
  22644. }
  22645. if (variable_obj.dimensions == 1) {
  22646. variable_obj.value = [0.0, 0.0];
  22647. }
  22648. if (variable_obj.dimensions == 2) {
  22649. variable_obj.value = [[0.0, 0.0], [0.0, 0.0]];
  22650. }
  22651. }
  22652. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22653. if (variable_obj.dimensions == 0) {
  22654. variable_obj.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value');
  22655. }
  22656. if (variable_obj.dimensions == 1) {
  22657. variable_obj.value = [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value')];
  22658. }
  22659. if (variable_obj.dimensions == 2) {
  22660. variable_obj.value = [[_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value')], [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value')]];
  22661. }
  22662. }
  22663. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  22664. if (variable_obj.dimensions == 0) {
  22665. variable_obj.value = true;
  22666. }
  22667. if (variable_obj.dimensions == 1) {
  22668. variable_obj.value = [true, true];
  22669. }
  22670. if (variable_obj.dimensions == 2) {
  22671. variable_obj.value = [[true, true], [true, true]];
  22672. }
  22673. }
  22674. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  22675. if (variable_obj.dimensions == 0) {
  22676. variable_obj.value = 'A';
  22677. }
  22678. if (variable_obj.dimensions == 1) {
  22679. variable_obj.value = ['A', 'A'];
  22680. }
  22681. if (variable_obj.dimensions == 2) {
  22682. variable_obj.value = [['A', 'A'], ['A', 'A']];
  22683. }
  22684. }
  22685. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, variable_obj.name, variable_obj.value);
  22686. }
  22687. var opened_name_value_vector_global_ = false;
  22688. var opened_input_value_vector_global_ = null;
  22689. function enableVectorValueUpdate(var_obj, index, parent_node, function_name) {
  22690. if (opened_name_value_vector_global_) {
  22691. opened_input_value_vector_global_.focus();
  22692. return;
  22693. }
  22694. parent_node = $(parent_node);
  22695. opened_name_value_vector_global_ = true;
  22696. parent_node.find('.span_value_variable').text('');
  22697. var input_field;
  22698. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22699. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index].toFixed(1) + "' />");
  22700. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22701. } else {
  22702. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index] + "' />");
  22703. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22704. }
  22705. input_field.on('input', function () {
  22706. var inputWidth = input_field.textWidth() + 10;
  22707. opened_input_value_vector_global_ = input_field;
  22708. input_field.focus();
  22709. var tmpStr = input_field.val();
  22710. input_field.val('');
  22711. input_field.val(tmpStr);
  22712. input_field.css({
  22713. width: inputWidth
  22714. });
  22715. }).trigger('input');
  22716. input_field.focusout(function () {
  22717. var changed = false; /// update array:
  22718. if (input_field.val().trim()) {
  22719. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22720. var_obj.value[index] = parseFloat(input_field.val().trim());
  22721. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  22722. } else {
  22723. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22724. var_obj.value[index] = parseInt(input_field.val().trim());
  22725. } else {
  22726. var_obj.value[index] = input_field.val().trim();
  22727. }
  22728. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  22729. }
  22730. changed = true;
  22731. } else {
  22732. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22733. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  22734. } else {
  22735. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  22736. }
  22737. }
  22738. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22739. var_obj.value[index] = input_field.val();
  22740. changed = true;
  22741. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  22742. }
  22743. if (changed) {
  22744. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, var_obj.name, var_obj.value);
  22745. }
  22746. input_field.off();
  22747. input_field.remove(); /// update elements:
  22748. opened_name_value_vector_global_ = false;
  22749. opened_input_value_vector_global_ = false;
  22750. });
  22751. input_field.on('keydown', function (e) {
  22752. var code = e.keyCode || e.which;
  22753. var changed = false;
  22754. if (code == 13) {
  22755. if (input_field.val().trim()) {
  22756. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22757. var_obj.value[index] = parseFloat(input_field.val().trim());
  22758. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  22759. } else {
  22760. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22761. var_obj.value[index] = parseInt(input_field.val().trim());
  22762. } else {
  22763. var_obj.value[index] = input_field.val().trim();
  22764. }
  22765. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  22766. }
  22767. changed = true;
  22768. } else {
  22769. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22770. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  22771. } else {
  22772. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  22773. }
  22774. }
  22775. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22776. var_obj.value[index] = input_field.val();
  22777. changed = true;
  22778. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  22779. }
  22780. if (changed) {
  22781. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, var_obj.name, var_obj.value);
  22782. }
  22783. input_field.off();
  22784. input_field.remove(); /// update elements:
  22785. opened_name_value_vector_global_ = false;
  22786. opened_input_value_vector_global_ = false;
  22787. }
  22788. if (code == 27) {
  22789. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22790. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  22791. } else {
  22792. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  22793. }
  22794. input_field.off();
  22795. input_field.remove(); /// update elements:
  22796. opened_name_value_vector_global_ = false;
  22797. opened_input_value_vector_global_ = false;
  22798. }
  22799. });
  22800. input_field.select();
  22801. }
  22802. var opened_name_value_global_var = false;
  22803. var opened_input_value_global_ar = null;
  22804. function enableValueUpdate(var_obj, parent_node, function_name) {
  22805. if (opened_name_value_global_var) {
  22806. opened_input_value_global_ar.focus();
  22807. return;
  22808. }
  22809. parent_node = $(parent_node);
  22810. opened_name_value_global_var = true;
  22811. var input_field;
  22812. parent_node.find('.span_value_variable').text('');
  22813. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22814. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value.toFixed(1) + "' />");
  22815. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22816. } else {
  22817. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value + "' />");
  22818. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22819. }
  22820. input_field.on('input', function () {
  22821. var inputWidth = input_field.textWidth() + 10;
  22822. opened_input_value_global_ar = input_field;
  22823. input_field.focus();
  22824. var tmpStr = input_field.val();
  22825. input_field.val('');
  22826. input_field.val(tmpStr);
  22827. input_field.css({
  22828. width: inputWidth
  22829. });
  22830. }).trigger('input');
  22831. input_field.focusout(function () {
  22832. /// update array:
  22833. var changed = false;
  22834. if (input_field.val().trim()) {
  22835. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22836. var_obj.value = parseFloat(input_field.val().trim());
  22837. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  22838. } else {
  22839. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22840. var_obj.value = parseInt(input_field.val().trim());
  22841. } else if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  22842. var_obj.value = input_field.val().charAt(0);
  22843. } else {
  22844. var_obj.value = input_field.val().trim();
  22845. }
  22846. parent_node.find('.span_value_variable').text(var_obj.value);
  22847. }
  22848. changed = true;
  22849. } else {
  22850. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22851. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  22852. } else {
  22853. parent_node.find('.span_value_variable').text(var_obj.value);
  22854. }
  22855. }
  22856. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22857. var_obj.value = input_field.val();
  22858. changed = true;
  22859. parent_node.find('.span_value_variable').text(var_obj.value);
  22860. }
  22861. if (changed) {
  22862. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, var_obj.name, var_obj.value);
  22863. }
  22864. input_field.off();
  22865. input_field.remove(); /// update elements:
  22866. opened_name_value_global_var = false;
  22867. opened_input_value_global_ar = false;
  22868. });
  22869. input_field.on('keydown', function (e) {
  22870. var code = e.keyCode || e.which;
  22871. var changed = false;
  22872. if (code == 13) {
  22873. if (input_field.val().trim()) {
  22874. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22875. var_obj.value = parseFloat(input_field.val().trim());
  22876. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  22877. } else {
  22878. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22879. var_obj.value = parseInt(input_field.val().trim());
  22880. } else if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  22881. var_obj.value = input_field.val().charAt(0);
  22882. } else {
  22883. var_obj.value = input_field.val().trim();
  22884. }
  22885. parent_node.find('.span_value_variable').text(var_obj.value);
  22886. }
  22887. changed = true;
  22888. } else {
  22889. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22890. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  22891. } else {
  22892. parent_node.find('.span_value_variable').text(var_obj.value);
  22893. }
  22894. }
  22895. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22896. var_obj.value = input_field.val();
  22897. changed = true;
  22898. parent_node.find('.span_value_variable').text(var_obj.value);
  22899. }
  22900. if (changed) {
  22901. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, var_obj.name, var_obj.value);
  22902. }
  22903. input_field.off();
  22904. input_field.remove(); /// update elements:
  22905. opened_name_value_global_var = false;
  22906. opened_input_value_global_ar = false;
  22907. }
  22908. if (code == 27) {
  22909. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22910. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  22911. } else {
  22912. parent_node.find('.span_value_variable').text(var_obj.value);
  22913. }
  22914. input_field.off();
  22915. input_field.remove(); /// update elements:
  22916. opened_name_value_global_var = false;
  22917. opened_input_value_global_ar = false;
  22918. }
  22919. });
  22920. input_field.select();
  22921. }
  22922. var opened_name_global = false;
  22923. var opened_input_global = null;
  22924. function enableNameUpdate(variable_obj, variable_container, function_obj) {
  22925. if (opened_name_global) {
  22926. opened_input_global.focus();
  22927. return;
  22928. }
  22929. opened_name_global = true;
  22930. variable_container.find('.span_name_variable').text('');
  22931. var input_name;
  22932. input_name = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + variable_obj.name + "' />");
  22933. input_name.insertBefore(variable_container.find('.span_name_variable'));
  22934. input_name.on('input', function () {
  22935. var inputWidth = input_name.textWidth() + 10;
  22936. opened_input_global = input_name;
  22937. input_name.focus();
  22938. var tmpStr = input_name.val();
  22939. input_name.val('');
  22940. input_name.val(tmpStr);
  22941. input_name.css({
  22942. width: inputWidth
  22943. });
  22944. }).trigger('input');
  22945. input_name.focusout(function () {
  22946. /// update array:
  22947. if (input_name.val().trim().length > 0) {
  22948. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  22949. variable_container.find('.span_name_variable').text(variable_obj.name);
  22950. } else {
  22951. variable_container.find('.span_name_variable').text(variable_obj.name);
  22952. }
  22953. input_name.off();
  22954. input_name.remove(); /// update elements:
  22955. opened_name_global = false;
  22956. opened_input_global = false;
  22957. });
  22958. input_name.on('keydown', function (e) {
  22959. var code = e.keyCode || e.which;
  22960. if (code == 13) {
  22961. if (input_name.val().trim().length > 0) {
  22962. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  22963. variable_container.find('.span_name_variable').text(variable_obj.name);
  22964. } else {
  22965. variable_container.find('.span_name_variable').text(variable_obj.name);
  22966. }
  22967. input_name.off();
  22968. input_name.remove(); /// update elements:
  22969. opened_name_global = false;
  22970. opened_input_global = false;
  22971. }
  22972. if (code == 27) {
  22973. variable_container.find('.span_name_variable').text(variable_obj.name);
  22974. input_name.off();
  22975. input_name.remove(); /// update elements:
  22976. opened_name_global = false;
  22977. opened_input_global = false;
  22978. }
  22979. });
  22980. input_name.select();
  22981. }
  22982. var opened_name_value_matrix_global_v = false;
  22983. var opened_input_value_matrix_global_v = null;
  22984. function enableMatrixValueUpdate(var_obj, row, index, parent_node, function_name) {
  22985. if (opened_name_value_matrix_global_v) {
  22986. opened_input_value_matrix_global_v.focus();
  22987. return;
  22988. }
  22989. parent_node = $(parent_node);
  22990. opened_name_value_matrix_global_v = true;
  22991. parent_node.find('.span_value_variable').text('');
  22992. var input_field;
  22993. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22994. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index].toFixed(1) + "' />");
  22995. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22996. } else {
  22997. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index] + "' />");
  22998. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22999. }
  23000. input_field.on('input', function () {
  23001. var inputWidth = input_field.textWidth() + 10;
  23002. opened_input_value_matrix_global_v = input_field;
  23003. input_field.focus();
  23004. var tmpStr = input_field.val();
  23005. input_field.val('');
  23006. input_field.val(tmpStr);
  23007. input_field.css({
  23008. width: inputWidth
  23009. });
  23010. }).trigger('input');
  23011. input_field.focusout(function () {
  23012. var changed = false; /// update array:
  23013. if (input_field.val().trim()) {
  23014. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  23015. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  23016. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  23017. } else {
  23018. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  23019. var_obj.value[row][index] = parseInt(input_field.val().trim());
  23020. } else {
  23021. var_obj.value[row][index] = input_field.val().trim();
  23022. }
  23023. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  23024. }
  23025. changed = true;
  23026. } else {
  23027. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  23028. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  23029. } else {
  23030. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  23031. }
  23032. }
  23033. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  23034. var_obj.value[row][index] = input_field.val();
  23035. changed = true;
  23036. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  23037. }
  23038. if (changed) {
  23039. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, var_obj.name, var_obj.value);
  23040. }
  23041. input_field.off();
  23042. input_field.remove(); /// update elements:
  23043. opened_name_value_matrix_global_v = false;
  23044. opened_input_value_matrix_global_v = false;
  23045. });
  23046. input_field.on('keydown', function (e) {
  23047. var code = e.keyCode || e.which;
  23048. var changed = false;
  23049. if (code == 13) {
  23050. if (input_field.val().trim()) {
  23051. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  23052. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  23053. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  23054. } else {
  23055. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  23056. var_obj.value[row][index] = parseInt(input_field.val().trim());
  23057. } else {
  23058. var_obj.value[row][index] = input_field.val().trim();
  23059. }
  23060. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  23061. }
  23062. changed = true;
  23063. } else {
  23064. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  23065. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  23066. } else {
  23067. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  23068. }
  23069. }
  23070. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  23071. var_obj.value[row][index] = input_field.val();
  23072. changed = true;
  23073. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  23074. }
  23075. if (changed) {
  23076. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_VAR_VALUE, var_obj.name, var_obj.value);
  23077. }
  23078. input_field.off();
  23079. input_field.remove(); /// update elements:
  23080. opened_name_value_matrix_global_v = false;
  23081. opened_input_value_matrix_global_v = false;
  23082. }
  23083. if (code == 27) {
  23084. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  23085. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  23086. } else {
  23087. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  23088. }
  23089. input_field.off();
  23090. input_field.remove(); /// update elements:
  23091. opened_name_value_matrix_global_v = false;
  23092. opened_input_value_matrix_global_v = false;
  23093. }
  23094. });
  23095. input_field.select();
  23096. }
  23097. /***/ }),
  23098. /***/ "./grammar/en/ivprog.ts":
  23099. /*!******************************!*\
  23100. !*** ./grammar/en/ivprog.ts ***!
  23101. \******************************/
  23102. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23103. "use strict";
  23104. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23105. exports.enLexer = void 0;
  23106. const lexer_1 = __webpack_require__(/*! ../lexer */ "./grammar/lexer.ts");
  23107. // i18n lexer strings for the language.
  23108. const types = {
  23109. // types
  23110. RK_REAL: "real",
  23111. RK_INTEGER: "int",
  23112. RK_BOOLEAN: "bool",
  23113. RK_CHARACTER: "char",
  23114. RK_STRING: "string",
  23115. };
  23116. const commands = {
  23117. // RK_VOID is not formally part of Types since it doesn't have a valid value/instance
  23118. RK_VOID: "vazio",
  23119. // commands
  23120. RK_PROGRAM: "program",
  23121. RK_SWITCH: "switch",
  23122. RK_CASE: "case",
  23123. RK_DEFAULT: "otherwise",
  23124. RK_CONST: "const",
  23125. RK_FUNCTION: "function",
  23126. RK_RETURN: "return",
  23127. RK_FOR: "for",
  23128. RK_FOR_ALT: "repeat_for",
  23129. RK_FOR_FROM: "from",
  23130. RK_FOR_TO: "to",
  23131. RK_FOR_PASS: "pass",
  23132. RK_BREAK: "break",
  23133. RK_DO: "repeat",
  23134. RK_DO_UNTIL: "until",
  23135. RK_WHILE: "while",
  23136. RK_WHILE_ALT: "repeat_while",
  23137. RK_IF: "if",
  23138. RK_ELSE: "else",
  23139. RK_REFERENCE: "&",
  23140. };
  23141. const boolVal = {
  23142. RK_FALSE: "false",
  23143. RK_TRUE: "true",
  23144. };
  23145. const logicOp = {
  23146. RK_LOGICAL_NOT: "not",
  23147. RK_LOGICAL_AND: "AND",
  23148. RK_LOGICAL_OR: "OR",
  23149. };
  23150. const langLibs = {
  23151. $mathLib: "Mathematics",
  23152. $ioLib: "IO",
  23153. $strLib: "Text",
  23154. $arrayLib: "Array",
  23155. $langLib: "Conversion",
  23156. };
  23157. const langFuncs = {
  23158. main_function: "main",
  23159. $read: "read",
  23160. $write: "write",
  23161. $numElements: "total_of_elements",
  23162. $matrixLines: "total_of_lines",
  23163. $matrixColumns: "total_of_columns",
  23164. $substring: "substring",
  23165. $length: "length",
  23166. $uppercase: "uppercase",
  23167. $lowercase: "lowercase",
  23168. $charAt: "char_at",
  23169. $isReal: "is_real",
  23170. $isInt: "is_integer",
  23171. $isBool: "is_logic",
  23172. $castReal: "to_real",
  23173. $castInt: "to_integer",
  23174. $castBool: "to_logic",
  23175. $castString: "to_string",
  23176. $castChar: "to_char",
  23177. $sin: "sin",
  23178. $cos: "cos",
  23179. $tan: "tan",
  23180. $sqrt: "sqrt",
  23181. $pow: "pow",
  23182. $log: "log",
  23183. $abs: "abs",
  23184. $negate: "negate",
  23185. $invert: "invert",
  23186. $max: "maximum",
  23187. $min: "minimum",
  23188. $rand: "random",
  23189. };
  23190. // END i18n lexer strings
  23191. exports.enLexer = lexer_1.makeLexer({
  23192. commands,
  23193. boolVal,
  23194. logicOp,
  23195. types,
  23196. langLibs,
  23197. langFuncs,
  23198. });
  23199. /***/ }),
  23200. /***/ "./grammar/helper.ts":
  23201. /*!***************************!*\
  23202. !*** ./grammar/helper.ts ***!
  23203. \***************************/
  23204. /***/ ((__unused_webpack_module, exports) => {
  23205. "use strict";
  23206. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23207. exports.combineRegex = void 0;
  23208. function combineRegex(strings, ...pieces) {
  23209. return new RegExp(strings.raw
  23210. .map((r, i) => r + (pieces[i] === undefined ? "" : "(?:" + pieces[i].source + ")"))
  23211. .join(""));
  23212. }
  23213. exports.combineRegex = combineRegex;
  23214. /***/ }),
  23215. /***/ "./grammar/index.ts":
  23216. /*!**************************!*\
  23217. !*** ./grammar/index.ts ***!
  23218. \**************************/
  23219. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23220. "use strict";
  23221. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23222. const ivprog_1 = __webpack_require__(/*! ./pt/ivprog */ "./grammar/pt/ivprog.ts");
  23223. const ivprog_2 = __webpack_require__(/*! ./en/ivprog */ "./grammar/en/ivprog.ts");
  23224. /*import * as ES from "./es/ivprog.g4";
  23225. import ESFuncs from "./es/langFunctions";
  23226. import ESLibs from "./es/langLibs";*/
  23227. const lexers = {};
  23228. lexers["pt"] = ivprog_1.ptLexer;
  23229. lexers["en"] = ivprog_2.enLexer;
  23230. exports["default"] = lexers;
  23231. /***/ }),
  23232. /***/ "./grammar/lexer.ts":
  23233. /*!**************************!*\
  23234. !*** ./grammar/lexer.ts ***!
  23235. \**************************/
  23236. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23237. "use strict";
  23238. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23239. exports.makeLexer = exports.IVProgLexer = void 0;
  23240. const moo = __webpack_require__(/*! moo */ "./node_modules/moo/moo.js");
  23241. const helper_1 = __webpack_require__(/*! ./helper */ "./grammar/helper.ts");
  23242. class IVProgLexer {
  23243. constructor(RKs, lexer, rules, i18nLexer) {
  23244. this.RKs = RKs;
  23245. this.lexer = lexer;
  23246. this.rules = rules;
  23247. this.i18nLexer = i18nLexer;
  23248. }
  23249. getReservedKeys() {
  23250. return this.RKs;
  23251. }
  23252. getRules() {
  23253. return this.rules;
  23254. }
  23255. getTypeKeys() {
  23256. return this.i18nLexer.types;
  23257. }
  23258. getLangLibs() {
  23259. return this.i18nLexer.langLibs;
  23260. }
  23261. getLangFuncs() {
  23262. return this.i18nLexer.langFuncs;
  23263. }
  23264. }
  23265. exports.IVProgLexer = IVProgLexer;
  23266. // General Regex Rules
  23267. const ID = "[a-zA-Z_][a-zA-Z0-9_]*";
  23268. const HEX_DIGIT = "[0-9a-fA-F]";
  23269. const OCTAL_DIGIT = "[0-7]";
  23270. const ESC_OCTAL = RegExp(`\\\\[0-3]${OCTAL_DIGIT}${OCTAL_DIGIT}|\\\\${OCTAL_DIGIT}${OCTAL_DIGIT}|\\\\${OCTAL_DIGIT}`);
  23271. const ESC_UNICODE = RegExp(`\\\\u${HEX_DIGIT}${HEX_DIGIT}${HEX_DIGIT}${HEX_DIGIT}`);
  23272. const ESC_SEQ_BASE = /\\[b,t,n,f,r,",',\\]|/;
  23273. const ESC_SEQ = helper_1.combineRegex `${ESC_SEQ_BASE}|${ESC_UNICODE}|${ESC_OCTAL}`;
  23274. const STRING_CHARACTER = helper_1.combineRegex `${ESC_SEQ}|[^"\\\\]`;
  23275. function makeLexer(lexer) {
  23276. const RKs = {};
  23277. const rules = {};
  23278. Object.entries(lexer.types).forEach(([key, value]) => {
  23279. RKs[key] = value;
  23280. rules[key] = key;
  23281. });
  23282. Object.entries(lexer.boolVal).forEach(([key, value]) => {
  23283. RKs[key] = value;
  23284. rules[key] = key;
  23285. });
  23286. Object.entries(lexer.commands).forEach(([key, value]) => {
  23287. RKs[key] = value;
  23288. rules[key] = key;
  23289. });
  23290. RKs["AND_OPERATOR"] = lexer.logicOp.RK_LOGICAL_AND;
  23291. RKs["OR_OPERATOR"] = lexer.logicOp.RK_LOGICAL_OR;
  23292. RKs["NOT_OPERATOR"] = lexer.logicOp.RK_LOGICAL_NOT;
  23293. const RESERVED_KEYS = moo.keywords(RKs);
  23294. const lexerRules = {
  23295. COMMENTS: { match: /\/\/[^$]*?$|\/\*[^$]*?\*\//, lineBreaks: true },
  23296. OPEN_BRACE: /\[/,
  23297. CLOSE_BRACE: /\]/,
  23298. OPEN_PARENTHESIS: /\(/,
  23299. CLOSE_PARENTHESIS: /\)/,
  23300. OPEN_CURLY: /\{/,
  23301. CLOSE_CURLY: /\}/,
  23302. COMMA: /,/,
  23303. ASSIGNMENT: /<-|←/,
  23304. REAL: /[0-9]+\.[0-9]*[eE][+-]?[0-9]+|[0-9]+\.[0-9]+/,
  23305. INTEGER: RegExp(`(?:0x|0X)${HEX_DIGIT}+|(?:0b|0B)[0-1]+|[0-9]+`),
  23306. SUM_OP: /[+-]/,
  23307. MULTI_OP: /[*/%]/,
  23308. RELATIONAL_OPERATOR: />=|==|<=|>|<|!=/,
  23309. COLON: /:/,
  23310. STRING: helper_1.combineRegex `"(?:${STRING_CHARACTER})*?"`,
  23311. CHARACTER: helper_1.combineRegex `'(?:${ESC_SEQ}|[^'\\\\])'`,
  23312. EOS: { match: /;\r?\n?|[\r\n]+/, lineBreaks: true },
  23313. WHITESPACE: /(?: |\t)+/,
  23314. RK_REFERENCE: RegExp(lexer.commands.RK_REFERENCE),
  23315. ID: { match: RegExp(ID), type: RESERVED_KEYS },
  23316. DOT: /\./,
  23317. ERROR: { match: /[\$?`]/, error: true },
  23318. };
  23319. Object.entries(lexerRules).forEach(([key, _]) => (rules[key] = key));
  23320. const moolexer = moo.compile(lexerRules);
  23321. return new IVProgLexer(RKs, moolexer, rules, lexer);
  23322. }
  23323. exports.makeLexer = makeLexer;
  23324. /***/ }),
  23325. /***/ "./grammar/pt/ivprog.ts":
  23326. /*!******************************!*\
  23327. !*** ./grammar/pt/ivprog.ts ***!
  23328. \******************************/
  23329. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23330. "use strict";
  23331. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23332. exports.ptLexer = void 0;
  23333. const lexer_1 = __webpack_require__(/*! ../lexer */ "./grammar/lexer.ts");
  23334. // i18n lexer strings for the language.
  23335. const types = {
  23336. // types
  23337. RK_REAL: "real",
  23338. RK_INTEGER: "inteiro",
  23339. RK_BOOLEAN: "logico",
  23340. RK_CHARACTER: "caractere",
  23341. RK_STRING: "cadeia",
  23342. };
  23343. const commands = {
  23344. // RK_VOID is not formally part of Types since it doesn't have a valid value/instance
  23345. RK_VOID: "vazio",
  23346. // commands
  23347. RK_PROGRAM: "programa",
  23348. RK_SWITCH: "escolha",
  23349. RK_CASE: "caso",
  23350. RK_DEFAULT: "contrario",
  23351. RK_CONST: "const",
  23352. RK_FUNCTION: "funcao",
  23353. RK_RETURN: "devolva",
  23354. RK_FOR: "para",
  23355. RK_FOR_ALT: "repita_para",
  23356. RK_FOR_FROM: "de",
  23357. RK_FOR_TO: "ate",
  23358. RK_FOR_PASS: "passo",
  23359. RK_BREAK: "pare",
  23360. RK_DO: "repita",
  23361. RK_DO_UNTIL: "ate_que",
  23362. RK_WHILE: "enquanto",
  23363. RK_WHILE_ALT: "repita_enquanto",
  23364. RK_IF: "se",
  23365. RK_ELSE: "senao",
  23366. RK_REFERENCE: "&",
  23367. };
  23368. const boolVal = {
  23369. RK_FALSE: "falso",
  23370. RK_TRUE: "verdadeiro",
  23371. };
  23372. const logicOp = {
  23373. RK_LOGICAL_NOT: "nao",
  23374. RK_LOGICAL_AND: "E",
  23375. RK_LOGICAL_OR: "OU",
  23376. };
  23377. const langLibs = {
  23378. $mathLib: "Matematica",
  23379. $ioLib: "ES",
  23380. $strLib: "Texto",
  23381. $arrayLib: "Arranjo",
  23382. $langLib: "Conversao",
  23383. };
  23384. const langFuncs = {
  23385. main_function: "inicio",
  23386. $read: "leia",
  23387. $write: "escreva",
  23388. $numElements: "total_de_elementos",
  23389. $matrixLines: "total_de_linhas",
  23390. $matrixColumns: "total_de_colunas",
  23391. $substring: "subcadeia",
  23392. $length: "comprimento",
  23393. $uppercase: "caixa_alta",
  23394. $lowercase: "caixa_baixa",
  23395. $charAt: "caractere_na_posicao",
  23396. $isReal: "e_real",
  23397. $isInt: "e_inteiro",
  23398. $isBool: "e_logico",
  23399. $castReal: "como_real",
  23400. $castInt: "como_inteiro",
  23401. $castBool: "como_logico",
  23402. $castString: "como_cadeia",
  23403. $castChar: "como_caractere",
  23404. $sin: "seno",
  23405. $cos: "cosseno",
  23406. $tan: "tangente",
  23407. $sqrt: "raiz_quadrada",
  23408. $pow: "potencia",
  23409. $log: "logaritmo",
  23410. $abs: "modulo",
  23411. $negate: "trocar_sinal",
  23412. $invert: "inverter_valor",
  23413. $max: "maximo",
  23414. $min: "minimo",
  23415. $rand: "numero_aleatorio",
  23416. };
  23417. // END i18n lexer strings
  23418. exports.ptLexer = lexer_1.makeLexer({
  23419. commands,
  23420. boolVal,
  23421. logicOp,
  23422. types,
  23423. langLibs,
  23424. langFuncs,
  23425. });
  23426. /***/ }),
  23427. /***/ "./i18n/index.ts":
  23428. /*!***********************!*\
  23429. !*** ./i18n/index.ts ***!
  23430. \***********************/
  23431. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23432. "use strict";
  23433. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23434. const Messages = __webpack_require__(/*! ./message.csv */ "./i18n/message.csv");
  23435. const UI = __webpack_require__(/*! ./ui.csv */ "./i18n/ui.csv");
  23436. const Errors = __webpack_require__(/*! ./error.csv */ "./i18n/error.csv");
  23437. const MessagesObj = Messages;
  23438. const UIObj = UI;
  23439. const ErrorsObj = Errors;
  23440. const i18n_data = {};
  23441. for (const key in UIObj) {
  23442. const data = {};
  23443. data['error'] = ErrorsObj[key];
  23444. data['message'] = MessagesObj[key];
  23445. data['ui'] = UIObj[key];
  23446. i18n_data[key] = data;
  23447. }
  23448. exports["default"] = i18n_data;
  23449. /***/ }),
  23450. /***/ "./js/ast/operators.ts":
  23451. /*!*****************************!*\
  23452. !*** ./js/ast/operators.ts ***!
  23453. \*****************************/
  23454. /***/ ((__unused_webpack_module, exports) => {
  23455. "use strict";
  23456. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23457. exports.convertFromString = exports.Operators = void 0;
  23458. exports.Operators = Object.freeze({
  23459. ADD: { ord: 0, value: "+" },
  23460. SUB: { ord: 1, value: "-" },
  23461. MULT: { ord: 2, value: '*' },
  23462. DIV: { ord: 3, value: '/' },
  23463. MOD: { ord: 4, value: '%' },
  23464. GT: { ord: 5, value: '>' },
  23465. GE: { ord: 6, value: '>=' },
  23466. LT: { ord: 7, value: '<' },
  23467. LE: { ord: 8, value: '<=' },
  23468. EQ: { ord: 9, value: '==' },
  23469. NEQ: { ord: 10, value: '!=' },
  23470. AND: { ord: 11, value: 'and' },
  23471. OR: { ord: 12, value: 'or' },
  23472. NOT: { ord: 13, value: 'not' }
  23473. });
  23474. function convertFromString(op) {
  23475. switch (op) {
  23476. case '+': return exports.Operators.ADD;
  23477. case '-': return exports.Operators.SUB;
  23478. case '*': return exports.Operators.MULT;
  23479. case '/': return exports.Operators.DIV;
  23480. case '%': return exports.Operators.MOD;
  23481. case '>': return exports.Operators.GT;
  23482. case '>=': return exports.Operators.GE;
  23483. case '<': return exports.Operators.LT;
  23484. case '<=': return exports.Operators.LE;
  23485. case '==': return exports.Operators.EQ;
  23486. case '!=': return exports.Operators.NEQ;
  23487. case 'and': return exports.Operators.AND;
  23488. case 'or': return exports.Operators.OR;
  23489. case 'not': return exports.Operators.NOT;
  23490. }
  23491. return null;
  23492. }
  23493. exports.convertFromString = convertFromString;
  23494. /***/ }),
  23495. /***/ "./js/memory/address.ts":
  23496. /*!******************************!*\
  23497. !*** ./js/memory/address.ts ***!
  23498. \******************************/
  23499. /***/ ((__unused_webpack_module, exports) => {
  23500. "use strict";
  23501. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23502. exports.Address = void 0;
  23503. class Address {
  23504. /**
  23505. *
  23506. * @param {Number} id the address id
  23507. * @param {never} value the value stored at this address
  23508. */
  23509. constructor(id, value) {
  23510. this.id = id;
  23511. this.value = value;
  23512. }
  23513. }
  23514. exports.Address = Address;
  23515. /***/ }),
  23516. /***/ "./js/memory/location.ts":
  23517. /*!*******************************!*\
  23518. !*** ./js/memory/location.ts ***!
  23519. \*******************************/
  23520. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23521. "use strict";
  23522. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23523. exports.Location = void 0;
  23524. const address_1 = __webpack_require__(/*! ./address */ "./js/memory/address.ts");
  23525. class LocationHolder {
  23526. constructor() {
  23527. this.data = [];
  23528. this.address_id = 0;
  23529. }
  23530. /**
  23531. *
  23532. * @param {never} value the value to be allocated
  23533. * @returns {number} - the address id
  23534. */
  23535. allocate(value) {
  23536. const id = this.address_id;
  23537. // console.log("Allocation address "+ id);
  23538. const address = new address_1.Address(id, value);
  23539. this.data.push(address);
  23540. this.address_id += 1;
  23541. return id;
  23542. }
  23543. /**
  23544. *
  23545. * @param {number} id
  23546. */
  23547. deallocate(id) {
  23548. const index = this.findIndex(id);
  23549. // console.log("Deallocation address "+ id);
  23550. if (index !== -1) {
  23551. this.data.splice(index, 1);
  23552. return true;
  23553. }
  23554. return false;
  23555. }
  23556. /**
  23557. *
  23558. * @param {number} id
  23559. * @returns {Address} the address identified by id
  23560. */
  23561. find(id) {
  23562. let beg = 0;
  23563. let end = this.data.length;
  23564. // console.log("Finding address "+id);
  23565. while (beg < end) {
  23566. const med = Math.floor((beg + end) / 2);
  23567. const address = this.getAddressAt(med);
  23568. if (address.id === id) {
  23569. return address;
  23570. }
  23571. else if (id > address.id) {
  23572. beg = med;
  23573. }
  23574. else {
  23575. end = med;
  23576. }
  23577. }
  23578. return undefined;
  23579. }
  23580. getAddressAt(pos) {
  23581. return this.data[pos];
  23582. }
  23583. /**
  23584. *
  23585. * @param {number} id address id
  23586. * @returns {number} the index of the address identified by id
  23587. */
  23588. findIndex(id) {
  23589. let beg = 0;
  23590. let end = this.data.length;
  23591. while (beg < end) {
  23592. const med = Math.floor((beg + end) / 2);
  23593. const address = this.getAddressAt(med);
  23594. if (address.id === id) {
  23595. return med;
  23596. }
  23597. else if (id > address.id) {
  23598. beg = med;
  23599. }
  23600. else {
  23601. end = med;
  23602. }
  23603. }
  23604. return -1;
  23605. }
  23606. updateAddress(id, value) {
  23607. const index = this.findIndex(id);
  23608. if (index === -1) {
  23609. throw new Error("Invalid address..." + id);
  23610. }
  23611. this.data[index].value = value;
  23612. }
  23613. clear() {
  23614. for (let i = 0; i < this.data.length; i += 1) {
  23615. delete this.data[i];
  23616. }
  23617. this.data = [];
  23618. this.address_id = 0;
  23619. }
  23620. }
  23621. const inner_ref = new LocationHolder();
  23622. exports.Location = Object.freeze({
  23623. allocate: inner_ref.allocate.bind(inner_ref),
  23624. deallocate: inner_ref.deallocate.bind(inner_ref),
  23625. find: inner_ref.find.bind(inner_ref),
  23626. updateAddress: inner_ref.updateAddress.bind(inner_ref),
  23627. clear: inner_ref.clear.bind(inner_ref),
  23628. size: () => inner_ref.data.length
  23629. });
  23630. /***/ }),
  23631. /***/ "./js/processor/compatibilityTable.ts":
  23632. /*!********************************************!*\
  23633. !*** ./js/processor/compatibilityTable.ts ***!
  23634. \********************************************/
  23635. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23636. "use strict";
  23637. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23638. exports.resultTypeAfterUnaryOp = exports.resultTypeAfterInfixOp = void 0;
  23639. const types_1 = __webpack_require__(/*! ../typeSystem/types */ "./js/typeSystem/types.ts");
  23640. const operators_1 = __webpack_require__(/*! ../ast/operators */ "./js/ast/operators.ts");
  23641. const multiType_1 = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.ts");
  23642. const config_1 = __webpack_require__(/*! ../util/config */ "./js/util/config.ts");
  23643. function buildInfixAddTable() {
  23644. const table = [[], [], [], [], []];
  23645. table[types_1.Types.INTEGER.ord][types_1.Types.INTEGER.ord] = types_1.Types.INTEGER;
  23646. table[types_1.Types.INTEGER.ord][types_1.Types.REAL.ord] = types_1.Types.REAL;
  23647. table[types_1.Types.INTEGER.ord][types_1.Types.STRING.ord] = types_1.Types.STRING;
  23648. table[types_1.Types.REAL.ord][types_1.Types.INTEGER.ord] = types_1.Types.REAL;
  23649. table[types_1.Types.REAL.ord][types_1.Types.REAL.ord] = types_1.Types.REAL;
  23650. table[types_1.Types.REAL.ord][types_1.Types.STRING.ord] = types_1.Types.STRING;
  23651. table[types_1.Types.STRING.ord][types_1.Types.INTEGER.ord] = types_1.Types.STRING;
  23652. table[types_1.Types.STRING.ord][types_1.Types.REAL.ord] = types_1.Types.STRING;
  23653. table[types_1.Types.STRING.ord][types_1.Types.STRING.ord] = types_1.Types.STRING;
  23654. table[types_1.Types.STRING.ord][types_1.Types.BOOLEAN.ord] = types_1.Types.STRING;
  23655. table[types_1.Types.STRING.ord][types_1.Types.CHAR.ord] = types_1.Types.STRING;
  23656. table[types_1.Types.CHAR.ord][types_1.Types.CHAR.ord] = types_1.Types.STRING;
  23657. table[types_1.Types.CHAR.ord][types_1.Types.STRING.ord] = types_1.Types.STRING;
  23658. return table;
  23659. }
  23660. function buildInfixMultiDivSubTable() {
  23661. const table = [[], []];
  23662. table[types_1.Types.INTEGER.ord][types_1.Types.INTEGER.ord] = types_1.Types.INTEGER;
  23663. table[types_1.Types.INTEGER.ord][types_1.Types.REAL.ord] = types_1.Types.REAL;
  23664. table[types_1.Types.REAL.ord][types_1.Types.INTEGER.ord] = types_1.Types.REAL;
  23665. table[types_1.Types.REAL.ord][types_1.Types.REAL.ord] = types_1.Types.REAL;
  23666. return table;
  23667. }
  23668. function buildInfixEqualityInequalityTable() {
  23669. const table = [[], [], [], [], []];
  23670. table[types_1.Types.INTEGER.ord][types_1.Types.INTEGER.ord] = types_1.Types.BOOLEAN;
  23671. table[types_1.Types.REAL.ord][types_1.Types.REAL.ord] = types_1.Types.BOOLEAN;
  23672. table[types_1.Types.BOOLEAN.ord][types_1.Types.BOOLEAN.ord] = types_1.Types.BOOLEAN;
  23673. table[types_1.Types.STRING.ord][types_1.Types.STRING.ord] = types_1.Types.BOOLEAN;
  23674. table[types_1.Types.CHAR.ord][types_1.Types.CHAR.ord] = types_1.Types.BOOLEAN;
  23675. return table;
  23676. }
  23677. function buildInfixRelationalTable() {
  23678. const table = [[], [], [], [], []];
  23679. table[types_1.Types.INTEGER.ord][types_1.Types.INTEGER.ord] = types_1.Types.BOOLEAN;
  23680. table[types_1.Types.REAL.ord][types_1.Types.REAL.ord] = types_1.Types.BOOLEAN;
  23681. table[types_1.Types.STRING.ord][types_1.Types.STRING.ord] = types_1.Types.BOOLEAN;
  23682. table[types_1.Types.CHAR.ord][types_1.Types.CHAR.ord] = types_1.Types.BOOLEAN;
  23683. return table;
  23684. }
  23685. function buildInfixAndOrTable() {
  23686. const table = [[], [], [], []];
  23687. table[types_1.Types.BOOLEAN.ord][types_1.Types.BOOLEAN.ord] = types_1.Types.BOOLEAN;
  23688. return table;
  23689. }
  23690. function buildInfixModTable() {
  23691. const table = [[]];
  23692. table[types_1.Types.INTEGER.ord][types_1.Types.INTEGER.ord] = types_1.Types.INTEGER;
  23693. return table;
  23694. }
  23695. function buildUnarySumSubList() {
  23696. const list = [];
  23697. list[types_1.Types.INTEGER.ord] = types_1.Types.INTEGER;
  23698. list[types_1.Types.REAL.ord] = types_1.Types.REAL;
  23699. return list;
  23700. }
  23701. function buildUnaryNegList() {
  23702. const list = [];
  23703. list[types_1.Types.BOOLEAN.ord] = types_1.Types.BOOLEAN;
  23704. return list;
  23705. }
  23706. function buildInfixCompatibilityTable() {
  23707. const compatibilityMap = new WeakMap();
  23708. compatibilityMap.set(operators_1.Operators.ADD, buildInfixAddTable());
  23709. compatibilityMap.set(operators_1.Operators.SUB, buildInfixMultiDivSubTable());
  23710. compatibilityMap.set(operators_1.Operators.MULT, buildInfixMultiDivSubTable());
  23711. compatibilityMap.set(operators_1.Operators.DIV, buildInfixMultiDivSubTable());
  23712. compatibilityMap.set(operators_1.Operators.EQ, buildInfixEqualityInequalityTable());
  23713. compatibilityMap.set(operators_1.Operators.NEQ, buildInfixEqualityInequalityTable());
  23714. compatibilityMap.set(operators_1.Operators.GE, buildInfixRelationalTable());
  23715. compatibilityMap.set(operators_1.Operators.GT, buildInfixRelationalTable());
  23716. compatibilityMap.set(operators_1.Operators.LE, buildInfixRelationalTable());
  23717. compatibilityMap.set(operators_1.Operators.LT, buildInfixRelationalTable());
  23718. compatibilityMap.set(operators_1.Operators.OR, buildInfixAndOrTable());
  23719. compatibilityMap.set(operators_1.Operators.AND, buildInfixAndOrTable());
  23720. compatibilityMap.set(operators_1.Operators.MOD, buildInfixModTable());
  23721. return compatibilityMap;
  23722. }
  23723. function buildUnaryCompatibilityTable() {
  23724. const compatibilityMap = new WeakMap();
  23725. compatibilityMap.set(operators_1.Operators.ADD, buildUnarySumSubList());
  23726. compatibilityMap.set(operators_1.Operators.SUB, buildUnarySumSubList());
  23727. compatibilityMap.set(operators_1.Operators.NOT, buildUnaryNegList());
  23728. return compatibilityMap;
  23729. }
  23730. const infixMap = buildInfixCompatibilityTable();
  23731. const unaryMap = buildUnaryCompatibilityTable();
  23732. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  23733. try {
  23734. if (leftExpressionType instanceof multiType_1.MultiType && rightExpressionType instanceof multiType_1.MultiType) {
  23735. let newMulti = [];
  23736. for (let i = 0; i < leftExpressionType.types.length; ++i) {
  23737. const typeA = leftExpressionType.types[i];
  23738. for (let j = 0; j < rightExpressionType.types.length; ++i) {
  23739. const typeB = rightExpressionType.types[j];
  23740. newMulti.push(resultTypeAfterInfixOp(operator, typeA, typeB));
  23741. }
  23742. }
  23743. newMulti = newMulti.filter(x => !x.isCompatible(types_1.Types.UNDEFINED));
  23744. if (newMulti.length <= 0) {
  23745. if (config_1.Config.enable_type_casting) {
  23746. if (leftExpressionType.isCompatible(types_1.Types.INTEGER) || leftExpressionType.isCompatible(types_1.Types.REAL)) {
  23747. if (rightExpressionType.isCompatible(types_1.Types.INTEGER) || rightExpressionType.isCompatible(types_1.Types.REAL)) {
  23748. return new multiType_1.MultiType([types_1.Types.INTEGER, types_1.Types.REAL]);
  23749. }
  23750. }
  23751. }
  23752. return types_1.Types.UNDEFINED;
  23753. }
  23754. else {
  23755. return new multiType_1.MultiType(newMulti);
  23756. }
  23757. }
  23758. else if (leftExpressionType instanceof multiType_1.MultiType) {
  23759. if (leftExpressionType.isCompatible(rightExpressionType)) {
  23760. return resultTypeAfterInfixOp(operator, rightExpressionType, rightExpressionType);
  23761. }
  23762. else {
  23763. if (config_1.Config.enable_type_casting) {
  23764. if (leftExpressionType.isCompatible(types_1.Types.INTEGER) || leftExpressionType.isCompatible(types_1.Types.REAL)) {
  23765. if (rightExpressionType.isCompatible(types_1.Types.INTEGER) || rightExpressionType.isCompatible(types_1.Types.REAL)) {
  23766. return rightExpressionType;
  23767. }
  23768. }
  23769. }
  23770. return types_1.Types.UNDEFINED;
  23771. }
  23772. }
  23773. else if (rightExpressionType instanceof multiType_1.MultiType) {
  23774. if (rightExpressionType.isCompatible(leftExpressionType)) {
  23775. return resultTypeAfterInfixOp(operator, leftExpressionType, leftExpressionType);
  23776. }
  23777. else {
  23778. if (config_1.Config.enable_type_casting) {
  23779. if (leftExpressionType.isCompatible(types_1.Types.INTEGER) || leftExpressionType.isCompatible(types_1.Types.REAL)) {
  23780. if (rightExpressionType.isCompatible(types_1.Types.INTEGER) || rightExpressionType.isCompatible(types_1.Types.REAL)) {
  23781. return leftExpressionType;
  23782. }
  23783. }
  23784. }
  23785. return types_1.Types.UNDEFINED;
  23786. }
  23787. }
  23788. const resultTable = infixMap.get(operator) || [];
  23789. // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  23790. const resultType = resultTable[leftExpressionType.ord][rightExpressionType.ord];
  23791. if (resultType === null || resultType === undefined) {
  23792. if (config_1.Config.enable_type_casting) {
  23793. if (leftExpressionType.isCompatible(types_1.Types.INTEGER) || leftExpressionType.isCompatible(types_1.Types.REAL)) {
  23794. if (rightExpressionType.isCompatible(types_1.Types.INTEGER) || rightExpressionType.isCompatible(types_1.Types.REAL)) {
  23795. if (operator === operators_1.Operators.MOD) {
  23796. return types_1.Types.INTEGER;
  23797. }
  23798. else if (operator.ord >= 5 && operator.ord <= 10) {
  23799. return types_1.Types.BOOLEAN;
  23800. }
  23801. }
  23802. }
  23803. }
  23804. return types_1.Types.UNDEFINED;
  23805. }
  23806. return resultType;
  23807. }
  23808. catch (e) {
  23809. if (e instanceof TypeError) {
  23810. return types_1.Types.UNDEFINED;
  23811. }
  23812. else {
  23813. throw e;
  23814. }
  23815. }
  23816. }
  23817. exports.resultTypeAfterInfixOp = resultTypeAfterInfixOp;
  23818. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  23819. try {
  23820. if (leftExpressionType instanceof multiType_1.MultiType) {
  23821. let newMulti = [];
  23822. for (let i = 0; i < leftExpressionType.types.length; ++i) {
  23823. const type = leftExpressionType.types[i];
  23824. newMulti.push(resultTypeAfterUnaryOp(operator, type));
  23825. }
  23826. newMulti = newMulti.filter(x => !x.isCompatible(types_1.Types.UNDEFINED));
  23827. if (newMulti.length <= 0) {
  23828. return types_1.Types.UNDEFINED;
  23829. }
  23830. return new multiType_1.MultiType(newMulti);
  23831. }
  23832. const resultTable = unaryMap.get(operator) || [];
  23833. // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  23834. const resultType = resultTable[leftExpressionType.ord];
  23835. if (resultType == null) {
  23836. return types_1.Types.UNDEFINED;
  23837. }
  23838. return resultType;
  23839. }
  23840. catch (e) {
  23841. if (e instanceof TypeError) {
  23842. return types_1.Types.UNDEFINED;
  23843. }
  23844. else {
  23845. throw e;
  23846. }
  23847. }
  23848. }
  23849. exports.resultTypeAfterUnaryOp = resultTypeAfterUnaryOp;
  23850. /***/ }),
  23851. /***/ "./js/processor/context.ts":
  23852. /*!*********************************!*\
  23853. !*** ./js/processor/context.ts ***!
  23854. \*********************************/
  23855. /***/ ((__unused_webpack_module, exports) => {
  23856. "use strict";
  23857. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23858. exports.Context = void 0;
  23859. exports.Context = Object.freeze({
  23860. BASE: Symbol('context:base'),
  23861. BREAKABLE: Symbol('context:breakable'),
  23862. FUNCTION: Symbol('context:function')
  23863. });
  23864. /***/ }),
  23865. /***/ "./js/processor/modes.ts":
  23866. /*!*******************************!*\
  23867. !*** ./js/processor/modes.ts ***!
  23868. \*******************************/
  23869. /***/ ((__unused_webpack_module, exports) => {
  23870. "use strict";
  23871. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23872. exports.Modes = void 0;
  23873. exports.Modes = Object.freeze({
  23874. RETURN: Symbol('mode:return'),
  23875. BREAK: Symbol('mode:break'),
  23876. PAUSE: Symbol('mode:pause'),
  23877. RUN: Symbol('mode:run'),
  23878. ABORT: Symbol('mode:abort')
  23879. });
  23880. /***/ }),
  23881. /***/ "./js/processor/store/store.ts":
  23882. /*!*************************************!*\
  23883. !*** ./js/processor/store/store.ts ***!
  23884. \*************************************/
  23885. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23886. "use strict";
  23887. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23888. exports.Store = void 0;
  23889. /* eslint-disable @typescript-eslint/no-non-null-assertion */
  23890. const modes_1 = __webpack_require__(/*! ../modes */ "./js/processor/modes.ts");
  23891. const types_1 = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.ts");
  23892. const storeObject_1 = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.ts");
  23893. const storeObjectRef_1 = __webpack_require__(/*! ./storeObjectRef */ "./js/processor/store/storeObjectRef.ts");
  23894. const array_type_1 = __webpack_require__(/*! ../../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
  23895. const array_store_value_1 = __webpack_require__(/*! ./value/array_store_value */ "./js/processor/store/value/array_store_value.ts");
  23896. const location_1 = __webpack_require__(/*! ../../memory/location */ "./js/memory/location.ts");
  23897. const storeObjectArray_1 = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.ts");
  23898. const store_value_1 = __webpack_require__(/*! ./value/store_value */ "./js/processor/store/value/store_value.ts");
  23899. const store_value_address_1 = __webpack_require__(/*! ./value/store_value_address */ "./js/processor/store/value/store_value_address.ts");
  23900. const store_value_ref_1 = __webpack_require__(/*! ./value/store_value_ref */ "./js/processor/store/value/store_value_ref.ts");
  23901. const array_store_value_ref_1 = __webpack_require__(/*! ./value/array_store_value_ref */ "./js/processor/store/value/array_store_value_ref.ts");
  23902. const store_object_array_ref_1 = __webpack_require__(/*! ./store_object_array_ref */ "./js/processor/store/store_object_array_ref.ts");
  23903. class Store {
  23904. constructor(name) {
  23905. this.name = name;
  23906. this.store = new Map();
  23907. this.mode = modes_1.Modes.RUN;
  23908. }
  23909. static canImplicitTypeCast(castType, sourceType) {
  23910. if (castType.isCompatible(types_1.Types.INTEGER) || castType.isCompatible(types_1.Types.REAL)) {
  23911. if (sourceType.isCompatible(types_1.Types.INTEGER) || sourceType.isCompatible(types_1.Types.REAL)) {
  23912. return true;
  23913. }
  23914. }
  23915. return false;
  23916. }
  23917. static doImplicitCasting(castType, stoObj) {
  23918. if (!Store.canImplicitTypeCast(castType, stoObj.type)) {
  23919. throw new Error("!!!Critical error: attempted to type cast invalid types");
  23920. }
  23921. if (castType.isCompatible(types_1.Types.INTEGER)) {
  23922. return new store_value_1.StoreValue(types_1.Types.INTEGER, stoObj.get().trunc());
  23923. }
  23924. else {
  23925. return new store_value_1.StoreValue(types_1.Types.REAL, stoObj.get());
  23926. }
  23927. }
  23928. extendStore(nextStore) {
  23929. this.nextStore = nextStore;
  23930. }
  23931. applyStore(id) {
  23932. if (!this.store.has(id)) {
  23933. if (this.nextStore != null) {
  23934. return this.nextStore.applyStore(id);
  23935. }
  23936. else {
  23937. throw new Error(`Variable ${id} not found.`);
  23938. }
  23939. }
  23940. const val = this.store.get(id);
  23941. let result = null;
  23942. if (val.type instanceof array_type_1.ArrayType) {
  23943. const array = val;
  23944. const array_type = array.type;
  23945. let l = 0, c = 0;
  23946. const values = array.value.map(v => {
  23947. if (array.isVector) {
  23948. return new store_value_address_1.StoreValueAddress(array_type.innerType, v, l++, undefined, array.id, array.readOnly);
  23949. }
  23950. else {
  23951. if (c >= array.columns) {
  23952. c = 0;
  23953. l += 1;
  23954. }
  23955. return new store_value_address_1.StoreValueAddress(array_type.innerType, v, l, c++, array.id, array.readOnly);
  23956. }
  23957. });
  23958. result = new array_store_value_1.ArrayStoreValue(array_type, values, array.lines, array.columns, val.id, val.readOnly);
  23959. }
  23960. else {
  23961. result = new store_value_1.StoreValue(val.type, val.value, val.id, val.readOnly);
  23962. }
  23963. return result;
  23964. }
  23965. updateStore(id, stoValue) {
  23966. if (!this.store.has(id)) {
  23967. if (this.nextStore != null) {
  23968. this.nextStore.updateStore(id, stoValue);
  23969. return this;
  23970. }
  23971. else {
  23972. // TODO: better error message
  23973. throw new Error(`Variable ${id} not found.`);
  23974. }
  23975. }
  23976. else {
  23977. const oldObj = this.store.get(id);
  23978. if (oldObj.readOnly) {
  23979. // TODO: better error message
  23980. throw new Error("Cannot change value of a read only variable: " + id);
  23981. }
  23982. if (oldObj instanceof storeObjectArray_1.StoreObjectArray) {
  23983. const array_value = stoValue;
  23984. if (oldObj.isCompatible(array_value)) {
  23985. if (oldObj.isVector) {
  23986. array_value.get().forEach((val, index) => {
  23987. oldObj.setAt(val, index, undefined);
  23988. });
  23989. }
  23990. else {
  23991. let line = 0;
  23992. let column = 0;
  23993. array_value.get().forEach((val) => {
  23994. oldObj.setAt(val, line, column);
  23995. column += 1;
  23996. if (column >= oldObj.columns) {
  23997. line += 1;
  23998. column = 0;
  23999. }
  24000. });
  24001. }
  24002. return this;
  24003. }
  24004. }
  24005. else if (oldObj.isCompatible(stoValue)) {
  24006. const loc_address = oldObj.locAddress;
  24007. location_1.Location.updateAddress(loc_address, stoValue.get());
  24008. return this;
  24009. }
  24010. const oldType = oldObj.type;
  24011. const stoType = stoValue.type;
  24012. // TODO: better error message
  24013. throw new Error(`${oldType.value} is not compatible with type ${stoType.value} given`);
  24014. }
  24015. }
  24016. /**
  24017. * Method used to update regions of an array (vector or matrix). The should only be used when update an specific
  24018. * possition since it will only update the required addresses.
  24019. * @param {string} id the variable id to be updated
  24020. * @param {IStoreValue} sto_value the value to be used in the update process
  24021. * @param {number} line the line address of the vector/matrix
  24022. * @param {number} column the matrix column, which can be undefined
  24023. */
  24024. updateStoreArray(id, sto_value, line, column) {
  24025. if (!this.store.has(id)) {
  24026. if (this.nextStore != null) {
  24027. this.nextStore.updateStoreArray(id, sto_value, line, column);
  24028. return this;
  24029. }
  24030. else {
  24031. // TODO: better error message
  24032. throw new Error(`Variable ${id} not found.`);
  24033. }
  24034. }
  24035. else {
  24036. const oldObj = this.store.get(id);
  24037. if (oldObj.readOnly) {
  24038. // TODO: better error message
  24039. throw new Error("Cannot change value of a read only variable: " + id);
  24040. }
  24041. if (oldObj instanceof storeObjectArray_1.StoreObjectArray) {
  24042. if (sto_value instanceof array_store_value_1.ArrayStoreValue) {
  24043. // this must be a vector or matrix line update
  24044. const actual_values = sto_value.get();
  24045. if (oldObj.isVector && sto_value.isVector()) {
  24046. for (let i = 0; i < sto_value.lines; i += 1) {
  24047. const val = actual_values[i];
  24048. oldObj.setAt(val, i, undefined);
  24049. }
  24050. }
  24051. else if (!oldObj.isVector && column == null && sto_value.isVector()) {
  24052. for (let i = 0; i < oldObj.columns; i += 1) {
  24053. const val = actual_values[i];
  24054. oldObj.setAt(val, line, i);
  24055. }
  24056. }
  24057. else {
  24058. // TODO: better error message
  24059. throw new Error(`Attempting to assign an invalid value to array ${id}`);
  24060. }
  24061. }
  24062. else {
  24063. if (!oldObj.isVector && column == null) {
  24064. // TODO: better error message
  24065. throw new Error(`Attempting to assign an invalid value to array ${id}`);
  24066. }
  24067. oldObj.setAt(sto_value, line, column);
  24068. }
  24069. }
  24070. else {
  24071. throw new Error("Cannot update a non-array variable using updateStoreArray");
  24072. }
  24073. // const oldType = oldObj.type;
  24074. // const stoType = sto_value.type;
  24075. // // TODO: better error message
  24076. // throw new Error(`${oldType.value} is not compatible with type ${stoType.value} given`);
  24077. return this;
  24078. }
  24079. }
  24080. /**
  24081. * Inserts a new variable into the Store. This method should be used when declaring a new variable,
  24082. * including the special return variable $.
  24083. * @param id variable id
  24084. * @param stoValue the value to be used as the initial value of id
  24085. */
  24086. insertStore(id, stoValue) {
  24087. if (this.store.has(id)) {
  24088. // TODO: better error message
  24089. throw new Error(`${id} is already defined`);
  24090. }
  24091. // TODO check for array....
  24092. let newObj;
  24093. if (stoValue instanceof store_value_ref_1.StoreValueRef) {
  24094. newObj = new storeObjectRef_1.StoreObjectRef(stoValue);
  24095. }
  24096. else if (stoValue instanceof array_store_value_ref_1.ArrayStoreValueRef) {
  24097. newObj = new store_object_array_ref_1.StoreObjectArrayRef(stoValue, stoValue.lines, stoValue.columns);
  24098. }
  24099. else if (stoValue instanceof array_store_value_1.ArrayStoreValue) {
  24100. const columns = stoValue.isVector() ? 0 : stoValue.columns;
  24101. const addresses = [];
  24102. const all_values = stoValue.get();
  24103. if (all_values.length > 0) {
  24104. for (let i = 0; i < stoValue.get().length; i += 1) {
  24105. const val = all_values[i].get();
  24106. addresses.push(location_1.Location.allocate(val));
  24107. }
  24108. }
  24109. else {
  24110. let total = stoValue.lines;
  24111. total = stoValue.isVector() ? total : total * columns;
  24112. for (let i = 0; i < total; i += 1) {
  24113. addresses.push(location_1.Location.allocate(null));
  24114. }
  24115. }
  24116. newObj = new storeObjectArray_1.StoreObjectArray(stoValue.type, stoValue.lines, columns, addresses, stoValue.isConst);
  24117. }
  24118. else {
  24119. const loc_address = location_1.Location.allocate(stoValue.get());
  24120. newObj = new storeObject_1.StoreObject(stoValue.type, loc_address, stoValue.isConst);
  24121. }
  24122. newObj.setID(id);
  24123. this.store.set(id, newObj);
  24124. return this;
  24125. }
  24126. /**
  24127. * Helper function similar to applyStore. But it returns the actual object in the store be it ref or not
  24128. * applyStore will return the refferenced object if the object in the store is a ref
  24129. */
  24130. getStoreObject(id) {
  24131. if (!this.store.has(id)) {
  24132. if (this.nextStore != null) {
  24133. return this.nextStore.getStoreObject(id);
  24134. }
  24135. else {
  24136. throw new Error(`Variable ${id} not found.`);
  24137. }
  24138. }
  24139. return this.store.get(id);
  24140. }
  24141. destroy() {
  24142. this.store.forEach(sto => sto.destroy(), this);
  24143. }
  24144. isDefined(id) {
  24145. if (!this.store.has(id)) {
  24146. if (this.nextStore != null) {
  24147. return this.nextStore.isDefined(id);
  24148. }
  24149. else {
  24150. return false;
  24151. }
  24152. }
  24153. return true;
  24154. }
  24155. }
  24156. exports.Store = Store;
  24157. /***/ }),
  24158. /***/ "./js/processor/store/storeObject.ts":
  24159. /*!*******************************************!*\
  24160. !*** ./js/processor/store/storeObject.ts ***!
  24161. \*******************************************/
  24162. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24163. "use strict";
  24164. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24165. exports.StoreObject = void 0;
  24166. const location_1 = __webpack_require__(/*! ../../memory/location */ "./js/memory/location.ts");
  24167. class StoreObject {
  24168. /**
  24169. *
  24170. * @param {Type} type
  24171. * @param {Number} loc_address
  24172. * @param {Boolean} readOnly
  24173. */
  24174. constructor(type, loc_address, readOnly = false) {
  24175. this._loc_address = loc_address;
  24176. this._type = type;
  24177. this._readOnly = readOnly;
  24178. this._id = undefined;
  24179. }
  24180. setID(id) {
  24181. this._id = id;
  24182. }
  24183. get id() {
  24184. return this._id;
  24185. }
  24186. get inStore() {
  24187. return this.id !== null;
  24188. }
  24189. get type() {
  24190. return this._type;
  24191. }
  24192. /**
  24193. * Returns the actual value stored at the loccation address present in this object.
  24194. * The returned value is compatible with @prop{StoreObject.type}
  24195. */
  24196. get value() {
  24197. const address = location_1.Location.find(this._loc_address);
  24198. if (address != null) {
  24199. return address.value;
  24200. }
  24201. else {
  24202. throw new Error("!!!Critical Error: variable " + this.id + " does not have a valid address. Loc-Address " + this.locAddress);
  24203. }
  24204. }
  24205. get number() {
  24206. throw new Error("DOT NOT USE THIS PROPERTY!");
  24207. }
  24208. get readOnly() {
  24209. return this._readOnly;
  24210. }
  24211. set readOnly(value) {
  24212. this._readOnly = value;
  24213. }
  24214. isCompatible(another) {
  24215. return this.type.isCompatible(another.type);
  24216. }
  24217. destroy() {
  24218. return location_1.Location.deallocate(this._loc_address);
  24219. }
  24220. get locAddress() {
  24221. return this._loc_address;
  24222. }
  24223. }
  24224. exports.StoreObject = StoreObject;
  24225. /***/ }),
  24226. /***/ "./js/processor/store/storeObjectArray.ts":
  24227. /*!************************************************!*\
  24228. !*** ./js/processor/store/storeObjectArray.ts ***!
  24229. \************************************************/
  24230. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24231. "use strict";
  24232. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24233. exports.StoreObjectArray = void 0;
  24234. const storeObject_1 = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.ts");
  24235. const array_store_value_1 = __webpack_require__(/*! ./value/array_store_value */ "./js/processor/store/value/array_store_value.ts");
  24236. const location_1 = __webpack_require__(/*! ../../memory/location */ "./js/memory/location.ts");
  24237. class StoreObjectArray extends storeObject_1.StoreObject {
  24238. constructor(type, _lines, _columns, loc_addresses, readOnly = false) {
  24239. super(type, -1, readOnly);
  24240. this._lines = _lines;
  24241. this._columns = _columns;
  24242. this.loc_addresses = loc_addresses;
  24243. }
  24244. get lines() {
  24245. return this._lines;
  24246. }
  24247. get columns() {
  24248. return this._columns;
  24249. }
  24250. isCompatible(another) {
  24251. if (another instanceof array_store_value_1.ArrayStoreValue) {
  24252. const cols = another.columns == null ? 0 : another.columns;
  24253. if (this.lines === another.lines && this.columns === cols) {
  24254. return super.isCompatible(another);
  24255. }
  24256. }
  24257. return false;
  24258. }
  24259. get isVector() {
  24260. return this.type.dimensions === 1;
  24261. }
  24262. /**@override
  24263. * Returns the list of values stored by this array.
  24264. * All returned values are compatible with @prop{StoreObject.type}
  24265. */
  24266. get value() {
  24267. const values = [];
  24268. for (let i = 0; i < this.addresses.length; i += 1) {
  24269. const address = location_1.Location.find(this.addresses[i]);
  24270. if (address != null) {
  24271. values.push(address.value);
  24272. }
  24273. else {
  24274. throw new Error("!!!Critical Error: variable " + this.id + " does not have a valid address. Loc-Address " + this.locAddress);
  24275. }
  24276. }
  24277. return values;
  24278. }
  24279. destroy() {
  24280. let bool = true;
  24281. for (let i = 0; i < this.addresses.length; i += 1) {
  24282. bool = bool && location_1.Location.deallocate(this.addresses[i]);
  24283. }
  24284. return bool;
  24285. }
  24286. /**
  24287. * @override
  24288. *
  24289. * Returns the address that contains a list of all addresses of the values present in the array
  24290. */
  24291. get locAddress() {
  24292. throw new Error("!!!Internal Error: Cannot invoke locAddress on StoreObjectArray");
  24293. }
  24294. get addresses() {
  24295. return this.loc_addresses;
  24296. }
  24297. getAt(line, column) {
  24298. if (this.isVector) {
  24299. if (column != null) {
  24300. throw new Error(this.id + " is not a matrix!");
  24301. }
  24302. column = line;
  24303. line = 0;
  24304. }
  24305. else if (column == null) {
  24306. // this is a whole line...
  24307. const values = [];
  24308. for (let col = 0; col < this.columns; col += 1) {
  24309. const index = this.getIndexOf(line, col);
  24310. const address = location_1.Location.find(this.addresses[index]);
  24311. values.push(address.value);
  24312. }
  24313. return values;
  24314. }
  24315. const index = this.getIndexOf(line, column);
  24316. const address = location_1.Location.find(this.addresses[index]);
  24317. return address.value;
  24318. }
  24319. setAt(value, line, column) {
  24320. let used_dims = 1;
  24321. if (column != null) {
  24322. used_dims += 1;
  24323. }
  24324. if (!this.type.canAccept(value.type, used_dims)) {
  24325. throw new Error("!!!Internal Error: Attempting to insert an invalid value inside array " + this.id);
  24326. }
  24327. if (this.isVector) {
  24328. if (column != null) {
  24329. throw new Error(this.id + " is not a matrix!");
  24330. }
  24331. column = line;
  24332. line = 0;
  24333. }
  24334. else if (column == null) {
  24335. throw new Error("!!!Internal Error: Attempting to insert a line into matrix " + this.id);
  24336. }
  24337. const pos = this.getIndexOf(line, column);
  24338. location_1.Location.updateAddress(this.addresses[pos], value.get());
  24339. }
  24340. getIndexOf(line, column) {
  24341. return line * this.columns + column;
  24342. }
  24343. getLocAddressOf(line, column) {
  24344. if (this.isVector) {
  24345. if (column != null) {
  24346. throw new Error(this.id + " is not a matrix!");
  24347. }
  24348. column = line;
  24349. line = 0;
  24350. }
  24351. else if (column == null) {
  24352. // this is a whole line...
  24353. const values = [];
  24354. for (let col = 0; col < this.columns; col += 1) {
  24355. const index = this.getIndexOf(line, col);
  24356. values.push(this.addresses[index]);
  24357. }
  24358. return values;
  24359. }
  24360. const index = this.getIndexOf(line, column);
  24361. return this.addresses[index];
  24362. }
  24363. }
  24364. exports.StoreObjectArray = StoreObjectArray;
  24365. /***/ }),
  24366. /***/ "./js/processor/store/storeObjectRef.ts":
  24367. /*!**********************************************!*\
  24368. !*** ./js/processor/store/storeObjectRef.ts ***!
  24369. \**********************************************/
  24370. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24371. "use strict";
  24372. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24373. exports.StoreObjectRef = void 0;
  24374. const storeObject_1 = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.ts");
  24375. class StoreObjectRef extends storeObject_1.StoreObject {
  24376. /**
  24377. *
  24378. * @param {StoreObject} stoValue
  24379. */
  24380. constructor(stoValue) {
  24381. super(stoValue.type, stoValue.getRefAddress(), false);
  24382. this.refObj = stoValue.id;
  24383. this.reference_dimension = stoValue.getReferenceDimension();
  24384. }
  24385. get isRef() {
  24386. return true;
  24387. }
  24388. getRefObj() {
  24389. return this.refObj;
  24390. }
  24391. getReferenceDimension() {
  24392. return this.reference_dimension;
  24393. }
  24394. destroy() {
  24395. return false;
  24396. }
  24397. }
  24398. exports.StoreObjectRef = StoreObjectRef;
  24399. /***/ }),
  24400. /***/ "./js/processor/store/store_object_array_ref.ts":
  24401. /*!******************************************************!*\
  24402. !*** ./js/processor/store/store_object_array_ref.ts ***!
  24403. \******************************************************/
  24404. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24405. "use strict";
  24406. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24407. exports.StoreObjectArrayRef = void 0;
  24408. const storeObjectArray_1 = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.ts");
  24409. class StoreObjectArrayRef extends storeObjectArray_1.StoreObjectArray {
  24410. constructor(stoValue, lines, columns) {
  24411. super(stoValue.type, lines, columns, stoValue.getAddresses(), false);
  24412. this.refObj = stoValue.id;
  24413. }
  24414. get isRef() {
  24415. return true;
  24416. }
  24417. getRefObj() {
  24418. return this.refObj;
  24419. }
  24420. destroy() {
  24421. return false;
  24422. }
  24423. }
  24424. exports.StoreObjectArrayRef = StoreObjectArrayRef;
  24425. /***/ }),
  24426. /***/ "./js/processor/store/value/array_store_value.ts":
  24427. /*!*******************************************************!*\
  24428. !*** ./js/processor/store/value/array_store_value.ts ***!
  24429. \*******************************************************/
  24430. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24431. "use strict";
  24432. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24433. exports.ArrayStoreValue = void 0;
  24434. const array_type_1 = __webpack_require__(/*! ../../../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
  24435. const store_value_address_1 = __webpack_require__(/*! ./store_value_address */ "./js/processor/store/value/store_value_address.ts");
  24436. class ArrayStoreValue {
  24437. constructor(type, values, lines, columns, id, isConst = false) {
  24438. this.type = type;
  24439. this.id = id;
  24440. this.isConst = isConst;
  24441. this.values = values;
  24442. this.lines = lines;
  24443. this.columns = columns;
  24444. }
  24445. get() {
  24446. return this.values;
  24447. }
  24448. /**
  24449. * @deprecated
  24450. * Potential not necessary since array access is occuring directly in the StoreObject
  24451. * @param line
  24452. * @param column
  24453. */
  24454. getAt(line, column) {
  24455. console.log("Column ", column);
  24456. if (this.isVector()) {
  24457. if (column != null) {
  24458. throw new Error(this.id + " is not a matrix!");
  24459. }
  24460. column = line;
  24461. line = 0;
  24462. }
  24463. else if (column == null) {
  24464. const values = [];
  24465. for (let col = 0; col < this.columns; col += 1) {
  24466. const index = line * this.lines + col;
  24467. values.push(this.values[index]);
  24468. }
  24469. const array_type = this.type;
  24470. const vector_type = new array_type_1.ArrayType(array_type.innerType, array_type.dimensions - 1);
  24471. return new ArrayStoreValue(vector_type, values, this.columns, 0, this.id, this.isConst);
  24472. }
  24473. const index = line * this.lines + column;
  24474. console.log("Get at: ", index);
  24475. return this.values[index];
  24476. }
  24477. setAt(value, line, column) {
  24478. let used_dims = 1;
  24479. if (column != null) {
  24480. used_dims += 1;
  24481. }
  24482. let actual_line = line;
  24483. let actual_column = column;
  24484. if (!this.type.canAccept(value.type, used_dims)) {
  24485. throw new Error("!!!Internal Error: Attempting to insert an invalid value inside array " + this.id);
  24486. }
  24487. if (this.isVector()) {
  24488. if (column != null) {
  24489. throw new Error(this.id + " is not a matrix!");
  24490. }
  24491. actual_column = actual_line;
  24492. actual_line = 0;
  24493. }
  24494. else if (column == null) {
  24495. if (!(value instanceof ArrayStoreValue)) {
  24496. throw new Error("Attempting to insert a single value as a line of matrix " + this.id);
  24497. }
  24498. const actual_values = value.get();
  24499. for (let i = 0; i < this.columns; i += 1) {
  24500. const pos = actual_line * this.columns + i;
  24501. const val = actual_values[i];
  24502. this.values[pos] = new store_value_address_1.StoreValueAddress(value.type, val.get(), actual_line, i, this.id, this.isConst);
  24503. }
  24504. }
  24505. const columns = this.columns == null ? 0 : this.columns;
  24506. const pos = actual_line * columns + actual_column;
  24507. this.values[pos] = new store_value_address_1.StoreValueAddress(value.type, value.get(), line, column, this.id, this.isConst);
  24508. }
  24509. inStore() {
  24510. return this.id != null;
  24511. }
  24512. isVector() {
  24513. return this.type.dimensions == 1;
  24514. }
  24515. }
  24516. exports.ArrayStoreValue = ArrayStoreValue;
  24517. /***/ }),
  24518. /***/ "./js/processor/store/value/array_store_value_ref.ts":
  24519. /*!***********************************************************!*\
  24520. !*** ./js/processor/store/value/array_store_value_ref.ts ***!
  24521. \***********************************************************/
  24522. /***/ ((__unused_webpack_module, exports) => {
  24523. "use strict";
  24524. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24525. exports.ArrayStoreValueRef = void 0;
  24526. class ArrayStoreValueRef {
  24527. constructor(type, values, addresses, lines, columns, id) {
  24528. this.type = type;
  24529. this.values = values;
  24530. this.addresses = addresses;
  24531. this.lines = lines;
  24532. this.columns = columns;
  24533. this.id = id;
  24534. this.isConst = false;
  24535. }
  24536. get() {
  24537. return this.values;
  24538. }
  24539. getAddresses() {
  24540. return this.addresses;
  24541. }
  24542. inStore() {
  24543. return this.id != null;
  24544. }
  24545. }
  24546. exports.ArrayStoreValueRef = ArrayStoreValueRef;
  24547. /***/ }),
  24548. /***/ "./js/processor/store/value/store_value.ts":
  24549. /*!*************************************************!*\
  24550. !*** ./js/processor/store/value/store_value.ts ***!
  24551. \*************************************************/
  24552. /***/ ((__unused_webpack_module, exports) => {
  24553. "use strict";
  24554. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24555. exports.StoreValue = void 0;
  24556. class StoreValue {
  24557. constructor(type, value, id, isConst = false) {
  24558. this.type = type;
  24559. this.id = id;
  24560. this.isConst = isConst;
  24561. this.value = value;
  24562. }
  24563. get() {
  24564. return this.value;
  24565. }
  24566. inStore() {
  24567. return this.id != null;
  24568. }
  24569. }
  24570. exports.StoreValue = StoreValue;
  24571. /***/ }),
  24572. /***/ "./js/processor/store/value/store_value_address.ts":
  24573. /*!*********************************************************!*\
  24574. !*** ./js/processor/store/value/store_value_address.ts ***!
  24575. \*********************************************************/
  24576. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24577. "use strict";
  24578. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24579. exports.StoreValueAddress = void 0;
  24580. const store_value_1 = __webpack_require__(/*! ./store_value */ "./js/processor/store/value/store_value.ts");
  24581. class StoreValueAddress extends store_value_1.StoreValue {
  24582. constructor(type, value, line, column, id, isConst = false) {
  24583. super(type, value, id, isConst);
  24584. this.line = line;
  24585. this.column = column;
  24586. }
  24587. }
  24588. exports.StoreValueAddress = StoreValueAddress;
  24589. /***/ }),
  24590. /***/ "./js/processor/store/value/store_value_ref.ts":
  24591. /*!*****************************************************!*\
  24592. !*** ./js/processor/store/value/store_value_ref.ts ***!
  24593. \*****************************************************/
  24594. /***/ ((__unused_webpack_module, exports) => {
  24595. "use strict";
  24596. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24597. exports.StoreValueRef = void 0;
  24598. class StoreValueRef {
  24599. constructor(type, value, loc_address, id) {
  24600. this.type = type;
  24601. this.value = value;
  24602. this.loc_address = loc_address;
  24603. this.id = id;
  24604. this.isConst = false;
  24605. this.reference_dimesion = 0;
  24606. }
  24607. get() {
  24608. return this.value;
  24609. }
  24610. getRefAddress() {
  24611. return this.loc_address;
  24612. }
  24613. inStore() {
  24614. return this.id != null;
  24615. }
  24616. getReferenceDimension() {
  24617. return this.reference_dimesion;
  24618. }
  24619. setReferenceDimension(dimension) {
  24620. this.reference_dimesion = dimension;
  24621. }
  24622. }
  24623. exports.StoreValueRef = StoreValueRef;
  24624. /***/ }),
  24625. /***/ "./js/services/languageService.ts":
  24626. /*!****************************************!*\
  24627. !*** ./js/services/languageService.ts ***!
  24628. \****************************************/
  24629. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24630. "use strict";
  24631. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24632. exports.LanguageService = void 0;
  24633. const grammar_1 = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.ts");
  24634. const line_i18n_1 = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  24635. const config_1 = __webpack_require__(/*! ./../util/config */ "./js/util/config.ts");
  24636. class LanguageServiceExtended extends line_i18n_1.default.LanguageServiceNoLS {
  24637. constructor() {
  24638. super(typeof iLMparameters === "undefined"
  24639. ? config_1.Config.default_lang
  24640. : iLMparameters.lang);
  24641. }
  24642. getDefaultLang() {
  24643. return "en";
  24644. }
  24645. getCurrentLexer() {
  24646. const langLexer = grammar_1.default[this.getLang()];
  24647. if (langLexer === null || langLexer === undefined) {
  24648. return grammar_1.default[this.getDefaultLang()];
  24649. }
  24650. else {
  24651. return langLexer;
  24652. }
  24653. }
  24654. getCurrentLangFuncs() {
  24655. const langInfo = grammar_1.default[this.getLang()];
  24656. if (langInfo === null || langInfo === undefined) {
  24657. return grammar_1.default[this.getDefaultLang()].getLangFuncs();
  24658. }
  24659. else {
  24660. return langInfo.getLangFuncs();
  24661. }
  24662. }
  24663. getCurrentLangLibs() {
  24664. const langInfo = grammar_1.default[this.getLang()];
  24665. if (langInfo === null || langInfo === undefined) {
  24666. return grammar_1.default[this.getDefaultLang()].getLangLibs();
  24667. }
  24668. return langInfo.getLangLibs();
  24669. }
  24670. }
  24671. exports.LanguageService = new LanguageServiceExtended();
  24672. /***/ }),
  24673. /***/ "./js/typeSystem/array_type.ts":
  24674. /*!*************************************!*\
  24675. !*** ./js/typeSystem/array_type.ts ***!
  24676. \*************************************/
  24677. /***/ ((__unused_webpack_module, exports) => {
  24678. "use strict";
  24679. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24680. exports.ArrayType = void 0;
  24681. class ArrayType {
  24682. constructor(type, dimensions) {
  24683. this.dimensions = dimensions;
  24684. this.innerType = type;
  24685. }
  24686. get isVector() {
  24687. return this.dimensions == 1;
  24688. }
  24689. isCompatible(another) {
  24690. if (another instanceof ArrayType) {
  24691. if (this.dimensions !== another.dimensions) {
  24692. return false;
  24693. }
  24694. return this.innerType.isCompatible(another.innerType);
  24695. }
  24696. return false;
  24697. }
  24698. stringInfo() {
  24699. const list = this.innerType.stringInfo();
  24700. list.forEach(v => {
  24701. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  24702. const tmp = v;
  24703. tmp.dim = this.dimensions;
  24704. });
  24705. return list;
  24706. }
  24707. get value() {
  24708. return undefined;
  24709. }
  24710. get ord() {
  24711. return undefined;
  24712. }
  24713. canAccept(another, used_dims) {
  24714. const free_dims = this.dimensions - used_dims;
  24715. if (another instanceof ArrayType) {
  24716. return free_dims == another.dimensions && this.innerType.isCompatible(another.innerType);
  24717. }
  24718. else {
  24719. return free_dims == 0 && this.innerType.isCompatible(another);
  24720. }
  24721. }
  24722. }
  24723. exports.ArrayType = ArrayType;
  24724. /***/ }),
  24725. /***/ "./js/typeSystem/multiType.ts":
  24726. /*!************************************!*\
  24727. !*** ./js/typeSystem/multiType.ts ***!
  24728. \************************************/
  24729. /***/ ((__unused_webpack_module, exports) => {
  24730. "use strict";
  24731. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24732. exports.MultiType = void 0;
  24733. class MultiType {
  24734. constructor(types) {
  24735. this.types = types;
  24736. }
  24737. get value() {
  24738. return undefined;
  24739. }
  24740. get ord() {
  24741. return undefined;
  24742. }
  24743. stringInfo() {
  24744. let list = [];
  24745. for (let i = 0; i < this.types.length; i++) {
  24746. const t = this.types[i];
  24747. list = list.concat(t.stringInfo());
  24748. }
  24749. return list;
  24750. }
  24751. isCompatible(another) {
  24752. for (let i = 0; i < this.types.length; i++) {
  24753. const t = this.types[i];
  24754. if (another.isCompatible(t)) {
  24755. return true;
  24756. }
  24757. }
  24758. return false;
  24759. }
  24760. }
  24761. exports.MultiType = MultiType;
  24762. /***/ }),
  24763. /***/ "./js/typeSystem/type.ts":
  24764. /*!*******************************!*\
  24765. !*** ./js/typeSystem/type.ts ***!
  24766. \*******************************/
  24767. /***/ ((__unused_webpack_module, exports) => {
  24768. "use strict";
  24769. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24770. exports.Type = void 0;
  24771. class Type {
  24772. constructor(value, ord) {
  24773. this.value = value;
  24774. this.ord = ord;
  24775. }
  24776. stringInfo() {
  24777. return [{ type: this.value, dim: 0 }];
  24778. }
  24779. isCompatible(another) {
  24780. return this.value === another.value && this.ord === another.ord;
  24781. }
  24782. }
  24783. exports.Type = Type;
  24784. /***/ }),
  24785. /***/ "./js/typeSystem/types.ts":
  24786. /*!********************************!*\
  24787. !*** ./js/typeSystem/types.ts ***!
  24788. \********************************/
  24789. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24790. "use strict";
  24791. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24792. exports.fromOrdToType = exports.Types = void 0;
  24793. const type_1 = __webpack_require__(/*! ./type */ "./js/typeSystem/type.ts");
  24794. const multiType_1 = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.ts");
  24795. const maybe_1 = __webpack_require__(/*! ../util/maybe */ "./js/util/maybe.ts");
  24796. const INTEGER = new type_1.Type("integer", 0);
  24797. const REAL = new type_1.Type("real", 1);
  24798. const STRING = new type_1.Type("text", 2);
  24799. const BOOLEAN = new type_1.Type("boolean", 3);
  24800. const CHAR = new type_1.Type("char", 4);
  24801. const VOID = new type_1.Type("void", 5);
  24802. const UNDEFINED = new type_1.Type("undefined", 6);
  24803. const ALL = new multiType_1.MultiType([INTEGER, REAL, STRING, CHAR, BOOLEAN]);
  24804. exports.Types = Object.freeze({
  24805. INTEGER: INTEGER,
  24806. REAL: REAL,
  24807. STRING: STRING,
  24808. CHAR: CHAR,
  24809. BOOLEAN: BOOLEAN,
  24810. VOID: VOID,
  24811. UNDEFINED: UNDEFINED,
  24812. ALL: ALL
  24813. });
  24814. function fromOrdToType(ord) {
  24815. const typeMap = exports.Types;
  24816. for (const t in typeMap) {
  24817. if (typeMap[t].ord && typeMap[t].ord === ord) {
  24818. return maybe_1.Maybe.some(typeMap[t]);
  24819. }
  24820. }
  24821. return maybe_1.Maybe.none();
  24822. }
  24823. exports.fromOrdToType = fromOrdToType;
  24824. /***/ }),
  24825. /***/ "./js/util/config.ts":
  24826. /*!***************************!*\
  24827. !*** ./js/util/config.ts ***!
  24828. \***************************/
  24829. /***/ ((__unused_webpack_module, exports) => {
  24830. "use strict";
  24831. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24832. exports.Config = void 0;
  24833. class ConfigObject {
  24834. constructor() {
  24835. this.decimalPlaces = 8;
  24836. this.intConvertRoundMode = 2;
  24837. this.default_lang = "pt";
  24838. this.enable_type_casting = true;
  24839. this.idle_input_interval = 5000;
  24840. this.suspend_threshold = 1000;
  24841. // this.max_instruction_count = 350250; - automated evaluation limit
  24842. this.max_instruction_count = Number.MAX_SAFE_INTEGER;
  24843. this.activity_programming_type = new Map();
  24844. this.activity_functions = new Map();
  24845. this.activity_datatypes = new Map();
  24846. this.activity_commands = new Map();
  24847. this.activity_filter = new Map();
  24848. }
  24849. setConfig(opts) {
  24850. const otherConfig = opts;
  24851. for (const key in otherConfig) {
  24852. if (Object.prototype.hasOwnProperty.call(this, key)) {
  24853. this[key] = otherConfig[key];
  24854. }
  24855. }
  24856. }
  24857. }
  24858. const config = new ConfigObject();
  24859. exports.Config = config;
  24860. /***/ }),
  24861. /***/ "./js/util/maybe.ts":
  24862. /*!**************************!*\
  24863. !*** ./js/util/maybe.ts ***!
  24864. \**************************/
  24865. /***/ ((__unused_webpack_module, exports) => {
  24866. "use strict";
  24867. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24868. exports.Maybe = void 0;
  24869. /**
  24870. *
  24871. * Maybe Monad
  24872. * @Source: https://codewithstyle.info/advanced-functional-programming-in-typescript-maybe-monad/
  24873. * @Modified by: @lucascalion - 28/08/2019
  24874. *
  24875. **/
  24876. class Maybe {
  24877. constructor(value) {
  24878. this.value = value;
  24879. }
  24880. static some(value) {
  24881. if (!value) {
  24882. throw Error("Provided value must not be empty");
  24883. }
  24884. return new Maybe(value);
  24885. }
  24886. static none() {
  24887. return new Maybe(null);
  24888. }
  24889. static fromValue(value) {
  24890. return value ? Maybe.some(value) : Maybe.none();
  24891. }
  24892. getOrElse(defaultValue) {
  24893. return this.value === null ? defaultValue : this.value;
  24894. }
  24895. map(f) {
  24896. if (this.value === null) {
  24897. return Maybe.none();
  24898. }
  24899. else {
  24900. return Maybe.fromValue(f(this.value));
  24901. }
  24902. }
  24903. }
  24904. exports.Maybe = Maybe;
  24905. /***/ }),
  24906. /***/ "./.ima_version.json":
  24907. /*!***************************!*\
  24908. !*** ./.ima_version.json ***!
  24909. \***************************/
  24910. /***/ ((module) => {
  24911. "use strict";
  24912. module.exports = JSON.parse('{"version":"2022_01_07 17_52"}');
  24913. /***/ })
  24914. /******/ });
  24915. /************************************************************************/
  24916. /******/ // The module cache
  24917. /******/ var __webpack_module_cache__ = {};
  24918. /******/
  24919. /******/ // The require function
  24920. /******/ function __webpack_require__(moduleId) {
  24921. /******/ // Check if module is in cache
  24922. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  24923. /******/ if (cachedModule !== undefined) {
  24924. /******/ return cachedModule.exports;
  24925. /******/ }
  24926. /******/ // Create a new module (and put it into the cache)
  24927. /******/ var module = __webpack_module_cache__[moduleId] = {
  24928. /******/ // no module.id needed
  24929. /******/ // no module.loaded needed
  24930. /******/ exports: {}
  24931. /******/ };
  24932. /******/
  24933. /******/ // Execute the module function
  24934. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  24935. /******/
  24936. /******/ // Return the exports of the module
  24937. /******/ return module.exports;
  24938. /******/ }
  24939. /******/
  24940. /******/ // expose the modules object (__webpack_modules__)
  24941. /******/ __webpack_require__.m = __webpack_modules__;
  24942. /******/
  24943. /************************************************************************/
  24944. /******/ /* webpack/runtime/chunk loaded */
  24945. /******/ (() => {
  24946. /******/ var deferred = [];
  24947. /******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
  24948. /******/ if(chunkIds) {
  24949. /******/ priority = priority || 0;
  24950. /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
  24951. /******/ deferred[i] = [chunkIds, fn, priority];
  24952. /******/ return;
  24953. /******/ }
  24954. /******/ var notFulfilled = Infinity;
  24955. /******/ for (var i = 0; i < deferred.length; i++) {
  24956. /******/ var [chunkIds, fn, priority] = deferred[i];
  24957. /******/ var fulfilled = true;
  24958. /******/ for (var j = 0; j < chunkIds.length; j++) {
  24959. /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
  24960. /******/ chunkIds.splice(j--, 1);
  24961. /******/ } else {
  24962. /******/ fulfilled = false;
  24963. /******/ if(priority < notFulfilled) notFulfilled = priority;
  24964. /******/ }
  24965. /******/ }
  24966. /******/ if(fulfilled) {
  24967. /******/ deferred.splice(i--, 1)
  24968. /******/ var r = fn();
  24969. /******/ if (r !== undefined) result = r;
  24970. /******/ }
  24971. /******/ }
  24972. /******/ return result;
  24973. /******/ };
  24974. /******/ })();
  24975. /******/
  24976. /******/ /* webpack/runtime/compat get default export */
  24977. /******/ (() => {
  24978. /******/ // getDefaultExport function for compatibility with non-harmony modules
  24979. /******/ __webpack_require__.n = (module) => {
  24980. /******/ var getter = module && module.__esModule ?
  24981. /******/ () => (module['default']) :
  24982. /******/ () => (module);
  24983. /******/ __webpack_require__.d(getter, { a: getter });
  24984. /******/ return getter;
  24985. /******/ };
  24986. /******/ })();
  24987. /******/
  24988. /******/ /* webpack/runtime/define property getters */
  24989. /******/ (() => {
  24990. /******/ // define getter functions for harmony exports
  24991. /******/ __webpack_require__.d = (exports, definition) => {
  24992. /******/ for(var key in definition) {
  24993. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  24994. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  24995. /******/ }
  24996. /******/ }
  24997. /******/ };
  24998. /******/ })();
  24999. /******/
  25000. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  25001. /******/ (() => {
  25002. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  25003. /******/ })();
  25004. /******/
  25005. /******/ /* webpack/runtime/make namespace object */
  25006. /******/ (() => {
  25007. /******/ // define __esModule on exports
  25008. /******/ __webpack_require__.r = (exports) => {
  25009. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  25010. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  25011. /******/ }
  25012. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  25013. /******/ };
  25014. /******/ })();
  25015. /******/
  25016. /******/ /* webpack/runtime/jsonp chunk loading */
  25017. /******/ (() => {
  25018. /******/ // no baseURI
  25019. /******/
  25020. /******/ // object to store loaded and loading chunks
  25021. /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
  25022. /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
  25023. /******/ var installedChunks = {
  25024. /******/ "main": 0
  25025. /******/ };
  25026. /******/
  25027. /******/ // no chunk on demand loading
  25028. /******/
  25029. /******/ // no prefetching
  25030. /******/
  25031. /******/ // no preloaded
  25032. /******/
  25033. /******/ // no HMR
  25034. /******/
  25035. /******/ // no HMR manifest
  25036. /******/
  25037. /******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
  25038. /******/
  25039. /******/ // install a JSONP callback for chunk loading
  25040. /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
  25041. /******/ var [chunkIds, moreModules, runtime] = data;
  25042. /******/ // add "moreModules" to the modules object,
  25043. /******/ // then flag all "chunkIds" as loaded and fire callback
  25044. /******/ var moduleId, chunkId, i = 0;
  25045. /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
  25046. /******/ for(moduleId in moreModules) {
  25047. /******/ if(__webpack_require__.o(moreModules, moduleId)) {
  25048. /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
  25049. /******/ }
  25050. /******/ }
  25051. /******/ if(runtime) var result = runtime(__webpack_require__);
  25052. /******/ }
  25053. /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
  25054. /******/ for(;i < chunkIds.length; i++) {
  25055. /******/ chunkId = chunkIds[i];
  25056. /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
  25057. /******/ installedChunks[chunkId][0]();
  25058. /******/ }
  25059. /******/ installedChunks[chunkIds[i]] = 0;
  25060. /******/ }
  25061. /******/ return __webpack_require__.O(result);
  25062. /******/ }
  25063. /******/
  25064. /******/ var chunkLoadingGlobal = self["webpackChunkivprogCore"] = self["webpackChunkivprogCore"] || [];
  25065. /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
  25066. /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
  25067. /******/ })();
  25068. /******/
  25069. /************************************************************************/
  25070. /******/
  25071. /******/ // startup
  25072. /******/ // Load entry module and return exports
  25073. /******/ // This entry module depends on other loaded chunks and execution need to be delayed
  25074. /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["vendors-node_modules_babel_runtime_helpers_asyncToGenerator_js-node_modules_babel_runtime_hel-72ab78"], () => (__webpack_require__("./js/main.js")))
  25075. /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
  25076. /******/
  25077. /******/ return __webpack_exports__;
  25078. /******/ })()
  25079. ;
  25080. });
  25081. //# sourceMappingURL=main.351fa5be475052d189cc.js.map