1
0

main.1f2ec643885ac2dda183.js 1.3 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823
  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 ignore_logs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  11273. var algorithm_in_ilm = null;
  11274. if (data.split("\n::algorithm::")[1]) {
  11275. algorithm_in_ilm = data.split("\n::algorithm::")[1].split("\n::logs::")[0];
  11276. var logs = data.split("\n::algorithm::")[1].split("\n::logs::")[1];
  11277. if (logs != null && ignore_logs == false) {
  11278. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.parseLogs)(logs);
  11279. }
  11280. }
  11281. var content;
  11282. try {
  11283. content = JSON.parse(data.split("\n::algorithm::")[0]);
  11284. content["algorithm_in_ilm"] = algorithm_in_ilm;
  11285. } catch (e) {
  11286. console.error(e);
  11287. return _maybe__WEBPACK_IMPORTED_MODULE_6__.Maybe.none();
  11288. }
  11289. return _maybe__WEBPACK_IMPORTED_MODULE_6__.Maybe.some(content);
  11290. }
  11291. function configAuxiliar(obj_config) {
  11292. return new Map(Object.keys(obj_config).map(function (key) {
  11293. return [key, obj_config[key]];
  11294. }));
  11295. }
  11296. function setActivityConfig(config_json) {
  11297. ivprogCore.Config.activity_commands = configAuxiliar(config_json.commands);
  11298. ivprogCore.Config.activity_functions = configAuxiliar(config_json.functions);
  11299. ivprogCore.Config.activity_datatypes = configAuxiliar(config_json.datatypes);
  11300. ivprogCore.Config.activity_filter = configAuxiliar(config_json.filter);
  11301. ivprogCore.Config.activity_programming_type = configAuxiliar(config_json.programming);
  11302. }
  11303. function setPreviousAlgorithm(code) {
  11304. var code_obj = null;
  11305. try {
  11306. code_obj = ivprogCore.parseCode(code);
  11307. (0,_codeParser__WEBPACK_IMPORTED_MODULE_7__.parserCodeVisual)(code_obj);
  11308. } catch (e) {
  11309. showInvalidData();
  11310. console.log(e);
  11311. return;
  11312. }
  11313. }
  11314. function prepareActivityToStudentHelperJSON(ilm_cont) {
  11315. (0,_visualUI_functions__WEBPACK_IMPORTED_MODULE_0__.setTestCases)(ilm_cont.test_cases);
  11316. setActivityConfig(ilm_cont.settings);
  11317. if (ilm_cont.code) setPreviousAlgorithm(ilm_cont.code);else if (ilm_cont.algorithm) setPreviousAlgorithm(ilm_cont.algorithm);
  11318. }
  11319. function prepareActivityToStudentHelper(ilm_cont) {
  11320. var ignore_logs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  11321. var maybe_content = parseActivityData(ilm_cont, ignore_logs);
  11322. return maybe_content.map(function (content) {
  11323. var testCases = content.testcases;
  11324. (0,_visualUI_functions__WEBPACK_IMPORTED_MODULE_0__.setTestCases)(testCases);
  11325. var prog_type = null;
  11326. if (content.settings_programming_type) {
  11327. prog_type = content.settings_programming_type[0].value;
  11328. } else {
  11329. prog_type = "visual";
  11330. }
  11331. return {
  11332. settingsProgrammingType: prog_type,
  11333. settingsDataTypes: content.settings_data_types,
  11334. settingsCommands: content.settings_commands,
  11335. settingsFunctions: content.settings_functions,
  11336. algorithmInIlm: content.algorithm_in_ilm,
  11337. settingsFilter: content.settings_filter
  11338. };
  11339. });
  11340. }
  11341. function compareArray(a, b) {
  11342. for (var i = 0; i < a.length; ++i) {
  11343. var elementA = a[i];
  11344. var elementB = b[i];
  11345. if (elementA != elementB) {
  11346. return false;
  11347. }
  11348. }
  11349. return true;
  11350. }
  11351. function compareTestcases(original, student) {
  11352. if (original.length != student.length) {
  11353. return false;
  11354. }
  11355. for (var i = 0; i < original.length; ++i) {
  11356. var elementO = original[i];
  11357. var elementS = student[i];
  11358. if (!compareArray(elementO.input, elementS.input)) {
  11359. return false;
  11360. }
  11361. if (!compareArray(elementO.output, elementS.output)) {
  11362. return false;
  11363. }
  11364. }
  11365. return true;
  11366. }
  11367. function autoEval(originalData, callback) {
  11368. var code = (0,_visualUI_code_generator__WEBPACK_IMPORTED_MODULE_1__.generate)(); //console.debug(code);
  11369. var original = parseActivityData(originalData).getOrElse(undefined);
  11370. if (original == null) {
  11371. alert("iAssign did not provide the original activity data!");
  11372. return callback(null);
  11373. }
  11374. if (code == null) {
  11375. return callback(-1); // @FeedbackConvention Casos de teste vazios
  11376. } else {
  11377. if (!compareTestcases(original.testcases, (0,_visualUI_functions__WEBPACK_IMPORTED_MODULE_0__.getTestCases)())) {
  11378. return callback(-2); // @FeedbackConvention Casos de teste alterados pelo aluno
  11379. }
  11380. try {
  11381. var ast_code = _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_5__.SemanticAnalyser.analyseFromSource(code);
  11382. var con = new _testConsole__WEBPACK_IMPORTED_MODULE_3__.TestConsole([]);
  11383. var autoAssessment = new _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_2__.IVProgAssessment(ast_code, original.testcases, con);
  11384. autoAssessment.runTest().then(function (grade) {
  11385. return callback(grade);
  11386. })["catch"](function (err) {
  11387. console.log(err);
  11388. callback(-5); // @FeedbackConvention Falha na execução
  11389. });
  11390. } catch (e) {
  11391. console.error(e);
  11392. callback(-5);
  11393. }
  11394. }
  11395. }
  11396. /***/ }),
  11397. /***/ "./js/util/inputTest.js":
  11398. /*!******************************!*\
  11399. !*** ./js/util/inputTest.js ***!
  11400. \******************************/
  11401. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  11402. "use strict";
  11403. __webpack_require__.r(__webpack_exports__);
  11404. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  11405. /* harmony export */ "InputTest": () => (/* binding */ InputTest)
  11406. /* harmony export */ });
  11407. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  11408. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  11409. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  11410. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  11411. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  11412. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  11413. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  11414. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  11415. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  11416. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  11417. /* harmony import */ var _io_input__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  11418. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  11419. 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); }; }
  11420. 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; } }
  11421. var InputTest = /*#__PURE__*/function (_Input) {
  11422. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(InputTest, _Input);
  11423. var _super = _createSuper(InputTest);
  11424. function InputTest(inputList) {
  11425. var _this;
  11426. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, InputTest);
  11427. _this = _super.call(this);
  11428. _this.index = 0;
  11429. _this.inputList = inputList;
  11430. return _this;
  11431. }
  11432. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(InputTest, [{
  11433. key: "requestInput",
  11434. value: function requestInput() {
  11435. var _this2 = this;
  11436. var promise = new Promise(function (resolve, reject) {
  11437. if (_this2.index < _this2.inputList.length) {
  11438. resolve(_this2.inputList[_this2.index]);
  11439. _this2.index++;
  11440. } else {
  11441. reject(new Error(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_6__.LocalizedStrings.getError("exceeded_input_request")));
  11442. }
  11443. });
  11444. return promise;
  11445. }
  11446. }]);
  11447. return InputTest;
  11448. }(_io_input__WEBPACK_IMPORTED_MODULE_5__.Input);
  11449. /***/ }),
  11450. /***/ "./js/util/input_assessment.js":
  11451. /*!*************************************!*\
  11452. !*** ./js/util/input_assessment.js ***!
  11453. \*************************************/
  11454. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  11455. "use strict";
  11456. __webpack_require__.r(__webpack_exports__);
  11457. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  11458. /* harmony export */ "InputAssessment": () => (/* binding */ InputAssessment)
  11459. /* harmony export */ });
  11460. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  11461. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  11462. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  11463. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  11464. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  11465. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  11466. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  11467. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  11468. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  11469. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  11470. /* harmony import */ var _io_input__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  11471. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  11472. 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); }; }
  11473. 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; } }
  11474. var InputAssessment = /*#__PURE__*/function (_Input) {
  11475. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(InputAssessment, _Input);
  11476. var _super = _createSuper(InputAssessment);
  11477. function InputAssessment(input_list) {
  11478. var _this;
  11479. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, InputAssessment);
  11480. _this = _super.call(this);
  11481. _this.index = 0;
  11482. _this.input_list = input_list.map(function (val) {
  11483. return {
  11484. "value": val,
  11485. "read": false
  11486. };
  11487. });
  11488. return _this;
  11489. }
  11490. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(InputAssessment, [{
  11491. key: "requestInput",
  11492. value: function requestInput() {
  11493. var _this2 = this;
  11494. var promise = new Promise(function (resolve, reject) {
  11495. if (_this2.index < _this2.input_list.length) {
  11496. var input = _this2.input_list[_this2.index];
  11497. input.read = true;
  11498. _this2.index += 1;
  11499. resolve(input.value);
  11500. } else {
  11501. reject(new Error(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_6__.LocalizedStrings.getError("exceeded_input_request")));
  11502. }
  11503. });
  11504. return promise;
  11505. }
  11506. }, {
  11507. key: "isInputAvailable",
  11508. value: function isInputAvailable() {
  11509. return this.index < this.input_list.length;
  11510. }
  11511. }]);
  11512. return InputAssessment;
  11513. }(_io_input__WEBPACK_IMPORTED_MODULE_5__.Input);
  11514. /***/ }),
  11515. /***/ "./js/util/outputTest.js":
  11516. /*!*******************************!*\
  11517. !*** ./js/util/outputTest.js ***!
  11518. \*******************************/
  11519. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  11520. "use strict";
  11521. __webpack_require__.r(__webpack_exports__);
  11522. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  11523. /* harmony export */ "OutputTest": () => (/* binding */ OutputTest)
  11524. /* harmony export */ });
  11525. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  11526. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  11527. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  11528. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  11529. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
  11530. /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2__);
  11531. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
  11532. /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__);
  11533. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
  11534. /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__);
  11535. /* harmony import */ var _io_output__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  11536. 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); }; }
  11537. 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; } }
  11538. var OutputTest = /*#__PURE__*/function (_Output) {
  11539. _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_2___default()(OutputTest, _Output);
  11540. var _super = _createSuper(OutputTest);
  11541. function OutputTest() {
  11542. var _this;
  11543. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, OutputTest);
  11544. _this = _super.call(this);
  11545. _this.list = [];
  11546. _this.currentLine = null;
  11547. return _this;
  11548. }
  11549. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(OutputTest, [{
  11550. key: "write",
  11551. value: function write(text) {
  11552. var newLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  11553. if (this.currentLine == null) {
  11554. this.currentLine = this.list.push("") - 1;
  11555. }
  11556. this.list[this.currentLine] += text;
  11557. if (newLine) {
  11558. this.currentLine = null;
  11559. }
  11560. }
  11561. }, {
  11562. key: "sendOutput",
  11563. value: function sendOutput(text) {
  11564. var _this2 = this;
  11565. var output = "" + text;
  11566. if (output.indexOf("\n") !== -1) {
  11567. var outputList = output.split("\n");
  11568. var last = outputList.pop();
  11569. outputList.forEach(function (t) {
  11570. //t = t.replace(/\t/g, '&#x0020;&#x0020;');
  11571. //t = t.replace(/\s/g, "&#x0020;");
  11572. if (t.length == 0) _this2.currentLine = null;else _this2.write(t, true);
  11573. }); //last = last.replace(/\t/g, '&#x0020;&#x0020;');
  11574. //last = last.replace(/\s/g, "&#x0020;");
  11575. if (last.length != 0) this.write(last);
  11576. } else {
  11577. //output = output.replace(/\t/g, '&#x0020;&#x0020;');
  11578. //output = output.replace(/\s/g, "&#x0020;");
  11579. this.write(output);
  11580. }
  11581. }
  11582. }]);
  11583. return OutputTest;
  11584. }(_io_output__WEBPACK_IMPORTED_MODULE_5__.Output);
  11585. /***/ }),
  11586. /***/ "./js/util/parseFromVisual.js":
  11587. /*!************************************!*\
  11588. !*** ./js/util/parseFromVisual.js ***!
  11589. \************************************/
  11590. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  11591. "use strict";
  11592. __webpack_require__.r(__webpack_exports__);
  11593. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  11594. /* harmony export */ "parseExpression": () => (/* binding */ parseExpression),
  11595. /* harmony export */ "parseCode": () => (/* binding */ parseCode)
  11596. /* harmony export */ });
  11597. /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
  11598. /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__);
  11599. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  11600. /* harmony import */ var _ast_expressions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ast/expressions */ "./js/ast/expressions/index.js");
  11601. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../typeSystem/types */ "./js/typeSystem/types.ts");
  11602. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  11603. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../ast/commands */ "./js/ast/commands/index.js");
  11604. /* harmony import */ var _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
  11605. /* harmony import */ var _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  11606. var TYPES = {
  11607. VARIABLE: "var",
  11608. CONST: "const",
  11609. FUNCTION: "function",
  11610. RELATIONAL: "relational",
  11611. LOGIC: "logic",
  11612. ARITHMETIC: "arithmetic"
  11613. };
  11614. function translateOp(type, op) {
  11615. switch (type) {
  11616. case TYPES.ARITHMETIC:
  11617. return op.value;
  11618. case TYPES.RELATIONAL:
  11619. return op.value;
  11620. case TYPES.LOGIC:
  11621. {
  11622. if (op.ord === 11) {
  11623. return "and";
  11624. } else if (op.ord === 12) {
  11625. return "or";
  11626. } else {
  11627. return "not";
  11628. }
  11629. }
  11630. }
  11631. }
  11632. function getOpType(op) {
  11633. switch (op.ord) {
  11634. case 0:
  11635. case 1:
  11636. case 2:
  11637. case 3:
  11638. case 4:
  11639. return TYPES.ARITHMETIC;
  11640. case 5:
  11641. case 6:
  11642. case 7:
  11643. case 8:
  11644. case 9:
  11645. case 10:
  11646. return TYPES.RELATIONAL;
  11647. default:
  11648. return TYPES.LOGIC;
  11649. }
  11650. }
  11651. /**
  11652. * @param {Commands.Case} switchCase
  11653. * */
  11654. function switchCaseWalker(switchCase) {
  11655. var commands = switchCase.commands.map(commandWalker);
  11656. var expression = switchCase.isDefault ? null : expressionWalker(switchCase.expression);
  11657. return {
  11658. type: "switchcase",
  11659. line: switchCase.sourceInfo.line,
  11660. expression: expression,
  11661. commands: commands
  11662. };
  11663. }
  11664. /**
  11665. * @param {Commands.Switch} switchCommand
  11666. * */
  11667. function switchWalker(switchCommand) {
  11668. var expression = expressionWalker(switchCommand.expression);
  11669. var cases = switchCommand.cases.map(switchCaseWalker);
  11670. return {
  11671. type: "switch",
  11672. expression: expression,
  11673. cases: cases
  11674. };
  11675. }
  11676. /**
  11677. * @param {Commands.Return} returnCommand
  11678. * */
  11679. function returnWalker(returnCommand) {
  11680. var expression = expressionWalker(returnCommand.expression);
  11681. return {
  11682. type: "return",
  11683. expression: expression
  11684. };
  11685. }
  11686. function breakWalker(_) {
  11687. return {
  11688. type: "break"
  11689. };
  11690. }
  11691. /**
  11692. * @param {Commands.For} forLoop
  11693. * */
  11694. function forWalker(forLoop) {
  11695. var var_attribution = expressionWalker(forLoop.for_id);
  11696. var var_initial = expressionWalker(forLoop.for_from);
  11697. var condition = expressionWalker(forLoop.for_to);
  11698. var step_expression = forLoop.for_pass ? expressionWalker(forLoop.for_pass) : [];
  11699. var commands = forLoop.commands.map(commandWalker);
  11700. return {
  11701. type: "repeatNtimes",
  11702. var_attribution: var_attribution,
  11703. var_initial: var_initial,
  11704. condition: condition,
  11705. step_expression: step_expression,
  11706. commands: commands
  11707. };
  11708. }
  11709. /**
  11710. * @param {Commands.While} whileLoop
  11711. * */
  11712. function whileWalker(whileLoop) {
  11713. var expression = expressionWalker(whileLoop.expression);
  11714. var commands = whileLoop.commands.map(commandWalker);
  11715. var type = whileLoop.testFirst ? "whiletrue" : "dowhiletrue";
  11716. return {
  11717. type: type,
  11718. expression: expression,
  11719. commands: commands
  11720. };
  11721. }
  11722. /**
  11723. * @param {Commands.IfThenElse} ifthenelse
  11724. * */
  11725. function ifThenElseWalker(ifthenelse) {
  11726. //ifthenelse.
  11727. var expression = expressionWalker(ifthenelse.condition);
  11728. var ifTrue = ifthenelse.ifTrue.commands.map(commandWalker);
  11729. var ifFalse = [];
  11730. if (ifthenelse.ifFalse) {
  11731. if (ifthenelse.ifFalse instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.CommandBlock) {
  11732. ifFalse = ifthenelse.ifFalse.commands.map(commandWalker);
  11733. } else {
  11734. ifFalse = [ifThenElseWalker(ifthenelse.ifFalse)];
  11735. }
  11736. }
  11737. return {
  11738. type: "iftrue",
  11739. expression: expression,
  11740. ifTrue: ifTrue,
  11741. ifFalse: ifFalse
  11742. };
  11743. }
  11744. /**
  11745. * @param {Commands.Assign} assingment
  11746. * */
  11747. function assignmentWalker(assingment) {
  11748. var variable = null;
  11749. if (assingment instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.ArrayIndexAssign) {
  11750. var line = expressionWalker(assingment.line);
  11751. var arrayClass = "vector";
  11752. var column = null;
  11753. if (assingment.column) {
  11754. arrayClass = "matrix";
  11755. column = expressionWalker(assingment.column);
  11756. }
  11757. variable = [{
  11758. instance: "expression",
  11759. type: TYPES.VARIABLE,
  11760. "class": arrayClass,
  11761. column: column,
  11762. line: line,
  11763. value: assingment.id
  11764. }];
  11765. } else {
  11766. variable = [{
  11767. instance: "expression",
  11768. type: TYPES.VARIABLE,
  11769. value: assingment.id
  11770. }];
  11771. }
  11772. var expression = expressionWalker(assingment.expression);
  11773. return {
  11774. type: "attribution",
  11775. variable: variable,
  11776. expression: expression
  11777. };
  11778. }
  11779. /**
  11780. * @param {Command} command
  11781. * */
  11782. function commandWalker(command) {
  11783. var parsedCommand = null;
  11784. if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.FunctionCall) {
  11785. parsedCommand = functionCallWalker(command);
  11786. } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.Assign) {
  11787. parsedCommand = assignmentWalker(command);
  11788. } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.IfThenElse) {
  11789. parsedCommand = ifThenElseWalker(command);
  11790. } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.While) {
  11791. parsedCommand = whileWalker(command);
  11792. } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.Break) {
  11793. parsedCommand = breakWalker(command);
  11794. } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.Return) {
  11795. parsedCommand = returnWalker(command);
  11796. } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.Switch) {
  11797. parsedCommand = switchWalker(command);
  11798. } else if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.For) {
  11799. parsedCommand = forWalker(command);
  11800. } else {
  11801. throw new Error("not implemented");
  11802. }
  11803. parsedCommand.line = command.sourceInfo.line;
  11804. return parsedCommand;
  11805. }
  11806. /**
  11807. * @param {Commands.FunctionCall} functionCall
  11808. * */
  11809. function functionCallWalker(functionCall) {
  11810. var name = functionCall.id;
  11811. if (name.indexOf(".") !== -1) {
  11812. name = name.split(".")[1];
  11813. }
  11814. var parameters = functionCall.actualParameters.map(expressionWalker);
  11815. if (name === "$write") {
  11816. var lastInput = parameters[parameters.length - 1][0]; // if lastInput is an object with value === '\n', newLine is true
  11817. var newLine = lastInput.value && lastInput.value.match(/^\n$/) !== null;
  11818. var content = newLine ? parameters.slice(0, parameters.length - 1) : parameters;
  11819. return {
  11820. type: "writer",
  11821. newLine: newLine,
  11822. content: content
  11823. };
  11824. }
  11825. if (name === "$read") {
  11826. return {
  11827. type: "reader",
  11828. variable: parameters[0]
  11829. };
  11830. }
  11831. return {
  11832. type: "functioncall",
  11833. parameters_list: parameters,
  11834. name: functionCall.id
  11835. };
  11836. }
  11837. /**
  11838. * @param {Commands.Function} func
  11839. * */
  11840. function functionWalker(func) {
  11841. var funcDeclaration = {
  11842. name: func.name,
  11843. line: func.sourceInfo.line,
  11844. return_type: "",
  11845. return_dimensions: 0,
  11846. parameters_list: [],
  11847. variables_list: [],
  11848. commands: []
  11849. };
  11850. if (func.returnType instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_6__.ArrayType) {
  11851. funcDeclaration.return_type = func.returnType.innerType.value;
  11852. funcDeclaration.return_dimensions = func.returnType.dimensions;
  11853. } else {
  11854. funcDeclaration.return_type = func.returnType.value;
  11855. }
  11856. funcDeclaration.parameters_list = func.formalParameters.map(functionParameterWalker);
  11857. funcDeclaration.variables_list = func.variablesDeclarations.map(variableDeclarationWalker);
  11858. funcDeclaration.commands = func.commands.map(commandWalker);
  11859. return funcDeclaration;
  11860. }
  11861. /**
  11862. * @param {Commands.FormalParameter} formalParameter
  11863. * */
  11864. function functionParameterWalker(formalParameter) {
  11865. var variable = {
  11866. name: formalParameter.id,
  11867. line: formalParameter.sourceInfo.line,
  11868. type: "",
  11869. rows: 0,
  11870. columns: 0,
  11871. dimension: 0,
  11872. value: 0,
  11873. is_const: false,
  11874. reference: formalParameter.byRef
  11875. };
  11876. if (formalParameter.type instanceof _typeSystem_array_type__WEBPACK_IMPORTED_MODULE_6__.ArrayType) {
  11877. variable.type = formalParameter.type.innerType.value;
  11878. variable.dimension = formalParameter.type.dimensions;
  11879. } else {
  11880. variable.type = formalParameter.type.value;
  11881. }
  11882. return variable;
  11883. }
  11884. /**
  11885. * @param {Commands.Declaration} command
  11886. * @param {boolean} global
  11887. * */
  11888. function variableDeclarationWalker(command) {
  11889. var global = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  11890. var variable = {
  11891. name: command.id,
  11892. line: command.sourceInfo.line,
  11893. type: "",
  11894. rows: 0,
  11895. columns: 0,
  11896. dimension: 0,
  11897. value: 0,
  11898. is_const: false
  11899. };
  11900. variable.is_const = global && command.isConst;
  11901. if (command instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_5__.ArrayDeclaration) {
  11902. // array
  11903. var lines = expressionWalker(command.lines).pop();
  11904. variable.type = command.type.innerType.value;
  11905. if (command.isVector) {
  11906. variable.columns = lines.value;
  11907. variable.dimension = 1;
  11908. var values = command.initial.value.map(function (exp) {
  11909. return variableInitialWalker(exp);
  11910. });
  11911. variable.value = values;
  11912. } else {
  11913. var columns = expressionWalker(command.columns).pop();
  11914. variable.dimension = 2;
  11915. variable.rows = lines.value;
  11916. variable.columns = columns.value;
  11917. var _values = command.initial.value.map(function (rows) {
  11918. return rows.value.map(function (exp) {
  11919. return variableInitialWalker(exp);
  11920. });
  11921. });
  11922. variable.value = _values;
  11923. }
  11924. } else {
  11925. // atomic
  11926. variable.type = command.type.value;
  11927. variable.value = variableInitialWalker(command.initial);
  11928. }
  11929. return variable;
  11930. }
  11931. /**
  11932. * @param {any} expression
  11933. * */
  11934. function variableInitialWalker(expression) {
  11935. if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.UnaryApp) {
  11936. var left = variableInitialWalker(expression.left);
  11937. var opType = getOpType(expression.op);
  11938. if (opType !== TYPES.ARITHMETIC) {
  11939. throw new Error("invalid variable initial value: " + expression.toString());
  11940. }
  11941. return "".concat(expression.op.value).concat(left);
  11942. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.BoolLiteral) {
  11943. var value = expression.value;
  11944. return (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.convertBoolToString)(value);
  11945. } else if (expression instanceof _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_7__.Literal) {
  11946. var _value = expression.value;
  11947. if (expression.value.toNumber) {
  11948. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.REAL.isCompatible(expression.type) && expression.value.decimalPlaces() == 0) {
  11949. _value = expression.value.toFixed(2);
  11950. } else {
  11951. _value = expression.value.toNumber();
  11952. }
  11953. }
  11954. return _value;
  11955. }
  11956. throw new Error("invalid variable initial value: " + expression.toString());
  11957. }
  11958. /**
  11959. *
  11960. * @return {[]}
  11961. **/
  11962. function expressionWalker(expression) {
  11963. var result;
  11964. if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.VariableLiteral) {
  11965. result = [{
  11966. instance: "expression",
  11967. type: TYPES.VARIABLE,
  11968. value: expression.id
  11969. }];
  11970. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.FunctionCall) {
  11971. var funcObj = {
  11972. instance: "expression",
  11973. type: TYPES.FUNCTION,
  11974. value: expression.id
  11975. };
  11976. var paramsList = expression.actualParameters.map(function (e) {
  11977. return expressionWalker(e);
  11978. }); //const params = Array.prototype.concat.apply([], paramsList);
  11979. funcObj.params = paramsList;
  11980. result = [funcObj];
  11981. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.UnaryApp) {
  11982. console.log(expression);
  11983. var left = expressionWalker(expression.left);
  11984. var opType = getOpType(expression.op);
  11985. var opValue = translateOp(opType, expression.op);
  11986. result = [{
  11987. instance: "operator",
  11988. type: opType,
  11989. value: opValue
  11990. }].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(left));
  11991. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.InfixApp) {
  11992. var _left = expressionWalker(expression.left);
  11993. var right = expressionWalker(expression.right);
  11994. var _opType = getOpType(expression.op);
  11995. var _opValue = translateOp(_opType, expression.op);
  11996. result = [].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(_left), [{
  11997. instance: "operator",
  11998. type: _opType,
  11999. value: _opValue
  12000. }], _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(right));
  12001. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.ArrayAccess) {
  12002. var line = expressionWalker(expression.line);
  12003. var arrayClass = "vector";
  12004. var column = null;
  12005. if (expression.column) {
  12006. arrayClass = "matrix";
  12007. column = expressionWalker(expression.column);
  12008. }
  12009. result = [{
  12010. instance: "expression",
  12011. type: TYPES.VARIABLE,
  12012. "class": arrayClass,
  12013. column: column,
  12014. line: line,
  12015. value: expression.id
  12016. }];
  12017. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_2__.BoolLiteral) {
  12018. var value = expression.value;
  12019. result = [{
  12020. instance: "expression",
  12021. "class": "simple",
  12022. type: TYPES.CONST,
  12023. value: (0,_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_4__.convertBoolToString)(value)
  12024. }];
  12025. } else {
  12026. var _value2 = expression.value;
  12027. if (expression.value.toNumber) {
  12028. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__.Types.REAL.isCompatible(expression.type) && expression.value.decimalPlaces() == 0) {
  12029. _value2 = expression.value.toFixed(2);
  12030. } else {
  12031. _value2 = expression.value.toNumber();
  12032. }
  12033. }
  12034. result = [{
  12035. instance: "expression",
  12036. "class": "simple",
  12037. type: TYPES.CONST,
  12038. value: _value2
  12039. }];
  12040. }
  12041. if (expression.parenthesis) return ["("].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(result), [")"]);else return result;
  12042. }
  12043. function parseExpression(text) {
  12044. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_1__.IVProgParser.createParser(text);
  12045. var expressionAST = parser.parseExpressionOR();
  12046. return expressionWalker(expressionAST);
  12047. }
  12048. /**
  12049. * @param {string} text
  12050. * */
  12051. function parseCode(text) {
  12052. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_1__.IVProgParser.createParser(text, false);
  12053. var codeLinesMap = new Map();
  12054. var tokens = Array.from(parser.lexer.reset(text));
  12055. var tokenStream = [];
  12056. for (var _i = 0, _tokens = tokens; _i < _tokens.length; _i++) {
  12057. var token = _tokens[_i];
  12058. if (token.type === parser.ruleNames.ERROR) {
  12059. return null;
  12060. }
  12061. if (token.type === parser.ruleNames.COMMENTS) {
  12062. for (var i = 0; i <= token.lineBreaks; i++) {
  12063. if (codeLinesMap.has(i + token.line)) codeLinesMap.get(i + token.line).push(token);else codeLinesMap.set(i + token.line, [token]);
  12064. }
  12065. continue;
  12066. }
  12067. if (token.type !== parser.ruleNames.WHITESPACE) {
  12068. tokenStream.push(token);
  12069. }
  12070. }
  12071. parser.fill(tokenStream);
  12072. try {
  12073. var program = parser.parseTree();
  12074. var globals = program.global.map(function (decl) {
  12075. return variableDeclarationWalker(decl, true);
  12076. });
  12077. var functions = program.functions.map(functionWalker);
  12078. return {
  12079. globals: globals,
  12080. functions: functions
  12081. };
  12082. } catch (e) {
  12083. console.error(e);
  12084. return null;
  12085. }
  12086. }
  12087. /***/ }),
  12088. /***/ "./js/util/string_diff.js":
  12089. /*!********************************!*\
  12090. !*** ./js/util/string_diff.js ***!
  12091. \********************************/
  12092. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  12093. "use strict";
  12094. __webpack_require__.r(__webpack_exports__);
  12095. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  12096. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  12097. /* harmony export */ });
  12098. /**
  12099. * Author: @jhchen - https://github.com/jhchen
  12100. * Modified by: @lucascalion - 23/07/2019
  12101. * This library modifies the diff-patch-match library by Neil Fraser
  12102. * by removing the patch and match functionality and certain advanced
  12103. * options in the diff function. The original license is as follows:
  12104. *
  12105. * ===
  12106. *
  12107. * Diff Match and Patch
  12108. *
  12109. * Copyright 2006 Google Inc.
  12110. * http://code.google.com/p/google-diff-match-patch/
  12111. *
  12112. * Licensed under the Apache License, Version 2.0 (the "License");
  12113. * you may not use this file except in compliance with the License.
  12114. * You may obtain a copy of the License at
  12115. *
  12116. * http://www.apache.org/licenses/LICENSE-2.0
  12117. *
  12118. * Unless required by applicable law or agreed to in writing, software
  12119. * distributed under the License is distributed on an "AS IS" BASIS,
  12120. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12121. * See the License for the specific language governing permissions and
  12122. * limitations under the License.
  12123. */
  12124. /**
  12125. * The data structure representing a diff is an array of tuples:
  12126. * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
  12127. * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
  12128. */
  12129. var DIFF_DELETE = -1;
  12130. var DIFF_INSERT = 1;
  12131. var DIFF_EQUAL = 0;
  12132. /**
  12133. * Find the differences between two texts. Simplifies the problem by stripping
  12134. * any common prefix or suffix off the texts before diffing.
  12135. * @param {string} text1 Old string to be diffed.
  12136. * @param {string} text2 New string to be diffed.
  12137. * @param {Int|Object} [cursor_pos] Edit position in text1 or object with more info
  12138. * @return {Array} Array of diff tuples.
  12139. */
  12140. function diff_main(text1, text2, cursor_pos, _fix_unicode) {
  12141. // Check for equality
  12142. if (text1 === text2) {
  12143. if (text1) {
  12144. return [[DIFF_EQUAL, text1]];
  12145. }
  12146. return [];
  12147. }
  12148. if (cursor_pos != null) {
  12149. var editdiff = find_cursor_edit_diff(text1, text2, cursor_pos);
  12150. if (editdiff) {
  12151. return editdiff;
  12152. }
  12153. } // Trim off common prefix (speedup).
  12154. var commonlength = diff_commonPrefix(text1, text2);
  12155. var commonprefix = text1.substring(0, commonlength);
  12156. text1 = text1.substring(commonlength);
  12157. text2 = text2.substring(commonlength); // Trim off common suffix (speedup).
  12158. commonlength = diff_commonSuffix(text1, text2);
  12159. var commonsuffix = text1.substring(text1.length - commonlength);
  12160. text1 = text1.substring(0, text1.length - commonlength);
  12161. text2 = text2.substring(0, text2.length - commonlength); // Compute the diff on the middle block.
  12162. var diffs = diff_compute_(text1, text2); // Restore the prefix and suffix.
  12163. if (commonprefix) {
  12164. diffs.unshift([DIFF_EQUAL, commonprefix]);
  12165. }
  12166. if (commonsuffix) {
  12167. diffs.push([DIFF_EQUAL, commonsuffix]);
  12168. }
  12169. diff_cleanupMerge(diffs, _fix_unicode);
  12170. return diffs;
  12171. }
  12172. /**
  12173. * Find the differences between two texts. Assumes that the texts do not
  12174. * have any common prefix or suffix.
  12175. * @param {string} text1 Old string to be diffed.
  12176. * @param {string} text2 New string to be diffed.
  12177. * @return {Array} Array of diff tuples.
  12178. */
  12179. function diff_compute_(text1, text2) {
  12180. var diffs;
  12181. if (!text1) {
  12182. // Just add some text (speedup).
  12183. return [[DIFF_INSERT, text2]];
  12184. }
  12185. if (!text2) {
  12186. // Just delete some text (speedup).
  12187. return [[DIFF_DELETE, text1]];
  12188. }
  12189. var longtext = text1.length > text2.length ? text1 : text2;
  12190. var shorttext = text1.length > text2.length ? text2 : text1;
  12191. var i = longtext.indexOf(shorttext);
  12192. if (i !== -1) {
  12193. // Shorter text is inside the longer text (speedup).
  12194. 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.
  12195. if (text1.length > text2.length) {
  12196. diffs[0][0] = diffs[2][0] = DIFF_DELETE;
  12197. }
  12198. return diffs;
  12199. }
  12200. if (shorttext.length === 1) {
  12201. // Single character string.
  12202. // After the previous speedup, the character can't be an equality.
  12203. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
  12204. } // Check to see if the problem can be split in two.
  12205. var hm = diff_halfMatch_(text1, text2);
  12206. if (hm) {
  12207. // A half-match was found, sort out the return data.
  12208. var text1_a = hm[0];
  12209. var text1_b = hm[1];
  12210. var text2_a = hm[2];
  12211. var text2_b = hm[3];
  12212. var mid_common = hm[4]; // Send both pairs off for separate processing.
  12213. var diffs_a = diff_main(text1_a, text2_a);
  12214. var diffs_b = diff_main(text1_b, text2_b); // Merge the results.
  12215. return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
  12216. }
  12217. return diff_bisect_(text1, text2);
  12218. }
  12219. /**
  12220. * Find the 'middle snake' of a diff, split the problem in two
  12221. * and return the recursively constructed diff.
  12222. * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
  12223. * @param {string} text1 Old string to be diffed.
  12224. * @param {string} text2 New string to be diffed.
  12225. * @return {Array} Array of diff tuples.
  12226. * @private
  12227. */
  12228. function diff_bisect_(text1, text2) {
  12229. // Cache the text lengths to prevent multiple calls.
  12230. var text1_length = text1.length;
  12231. var text2_length = text2.length;
  12232. var max_d = Math.ceil((text1_length + text2_length) / 2);
  12233. var v_offset = max_d;
  12234. var v_length = 2 * max_d;
  12235. var v1 = new Array(v_length);
  12236. var v2 = new Array(v_length); // Setting all elements to -1 is faster in Chrome & Firefox than mixing
  12237. // integers and undefined.
  12238. for (var x = 0; x < v_length; x++) {
  12239. v1[x] = -1;
  12240. v2[x] = -1;
  12241. }
  12242. v1[v_offset + 1] = 0;
  12243. v2[v_offset + 1] = 0;
  12244. var delta = text1_length - text2_length; // If the total number of characters is odd, then the front path will collide
  12245. // with the reverse path.
  12246. var front = delta % 2 !== 0; // Offsets for start and end of k loop.
  12247. // Prevents mapping of space beyond the grid.
  12248. var k1start = 0;
  12249. var k1end = 0;
  12250. var k2start = 0;
  12251. var k2end = 0;
  12252. for (var d = 0; d < max_d; d++) {
  12253. // Walk the front path one step.
  12254. for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
  12255. var k1_offset = v_offset + k1;
  12256. var x1 = void 0;
  12257. if (k1 === -d || k1 !== d && v1[k1_offset - 1] < v1[k1_offset + 1]) {
  12258. x1 = v1[k1_offset + 1];
  12259. } else {
  12260. x1 = v1[k1_offset - 1] + 1;
  12261. }
  12262. var y1 = x1 - k1;
  12263. while (x1 < text1_length && y1 < text2_length && text1.charAt(x1) === text2.charAt(y1)) {
  12264. x1++;
  12265. y1++;
  12266. }
  12267. v1[k1_offset] = x1;
  12268. if (x1 > text1_length) {
  12269. // Ran off the right of the graph.
  12270. k1end += 2;
  12271. } else if (y1 > text2_length) {
  12272. // Ran off the bottom of the graph.
  12273. k1start += 2;
  12274. } else if (front) {
  12275. var k2_offset = v_offset + delta - k1;
  12276. if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] !== -1) {
  12277. // Mirror x2 onto top-left coordinate system.
  12278. var x2 = text1_length - v2[k2_offset];
  12279. if (x1 >= x2) {
  12280. // Overlap detfrontected.
  12281. return diff_bisectSplit_(text1, text2, x1, y1);
  12282. }
  12283. }
  12284. }
  12285. } // Walk the reverse path one step.
  12286. for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
  12287. var _k2_offset = v_offset + k2;
  12288. var _x = void 0;
  12289. if (k2 === -d || k2 !== d && v2[_k2_offset - 1] < v2[_k2_offset + 1]) {
  12290. _x = v2[_k2_offset + 1];
  12291. } else {
  12292. _x = v2[_k2_offset - 1] + 1;
  12293. }
  12294. var y2 = _x - k2;
  12295. while (_x < text1_length && y2 < text2_length && text1.charAt(text1_length - _x - 1) === text2.charAt(text2_length - y2 - 1)) {
  12296. _x++;
  12297. y2++;
  12298. }
  12299. v2[_k2_offset] = _x;
  12300. if (_x > text1_length) {
  12301. // Ran off the left of the graph.
  12302. k2end += 2;
  12303. } else if (y2 > text2_length) {
  12304. // Ran off the top of the graph.
  12305. k2start += 2;
  12306. } else if (!front) {
  12307. var _k1_offset = v_offset + delta - k2;
  12308. if (_k1_offset >= 0 && _k1_offset < v_length && v1[_k1_offset] !== -1) {
  12309. var _x2 = v1[_k1_offset];
  12310. var _y = v_offset + _x2 - _k1_offset; // Mirror x2 onto top-left coordinate system.
  12311. _x = text1_length - _x;
  12312. if (_x2 >= _x) {
  12313. // Overlap detected.
  12314. return diff_bisectSplit_(text1, text2, _x2, _y);
  12315. }
  12316. }
  12317. }
  12318. }
  12319. } // Diff took too long and hit the deadline or
  12320. // number of diffs equals number of characters, no commonality at all.
  12321. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
  12322. }
  12323. /**
  12324. * Given the location of the 'middle snake', split the diff in two parts
  12325. * and recurse.
  12326. * @param {string} text1 Old string to be diffed.
  12327. * @param {string} text2 New string to be diffed.
  12328. * @param {number} x Index of split point in text1.
  12329. * @param {number} y Index of split point in text2.
  12330. * @return {Array} Array of diff tuples.
  12331. */
  12332. function diff_bisectSplit_(text1, text2, x, y) {
  12333. var text1a = text1.substring(0, x);
  12334. var text2a = text2.substring(0, y);
  12335. var text1b = text1.substring(x);
  12336. var text2b = text2.substring(y); // Compute both diffs serially.
  12337. var diffs = diff_main(text1a, text2a);
  12338. var diffsb = diff_main(text1b, text2b);
  12339. return diffs.concat(diffsb);
  12340. }
  12341. /**
  12342. * Determine the common prefix of two strings.
  12343. * @param {string} text1 First string.
  12344. * @param {string} text2 Second string.
  12345. * @return {number} The number of characters common to the start of each
  12346. * string.
  12347. */
  12348. function diff_commonPrefix(text1, text2) {
  12349. // Quick check for common null cases.
  12350. if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) {
  12351. return 0;
  12352. } // Binary search.
  12353. // Performance analysis: http://neil.fraser.name/news/2007/10/09/
  12354. var pointermin = 0;
  12355. var pointermax = Math.min(text1.length, text2.length);
  12356. var pointermid = pointermax;
  12357. var pointerstart = 0;
  12358. while (pointermin < pointermid) {
  12359. if (text1.substring(pointerstart, pointermid) == text2.substring(pointerstart, pointermid)) {
  12360. pointermin = pointermid;
  12361. pointerstart = pointermin;
  12362. } else {
  12363. pointermax = pointermid;
  12364. }
  12365. pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
  12366. }
  12367. if (is_surrogate_pair_start(text1.charCodeAt(pointermid - 1))) {
  12368. pointermid--;
  12369. }
  12370. return pointermid;
  12371. }
  12372. /**
  12373. * Determine the common suffix of two strings.
  12374. * @param {string} text1 First string.
  12375. * @param {string} text2 Second string.
  12376. * @return {number} The number of characters common to the end of each string.
  12377. */
  12378. function diff_commonSuffix(text1, text2) {
  12379. // Quick check for common null cases.
  12380. if (!text1 || !text2 || text1.slice(-1) !== text2.slice(-1)) {
  12381. return 0;
  12382. } // Binary search.
  12383. // Performance analysis: http://neil.fraser.name/news/2007/10/09/
  12384. var pointermin = 0;
  12385. var pointermax = Math.min(text1.length, text2.length);
  12386. var pointermid = pointermax;
  12387. var pointerend = 0;
  12388. while (pointermin < pointermid) {
  12389. if (text1.substring(text1.length - pointermid, text1.length - pointerend) == text2.substring(text2.length - pointermid, text2.length - pointerend)) {
  12390. pointermin = pointermid;
  12391. pointerend = pointermin;
  12392. } else {
  12393. pointermax = pointermid;
  12394. }
  12395. pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
  12396. }
  12397. if (is_surrogate_pair_end(text1.charCodeAt(text1.length - pointermid))) {
  12398. pointermid--;
  12399. }
  12400. return pointermid;
  12401. }
  12402. /**
  12403. * Do the two texts share a substring which is at least half the length of the
  12404. * longer text?
  12405. * This speedup can produce non-minimal diffs.
  12406. * @param {string} text1 First string.
  12407. * @param {string} text2 Second string.
  12408. * @return {Array.<string>} Five element Array, containing the prefix of
  12409. * text1, the suffix of text1, the prefix of text2, the suffix of
  12410. * text2 and the common middle. Or null if there was no match.
  12411. */
  12412. function diff_halfMatch_(text1, text2) {
  12413. var longtext = text1.length > text2.length ? text1 : text2;
  12414. var shorttext = text1.length > text2.length ? text2 : text1;
  12415. if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
  12416. return null; // Pointless.
  12417. }
  12418. /**
  12419. * Does a substring of shorttext exist within longtext such that the substring
  12420. * is at least half the length of longtext?
  12421. * Closure, but does not reference any external variables.
  12422. * @param {string} longtext Longer string.
  12423. * @param {string} shorttext Shorter string.
  12424. * @param {number} i Start index of quarter length substring within longtext.
  12425. * @return {Array.<string>} Five element Array, containing the prefix of
  12426. * longtext, the suffix of longtext, the prefix of shorttext, the suffix
  12427. * of shorttext and the common middle. Or null if there was no match.
  12428. * @private
  12429. */
  12430. function diff_halfMatchI_(longtext, shorttext, i) {
  12431. // Start with a 1/4 length substring at position i as a seed.
  12432. var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
  12433. var j = -1;
  12434. var best_common = '';
  12435. var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
  12436. while ((j = shorttext.indexOf(seed, j + 1)) !== -1) {
  12437. var prefixLength = diff_commonPrefix(longtext.substring(i), shorttext.substring(j));
  12438. var suffixLength = diff_commonSuffix(longtext.substring(0, i), shorttext.substring(0, j));
  12439. if (best_common.length < suffixLength + prefixLength) {
  12440. best_common = shorttext.substring(j - suffixLength, j) + shorttext.substring(j, j + prefixLength);
  12441. best_longtext_a = longtext.substring(0, i - suffixLength);
  12442. best_longtext_b = longtext.substring(i + prefixLength);
  12443. best_shorttext_a = shorttext.substring(0, j - suffixLength);
  12444. best_shorttext_b = shorttext.substring(j + prefixLength);
  12445. }
  12446. }
  12447. if (best_common.length * 2 >= longtext.length) {
  12448. return [best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b, best_common];
  12449. } else {
  12450. return null;
  12451. }
  12452. } // First check if the second quarter is the seed for a half-match.
  12453. var hm1 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 4)); // Check again based on the third quarter.
  12454. var hm2 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 2));
  12455. var hm;
  12456. if (!hm1 && !hm2) {
  12457. return null;
  12458. } else if (!hm2) {
  12459. hm = hm1;
  12460. } else if (!hm1) {
  12461. hm = hm2;
  12462. } else {
  12463. // Both matched. Select the longest.
  12464. hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
  12465. } // A half-match was found, sort out the return data.
  12466. var text1_a, text1_b, text2_a, text2_b;
  12467. if (text1.length > text2.length) {
  12468. text1_a = hm[0];
  12469. text1_b = hm[1];
  12470. text2_a = hm[2];
  12471. text2_b = hm[3];
  12472. } else {
  12473. text2_a = hm[0];
  12474. text2_b = hm[1];
  12475. text1_a = hm[2];
  12476. text1_b = hm[3];
  12477. }
  12478. var mid_common = hm[4];
  12479. return [text1_a, text1_b, text2_a, text2_b, mid_common];
  12480. }
  12481. /**
  12482. * Reorder and merge like edit sections. Merge equalities.
  12483. * Any edit section can move as long as it doesn't cross an equality.
  12484. * @param {Array} diffs Array of diff tuples.
  12485. * @param {boolean} fix_unicode Whether to normalize to a unicode-correct diff
  12486. */
  12487. function diff_cleanupMerge(diffs, fix_unicode) {
  12488. diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.
  12489. var pointer = 0;
  12490. var count_delete = 0;
  12491. var count_insert = 0;
  12492. var text_delete = '';
  12493. var text_insert = '';
  12494. var commonlength;
  12495. var previous_equality;
  12496. while (pointer < diffs.length) {
  12497. if (pointer < diffs.length - 1 && !diffs[pointer][1]) {
  12498. diffs.splice(pointer, 1);
  12499. continue;
  12500. }
  12501. switch (diffs[pointer][0]) {
  12502. case DIFF_INSERT:
  12503. count_insert++;
  12504. text_insert += diffs[pointer][1];
  12505. pointer++;
  12506. break;
  12507. case DIFF_DELETE:
  12508. count_delete++;
  12509. text_delete += diffs[pointer][1];
  12510. pointer++;
  12511. break;
  12512. case DIFF_EQUAL:
  12513. previous_equality = pointer - count_insert - count_delete - 1;
  12514. if (fix_unicode) {
  12515. // prevent splitting of unicode surrogate pairs. when fix_unicode is true,
  12516. // we assume that the old and new text in the diff are complete and correct
  12517. // unicode-encoded JS strings, but the tuple boundaries may fall between
  12518. // surrogate pairs. we fix this by shaving off stray surrogates from the end
  12519. // of the previous equality and the beginning of this equality. this may create
  12520. // empty equalities or a common prefix or suffix. for example, if AB and AC are
  12521. // emojis, `[[0, 'A'], [-1, 'BA'], [0, 'C']]` would turn into deleting 'ABAC' and
  12522. // inserting 'AC', and then the common suffix 'AC' will be eliminated. in this
  12523. // particular case, both equalities go away, we absorb any previous inequalities,
  12524. // and we keep scanning for the next equality before rewriting the tuples.
  12525. if (previous_equality >= 0 && ends_with_pair_start(diffs[previous_equality][1])) {
  12526. var stray = diffs[previous_equality][1].slice(-1);
  12527. diffs[previous_equality][1] = diffs[previous_equality][1].slice(0, -1);
  12528. text_delete = stray + text_delete;
  12529. text_insert = stray + text_insert;
  12530. if (!diffs[previous_equality][1]) {
  12531. // emptied out previous equality, so delete it and include previous delete/insert
  12532. diffs.splice(previous_equality, 1);
  12533. pointer--;
  12534. var k = previous_equality - 1;
  12535. if (diffs[k] && diffs[k][0] === DIFF_INSERT) {
  12536. count_insert++;
  12537. text_insert = diffs[k][1] + text_insert;
  12538. k--;
  12539. }
  12540. if (diffs[k] && diffs[k][0] === DIFF_DELETE) {
  12541. count_delete++;
  12542. text_delete = diffs[k][1] + text_delete;
  12543. k--;
  12544. }
  12545. previous_equality = k;
  12546. }
  12547. }
  12548. if (starts_with_pair_end(diffs[pointer][1])) {
  12549. var _stray = diffs[pointer][1].charAt(0);
  12550. diffs[pointer][1] = diffs[pointer][1].slice(1);
  12551. text_delete += _stray;
  12552. text_insert += _stray;
  12553. }
  12554. }
  12555. if (pointer < diffs.length - 1 && !diffs[pointer][1]) {
  12556. // for empty equality not at end, wait for next equality
  12557. diffs.splice(pointer, 1);
  12558. break;
  12559. }
  12560. if (text_delete.length > 0 || text_insert.length > 0) {
  12561. // note that diff_commonPrefix and diff_commonSuffix are unicode-aware
  12562. if (text_delete.length > 0 && text_insert.length > 0) {
  12563. // Factor out any common prefixes.
  12564. commonlength = diff_commonPrefix(text_insert, text_delete);
  12565. if (commonlength !== 0) {
  12566. if (previous_equality >= 0) {
  12567. diffs[previous_equality][1] += text_insert.substring(0, commonlength);
  12568. } else {
  12569. diffs.splice(0, 0, [DIFF_EQUAL, text_insert.substring(0, commonlength)]);
  12570. pointer++;
  12571. }
  12572. text_insert = text_insert.substring(commonlength);
  12573. text_delete = text_delete.substring(commonlength);
  12574. } // Factor out any common suffixes.
  12575. commonlength = diff_commonSuffix(text_insert, text_delete);
  12576. if (commonlength !== 0) {
  12577. diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];
  12578. text_insert = text_insert.substring(0, text_insert.length - commonlength);
  12579. text_delete = text_delete.substring(0, text_delete.length - commonlength);
  12580. }
  12581. } // Delete the offending records and add the merged ones.
  12582. var n = count_insert + count_delete;
  12583. if (text_delete.length === 0 && text_insert.length === 0) {
  12584. diffs.splice(pointer - n, n);
  12585. pointer = pointer - n;
  12586. } else if (text_delete.length === 0) {
  12587. diffs.splice(pointer - n, n, [DIFF_INSERT, text_insert]);
  12588. pointer = pointer - n + 1;
  12589. } else if (text_insert.length === 0) {
  12590. diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete]);
  12591. pointer = pointer - n + 1;
  12592. } else {
  12593. diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete], [DIFF_INSERT, text_insert]);
  12594. pointer = pointer - n + 2;
  12595. }
  12596. }
  12597. if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) {
  12598. // Merge this equality with the previous one.
  12599. diffs[pointer - 1][1] += diffs[pointer][1];
  12600. diffs.splice(pointer, 1);
  12601. } else {
  12602. pointer++;
  12603. }
  12604. count_insert = 0;
  12605. count_delete = 0;
  12606. text_delete = '';
  12607. text_insert = '';
  12608. break;
  12609. }
  12610. }
  12611. if (diffs[diffs.length - 1][1] === '') {
  12612. diffs.pop(); // Remove the dummy entry at the end.
  12613. } // Second pass: look for single edits surrounded on both sides by equalities
  12614. // which can be shifted sideways to eliminate an equality.
  12615. // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
  12616. var changes = false;
  12617. pointer = 1; // Intentionally ignore the first and last element (don't need checking).
  12618. while (pointer < diffs.length - 1) {
  12619. if (diffs[pointer - 1][0] === DIFF_EQUAL && diffs[pointer + 1][0] === DIFF_EQUAL) {
  12620. // This is a single edit surrounded by equalities.
  12621. if (diffs[pointer][1].substring(diffs[pointer][1].length - diffs[pointer - 1][1].length) === diffs[pointer - 1][1]) {
  12622. // Shift the edit over the previous equality.
  12623. diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length);
  12624. diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
  12625. diffs.splice(pointer - 1, 1);
  12626. changes = true;
  12627. } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == diffs[pointer + 1][1]) {
  12628. // Shift the edit over the next equality.
  12629. diffs[pointer - 1][1] += diffs[pointer + 1][1];
  12630. diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1];
  12631. diffs.splice(pointer + 1, 1);
  12632. changes = true;
  12633. }
  12634. }
  12635. pointer++;
  12636. } // If shifts were made, the diff needs reordering and another shift sweep.
  12637. if (changes) {
  12638. diff_cleanupMerge(diffs, fix_unicode);
  12639. }
  12640. }
  12641. function is_surrogate_pair_start(charCode) {
  12642. return charCode >= 0xD800 && charCode <= 0xDBFF;
  12643. }
  12644. function is_surrogate_pair_end(charCode) {
  12645. return charCode >= 0xDC00 && charCode <= 0xDFFF;
  12646. }
  12647. function starts_with_pair_end(str) {
  12648. return is_surrogate_pair_end(str.charCodeAt(0));
  12649. }
  12650. function ends_with_pair_start(str) {
  12651. return is_surrogate_pair_start(str.charCodeAt(str.length - 1));
  12652. }
  12653. function remove_empty_tuples(tuples) {
  12654. var ret = [];
  12655. for (var i = 0; i < tuples.length; i++) {
  12656. if (tuples[i][1].length > 0) {
  12657. ret.push(tuples[i]);
  12658. }
  12659. }
  12660. return ret;
  12661. }
  12662. function make_edit_splice(before, oldMiddle, newMiddle, after) {
  12663. if (ends_with_pair_start(before) || starts_with_pair_end(after)) {
  12664. return null;
  12665. }
  12666. return remove_empty_tuples([[DIFF_EQUAL, before], [DIFF_DELETE, oldMiddle], [DIFF_INSERT, newMiddle], [DIFF_EQUAL, after]]);
  12667. }
  12668. function find_cursor_edit_diff(oldText, newText, cursor_pos) {
  12669. // note: this runs after equality check has ruled out exact equality
  12670. var oldRange = typeof cursor_pos === 'number' ? {
  12671. index: cursor_pos,
  12672. length: 0
  12673. } : cursor_pos.oldRange;
  12674. var newRange = typeof cursor_pos === 'number' ? null : cursor_pos.newRange; // take into account the old and new selection to generate the best diff
  12675. // possible for a text edit. for example, a text change from "xxx" to "xx"
  12676. // could be a delete or forwards-delete of any one of the x's, or the
  12677. // result of selecting two of the x's and typing "x".
  12678. var oldLength = oldText.length;
  12679. var newLength = newText.length;
  12680. if (oldRange.length === 0 && (newRange === null || newRange.length === 0)) {
  12681. // see if we have an insert or delete before or after cursor
  12682. var oldCursor = oldRange.index;
  12683. var oldBefore = oldText.slice(0, oldCursor);
  12684. var oldAfter = oldText.slice(oldCursor);
  12685. var maybeNewCursor = newRange ? newRange.index : null;
  12686. editBefore: {
  12687. // is this an insert or delete right before oldCursor?
  12688. var newCursor = oldCursor + newLength - oldLength;
  12689. if (maybeNewCursor !== null && maybeNewCursor !== newCursor) {
  12690. break editBefore;
  12691. }
  12692. if (newCursor < 0 || newCursor > newLength) {
  12693. break editBefore;
  12694. }
  12695. var newBefore = newText.slice(0, newCursor);
  12696. var newAfter = newText.slice(newCursor);
  12697. if (newAfter !== oldAfter) {
  12698. break editBefore;
  12699. }
  12700. var prefixLength = Math.min(oldCursor, newCursor);
  12701. var oldPrefix = oldBefore.slice(0, prefixLength);
  12702. var newPrefix = newBefore.slice(0, prefixLength);
  12703. if (oldPrefix !== newPrefix) {
  12704. break editBefore;
  12705. }
  12706. var oldMiddle = oldBefore.slice(prefixLength);
  12707. var newMiddle = newBefore.slice(prefixLength);
  12708. return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldAfter);
  12709. }
  12710. editAfter: {
  12711. // is this an insert or delete right after oldCursor?
  12712. if (maybeNewCursor !== null && maybeNewCursor !== oldCursor) {
  12713. break editAfter;
  12714. }
  12715. var cursor = oldCursor;
  12716. var _newBefore = newText.slice(0, cursor);
  12717. var _newAfter = newText.slice(cursor);
  12718. if (_newBefore !== oldBefore) {
  12719. break editAfter;
  12720. }
  12721. var suffixLength = Math.min(oldLength - cursor, newLength - cursor);
  12722. var oldSuffix = oldAfter.slice(oldAfter.length - suffixLength);
  12723. var newSuffix = _newAfter.slice(_newAfter.length - suffixLength);
  12724. if (oldSuffix !== newSuffix) {
  12725. break editAfter;
  12726. }
  12727. var _oldMiddle = oldAfter.slice(0, oldAfter.length - suffixLength);
  12728. var _newMiddle = _newAfter.slice(0, _newAfter.length - suffixLength);
  12729. return make_edit_splice(oldBefore, _oldMiddle, _newMiddle, oldSuffix);
  12730. }
  12731. }
  12732. if (oldRange.length > 0 && newRange && newRange.length === 0) {
  12733. replaceRange: {
  12734. // see if diff could be a splice of the old selection range
  12735. var _oldPrefix = oldText.slice(0, oldRange.index);
  12736. var _oldSuffix = oldText.slice(oldRange.index + oldRange.length);
  12737. var _prefixLength = _oldPrefix.length;
  12738. var _suffixLength = _oldSuffix.length;
  12739. if (newLength < _prefixLength + _suffixLength) {
  12740. break replaceRange;
  12741. }
  12742. var _newPrefix = newText.slice(0, _prefixLength);
  12743. var _newSuffix = newText.slice(newLength - _suffixLength);
  12744. if (_oldPrefix !== _newPrefix || _oldSuffix !== _newSuffix) {
  12745. break replaceRange;
  12746. }
  12747. var _oldMiddle2 = oldText.slice(_prefixLength, oldLength - _suffixLength);
  12748. var _newMiddle2 = newText.slice(_prefixLength, newLength - _suffixLength);
  12749. return make_edit_splice(_oldPrefix, _oldMiddle2, _newMiddle2, _oldSuffix);
  12750. }
  12751. }
  12752. return null;
  12753. }
  12754. function diff(text1, text2, cursor_pos) {
  12755. // only pass fix_unicode=true at the top level, not when diff_main is
  12756. // recursively invoked
  12757. return diff_main(text1, text2, cursor_pos, true);
  12758. }
  12759. diff.INSERT = DIFF_INSERT;
  12760. diff.DELETE = DIFF_DELETE;
  12761. diff.EQUAL = DIFF_EQUAL;
  12762. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (diff);
  12763. /***/ }),
  12764. /***/ "./js/util/testConsole.js":
  12765. /*!********************************!*\
  12766. !*** ./js/util/testConsole.js ***!
  12767. \********************************/
  12768. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  12769. "use strict";
  12770. __webpack_require__.r(__webpack_exports__);
  12771. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  12772. /* harmony export */ "TestConsole": () => (/* binding */ TestConsole)
  12773. /* harmony export */ });
  12774. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  12775. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
  12776. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  12777. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
  12778. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../io/domConsole */ "./js/io/domConsole.js");
  12779. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  12780. var LocalizedStrings = (0,_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.getInstance)();
  12781. var TestConsole = /*#__PURE__*/function () {
  12782. function TestConsole(inputList) {
  12783. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, TestConsole);
  12784. this.index = 0;
  12785. this.inputList = inputList;
  12786. this.list = [];
  12787. this.currentLine = null;
  12788. }
  12789. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(TestConsole, [{
  12790. key: "writeRawHTML",
  12791. value: function writeRawHTML(text) {
  12792. this._appendTextLn(text);
  12793. }
  12794. }, {
  12795. key: "write",
  12796. value: function write(text) {
  12797. var newLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  12798. this._appendText(text, _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.USER, newLine);
  12799. }
  12800. }, {
  12801. key: "info",
  12802. value: function info(text) {
  12803. this._appendTextLn(text, _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.INFO);
  12804. }
  12805. }, {
  12806. key: "err",
  12807. value: function err(text) {
  12808. this._appendTextLn(text, _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.ERR);
  12809. }
  12810. }, {
  12811. key: "_appendText",
  12812. value: function _appendText(text, _type) {
  12813. var newLine = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  12814. if (this.currentLine == null) {
  12815. this.currentLine = this.list.push('') - 1;
  12816. }
  12817. this.list[this.currentLine] += text;
  12818. if (newLine) {
  12819. this.currentLine = null;
  12820. }
  12821. }
  12822. }, {
  12823. key: "_appendTextLn",
  12824. value: function _appendTextLn(text) {
  12825. this.list.push(text);
  12826. this.currentLine = null;
  12827. }
  12828. }, {
  12829. key: "getClassForType",
  12830. value: function getClassForType(type) {
  12831. switch (type) {
  12832. case _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.USER:
  12833. return "ivprog-term-userText";
  12834. case _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.INFO:
  12835. return "ivprog-term-info";
  12836. case _io_domConsole__WEBPACK_IMPORTED_MODULE_2__.DOMConsole.ERR:
  12837. return "ivprog-term-error";
  12838. }
  12839. }
  12840. }, {
  12841. key: "requestInput",
  12842. value: function requestInput() {
  12843. var _this = this;
  12844. var promise = new Promise(function (resolve, reject) {
  12845. if (_this.index < _this.inputList.length) {
  12846. resolve(_this.inputList[_this.index]);
  12847. _this.index++;
  12848. } else {
  12849. reject(new Error(LocalizedStrings.getError("exceeded_input_request")));
  12850. }
  12851. });
  12852. return promise;
  12853. }
  12854. }, {
  12855. key: "sendOutput",
  12856. value: function sendOutput(text) {
  12857. var _this2 = this;
  12858. var output = '' + text;
  12859. if (output.indexOf('\n') !== -1) {
  12860. var outputList = output.split('\n');
  12861. var last = outputList.pop();
  12862. outputList.forEach(function (t) {
  12863. t = t.replace(/\t/g, '&#x0020;&#x0020;');
  12864. t = t.replace(/\s/g, "&#x0020;");
  12865. if (t.length == 0) _this2.currentLine = null;else _this2.write(t, true);
  12866. });
  12867. last = last.replace(/\t/g, '&#x0020;&#x0020;');
  12868. last = last.replace(/\s/g, "&#x0020;");
  12869. if (last.length != 0) this.write(last);
  12870. } else {
  12871. output = output.replace(/\t/g, '&#x0020;&#x0020;');
  12872. output = output.replace(/\s/g, "&#x0020;");
  12873. this.write(output);
  12874. }
  12875. }
  12876. }]);
  12877. return TestConsole;
  12878. }();
  12879. /***/ }),
  12880. /***/ "./js/util/utils.js":
  12881. /*!**************************!*\
  12882. !*** ./js/util/utils.js ***!
  12883. \**************************/
  12884. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  12885. "use strict";
  12886. __webpack_require__.r(__webpack_exports__);
  12887. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  12888. /* harmony export */ "scrollIt": () => (/* binding */ scrollIt),
  12889. /* harmony export */ "isElementInViewport": () => (/* binding */ isElementInViewport),
  12890. /* harmony export */ "isKeyword": () => (/* binding */ isKeyword),
  12891. /* harmony export */ "isValidIdentifier": () => (/* binding */ isValidIdentifier),
  12892. /* harmony export */ "getCodeEditorModeConfig": () => (/* binding */ getCodeEditorModeConfig),
  12893. /* harmony export */ "levenshteinDistance": () => (/* binding */ levenshteinDistance),
  12894. /* harmony export */ "openAssessmentDetail": () => (/* binding */ openAssessmentDetail),
  12895. /* harmony export */ "range": () => (/* binding */ range),
  12896. /* harmony export */ "sleep": () => (/* binding */ sleep)
  12897. /* harmony export */ });
  12898. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
  12899. /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
  12900. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
  12901. /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
  12902. /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
  12903. /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_2__);
  12904. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/languageService */ "./js/services/languageService.ts");
  12905. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  12906. /* harmony import */ var _ast_operators__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.ts");
  12907. /**
  12908. * source: https://pawelgrzybek.com/page-scroll-in-vanilla-javascript/
  12909. *
  12910. */
  12911. function scrollIt(destination) {
  12912. var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
  12913. var easing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "linear";
  12914. var callback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  12915. var easings = {
  12916. linear: function linear(t) {
  12917. return t;
  12918. },
  12919. easeInQuad: function easeInQuad(t) {
  12920. return t * t;
  12921. },
  12922. easeOutQuad: function easeOutQuad(t) {
  12923. return t * (2 - t);
  12924. },
  12925. easeInOutQuad: function easeInOutQuad(t) {
  12926. return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
  12927. },
  12928. easeInCubic: function easeInCubic(t) {
  12929. return t * t * t;
  12930. },
  12931. easeOutCubic: function easeOutCubic(t) {
  12932. return --t * t * t + 1;
  12933. },
  12934. easeInOutCubic: function easeInOutCubic(t) {
  12935. return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
  12936. },
  12937. easeInQuart: function easeInQuart(t) {
  12938. return t * t * t * t;
  12939. },
  12940. easeOutQuart: function easeOutQuart(t) {
  12941. return 1 - --t * t * t * t;
  12942. },
  12943. easeInOutQuart: function easeInOutQuart(t) {
  12944. return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t;
  12945. },
  12946. easeInQuint: function easeInQuint(t) {
  12947. return t * t * t * t * t;
  12948. },
  12949. easeOutQuint: function easeOutQuint(t) {
  12950. return 1 + --t * t * t * t * t;
  12951. },
  12952. easeInOutQuint: function easeInOutQuint(t) {
  12953. return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t;
  12954. }
  12955. };
  12956. var start = window.pageYOffset;
  12957. var startTime = "now" in window.performance ? performance.now() : new Date().getTime();
  12958. var documentHeight = Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);
  12959. var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName("body")[0].clientHeight;
  12960. var destinationOffset = typeof destination === "number" ? destination : destination.offsetTop;
  12961. var destinationOffsetToScroll = Math.round(documentHeight - destinationOffset < windowHeight ? documentHeight - windowHeight : destinationOffset);
  12962. if ("requestAnimationFrame" in window === false) {
  12963. window.scroll(0, destinationOffsetToScroll);
  12964. if (callback) {
  12965. callback();
  12966. }
  12967. return;
  12968. }
  12969. function scroll() {
  12970. var now = "now" in window.performance ? performance.now() : new Date().getTime();
  12971. var time = Math.min(1, (now - startTime) / duration);
  12972. var timeFunction = easings[easing](time);
  12973. window.scroll(0, Math.ceil(timeFunction * (destinationOffsetToScroll - start) + start));
  12974. if (window.pageYOffset === destinationOffsetToScroll) {
  12975. if (callback) {
  12976. callback();
  12977. }
  12978. return;
  12979. }
  12980. requestAnimationFrame(scroll);
  12981. }
  12982. scroll();
  12983. }
  12984. /**
  12985. *
  12986. * source: https://stackoverflow.com/a/16270434
  12987. */
  12988. function isElementInViewport(el) {
  12989. var rect = el.getBoundingClientRect();
  12990. return rect.bottom > 0 && rect.right > 0 && rect.left < (window.innerWidth || document.documentElement.clientWidth) && rect.top < (window.innerHeight || document.documentElement.clientHeight);
  12991. }
  12992. var cacheMainList = null;
  12993. var cacheOp = null;
  12994. function fillCache() {
  12995. if (cacheMainList == null) {
  12996. cacheMainList = [];
  12997. 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"];
  12998. var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_3__.LanguageService.getCurrentLexer();
  12999. var names = lexer.getReservedKeys();
  13000. for (var key = 0; key < mainList.length; ++key) {
  13001. var word = mainList[key];
  13002. var keyword = names[word];
  13003. cacheMainList.push(keyword);
  13004. }
  13005. }
  13006. if (cacheOp == null) {
  13007. cacheOp = [];
  13008. 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];
  13009. for (var op = 0; op < logicOpList.length; ++op) {
  13010. var lOp = "logic_operator_".concat(logicOpList[op]);
  13011. cacheOp.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_4__.LocalizedStrings.getUI(lOp));
  13012. }
  13013. }
  13014. }
  13015. function isKeyword(text) {
  13016. fillCache();
  13017. for (var key = 0; key < cacheMainList.length; ++key) {
  13018. var keyword = cacheMainList[key];
  13019. if (keyword == text) {
  13020. return true;
  13021. }
  13022. } // not in main list, check op
  13023. for (var op = 0; op < cacheOp.length; op++) {
  13024. var lOp = cacheOp[op];
  13025. if (lOp == text) {
  13026. return true;
  13027. }
  13028. }
  13029. return false;
  13030. }
  13031. function isValidIdentifier(identifier_str) {
  13032. var validRegex = /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  13033. if (!validRegex) {
  13034. return false;
  13035. }
  13036. return !isKeyword(identifier_str);
  13037. }
  13038. function getCodeEditorModeConfig() {
  13039. 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"];
  13040. var keywordsList = ["RK_CONST", "RK_RETURN", "RK_BREAK", "RK_FOR_FROM", "RK_FOR_TO", "RK_FOR_PASS", "RK_DO_UNTIL"];
  13041. var typeList = ["RK_REAL", "RK_VOID", "RK_BOOLEAN", "RK_STRING", "RK_INTEGER", "RK_CHARACTER"];
  13042. var atomList = ["RK_FALSE", "RK_TRUE"];
  13043. var case_default = [];
  13044. var blocks = [];
  13045. var keywords = [];
  13046. var types = [];
  13047. var atoms = [];
  13048. var switchString = "";
  13049. cacheMainList = [];
  13050. var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_3__.LanguageService.getCurrentLexer();
  13051. var names = lexer.getReservedKeys(); //console.debug(names);
  13052. blockList.forEach(function (v) {
  13053. var keyword = names[v];
  13054. var value = keyword;
  13055. cacheMainList.push(value);
  13056. keywords.push(value);
  13057. blocks.push(value);
  13058. if (v == "RK_SWITCH") {
  13059. switchString = value;
  13060. } else if (v == "RK_CASE" || v == "RK_DEFAULT") {
  13061. case_default.push(value);
  13062. }
  13063. });
  13064. keywordsList.forEach(function (v) {
  13065. var keyword = names[v];
  13066. var value = keyword;
  13067. cacheMainList.push(value);
  13068. keywords.push(value);
  13069. });
  13070. typeList.forEach(function (v) {
  13071. var keyword = names[v];
  13072. var value = keyword;
  13073. cacheMainList.push(value);
  13074. types.push(value);
  13075. });
  13076. atomList.forEach(function (v) {
  13077. var keyword = names[v];
  13078. var value = keyword;
  13079. cacheMainList.push(value);
  13080. atoms.push(value);
  13081. });
  13082. cacheOp = [];
  13083. var logicOpList = ["NOT_OPERATOR", "OR_OPERATOR", "AND_OPERATOR"];
  13084. logicOpList.forEach(function (v) {
  13085. var keyword = names[v];
  13086. var value = keyword;
  13087. cacheOp.push(value);
  13088. keywords.push(value);
  13089. });
  13090. cacheMainList.push(lexer.getLangFuncs().main_function);
  13091. return {
  13092. case_default: case_default,
  13093. atoms: atoms,
  13094. keywords: keywords,
  13095. switchString: switchString,
  13096. types: types,
  13097. blocks: blocks
  13098. };
  13099. }
  13100. /**
  13101. * Source: https://gist.github.com/andrei-m/982927
  13102. * @param {string} a
  13103. * @param {string} b
  13104. */
  13105. function levenshteinDistance(a, b) {
  13106. if (a.length == 0) return b.length;
  13107. if (b.length == 0) return a.length;
  13108. var matrix = []; // increment along the first column of each row
  13109. var i;
  13110. for (i = 0; i <= b.length; i++) {
  13111. matrix[i] = [i];
  13112. } // increment each column in the first row
  13113. var j;
  13114. for (j = 0; j <= a.length; j++) {
  13115. matrix[0][j] = j;
  13116. } // Fill in the rest of the matrix
  13117. for (i = 1; i <= b.length; i++) {
  13118. for (j = 1; j <= a.length; j++) {
  13119. if (b.charCodeAt(i - 1) == a.charCodeAt(j - 1)) {
  13120. matrix[i][j] = matrix[i - 1][j - 1];
  13121. } else {
  13122. matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
  13123. Math.min(matrix[i][j - 1] + 1, // insertion
  13124. matrix[i - 1][j] + 1)); // deletion
  13125. }
  13126. }
  13127. }
  13128. return matrix[b.length][a.length];
  13129. }
  13130. var win = null;
  13131. function openAssessmentDetail(event) {
  13132. event.preventDefault();
  13133. var page_code = event.currentTarget.dataset.page;
  13134. if (win != null) {
  13135. win.close();
  13136. }
  13137. win = window.open("", "DetailWindow", "width=550,height=600");
  13138. win.document.open();
  13139. win.document.write(page_code);
  13140. win.document.close();
  13141. }
  13142. function range(size) {
  13143. var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  13144. return _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_2___default()(Array(size).keys()).map(function (i) {
  13145. return i + startAt;
  13146. });
  13147. }
  13148. /**
  13149. *
  13150. * @param {number} ms
  13151. */
  13152. function sleep(_x) {
  13153. return _sleep.apply(this, arguments);
  13154. }
  13155. function _sleep() {
  13156. _sleep = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(ms) {
  13157. return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
  13158. while (1) {
  13159. switch (_context.prev = _context.next) {
  13160. case 0:
  13161. return _context.abrupt("return", new Promise(function (res, _) {
  13162. return setTimeout(res, ms);
  13163. }));
  13164. case 1:
  13165. case "end":
  13166. return _context.stop();
  13167. }
  13168. }
  13169. }, _callee);
  13170. }));
  13171. return _sleep.apply(this, arguments);
  13172. }
  13173. /***/ }),
  13174. /***/ "./js/visualUI/algorithm.js":
  13175. /*!**********************************!*\
  13176. !*** ./js/visualUI/algorithm.js ***!
  13177. \**********************************/
  13178. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  13179. "use strict";
  13180. __webpack_require__.r(__webpack_exports__);
  13181. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  13182. /* harmony export */ "renderAlgorithm": () => (/* binding */ renderAlgorithm)
  13183. /* harmony export */ });
  13184. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  13185. /* harmony import */ var _functions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
  13186. window.block_render = false;
  13187. function renderAlgorithm() {
  13188. if (window.block_render) {
  13189. return;
  13190. }
  13191. if (window.draging) {
  13192. return;
  13193. }
  13194. window.block_render = true;
  13195. $('.all_functions').children().off();
  13196. $('.all_functions').empty();
  13197. $('.list_globals').children().off();
  13198. $('.list_globals').empty();
  13199. for (var i = 0; i < window.program_obj.functions.length; i++) {
  13200. _functions__WEBPACK_IMPORTED_MODULE_1__.renderFunction(window.program_obj.functions[i]);
  13201. }
  13202. for (var i = 0; i < window.program_obj.globals.length; i++) {
  13203. _globals__WEBPACK_IMPORTED_MODULE_0__.renderGlobal(window.program_obj.globals[i]);
  13204. }
  13205. setTimeout(function () {
  13206. window.block_render = false;
  13207. }, 100);
  13208. if (settingsFilter && settingsFilter[0]) {
  13209. blockAllEditingOptions();
  13210. }
  13211. $('.command_drag').popup({
  13212. content: LocalizedStrings.getUI("text_move_command"),
  13213. delay: {
  13214. show: 1000,
  13215. hide: 0
  13216. }
  13217. });
  13218. }
  13219. /***/ }),
  13220. /***/ "./js/visualUI/code_generator.js":
  13221. /*!***************************************!*\
  13222. !*** ./js/visualUI/code_generator.js ***!
  13223. \***************************************/
  13224. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  13225. "use strict";
  13226. __webpack_require__.r(__webpack_exports__);
  13227. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  13228. /* harmony export */ "generate": () => (/* binding */ generate),
  13229. /* harmony export */ "repeatNtimesHeader": () => (/* binding */ repeatNtimesHeader),
  13230. /* harmony export */ "elementExpressionCode": () => (/* binding */ elementExpressionCode),
  13231. /* harmony export */ "variableValueMenuCode": () => (/* binding */ variableValueMenuCode)
  13232. /* harmony export */ });
  13233. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  13234. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  13235. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  13236. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  13237. /* eslint-disable @typescript-eslint/no-use-before-define */
  13238. /* globals $*/
  13239. function generate() {
  13240. $(".ivprog_visual_panel").find(".error_icon").remove();
  13241. var code = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("program") + " { ";
  13242. code += globalsCode();
  13243. code += "\n";
  13244. var has_error = false;
  13245. for (var i = 0; i < window.program_obj.functions.length; i++) {
  13246. var n_code = functionsCode(window.program_obj.functions[i]);
  13247. if (n_code == null) {
  13248. has_error = true;
  13249. }
  13250. code += n_code;
  13251. code += "\n";
  13252. }
  13253. code += "\n}";
  13254. if (has_error) {
  13255. return null;
  13256. } else {
  13257. return code;
  13258. }
  13259. }
  13260. function functionsCode(function_obj) {
  13261. var ret = "\n\t" + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("function") + " ";
  13262. var has_error = false;
  13263. switch (function_obj.return_type) {
  13264. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  13265. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_integer");
  13266. break;
  13267. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  13268. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_real");
  13269. break;
  13270. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  13271. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_text");
  13272. break;
  13273. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  13274. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_boolean");
  13275. break;
  13276. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  13277. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_char");
  13278. break;
  13279. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID:
  13280. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_void");
  13281. break;
  13282. }
  13283. ret += " ";
  13284. if (function_obj.return_dimensions == 1) {
  13285. ret += "[] ";
  13286. } else if (function_obj.return_dimensions == 2) {
  13287. ret += "[][] ";
  13288. }
  13289. if (function_obj.is_main) {
  13290. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("start");
  13291. } else {
  13292. ret += function_obj.name;
  13293. }
  13294. ret += " ( ";
  13295. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  13296. ret += parametersCode(function_obj.parameters_list[j]);
  13297. if (j + 1 < function_obj.parameters_list.length) {
  13298. ret += ", ";
  13299. }
  13300. }
  13301. ret += " ) {";
  13302. for (var _j = 0; _j < function_obj.variables_list.length; _j++) {
  13303. ret += variablesCode(function_obj.variables_list[_j]);
  13304. }
  13305. for (var _j2 = 0; _j2 < function_obj.commands.length; _j2++) {
  13306. //try {
  13307. ret += commandsCode(function_obj.commands[_j2]);
  13308. /*} catch (err) {
  13309. has_error = true;
  13310. console.error(err.message);
  13311. var todos = $('body').find('.command_container');
  13312. for (var i = 0; i < todos.length; i++) {
  13313. if ($(todos[i]).data('command') == function_obj.commands[j]) {
  13314. $( todos[i] ).prepend( ' <i class="ui icon red exclamation triangle error_icon"></i> ' );
  13315. break;
  13316. }
  13317. }
  13318. }*/
  13319. }
  13320. ret += "\n\t}";
  13321. if (has_error) {
  13322. return null;
  13323. } else {
  13324. return ret;
  13325. }
  13326. }
  13327. function commandsCode(command_obj) {
  13328. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  13329. switch (command_obj.type) {
  13330. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES["break"]:
  13331. return breaksCode(command_obj, indentation);
  13332. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.comment:
  13333. return commentsCode(command_obj, indentation);
  13334. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.reader:
  13335. return readersCode(command_obj, indentation);
  13336. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.writer:
  13337. return writersCode(command_obj, indentation);
  13338. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.functioncall:
  13339. return functioncallsCode(command_obj, indentation);
  13340. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.attribution:
  13341. return attributionsCode(command_obj, indentation);
  13342. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.whiletrue:
  13343. return whiletruesCode(command_obj, indentation);
  13344. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.dowhiletrue:
  13345. return doWhilesCode(command_obj, indentation);
  13346. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.iftrue:
  13347. return iftruesCode(command_obj, indentation);
  13348. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES.repeatNtimes:
  13349. return repeatNtimesCode(command_obj, indentation);
  13350. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES["switch"]:
  13351. return switchsCode(command_obj, indentation);
  13352. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.COMMAND_TYPES["return"]:
  13353. return returnsCode(command_obj, indentation);
  13354. }
  13355. }
  13356. function returnsCode(command_obj, indentation) {
  13357. var ret = "\n";
  13358. for (var i = 0; i < indentation; i++) {
  13359. ret += "\t";
  13360. }
  13361. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_return");
  13362. if (command_obj.variable_value_menu) {
  13363. try {
  13364. ret += " " + elementExpressionCode(command_obj.variable_value_menu); //ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu, true);
  13365. } catch (err) {//Empty block
  13366. }
  13367. }
  13368. return ret;
  13369. }
  13370. function breaksCode(_command_obj, indentation) {
  13371. var ret = "\n";
  13372. for (var i = 0; i < indentation; i++) {
  13373. ret += "\t";
  13374. }
  13375. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_break");
  13376. return ret;
  13377. }
  13378. function switchsCode(command_obj, indentation) {
  13379. var ret = "\n";
  13380. for (var i = 0; i < indentation; i++) {
  13381. ret += "\t";
  13382. }
  13383. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_switch") + " ( ";
  13384. ret += variableValueMenuCode(command_obj.variable);
  13385. ret += " ) { ";
  13386. if (command_obj.cases) {
  13387. for (var _i = 0; _i < command_obj.cases.length; _i++) {
  13388. ret += switchcasesCode(command_obj.cases[_i], indentation + 1);
  13389. }
  13390. }
  13391. ret += "\n";
  13392. for (var _i2 = 0; _i2 < indentation; _i2++) {
  13393. ret += "\t";
  13394. }
  13395. ret += "} ";
  13396. return ret;
  13397. }
  13398. function switchcasesCode(switchcase, indentation) {
  13399. var ret = "\n";
  13400. for (var i = 0; i < indentation; i++) {
  13401. ret += "\t";
  13402. }
  13403. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_case") + " ";
  13404. ret += variableValueMenuCode(switchcase.variable_value_menu);
  13405. ret += " :";
  13406. if (switchcase.commands_block) {
  13407. for (var _i3 = 0; _i3 < switchcase.commands_block.length; _i3++) {
  13408. ret += commandsCode(switchcase.commands_block[_i3], indentation + 1);
  13409. }
  13410. }
  13411. return ret;
  13412. }
  13413. function repeatNtimesHeader(command_obj) {
  13414. var ret = "";
  13415. if (command_obj.var_attribution) {
  13416. ret += '<span class="repeatN_text_par_1">';
  13417. ret += variableValueMenuCode(command_obj.var_attribution);
  13418. ret += '</span>';
  13419. ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_from"), " ");
  13420. ret += '<span class="repeatN_text_par_2">';
  13421. ret += variableValueMenuCode(command_obj.expression1);
  13422. ret += '</span>';
  13423. }
  13424. if (command_obj.expression2) {
  13425. ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_to"), " ");
  13426. ret += '<span class="repeatN_text_par_3">';
  13427. ret += variableValueMenuCode(command_obj.expression2);
  13428. ret += '</span>';
  13429. }
  13430. if (command_obj.expression3) {
  13431. ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_pass"), " ");
  13432. ret += '<span class="repeatN_text_par_4">';
  13433. switch (command_obj.expression3.itens[1]) {
  13434. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.plus:
  13435. ret += " +";
  13436. break;
  13437. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.minus:
  13438. ret += " -";
  13439. break;
  13440. }
  13441. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  13442. ret += '</span>';
  13443. }
  13444. return ret;
  13445. }
  13446. function repeatNtimesCode(command_obj, indentation) {
  13447. var ret = "\n";
  13448. for (var i = 0; i < indentation; i++) {
  13449. ret += "\t";
  13450. }
  13451. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_for") + " ";
  13452. if (command_obj.var_attribution) {
  13453. ret += variableValueMenuCode(command_obj.var_attribution);
  13454. ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_from"), " ");
  13455. ret += variableValueMenuCode(command_obj.expression1);
  13456. }
  13457. if (command_obj.expression2) {
  13458. ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_to"), " ");
  13459. ret += variableValueMenuCode(command_obj.expression2);
  13460. }
  13461. if (command_obj.expression3) {
  13462. ret += " ".concat(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_for_pass"), " ");
  13463. switch (command_obj.expression3.itens[1]) {
  13464. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.plus:
  13465. ret += " +";
  13466. break;
  13467. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.minus:
  13468. ret += " -";
  13469. break;
  13470. }
  13471. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  13472. }
  13473. ret += " { ";
  13474. if (command_obj.commands_block) {
  13475. for (var _i4 = 0; _i4 < command_obj.commands_block.length; _i4++) {
  13476. ret += commandsCode(command_obj.commands_block[_i4], indentation + 1);
  13477. }
  13478. }
  13479. ret += "\n";
  13480. for (var _i5 = 0; _i5 < indentation; _i5++) {
  13481. ret += "\t";
  13482. }
  13483. ret += "}";
  13484. return ret;
  13485. }
  13486. function iftruesCode(command_obj, indentation) {
  13487. var ret = "\n";
  13488. for (var i = 0; i < indentation; i++) {
  13489. ret += "\t";
  13490. }
  13491. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_if");
  13492. if (!command_obj.expression) {
  13493. _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("inform_valid_expression"));
  13494. } else {
  13495. ret += " ( ";
  13496. ret += elementExpressionCode(command_obj.expression);
  13497. ret += " ) ";
  13498. }
  13499. /*switch (command_obj.expression.expression.type) {
  13500. case Models.EXPRESSION_TYPES.exp_logic:
  13501. ret += logicExpressionCode(command_obj.expression.expression);
  13502. break;
  13503. case Models.EXPRESSION_TYPES.exp_arithmetic:
  13504. ret += arithmeticExpressionCode(command_obj.expression.expression);
  13505. break;
  13506. }*/
  13507. ret += " { ";
  13508. if (command_obj.commands_block) {
  13509. for (var _i6 = 0; _i6 < command_obj.commands_block.length; _i6++) {
  13510. ret += commandsCode(command_obj.commands_block[_i6], indentation + 1);
  13511. }
  13512. }
  13513. ret += "\n";
  13514. for (var _i7 = 0; _i7 < indentation; _i7++) {
  13515. ret += "\t";
  13516. }
  13517. ret += "} " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_else") + " {";
  13518. if (command_obj.commands_else) {
  13519. for (var _i8 = 0; _i8 < command_obj.commands_else.length; _i8++) {
  13520. ret += commandsCode(command_obj.commands_else[_i8], indentation + 1);
  13521. }
  13522. }
  13523. ret += "\n";
  13524. for (var _i9 = 0; _i9 < indentation; _i9++) {
  13525. ret += "\t";
  13526. }
  13527. ret += "}";
  13528. return ret;
  13529. }
  13530. function doWhilesCode(command_obj, indentation) {
  13531. var ret = "\n";
  13532. for (var i = 0; i < indentation; i++) {
  13533. ret += "\t";
  13534. }
  13535. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_do") + " { ";
  13536. if (command_obj.commands_block) {
  13537. for (var _i10 = 0; _i10 < command_obj.commands_block.length; _i10++) {
  13538. ret += commandsCode(command_obj.commands_block[_i10], indentation + 1);
  13539. }
  13540. }
  13541. ret += "\n";
  13542. for (var _i11 = 0; _i11 < indentation; _i11++) {
  13543. ret += "\t";
  13544. }
  13545. ret += "} " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_do_until");
  13546. if (!command_obj.expression) {
  13547. _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("inform_valid_expression"));
  13548. }
  13549. /*switch (command_obj.expression.expression.type) {
  13550. case Models.EXPRESSION_TYPES.exp_logic:
  13551. ret += logicExpressionCode(command_obj.expression.expression);
  13552. break;
  13553. case Models.EXPRESSION_TYPES.exp_arithmetic:
  13554. ret += arithmeticExpressionCode(command_obj.expression.expression);
  13555. break;
  13556. }*/
  13557. if (command_obj.expression) {
  13558. ret += " ( ";
  13559. ret += elementExpressionCode(command_obj.expression);
  13560. ret += " ) ";
  13561. }
  13562. return ret;
  13563. }
  13564. function whiletruesCode(command_obj, indentation) {
  13565. var ret = "\n";
  13566. for (var i = 0; i < indentation; i++) {
  13567. ret += "\t";
  13568. }
  13569. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_code_while");
  13570. if (!command_obj.expression) {
  13571. _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("inform_valid_expression"));
  13572. }
  13573. /*switch (command_obj.expression.expression.type) {
  13574. case Models.EXPRESSION_TYPES.exp_logic:
  13575. ret += logicExpressionCode(command_obj.expression.expression);
  13576. break;
  13577. case Models.EXPRESSION_TYPES.exp_arithmetic:
  13578. ret += arithmeticExpressionCode(command_obj.expression.expression);
  13579. break;
  13580. }*/
  13581. if (command_obj.expression) {
  13582. ret += " ( ";
  13583. ret += elementExpressionCode(command_obj.expression);
  13584. ret += " ) ";
  13585. }
  13586. ret += " { ";
  13587. if (command_obj.commands_block) {
  13588. for (var _i12 = 0; _i12 < command_obj.commands_block.length; _i12++) {
  13589. ret += commandsCode(command_obj.commands_block[_i12], indentation + 1);
  13590. }
  13591. }
  13592. ret += "\n";
  13593. for (var _i13 = 0; _i13 < indentation; _i13++) {
  13594. ret += "\t";
  13595. }
  13596. ret += "}";
  13597. return ret;
  13598. }
  13599. function logicExpressionCode(expression) {
  13600. var ret = " ( ";
  13601. if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_logic) {
  13602. ret += logicExpressionCode(expression.first_operand);
  13603. } else if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_arithmetic) {
  13604. ret += arithmeticExpressionCode(expression.first_operand);
  13605. } else {
  13606. ret += variableValueMenuCode(expression.first_operand);
  13607. }
  13608. if (expression.operator) {
  13609. switch (expression.operator) {
  13610. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.equals_to:
  13611. ret += " == ";
  13612. break;
  13613. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.not_equals_to:
  13614. ret += " != ";
  13615. break;
  13616. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.and:
  13617. ret += " && ";
  13618. break;
  13619. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.or:
  13620. ret += " || ";
  13621. break;
  13622. }
  13623. if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_logic) {
  13624. ret += logicExpressionCode(expression.second_operand);
  13625. } else if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_arithmetic) {
  13626. ret += arithmeticExpressionCode(expression.second_operand);
  13627. } else {
  13628. ret += variableValueMenuCode(expression.second_operand);
  13629. }
  13630. }
  13631. ret += " ) ";
  13632. return ret;
  13633. }
  13634. function arithmeticExpressionCode(expression) {
  13635. var ret = " ( ";
  13636. if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_logic) {
  13637. ret += logicExpressionCode(expression.first_operand);
  13638. } else if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_arithmetic) {
  13639. ret += arithmeticExpressionCode(expression.first_operand);
  13640. } else {
  13641. ret += variableValueMenuCode(expression.first_operand);
  13642. }
  13643. switch (expression.operator) {
  13644. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.greater_than:
  13645. ret += " > ";
  13646. break;
  13647. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.less_than:
  13648. ret += " < ";
  13649. break;
  13650. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.equals_to:
  13651. ret += " == ";
  13652. break;
  13653. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.not_equals_to:
  13654. ret += " != ";
  13655. break;
  13656. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
  13657. ret += " >= ";
  13658. break;
  13659. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.less_than_or_equals_to:
  13660. ret += " <= ";
  13661. break;
  13662. }
  13663. if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_logic) {
  13664. ret += logicExpressionCode(expression.second_operand);
  13665. } else if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.exp_arithmetic) {
  13666. ret += arithmeticExpressionCode(expression.second_operand);
  13667. } else {
  13668. ret += variableValueMenuCode(expression.second_operand);
  13669. }
  13670. ret += " ) ";
  13671. return ret;
  13672. }
  13673. function attributionsCode(command_obj, indentation) {
  13674. var ret = "\n";
  13675. for (var i = 0; i < indentation; i++) {
  13676. ret += "\t";
  13677. }
  13678. ret += variableValueMenuCode(command_obj.variable) + " <- ";
  13679. /*for (var i = 0; i < command_obj.expression.length; i++) {
  13680. ret += elementExpressionCode(command_obj.expression[i]);
  13681. }*/
  13682. ret += elementExpressionCode(command_obj.expression);
  13683. return ret;
  13684. }
  13685. function elementExpressionCode(expression_obj) {
  13686. var ret = "";
  13687. for (var i = 0; i < expression_obj.length; i++) {
  13688. if (expression_obj[i].type) {
  13689. ret += variableValueMenuCode(expression_obj[i]);
  13690. } else if (expression_obj[i].type_op) {
  13691. switch (expression_obj[i].item) {
  13692. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.plus:
  13693. ret += " + ";
  13694. break;
  13695. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.minus:
  13696. ret += " - ";
  13697. break;
  13698. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.multiplication:
  13699. ret += " * ";
  13700. break;
  13701. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.division:
  13702. ret += " / ";
  13703. break;
  13704. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_TYPES.module:
  13705. ret += " % ";
  13706. break;
  13707. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.equals_to:
  13708. ret += " == ";
  13709. break;
  13710. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.not_equals_to:
  13711. ret += " != ";
  13712. break;
  13713. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.and:
  13714. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_operator_and") + " ";
  13715. break;
  13716. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.or:
  13717. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_operator_or") + " ";
  13718. break;
  13719. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.LOGIC_COMPARISON.not:
  13720. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_operator_not") + " ";
  13721. break;
  13722. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.greater_than:
  13723. ret += " > ";
  13724. break;
  13725. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.less_than:
  13726. ret += " < ";
  13727. break;
  13728. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
  13729. ret += " >= ";
  13730. break;
  13731. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.ARITHMETIC_COMPARISON.less_than_or_equals_to:
  13732. ret += " <= ";
  13733. break;
  13734. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.EXPRESSION_TYPES.write_sep:
  13735. ret += ', " ", ';
  13736. break;
  13737. }
  13738. } else {
  13739. ret += " " + expression_obj[i] + " ";
  13740. }
  13741. }
  13742. return ret;
  13743. }
  13744. function functioncallsCode(command_obj, indentation) {
  13745. var ret = "\n";
  13746. for (var i = 0; i < indentation; i++) {
  13747. ret += "\t";
  13748. }
  13749. ret += variableValueMenuCode(command_obj.function_called);
  13750. return ret;
  13751. }
  13752. function readersCode(command_obj, indentation) {
  13753. var ret = "\n";
  13754. for (var i = 0; i < indentation; i++) {
  13755. ret += "\t";
  13756. }
  13757. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_command_read") + " ( ";
  13758. ret += variableValueMenuCode(command_obj.variable_value_menu);
  13759. ret += " ) ";
  13760. return ret;
  13761. }
  13762. function variableValueMenuCode(variable_obj) {
  13763. var is_return = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  13764. var ret = "";
  13765. try {
  13766. if (variable_obj.function_called) {
  13767. if (variable_obj.function_called.name) {
  13768. ret += variable_obj.function_called.name + " ( ";
  13769. } else {
  13770. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.translateInternalFunction(variable_obj.function_called.identifier, variable_obj.function_called.category) + " ( ";
  13771. }
  13772. if (variable_obj.parameters_list) {
  13773. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  13774. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  13775. if (i + 1 < variable_obj.parameters_list.length) {
  13776. ret += ", ";
  13777. }
  13778. }
  13779. }
  13780. ret += " )";
  13781. } else if (variable_obj.content.type) {
  13782. ret += variable_obj.content.name;
  13783. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  13784. ret += " [ " + variableValueMenuCode(variable_obj.column) + " ] ";
  13785. }
  13786. if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2 && variable_obj.reference_dimensions == 1) {
  13787. ret += " [ " + variableValueMenuCode(variable_obj.row) + " ] ";
  13788. } else if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  13789. ret += " [ " + variableValueMenuCode(variable_obj.row) + " ] ";
  13790. ret += " [ " + variableValueMenuCode(variable_obj.column) + " ] ";
  13791. }
  13792. } else {
  13793. var content = String(variable_obj.content);
  13794. if (isNaN(content)) {
  13795. // console.debug("Content length: ", content.length);
  13796. // console.debug("Char code at 0", content.charCodeAt(0));
  13797. var isBackslash = content.charCodeAt(0) === 92;
  13798. if (content.length === 1 || content.length === 2 && isBackslash) {
  13799. ret += "'".concat(content, "'");
  13800. } else {
  13801. ret += '"' + variable_obj.content + '"';
  13802. }
  13803. } else if (content.length == 0) {
  13804. ret += '""';
  13805. } else if (content.trim().length == 0) {
  13806. ret += '"' + content + '"';
  13807. } else {
  13808. ret += variable_obj.content;
  13809. }
  13810. }
  13811. } catch (err) {
  13812. if (!is_return) {
  13813. _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(variable_obj.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("inform_valid_content"));
  13814. throw err;
  13815. }
  13816. }
  13817. return ret;
  13818. }
  13819. function writersCode(command_obj, indentation) {
  13820. var ret = "\n";
  13821. for (var i = 0; i < indentation; i++) {
  13822. ret += "\t";
  13823. }
  13824. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_command_write") + " ( ";
  13825. /*for (var i = 0; i < command_obj.content.length; i++) {
  13826. ret += variableValueMenuCode(command_obj.content[i]);
  13827. if ((i + 1) < command_obj.content.length) {
  13828. ret += ' + ';
  13829. }
  13830. }*/
  13831. ret += elementExpressionCode(command_obj.content);
  13832. if (command_obj.newline) {
  13833. ret += ', "\\n"';
  13834. }
  13835. ret += " ) ";
  13836. return ret;
  13837. }
  13838. function commentsCode(command_obj, indentation) {
  13839. var ret = "\n";
  13840. for (var i = 0; i < indentation; i++) {
  13841. ret += "\t";
  13842. }
  13843. ret += "// ";
  13844. ret += command_obj.comment_text.content;
  13845. return ret;
  13846. }
  13847. function parametersCode(parameter_obj) {
  13848. var ret = "";
  13849. switch (parameter_obj.type) {
  13850. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  13851. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_integer") + " ";
  13852. break;
  13853. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  13854. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_real") + " ";
  13855. break;
  13856. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  13857. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_text") + " ";
  13858. break;
  13859. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  13860. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_boolean") + " ";
  13861. break;
  13862. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  13863. ret += " " + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_char") + " ";
  13864. break;
  13865. }
  13866. if (parameter_obj.reference) ret += "&";
  13867. ret += parameter_obj.name + "";
  13868. if (parameter_obj.dimensions == 1) {
  13869. ret += " []";
  13870. } else if (parameter_obj.dimensions == 2) {
  13871. ret += " [][]";
  13872. }
  13873. return ret;
  13874. }
  13875. function variablesCode(variable_obj) {
  13876. var ret = "";
  13877. var temp = variable_obj;
  13878. ret += "\n\t\t";
  13879. if (temp.is_constant) {
  13880. ret += "const ";
  13881. }
  13882. switch (temp.type) {
  13883. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  13884. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_integer") + " ";
  13885. break;
  13886. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  13887. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_real") + " ";
  13888. break;
  13889. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  13890. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_text") + " ";
  13891. break;
  13892. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  13893. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_boolean") + " ";
  13894. break;
  13895. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  13896. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_char") + " ";
  13897. break;
  13898. }
  13899. ret += temp.name + " ";
  13900. if (temp.dimensions == 1) {
  13901. ret += "[" + temp.columns + "] ";
  13902. switch (temp.type) {
  13903. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  13904. ret += "<- {";
  13905. for (var j = 0; j < temp.value.length; j++) {
  13906. ret += temp.value[j];
  13907. if (j + 1 < temp.value.length) {
  13908. ret += ", ";
  13909. }
  13910. }
  13911. ret += "}";
  13912. break;
  13913. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  13914. ret += "<- {";
  13915. for (var _j3 = 0; _j3 < temp.value.length; _j3++) {
  13916. ret += parseFloat(temp.value[_j3]).toFixed(2);
  13917. if (_j3 + 1 < temp.value.length) {
  13918. ret += ", ";
  13919. }
  13920. }
  13921. ret += "}";
  13922. break;
  13923. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  13924. ret += "<- {";
  13925. for (var _j4 = 0; _j4 < temp.value.length; _j4++) {
  13926. ret += '"' + temp.value[_j4] + '"';
  13927. if (_j4 + 1 < temp.value.length) {
  13928. ret += ", ";
  13929. }
  13930. }
  13931. ret += "}";
  13932. break;
  13933. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  13934. ret += "<- {";
  13935. for (var _j5 = 0; _j5 < temp.value.length; _j5++) {
  13936. if (temp.value[_j5]) {
  13937. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
  13938. } else {
  13939. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
  13940. }
  13941. if (_j5 + 1 < temp.value.length) {
  13942. ret += ", ";
  13943. }
  13944. }
  13945. ret += "}";
  13946. break;
  13947. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  13948. ret += "<- {";
  13949. for (var _j6 = 0; _j6 < temp.value.length; _j6++) {
  13950. ret += "'" + temp.value[_j6] + "'";
  13951. if (_j6 + 1 < temp.value.length) {
  13952. ret += ", ";
  13953. }
  13954. }
  13955. ret += "}";
  13956. break;
  13957. }
  13958. } else if (temp.dimensions == 2) {
  13959. ret += "[" + temp.rows + "][" + temp.columns + "] ";
  13960. switch (temp.type) {
  13961. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  13962. ret += "<- {";
  13963. for (var _j7 = 0; _j7 < temp.rows; _j7++) {
  13964. ret += "{";
  13965. for (var k = 0; k < temp.columns; k++) {
  13966. ret += temp.value[_j7][k];
  13967. if (k + 1 < temp.columns) {
  13968. ret += ", ";
  13969. }
  13970. }
  13971. ret += "}";
  13972. if (_j7 + 1 < temp.rows) {
  13973. ret += ", ";
  13974. }
  13975. }
  13976. ret += "}";
  13977. break;
  13978. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  13979. ret += "<- {";
  13980. for (var _j8 = 0; _j8 < temp.rows; _j8++) {
  13981. ret += "{";
  13982. for (var _k = 0; _k < temp.columns; _k++) {
  13983. ret += parseFloat(temp.value[_j8][_k]).toFixed(2);
  13984. if (_k + 1 < temp.columns) {
  13985. ret += ", ";
  13986. }
  13987. }
  13988. ret += "}";
  13989. if (_j8 + 1 < temp.rows) {
  13990. ret += ", ";
  13991. }
  13992. }
  13993. ret += "}";
  13994. break;
  13995. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  13996. ret += "<- {";
  13997. for (var _j9 = 0; _j9 < temp.rows; _j9++) {
  13998. ret += "{";
  13999. for (var _k2 = 0; _k2 < temp.columns; _k2++) {
  14000. ret += '"' + temp.value[_j9][_k2] + '"';
  14001. if (_k2 + 1 < temp.columns) {
  14002. ret += ", ";
  14003. }
  14004. }
  14005. ret += "}";
  14006. if (_j9 + 1 < temp.rows) {
  14007. ret += ", ";
  14008. }
  14009. }
  14010. ret += "}";
  14011. break;
  14012. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  14013. ret += "<- {";
  14014. for (var _j10 = 0; _j10 < temp.rows; _j10++) {
  14015. ret += "{";
  14016. for (var _k3 = 0; _k3 < temp.columns; _k3++) {
  14017. if (temp.value[_j10][_k3]) {
  14018. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
  14019. } else {
  14020. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
  14021. }
  14022. if (_k3 + 1 < temp.columns) {
  14023. ret += ", ";
  14024. }
  14025. }
  14026. ret += "}";
  14027. if (_j10 + 1 < temp.rows) {
  14028. ret += ", ";
  14029. }
  14030. }
  14031. ret += "}";
  14032. break;
  14033. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  14034. ret += "<- {";
  14035. for (var _j11 = 0; _j11 < temp.rows; _j11++) {
  14036. ret += "{";
  14037. for (var _k4 = 0; _k4 < temp.columns; _k4++) {
  14038. ret += "'" + temp.value[_j11][_k4] + "'";
  14039. if (_k4 + 1 < temp.columns) {
  14040. ret += ", ";
  14041. }
  14042. }
  14043. ret += "}";
  14044. if (_j11 + 1 < temp.rows) {
  14045. ret += ", ";
  14046. }
  14047. }
  14048. ret += "}";
  14049. break;
  14050. }
  14051. } else {
  14052. switch (temp.type) {
  14053. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  14054. ret += "<- " + temp.value;
  14055. break;
  14056. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  14057. ret += "<- " + parseFloat(temp.value).toFixed(2);
  14058. break;
  14059. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  14060. ret += '<- "' + temp.value + '"';
  14061. break;
  14062. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  14063. ret += "<- ";
  14064. if (temp.value) {
  14065. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
  14066. } else {
  14067. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
  14068. }
  14069. break;
  14070. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  14071. ret += "<- '" + temp.value + "'";
  14072. break;
  14073. }
  14074. }
  14075. return ret;
  14076. }
  14077. function globalsCode() {
  14078. var ret = "";
  14079. if (window.program_obj.globals) {
  14080. for (var i = 0; i < window.program_obj.globals.length; i++) {
  14081. var temp = window.program_obj.globals[i];
  14082. ret += "\n\t";
  14083. if (temp.is_constant) {
  14084. ret += "const ";
  14085. }
  14086. switch (temp.type) {
  14087. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  14088. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_integer");
  14089. break;
  14090. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  14091. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_real");
  14092. break;
  14093. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  14094. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_text");
  14095. break;
  14096. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  14097. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_boolean");
  14098. break;
  14099. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  14100. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_char");
  14101. break;
  14102. }
  14103. ret += " " + temp.name + " ";
  14104. if (temp.dimensions == 1) {
  14105. ret += "[" + temp.columns + "] ";
  14106. switch (temp.type) {
  14107. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  14108. ret += "<- {";
  14109. for (var j = 0; j < temp.value.length; j++) {
  14110. ret += temp.value[j];
  14111. if (j + 1 < temp.value.length) {
  14112. ret += ", ";
  14113. }
  14114. }
  14115. ret += "}";
  14116. break;
  14117. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  14118. ret += "<- {";
  14119. for (var _j12 = 0; _j12 < temp.value.length; _j12++) {
  14120. ret += parseFloat(temp.value[_j12]).toFixed(2);
  14121. if (_j12 + 1 < temp.value.length) {
  14122. ret += ", ";
  14123. }
  14124. }
  14125. ret += "}";
  14126. break;
  14127. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  14128. ret += "<- {";
  14129. for (var _j13 = 0; _j13 < temp.value.length; _j13++) {
  14130. ret += '"' + temp.value[_j13] + '"';
  14131. if (_j13 + 1 < temp.value.length) {
  14132. ret += ", ";
  14133. }
  14134. }
  14135. ret += "}";
  14136. break;
  14137. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  14138. ret += "<- {";
  14139. for (var _j14 = 0; _j14 < temp.value.length; _j14++) {
  14140. if (temp.value[_j14]) {
  14141. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
  14142. } else {
  14143. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
  14144. }
  14145. if (_j14 + 1 < temp.value.length) {
  14146. ret += ", ";
  14147. }
  14148. }
  14149. ret += "}";
  14150. break;
  14151. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  14152. ret += "<- {";
  14153. for (var _j15 = 0; _j15 < temp.value.length; _j15++) {
  14154. ret += "'" + temp.value[_j15] + "'";
  14155. if (_j15 + 1 < temp.value.length) {
  14156. ret += ", ";
  14157. }
  14158. }
  14159. ret += "}";
  14160. break;
  14161. }
  14162. } else if (temp.dimensions == 2) {
  14163. ret += "[" + temp.rows + "][" + temp.columns + "] ";
  14164. switch (temp.type) {
  14165. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  14166. ret += "<- {";
  14167. for (var _j16 = 0; _j16 < temp.rows; _j16++) {
  14168. ret += "{";
  14169. for (var k = 0; k < temp.columns; k++) {
  14170. ret += temp.value[_j16][k];
  14171. if (k + 1 < temp.columns) {
  14172. ret += ", ";
  14173. }
  14174. }
  14175. ret += "}";
  14176. if (_j16 + 1 < temp.rows) {
  14177. ret += ", ";
  14178. }
  14179. }
  14180. ret += "}";
  14181. break;
  14182. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  14183. ret += "<- {";
  14184. for (var _j17 = 0; _j17 < temp.rows; _j17++) {
  14185. ret += "{";
  14186. for (var _k5 = 0; _k5 < temp.columns; _k5++) {
  14187. ret += parseFloat(temp.value[_j17][_k5]).toFixed(2);
  14188. if (_k5 + 1 < temp.columns) {
  14189. ret += ", ";
  14190. }
  14191. }
  14192. ret += "}";
  14193. if (_j17 + 1 < temp.rows) {
  14194. ret += ", ";
  14195. }
  14196. }
  14197. ret += "}";
  14198. break;
  14199. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  14200. ret += "<- {";
  14201. for (var _j18 = 0; _j18 < temp.rows; _j18++) {
  14202. ret += "{";
  14203. for (var _k6 = 0; _k6 < temp.columns; _k6++) {
  14204. ret += '"' + temp.value[_j18][_k6] + '"';
  14205. if (_k6 + 1 < temp.columns) {
  14206. ret += ", ";
  14207. }
  14208. }
  14209. ret += "}";
  14210. if (_j18 + 1 < temp.rows) {
  14211. ret += ", ";
  14212. }
  14213. }
  14214. ret += "}";
  14215. break;
  14216. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  14217. ret += "<- {";
  14218. for (var _j19 = 0; _j19 < temp.rows; _j19++) {
  14219. ret += "{";
  14220. for (var _k7 = 0; _k7 < temp.columns; _k7++) {
  14221. if (temp.value[_j19][_k7]) {
  14222. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
  14223. } else {
  14224. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
  14225. }
  14226. if (_k7 + 1 < temp.columns) {
  14227. ret += ", ";
  14228. }
  14229. }
  14230. ret += "}";
  14231. if (_j19 + 1 < temp.rows) {
  14232. ret += ", ";
  14233. }
  14234. }
  14235. ret += "}";
  14236. break;
  14237. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  14238. ret += "<- {";
  14239. for (var _j20 = 0; _j20 < temp.rows; _j20++) {
  14240. ret += "{";
  14241. for (var _k8 = 0; _k8 < temp.columns; _k8++) {
  14242. ret += "'" + temp.value[_j20][_k8] + "'";
  14243. if (_k8 + 1 < temp.columns) {
  14244. ret += ", ";
  14245. }
  14246. }
  14247. ret += "}";
  14248. if (_j20 + 1 < temp.rows) {
  14249. ret += ", ";
  14250. }
  14251. }
  14252. ret += "}";
  14253. break;
  14254. }
  14255. } else {
  14256. switch (temp.type) {
  14257. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER:
  14258. ret += "<- " + temp.value;
  14259. break;
  14260. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL:
  14261. ret += "<- " + parseFloat(temp.value).toFixed(2);
  14262. break;
  14263. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT:
  14264. ret += '<- "' + temp.value + '"';
  14265. break;
  14266. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN:
  14267. ret += "<- ";
  14268. if (temp.value) {
  14269. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_true");
  14270. } else {
  14271. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_false");
  14272. }
  14273. break;
  14274. case _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR:
  14275. ret += "<- '" + temp.value + "'";
  14276. break;
  14277. }
  14278. }
  14279. }
  14280. }
  14281. return ret;
  14282. }
  14283. /***/ }),
  14284. /***/ "./js/visualUI/commands.js":
  14285. /*!*********************************!*\
  14286. !*** ./js/visualUI/commands.js ***!
  14287. \*********************************/
  14288. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  14289. "use strict";
  14290. __webpack_require__.r(__webpack_exports__);
  14291. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  14292. /* harmony export */ "removeCommand": () => (/* binding */ removeCommand),
  14293. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  14294. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand),
  14295. /* harmony export */ "genericCreateCommand": () => (/* binding */ genericCreateCommand)
  14296. /* harmony export */ });
  14297. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14298. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14299. /* harmony import */ var _commands_comment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  14300. /* harmony import */ var _commands_reader__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  14301. /* harmony import */ var _commands_writer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  14302. /* harmony import */ var _commands_attribution__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  14303. /* harmony import */ var _commands_iftrue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  14304. /* harmony import */ var _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  14305. /* harmony import */ var _commands_whiletrue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  14306. /* harmony import */ var _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  14307. /* harmony import */ var _commands_switch__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  14308. /* harmony import */ var _commands_functioncall__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  14309. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14310. /* harmony import */ var _commands_break__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  14311. /* harmony import */ var _commands_return__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  14312. /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./../services/userLog */ "./js/services/userLog.js");
  14313. // let has_element_created_draged = false;
  14314. // let which_element_is_draged = null;
  14315. function removeCommand(command, function_obj, dom_obj) {
  14316. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.REMOVE_COMMAND, command.type, '/', 0);
  14317. if (function_obj.commands.indexOf(command) > -1) {
  14318. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  14319. return true;
  14320. } // Utilize dois parantNode, pois o primeiro é o div de comandos
  14321. try {
  14322. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  14323. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  14324. return true;
  14325. }
  14326. } catch (err) {}
  14327. try {
  14328. if (dom_obj.parent().parent().data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue) {
  14329. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  14330. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  14331. return true;
  14332. }
  14333. }
  14334. } catch (err) {}
  14335. if (dom_obj.parent().data('switchcase')) {
  14336. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  14337. return true;
  14338. }
  14339. return false;
  14340. }
  14341. window.function_container_active = null;
  14342. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  14343. var floatingObject;
  14344. switch (command_type) {
  14345. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]:
  14346. floatingObject = _commands_break__WEBPACK_IMPORTED_MODULE_13__.createFloatingCommand();
  14347. break;
  14348. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment:
  14349. floatingObject = _commands_comment__WEBPACK_IMPORTED_MODULE_2__.createFloatingCommand();
  14350. break;
  14351. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.reader:
  14352. floatingObject = _commands_reader__WEBPACK_IMPORTED_MODULE_3__.createFloatingCommand();
  14353. break;
  14354. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.writer:
  14355. floatingObject = _commands_writer__WEBPACK_IMPORTED_MODULE_4__.createFloatingCommand();
  14356. break;
  14357. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.attribution:
  14358. floatingObject = _commands_attribution__WEBPACK_IMPORTED_MODULE_5__.createFloatingCommand();
  14359. break;
  14360. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue:
  14361. floatingObject = _commands_iftrue__WEBPACK_IMPORTED_MODULE_6__.createFloatingCommand();
  14362. break;
  14363. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes:
  14364. floatingObject = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_7__.createFloatingCommand();
  14365. break;
  14366. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue:
  14367. floatingObject = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_8__.createFloatingCommand();
  14368. break;
  14369. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue:
  14370. floatingObject = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_9__.createFloatingCommand();
  14371. break;
  14372. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]:
  14373. floatingObject = _commands_switch__WEBPACK_IMPORTED_MODULE_10__.createFloatingCommand();
  14374. break;
  14375. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.functioncall:
  14376. floatingObject = _commands_functioncall__WEBPACK_IMPORTED_MODULE_11__.createFloatingCommand();
  14377. break;
  14378. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["return"]:
  14379. floatingObject = _commands_return__WEBPACK_IMPORTED_MODULE_14__.createFloatingCommand();
  14380. break;
  14381. }
  14382. floatingObject.draggable().appendTo("body");
  14383. $('body').mouseup(function (evt) {
  14384. manageCommand(function_obj, function_container, evt, command_type);
  14385. $('body').off('mouseup');
  14386. $('body').off('mouseover');
  14387. });
  14388. if (!function_container.hasClass('function_div') || function_container.length < 1) {
  14389. window.mouse_event = mouse_event;
  14390. function_container = $(mouse_event.originalEvent.srcElement.closest('.function_div'));
  14391. }
  14392. function_container_active = function_container;
  14393. function_container.find('.commands_list_div').on('mousemove', function (evt) {
  14394. addGhostDiv(evt);
  14395. });
  14396. function_container.find('.commands_list_div').find("*").on('mousemove', function (evt) {
  14397. addGhostDiv(evt);
  14398. });
  14399. function_container.on('mouseout', function (event) {
  14400. var el = $(document.elementFromPoint(event.clientX, event.clientY));
  14401. if (el.closest('.commands_list_div').length < 1) {
  14402. window.ghostDiv.remove();
  14403. }
  14404. });
  14405. floatingObject.css("position", "absolute");
  14406. mouse_event.type = "mousedown.draggable";
  14407. mouse_event.target = floatingObject[0];
  14408. floatingObject.css("left", mouse_event.pageX - window.divx);
  14409. floatingObject.css("top", mouse_event.pageY);
  14410. floatingObject.trigger(mouse_event);
  14411. }
  14412. window.divx = 100;
  14413. window.ghostDiv = $('<div class="ghost_div">');
  14414. window.active_container = null;
  14415. function addGhostToEmptyBlock(element, evt) {
  14416. $('.ghost_div').remove();
  14417. var container = element.closest('.command_container');
  14418. if (container.hasClass('switch')) {
  14419. container = $(evt.target).closest('.case_div');
  14420. }
  14421. if (!container.hasClass('dowhiletrue') && !container.hasClass('iftrue') && !container.hasClass('repeatNtimes') && !container.hasClass('case_div') && !container.hasClass('whiletrue')) {
  14422. addGhostToNotEmptyBlock(element, evt);
  14423. return;
  14424. }
  14425. if (window.active_container != null) {
  14426. if (window.active_container.is(container)) {//console.log('é o mesmo, não mudou!');
  14427. } else {
  14428. if (container.length < 1) {
  14429. container = element.closest('.commands_list_div');
  14430. if (window.active_container.is(container)) {//console.log('é o mesmo command list');
  14431. } else {
  14432. //console.log('mudou para um command list');
  14433. window.active_container = container;
  14434. }
  14435. } else {//console.log('mudou para um outro container?');
  14436. }
  14437. }
  14438. }
  14439. window.active_container = container;
  14440. if (container.hasClass('iftrue')) {
  14441. var containerIf = container.find('.commands_if').get(0);
  14442. var containerElse = container.find('.commands_else').get(0);
  14443. var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
  14444. var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
  14445. var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
  14446. var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
  14447. if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
  14448. $(containerIf).append(window.ghostDiv);
  14449. } else {
  14450. $(containerElse).append(window.ghostDiv);
  14451. }
  14452. } else if (container.hasClass('case_div')) {
  14453. container.find('.case_commands_block').append(window.ghostDiv);
  14454. } else {
  14455. container.find('.block_commands').append(window.ghostDiv);
  14456. }
  14457. }
  14458. function addGhostToNotEmptyBlock(element, evt) {
  14459. $('.ghost_div').remove();
  14460. var container = element.closest('.dowhiletrue, .iftrue, .repeatNtimes, .case_div, .whiletrue'); //console.log("\n\nNOT EMPTY: ", container);
  14461. //if (window.active_container != null) {
  14462. //}
  14463. if (container.length < 1) {
  14464. container = element.closest('.commands_list_div');
  14465. window.active_container = container;
  14466. addGhostToFunctionArea(element, evt);
  14467. } else {//console.log('mudou para um outro container?');
  14468. }
  14469. window.active_container = container; // quem está mais próximo? // Essa regra se aplica somente quando o over está sobre um comando
  14470. var allfilhos;
  14471. if (container.hasClass('iftrue')) {
  14472. if ($(evt.target).closest('.data_block_if').length > 0) {
  14473. allfilhos = container.find('.commands_if').children('.command_container');
  14474. } else if ($(evt.target).closest('.data_block_else').length > 0) {
  14475. allfilhos = container.find('.commands_else').children('.command_container');
  14476. } else {
  14477. var containerIf = container.find('.commands_if').get(0);
  14478. var containerElse = container.find('.commands_else').get(0);
  14479. var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
  14480. var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
  14481. var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
  14482. var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
  14483. if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
  14484. allfilhos = $(containerIf).children('.command_container');
  14485. } else {
  14486. allfilhos = $(containerElse).children('.command_container');
  14487. }
  14488. }
  14489. } else if (container.hasClass('case_div')) {
  14490. allfilhos = container.children('.case_commands_block').children('.command_container');
  14491. } else if (container.hasClass('commands_list_div')) {
  14492. allfilhos = container.children('.command_container');
  14493. } else {
  14494. allfilhos = container.children('.block_commands').children('.command_container');
  14495. }
  14496. var topDistances = [];
  14497. var bottomDistances = [];
  14498. for (var i = 0; i < allfilhos.length; i++) {
  14499. var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
  14500. topDistances.push(topD);
  14501. var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
  14502. bottomDistances.push(botD);
  14503. }
  14504. var menorTop = Math.min.apply(null, topDistances);
  14505. var indiceTop = topDistances.indexOf(menorTop);
  14506. var menorBot = Math.min.apply(null, bottomDistances);
  14507. var indiceBot = bottomDistances.indexOf(menorBot);
  14508. if (menorTop < menorBot) {
  14509. window.ghostDiv.insertBefore($(allfilhos.get(indiceTop)));
  14510. } else {
  14511. window.ghostDiv.insertAfter($(allfilhos.get(indiceBot)));
  14512. }
  14513. }
  14514. function addGhostToFunctionArea(undermouse, evt) {
  14515. $('.ghost_div').remove();
  14516. var allfilhos = undermouse.closest('.commands_list_div').children('.command_container');
  14517. var topDistances = [];
  14518. var bottomDistances = [];
  14519. for (var i = 0; i < allfilhos.length; i++) {
  14520. var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
  14521. topDistances.push(topD);
  14522. var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
  14523. bottomDistances.push(botD);
  14524. }
  14525. var menorTop = Math.min.apply(null, topDistances);
  14526. var indiceTop = topDistances.indexOf(menorTop);
  14527. var menorBot = Math.min.apply(null, bottomDistances);
  14528. var indiceBot = bottomDistances.indexOf(menorBot);
  14529. if (menorTop < menorBot) {
  14530. window.ghostDiv.insertBefore($(allfilhos.get(indiceTop)));
  14531. } else {
  14532. window.ghostDiv.insertAfter($(allfilhos.get(indiceBot)));
  14533. }
  14534. }
  14535. function addGhostDiv(evt) {
  14536. var undermouse = $(evt.target);
  14537. if (undermouse.hasClass('ghost_div')) {
  14538. return;
  14539. } else if (undermouse.hasClass('commands_list_div')) {
  14540. addGhostToFunctionArea(undermouse, evt);
  14541. return;
  14542. } else if (undermouse.hasClass('block_commands')) {
  14543. if (undermouse.find('.command_container').length > 0) {
  14544. addGhostToNotEmptyBlock(undermouse, evt);
  14545. } else {
  14546. addGhostToEmptyBlock(undermouse, evt);
  14547. }
  14548. } else if (undermouse.hasClass('case_div')) {
  14549. if (undermouse.find('.case_commands_block').find('.command_container').length > 0) {
  14550. addGhostToNotEmptyBlock(undermouse, evt);
  14551. } else {
  14552. addGhostToEmptyBlock(undermouse, evt);
  14553. }
  14554. } else {
  14555. addGhostToNotEmptyBlock(undermouse, evt);
  14556. }
  14557. }
  14558. function borderMouseDragCommand(function_obj, function_container, evt) {
  14559. function_container.find('.over_command_drag').each(function (index) {
  14560. $(this).removeClass('over_command_drag');
  14561. });
  14562. var prev = null;
  14563. function_container.find('.commands_list_div').each(function (index) {
  14564. prev = $(this);
  14565. if (prev) {
  14566. var objLeft = prev.offset().left;
  14567. var objTop = prev.offset().top;
  14568. var objRight = objLeft + prev.width();
  14569. var objBottom = objTop + prev.height();
  14570. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  14571. prev.addClass("over_command_drag");
  14572. }
  14573. }
  14574. });
  14575. function_container.find('.command_container').each(function (index) {
  14576. var obj = $(this);
  14577. var objLeft = obj.offset().left;
  14578. var objTop = obj.offset().top;
  14579. var objRight = objLeft + obj.width();
  14580. var objBottom = objTop + obj.height();
  14581. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  14582. if (prev) {
  14583. prev.removeClass('over_command_drag');
  14584. }
  14585. obj.addClass("over_command_drag");
  14586. return;
  14587. }
  14588. });
  14589. } // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  14590. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  14591. var createdElement;
  14592. switch (command.type) {
  14593. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment:
  14594. createdElement = _commands_comment__WEBPACK_IMPORTED_MODULE_2__.renderCommand(command, function_obj);
  14595. break;
  14596. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]:
  14597. createdElement = _commands_break__WEBPACK_IMPORTED_MODULE_13__.renderCommand(command, function_obj);
  14598. break;
  14599. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.reader:
  14600. createdElement = _commands_reader__WEBPACK_IMPORTED_MODULE_3__.renderCommand(command, function_obj);
  14601. break;
  14602. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.writer:
  14603. createdElement = _commands_writer__WEBPACK_IMPORTED_MODULE_4__.renderCommand(command, function_obj);
  14604. break;
  14605. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.attribution:
  14606. createdElement = _commands_attribution__WEBPACK_IMPORTED_MODULE_5__.renderCommand(command, function_obj);
  14607. break;
  14608. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.functioncall:
  14609. createdElement = _commands_functioncall__WEBPACK_IMPORTED_MODULE_11__.renderCommand(command, function_obj);
  14610. break;
  14611. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue:
  14612. createdElement = _commands_iftrue__WEBPACK_IMPORTED_MODULE_6__.renderCommand(command, function_obj);
  14613. break;
  14614. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes:
  14615. createdElement = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_7__.renderCommand(command, function_obj);
  14616. break;
  14617. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue:
  14618. createdElement = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_8__.renderCommand(command, function_obj);
  14619. break;
  14620. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue:
  14621. createdElement = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_9__.renderCommand(command, function_obj);
  14622. break;
  14623. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]:
  14624. createdElement = _commands_switch__WEBPACK_IMPORTED_MODULE_10__.renderCommand(command, function_obj);
  14625. break;
  14626. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["return"]:
  14627. createdElement = _commands_return__WEBPACK_IMPORTED_MODULE_14__.renderCommand(command, function_obj);
  14628. break;
  14629. }
  14630. switch (before_after_inside) {
  14631. case 1:
  14632. createdElement.insertBefore(element_reference);
  14633. break;
  14634. case 2:
  14635. createdElement.insertAfter(element_reference);
  14636. break;
  14637. case 3:
  14638. element_reference.append(createdElement);
  14639. break;
  14640. }
  14641. }
  14642. function genericCreateCommand(command_type) {
  14643. switch (command_type) {
  14644. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]:
  14645. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.Break();
  14646. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment:
  14647. 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));
  14648. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.reader:
  14649. 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));
  14650. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.writer:
  14651. 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)]);
  14652. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.attribution:
  14653. 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), []);
  14654. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.functioncall:
  14655. 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);
  14656. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue:
  14657. 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)]);
  14658. //(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block)
  14659. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes:
  14660. 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);
  14661. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue:
  14662. 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);
  14663. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue:
  14664. 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);
  14665. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]:
  14666. 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))];
  14667. 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);
  14668. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["return"]:
  14669. 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)]);
  14670. }
  14671. }
  14672. function dragTrash(event) {
  14673. $('.ghost_div').remove();
  14674. var trash = $('<i class="ui icon trash alternate outline"></i>');
  14675. $('body').append(trash);
  14676. trash.css('position', 'absolute');
  14677. trash.css('top', event.clientY);
  14678. trash.css('left', event.clientX - 20);
  14679. trash.css('font-size', '3em');
  14680. trash.css('display', 'none');
  14681. function_container_active.find('.commands_list_div').off('mousemove');
  14682. function_container_active.find('.commands_list_div').find("*").off('mousemove');
  14683. trash.fadeIn(200, function () {
  14684. trash.fadeOut(200, function () {
  14685. trash.remove();
  14686. });
  14687. });
  14688. }
  14689. function findSingleElement(searching, query) {
  14690. if (!searching || !query) {
  14691. return '';
  14692. }
  14693. 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) {
  14694. if (searching.commands_block) {
  14695. return '' + searching.commands_block.indexOf(query);
  14696. } else {
  14697. return '0';
  14698. }
  14699. } else if (searching.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue) {
  14700. if (searching.commands_block == null) {
  14701. searching.commands_block = [];
  14702. }
  14703. if (searching.commands_else == null) {
  14704. searching.commands_else = [];
  14705. }
  14706. if (searching.commands_block.indexOf(query) >= 0) {
  14707. return 'if[' + searching.commands_block.indexOf(query) + ']';
  14708. } else {
  14709. return 'else[' + searching.commands_else.indexOf(query) + ']';
  14710. }
  14711. } else if (searching.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]) {
  14712. for (var i = 0; i < searching.cases.length; i++) {
  14713. if (searching.cases[i].commands_block.indexOf(query) >= 0) {
  14714. return 'case[' + searching.cases[i].commands_block.indexOf(query) + ']';
  14715. }
  14716. }
  14717. }
  14718. }
  14719. function findPathRecursive(starter_index, hierarquia_bottom_up, function_obj) {
  14720. var index_command = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : -1;
  14721. var actual = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  14722. var full_path = '';
  14723. for (var i = 0; i <= hierarquia_bottom_up.length; i++) {
  14724. full_path += findSingleElement(hierarquia_bottom_up[i], hierarquia_bottom_up[i + 1]) + '-';
  14725. }
  14726. return full_path;
  14727. }
  14728. function manageCommand(function_obj, function_container, event, command_type) {
  14729. $(".created_element").each(function (index) {
  14730. $(this).remove();
  14731. });
  14732. var el = $(document.elementFromPoint(event.clientX, event.clientY));
  14733. if (el.hasClass('ghost_div')) {
  14734. if (el.closest('.command_container').length < 1) {
  14735. el.closest('.commands_list_div').css('height', el.closest('.commands_list_div').css('height') + 30); //$('.ghost_div').remove();
  14736. el = el.closest('.commands_list_div');
  14737. }
  14738. } // Primeiro verificar se ele soltou no espaço da função correta:
  14739. var hier = el.parentsUntil(".all_functions");
  14740. var esta_correto = false;
  14741. var esta_na_div_correta = false;
  14742. if (el.hasClass("commands_list_div")) {
  14743. esta_na_div_correta = true;
  14744. }
  14745. for (var i = 0; i < hier.length; i++) {
  14746. var temp = $(hier[i]);
  14747. if (temp.hasClass("commands_list_div")) {
  14748. esta_na_div_correta = true;
  14749. }
  14750. if (temp.data('fun') == function_obj) {
  14751. esta_correto = true;
  14752. break;
  14753. }
  14754. }
  14755. if (!esta_correto) {
  14756. // has_element_created_draged = false;
  14757. // which_element_is_draged = null;
  14758. dragTrash(event);
  14759. return;
  14760. } else {
  14761. if (!esta_na_div_correta) {
  14762. // has_element_created_draged = false;
  14763. // which_element_is_draged = null;
  14764. dragTrash(event);
  14765. return;
  14766. }
  14767. }
  14768. var hierarquia_bottom_up = null; // Agora é descobrir qual o escopo para adicionar o comando:
  14769. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  14770. if (typeof el.data('fun') !== 'undefined') {
  14771. // Se a lista de comandos estiver vazia, então é o primeiro.
  14772. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  14773. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  14774. // pode adicionar
  14775. el.data('fun').commands = [];
  14776. var new_cmd = genericCreateCommand(command_type);
  14777. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, command_type, '/', 0);
  14778. el.data('fun').commands.push(new_cmd);
  14779. renderCommand(new_cmd, $(function_container).find('.commands_list_div'), 3, function_obj);
  14780. } else {
  14781. // Entra nesse else, caso já existam outros comandos no bloco:
  14782. findNearbyCommandToAddInFunctionScope(el, event, $(function_container).find('.commands_list_div'), function_obj, command_type);
  14783. }
  14784. } else {
  14785. // descobrir em qual comando ele soltou:
  14786. var hier_find = el.parentsUntil(".commands_list_div");
  14787. hierarquia_bottom_up = [];
  14788. if (typeof el.data('command') !== 'undefined') {
  14789. hierarquia_bottom_up.push(el.data('command'));
  14790. }
  14791. for (var i = 0; i < hier_find.length; i++) {
  14792. if (typeof $(hier_find[i]).data('command') !== 'undefined') {
  14793. hierarquia_bottom_up.push($(hier_find[i]).data('command'));
  14794. }
  14795. } // Se for do tipo break, verificar se está no contexto correto:
  14796. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  14797. var is_correct_context = false;
  14798. if (command_type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]) {
  14799. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  14800. 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"]) {
  14801. is_correct_context = true;
  14802. break;
  14803. }
  14804. }
  14805. if (!is_correct_context) {
  14806. console.error("Context not allowed to insert BREAK COMMAND!");
  14807. return;
  14808. }
  14809. } // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  14810. if (hierarquia_bottom_up.length == 1) {
  14811. var sub_elemento = false;
  14812. for (var i = 0; i < hier_find.length; i++) {
  14813. if (typeof $(hier_find[i]).data('command') !== 'undefined') {
  14814. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  14815. sub_elemento = true;
  14816. break;
  14817. }
  14818. }
  14819. if (!sub_elemento) {
  14820. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  14821. }
  14822. } else {
  14823. // caso exista mais de um elemento na hierarquia:
  14824. if (typeof $(el).data('command') !== 'undefined') {
  14825. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  14826. } else {
  14827. var sub_elemento = false;
  14828. for (var i = 0; i < hier_find.length; i++) {
  14829. if (typeof $(hier_find[i]).data('command') !== 'undefined') {
  14830. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  14831. sub_elemento = true;
  14832. break;
  14833. }
  14834. }
  14835. }
  14836. }
  14837. } // has_element_created_draged = false;
  14838. // which_element_is_draged = null;
  14839. if (hierarquia_bottom_up) {
  14840. var i = hierarquia_bottom_up.length - 1;
  14841. var starter_index = window.program_obj.functions[window.program_obj.functions.indexOf(function_obj)].commands.indexOf(hierarquia_bottom_up[i]);
  14842. var all_str_path = starter_index + '-' + findPathRecursive(starter_index, hierarquia_bottom_up, function_obj);
  14843. (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);
  14844. }
  14845. renderAlgorithm();
  14846. }
  14847. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  14848. var el_jq = $(el);
  14849. var command_parent = el_jq.data('command');
  14850. 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"]) {
  14851. 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) {
  14852. // Se não tiver outro comando ainda no bloco, só adiciona:
  14853. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  14854. command_parent.commands_block = [];
  14855. var recentComand = genericCreateCommand(command_type);
  14856. command_parent.commands_block.push(recentComand);
  14857. (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);
  14858. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  14859. } else {
  14860. // Se já tem algum comando no bloco:
  14861. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  14862. }
  14863. } else {
  14864. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  14865. addCommandToSwitchCase(event, function_obj, command_type);
  14866. }
  14867. } else {
  14868. // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  14869. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  14870. }
  14871. }
  14872. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  14873. var all_sub = $(node_list_commands).find('div.command_container');
  14874. var menor_distancia = 999999999;
  14875. var elemento_menor_distancia = null;
  14876. var antes = true;
  14877. var t_bot;
  14878. var t_top; // Descobrindo o elemento mais próximo:
  14879. for (var i = 0; i < all_sub.length; i++) {
  14880. t_top = all_sub[i].getBoundingClientRect().top;
  14881. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  14882. if (t_top - event.clientY < menor_distancia) {
  14883. menor_distancia = event.clientY - t_top;
  14884. elemento_menor_distancia = all_sub[i];
  14885. }
  14886. }
  14887. 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:
  14888. if (borda_inferior - event.clientY < menor_distancia) {
  14889. var recentComand = genericCreateCommand(command_type);
  14890. command_parent.commands_block.push(recentComand); //
  14891. renderCommand(recentComand, node_list_commands, 3, function_obj);
  14892. } else {
  14893. var recentComand = genericCreateCommand(command_type);
  14894. var index = command_parent.commands_block.indexOf($(elemento_menor_distancia).data('command'));
  14895. if (index > -1) {
  14896. command_parent.commands_block.splice(index, 0, recentComand);
  14897. }
  14898. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  14899. }
  14900. }
  14901. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  14902. var el_jq = $(el);
  14903. var command_parent = $(el.parentNode.parentNode).data('command');
  14904. var command_target = el_jq.data('command');
  14905. var temp_parent = $(el.parentNode.parentNode);
  14906. var is_in_else = false;
  14907. if (!command_parent) {
  14908. command_parent = el_jq.data('command');
  14909. temp_parent = el_jq;
  14910. var hier = el_jq.parentsUntil(".command_container");
  14911. for (var i = 0; i < hier.length; i++) {
  14912. var temp = $(hier[i]);
  14913. if (typeof temp.data('else') != 'undefined') {
  14914. is_in_else = true;
  14915. }
  14916. if (typeof temp.data('command') != 'undefined') {
  14917. command_parent = temp.data('command');
  14918. temp_parent = temp;
  14919. }
  14920. }
  14921. }
  14922. var hier = el_jq.parentsUntil(".command_container");
  14923. for (var i = 0; i < hier.length; i++) {
  14924. var temp = $(hier[i]);
  14925. if (typeof temp.data('else') != 'undefined') {
  14926. is_in_else = true;
  14927. }
  14928. }
  14929. if (command_parent == command_target) {
  14930. var hier = el_jq.parentsUntil(".command_container");
  14931. for (var i = 0; i < hier.length; i++) {
  14932. var temp = $(hier[i]);
  14933. if (typeof temp.data('else') !== 'undefined') {
  14934. is_in_else = true;
  14935. break;
  14936. }
  14937. }
  14938. }
  14939. 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"]) {
  14940. var hier = temp_parent.parentsUntil(".all_cases_div");
  14941. for (var i = 0; i < hier.length; i++) {
  14942. var temp = $(hier[i]);
  14943. if (typeof temp.data('switchcase') !== 'undefined') {
  14944. command_parent = temp.data('switchcase');
  14945. is_in_else = false;
  14946. break;
  14947. }
  14948. }
  14949. }
  14950. var menor_distancia = 999999999;
  14951. var antes = true;
  14952. var t_bot;
  14953. var t_top;
  14954. t_top = el.getBoundingClientRect().top;
  14955. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  14956. var d_top = event.clientY - t_top; // distancia topo
  14957. var d_bot = t_bot - event.clientY; // distancia baixo
  14958. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  14959. if (d_top < d_bot) {
  14960. var recentComand = genericCreateCommand(command_type);
  14961. if (is_in_else) {
  14962. if (command_parent == command_target) {
  14963. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  14964. command_parent.commands_else = [];
  14965. var recentComand = genericCreateCommand(command_type);
  14966. command_parent.commands_else.push(recentComand);
  14967. renderCommand(recentComand, el_jq, 3, function_obj);
  14968. } else {
  14969. // Se já tem algum comando no bloco:
  14970. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  14971. }
  14972. return;
  14973. }
  14974. var index = command_parent.commands_else.indexOf(command_target);
  14975. if (index > -1) {
  14976. command_parent.commands_else.splice(index, 0, recentComand);
  14977. }
  14978. renderCommand(recentComand, el, 1, function_obj);
  14979. } else {
  14980. if (command_parent == command_target) {
  14981. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  14982. command_parent.commands_block = [];
  14983. var recentComand = genericCreateCommand(command_type);
  14984. command_parent.commands_block.push(recentComand);
  14985. renderCommand(recentComand, el_jq, 3, function_obj);
  14986. } else {
  14987. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  14988. }
  14989. return;
  14990. }
  14991. var index = command_parent.commands_block.indexOf(command_target);
  14992. if (index > -1) {
  14993. command_parent.commands_block.splice(index, 0, recentComand);
  14994. }
  14995. renderCommand(recentComand, el, 1, function_obj);
  14996. }
  14997. } else {
  14998. var recentComand = genericCreateCommand(command_type);
  14999. if (is_in_else) {
  15000. if (command_parent == command_target) {
  15001. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  15002. command_parent.commands_else = [];
  15003. var recentComand = genericCreateCommand(command_type);
  15004. command_parent.commands_else.push(recentComand);
  15005. renderCommand(recentComand, el_jq, 3, function_obj);
  15006. } else {
  15007. // Se já tem algum comando no bloco:
  15008. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  15009. }
  15010. return;
  15011. }
  15012. var index = command_parent.commands_else.indexOf(command_target);
  15013. if (index > -1) {
  15014. command_parent.commands_else.splice(index + 1, 0, recentComand);
  15015. }
  15016. renderCommand(recentComand, el, 2, function_obj);
  15017. } else {
  15018. if (command_parent == command_target) {
  15019. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  15020. command_parent.commands_block = [];
  15021. var recentComand = genericCreateCommand(command_type);
  15022. command_parent.commands_block.push(recentComand);
  15023. renderCommand(recentComand, el_jq, 3, function_obj);
  15024. } else {
  15025. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  15026. }
  15027. return;
  15028. }
  15029. var index = command_parent.commands_block.indexOf(command_target);
  15030. if (index > -1) {
  15031. command_parent.commands_block.splice(index + 1, 0, recentComand);
  15032. }
  15033. renderCommand(recentComand, el, 2, function_obj);
  15034. }
  15035. }
  15036. }
  15037. function insertCommandInBlock(el, event, function_obj, command_type) {
  15038. var el_jq = $(el);
  15039. var command_parent = el_jq.data('command');
  15040. 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) {
  15041. // Se não tiver outro comando ainda no bloco, só adiciona:
  15042. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  15043. command_parent.commands_block = [];
  15044. var recentComand = genericCreateCommand(command_type);
  15045. command_parent.commands_block.push(recentComand);
  15046. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  15047. } else {
  15048. // Se já tem algum comando no bloco:
  15049. findInBlockCorrectPlace(el, event, function_obj, command_type);
  15050. }
  15051. } else if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue) {
  15052. // no if ou no else?
  15053. var correct_div = $(document.elementFromPoint(event.pageX, event.pageY));
  15054. var is_in_if = true;
  15055. if (correct_div.data('if')) {
  15056. is_in_if = true;
  15057. } else if (correct_div.data('else')) {
  15058. is_in_if = false;
  15059. } else {
  15060. var hier = correct_div.parentsUntil(".command_container");
  15061. for (var i = 0; i < hier.length; i++) {
  15062. var temp = $(hier[i]);
  15063. if (typeof temp.data('if') !== 'undefined') {
  15064. is_in_if = true;
  15065. break;
  15066. }
  15067. if (typeof temp.data('else') !== 'undefined') {
  15068. is_in_if = false;
  15069. break;
  15070. }
  15071. }
  15072. }
  15073. if (is_in_if) {
  15074. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  15075. command_parent.commands_block = [];
  15076. var recentComand = genericCreateCommand(command_type);
  15077. command_parent.commands_block.push(recentComand);
  15078. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  15079. } else {
  15080. // Se já tem algum comando no bloco:
  15081. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  15082. }
  15083. } else {
  15084. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  15085. command_parent.commands_else = [];
  15086. var recentComand = genericCreateCommand(command_type);
  15087. command_parent.commands_else.push(recentComand);
  15088. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  15089. } else {
  15090. // Se já tem algum comando no bloco:
  15091. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  15092. }
  15093. }
  15094. } else {
  15095. // é do tipo switch
  15096. addCommandToSwitchCase(event, function_obj, command_type);
  15097. }
  15098. }
  15099. function addCommandToSwitchCase(event, function_obj, command_type) {
  15100. var el = $(document.elementFromPoint(event.clientX, event.clientY));
  15101. var which_case = el.data('switchcase');
  15102. var case_div = el;
  15103. if (!which_case) {
  15104. var hier_find = el.parentsUntil(".all_cases_div");
  15105. for (var i = 0; i < hier_find.length; i++) {
  15106. if (typeof $(hier_find[i]).data('switchcase') !== 'undefined') {
  15107. which_case = $(hier_find[i]).data('switchcase');
  15108. case_div = $(hier_find[i]);
  15109. break;
  15110. }
  15111. }
  15112. }
  15113. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  15114. which_case.commands_block = [];
  15115. var recentComand = genericCreateCommand(command_type);
  15116. which_case.commands_block.push(recentComand);
  15117. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  15118. } else {
  15119. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  15120. }
  15121. }
  15122. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  15123. var all_sub = case_div.find('div.command_container');
  15124. var menor_distancia = 999999999;
  15125. var elemento_menor_distancia = null;
  15126. var antes = true;
  15127. var t_bot;
  15128. var t_top; // Descobrindo o elemento mais próximo:
  15129. for (var i = 0; i < all_sub.length; i++) {
  15130. t_top = all_sub[i].getBoundingClientRect().top;
  15131. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  15132. if (t_top - event.clientY < menor_distancia) {
  15133. menor_distancia = event.clientY - t_top;
  15134. elemento_menor_distancia = all_sub[i];
  15135. }
  15136. }
  15137. 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:
  15138. if (borda_inferior - event.clientY < menor_distancia) {
  15139. var recentComand = genericCreateCommand(command_type);
  15140. which_case.commands_block.push(recentComand);
  15141. renderCommand(recentComand, $(case_div.find('.case_commands_block')[0]), 3, function_obj);
  15142. } else {
  15143. var recentComand = genericCreateCommand(command_type);
  15144. var index = which_case.commands_block.indexOf($(elemento_menor_distancia).data('command'));
  15145. if (index > -1) {
  15146. which_case.commands_block.splice(index, 0, recentComand);
  15147. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  15148. }
  15149. }
  15150. }
  15151. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  15152. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  15153. var el_jq = $(el);
  15154. var all_sub = el_jq.find('div.command_container');
  15155. var menor_distancia = 999999999;
  15156. var elemento_menor_distancia = null;
  15157. var antes = true;
  15158. var t_bot;
  15159. var t_top; // Descobrindo o elemento mais próximo:
  15160. for (var i = 0; i < all_sub.length; i++) {
  15161. t_top = all_sub[i].getBoundingClientRect().top;
  15162. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  15163. if (t_top - event.clientY < menor_distancia) {
  15164. menor_distancia = event.clientY - t_top;
  15165. elemento_menor_distancia = all_sub[i];
  15166. }
  15167. }
  15168. 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:
  15169. if (borda_inferior - event.clientY < menor_distancia) {
  15170. var recentComand = genericCreateCommand(command_type);
  15171. var command_parent = el_jq.data('command');
  15172. if (is_in_else) {
  15173. command_parent.commands_else.push(recentComand);
  15174. renderCommand(recentComand, el_jq, 3, function_obj);
  15175. } else {
  15176. command_parent.commands_block.push(recentComand);
  15177. renderCommand(recentComand, $(el_jq.find('.block_commands')[0]), 3, function_obj);
  15178. }
  15179. } else {
  15180. var recentComand = genericCreateCommand(command_type);
  15181. var command_parent = el_jq.data('command');
  15182. if (is_in_else) {
  15183. var index = command_parent.commands_else.indexOf($(elemento_menor_distancia).data('command'));
  15184. if (index > -1) {
  15185. command_parent.commands_else.splice(index, 0, recentComand);
  15186. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  15187. }
  15188. } else {
  15189. var index = command_parent.commands_block.indexOf($(elemento_menor_distancia).data('command'));
  15190. if (index > -1) {
  15191. command_parent.commands_block.splice(index, 0, recentComand);
  15192. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  15193. }
  15194. }
  15195. }
  15196. }
  15197. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  15198. switch ($(el).data('command').type) {
  15199. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.iftrue:
  15200. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["switch"]:
  15201. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes:
  15202. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.whiletrue:
  15203. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.dowhiletrue:
  15204. insertCommandInBlock(el, event, function_obj, command_type);
  15205. return;
  15206. }
  15207. var menor_distancia = 999999999;
  15208. var antes = true;
  15209. var t_bot;
  15210. var t_top;
  15211. t_top = el.getBoundingClientRect().top;
  15212. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  15213. var d_top = event.clientY - t_top; // distancia topo
  15214. var d_bot = t_bot - event.clientY; // distancia baixo
  15215. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  15216. if (d_top < d_bot) {
  15217. var recentComand = genericCreateCommand(command_type);
  15218. var index = function_obj.commands.indexOf($(el).data('command'));
  15219. if (index > -1) {
  15220. function_obj.commands.splice(index, 0, recentComand);
  15221. }
  15222. renderCommand(recentComand, el, 1, function_obj);
  15223. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, command_type, '/', index);
  15224. } else {
  15225. var recentComand = genericCreateCommand(command_type);
  15226. var index = function_obj.commands.indexOf($(el).data('command'));
  15227. if (index > -1) {
  15228. function_obj.commands.splice(index + 1, 0, recentComand);
  15229. }
  15230. renderCommand(recentComand, el, 2, function_obj);
  15231. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, command_type, '/', index);
  15232. }
  15233. }
  15234. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  15235. var all_sub = $(node_list_commands).find('div.command_container');
  15236. var menor_distancia = 999999999;
  15237. var elemento_menor_distancia = null;
  15238. var antes = true;
  15239. var t_bot;
  15240. var t_top; // Descobrindo o elemento mais próximo:
  15241. for (var i = 0; i < all_sub.length; i++) {
  15242. t_top = all_sub[i].getBoundingClientRect().top;
  15243. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  15244. if (t_top - event.clientY < menor_distancia) {
  15245. menor_distancia = event.clientY - t_top;
  15246. elemento_menor_distancia = all_sub[i];
  15247. }
  15248. }
  15249. 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:
  15250. if (borda_inferior - event.clientY < menor_distancia) {
  15251. var recentComand = genericCreateCommand(command_type);
  15252. function_obj.commands.push(recentComand); //
  15253. renderCommand(recentComand, node_list_commands, 3, function_obj);
  15254. (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);
  15255. } else {
  15256. var recentComand = genericCreateCommand(command_type);
  15257. var index = function_obj.commands.indexOf($(elemento_menor_distancia).data('command'));
  15258. if (index > -1) {
  15259. function_obj.commands.splice(index, 0, recentComand);
  15260. }
  15261. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  15262. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, command_type, '/', index);
  15263. }
  15264. }
  15265. /***/ }),
  15266. /***/ "./js/visualUI/commands/attribution.js":
  15267. /*!*********************************************!*\
  15268. !*** ./js/visualUI/commands/attribution.js ***!
  15269. \*********************************************/
  15270. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  15271. "use strict";
  15272. __webpack_require__.r(__webpack_exports__);
  15273. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  15274. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  15275. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand),
  15276. /* harmony export */ "manageExpressionElements": () => (/* binding */ manageExpressionElements),
  15277. /* harmony export */ "renderMenuOperations": () => (/* binding */ renderMenuOperations)
  15278. /* harmony export */ });
  15279. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15280. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15281. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15282. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15283. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  15284. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
  15285. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../algorithm */ "./js/visualUI/algorithm.js");
  15286. function createFloatingCommand() {
  15287. return $('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x <&#8212; 1 + 1 </span></div>');
  15288. }
  15289. function renderCommand(command, function_obj) {
  15290. 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>');
  15291. el.data('command', command);
  15292. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
  15293. if (!command.expression || command.expression.length < 1) {
  15294. 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);
  15295. command.expression.push(exp);
  15296. }
  15297. addHandlers(command, function_obj, el);
  15298. _generic_expression__WEBPACK_IMPORTED_MODULE_4__.renderExpression(command, function_obj, el.find('.expression_elements'), command.expression);
  15299. if (command.lockexpression) {
  15300. if (command.expression) {
  15301. try {
  15302. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  15303. if (text) {
  15304. $(el.find('.expression_elements')[0]).toggle();
  15305. $(el.find('.textual_expression')[0]).text(text);
  15306. $(el.find('.textual_expression')[0]).toggle();
  15307. $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
  15308. }
  15309. } catch (e) {
  15310. command.lockexpression = false;
  15311. }
  15312. }
  15313. }
  15314. el.find('.unlock').popup({
  15315. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
  15316. delay: {
  15317. show: 750,
  15318. hide: 0
  15319. }
  15320. });
  15321. el.find('.lock').popup({
  15322. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
  15323. delay: {
  15324. show: 750,
  15325. hide: 0
  15326. }
  15327. });
  15328. el.find('.button_write_expression').popup({
  15329. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression"),
  15330. delay: {
  15331. show: 750,
  15332. hide: 0
  15333. }
  15334. });
  15335. return el;
  15336. }
  15337. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  15338. var index_to_move = expression_element.itens.indexOf(ref_object);
  15339. switch (selectedItem.data('exp')) {
  15340. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp:
  15341. 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)]);
  15342. expression_element.itens[index_to_move] = exp;
  15343. break;
  15344. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.op_exp:
  15345. 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]]);
  15346. expression_element.itens[index_to_move] = exp;
  15347. break;
  15348. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.par_exp_par:
  15349. 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]]);
  15350. expression_element.itens[index_to_move] = exp;
  15351. break;
  15352. }
  15353. renderExpressionElements(command, function_obj, dom_object);
  15354. }
  15355. function renderExpressionElements(command, function_obj, el) {
  15356. var expression_div = el.find('.expression_elements');
  15357. var command_container;
  15358. if (el.hasClass("command_container") == false) {
  15359. var hier = el.parentsUntil(".command_container");
  15360. for (var i = 0; i < hier.length; i++) {
  15361. if ($(hier[i]).hasClass("command_container")) {
  15362. command_container = $(hier[i]);
  15363. break;
  15364. }
  15365. if ($(hier[i]).hasClass("expression_elements")) {
  15366. expression_div = $(hier[i]);
  15367. break;
  15368. }
  15369. }
  15370. }
  15371. if (command_container) {
  15372. expression_div = command_container.find('.expression_elements');
  15373. }
  15374. expression_div.text('');
  15375. for (var i = 0; i < command.expression.length; i++) {
  15376. var temp = $('<div class="expression_element"></div>');
  15377. temp.data('ref_element', command.expression[i]);
  15378. temp.data('ref_index', i);
  15379. expression_div.append(temp);
  15380. renderElement(command, function_obj, temp, command.expression[i]);
  15381. }
  15382. }
  15383. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  15384. var context_menu = '<div class="ui dropdown"><div class="text">';
  15385. switch (expression_element.itens[index_op]) {
  15386. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus:
  15387. context_menu += '+';
  15388. break;
  15389. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus:
  15390. context_menu += '-';
  15391. break;
  15392. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.multiplication:
  15393. context_menu += '*';
  15394. break;
  15395. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.division:
  15396. context_menu += '/';
  15397. break;
  15398. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.module:
  15399. context_menu += '%';
  15400. break;
  15401. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.none:
  15402. context_menu += '...';
  15403. break;
  15404. }
  15405. context_menu += '</div><div class="menu">';
  15406. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus + '">+</div>';
  15407. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus + '">-</div>';
  15408. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.multiplication + '">*</div>';
  15409. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.division + '">/</div>';
  15410. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.module + '">%</div>';
  15411. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.none + '" data-text="...">Nenhum</div>';
  15412. context_menu += '</div></div>';
  15413. context_menu = $(context_menu);
  15414. temp_op.append(context_menu);
  15415. context_menu.dropdown({
  15416. onChange: function onChange(value, text, $selectedItem) {
  15417. expression_element.itens[index_op] = value;
  15418. }
  15419. });
  15420. }
  15421. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  15422. if (el.hasClass("command_container") == false) {
  15423. var hier = el.parentsUntil(".commands_list_div");
  15424. for (var i = 0; i < hier.length; i++) {
  15425. if ($(hier[i]).hasClass("command_container")) {
  15426. el = $(hier[i]);
  15427. break;
  15428. }
  15429. }
  15430. }
  15431. if (dom_append_menu.hasClass("expression_elements") == false) {
  15432. var hier = el.parentsUntil(".commands_list_div");
  15433. for (var i = 0; i < hier.length; i++) {
  15434. if ($(hier[i]).hasClass("expression_elements")) {
  15435. dom_append_menu = $(hier[i]);
  15436. break;
  15437. }
  15438. }
  15439. }
  15440. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  15441. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  15442. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  15443. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  15444. context_menu += '</div></div>';
  15445. context_menu = $(context_menu);
  15446. dom_append_menu.append(context_menu);
  15447. context_menu.dropdown({
  15448. onChange: function onChange(value, text, $selectedItem) {
  15449. switch (value) {
  15450. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp:
  15451. 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)]);
  15452. expression_append_new_expression.push(exp);
  15453. break;
  15454. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.op_exp:
  15455. 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)]);
  15456. expression_append_new_expression.push(exp);
  15457. break;
  15458. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.par_exp_par:
  15459. 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)]);
  15460. expression_append_new_expression.push(exp);
  15461. break;
  15462. }
  15463. renderExpressionElements(command, function_obj, el);
  15464. }
  15465. });
  15466. }
  15467. function renderElement(command, function_obj, el, expression_element) {
  15468. switch (expression_element.type_exp) {
  15469. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.exp_op_exp:
  15470. var temp_op = $('<div class="component_element"></div>');
  15471. var temp_exp_1 = $('<div class="component_element"></div>');
  15472. var temp_exp_2 = $('<div class="component_element"></div>');
  15473. el.append(temp_exp_1);
  15474. el.append(temp_op);
  15475. el.append(temp_exp_2);
  15476. if (expression_element.itens[0].type) {
  15477. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  15478. } else {
  15479. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  15480. }
  15481. renderOperator(command, function_obj, temp_op, expression_element, 1);
  15482. if (expression_element.itens[2].type) {
  15483. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  15484. } else {
  15485. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  15486. }
  15487. break;
  15488. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.op_exp:
  15489. var temp_op = $('<div class="component_element"></div>');
  15490. var temp_exp = $('<div class="component_element"></div>');
  15491. el.append(temp_op);
  15492. el.append(temp_exp);
  15493. renderOperator(command, function_obj, temp_op, expression_element, 0);
  15494. if (expression_element.itens[1].type) {
  15495. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  15496. } else {
  15497. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  15498. }
  15499. break;
  15500. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_ELEMENTS.par_exp_par:
  15501. var temp_par_1 = $('<div class="component_element"> ( </div>');
  15502. var temp_exp = $('<div class="component_element"></div>');
  15503. var temp_par_2 = $('<div class="component_element"> ) </div>');
  15504. el.append(temp_par_1);
  15505. el.append(temp_exp);
  15506. for (var j = 0; j < expression_element.itens.length; j++) {
  15507. if (expression_element.itens[j].type) {
  15508. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  15509. } else {
  15510. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  15511. }
  15512. } //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  15513. el.append(temp_par_2);
  15514. break;
  15515. }
  15516. }
  15517. function renderExpression(command, function_obj, el) {
  15518. var expression_div = el.find('.expression_elements');
  15519. expression_div.text('');
  15520. var menu_add_item = $('<div class="menu_add_item"></div>');
  15521. menu_add_item.data('index_add', 0);
  15522. expression_div.append(menu_add_item);
  15523. for (var i = 0; i < command.expression.length; i++) {
  15524. if (command.expression[i].type) {
  15525. var temp = $('<div class="expression_element"></div>');
  15526. temp.data('ref_element', command.expression[i]);
  15527. temp.data('ref_index', i);
  15528. expression_div.append(temp);
  15529. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, command.expression[i], temp, function_obj);
  15530. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  15531. var temp = $('<div class="expression_element">' + command.expression[i] + '</div>');
  15532. temp.data('ref_element', command.expression[i]);
  15533. temp.data('ref_index', i);
  15534. expression_div.append(temp);
  15535. } else {
  15536. var temp = '<div class="expression_element">';
  15537. switch (command.expression[i]) {
  15538. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus:
  15539. temp += '+';
  15540. break;
  15541. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus:
  15542. temp += '-';
  15543. break;
  15544. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.multiplication:
  15545. temp += '*';
  15546. break;
  15547. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.division:
  15548. temp += '/';
  15549. break;
  15550. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.module:
  15551. temp += '%';
  15552. break;
  15553. }
  15554. temp += '</div>';
  15555. temp = $(temp);
  15556. temp.data('ref_element', command.expression[i]);
  15557. temp.data('ref_index', i);
  15558. expression_div.append(temp);
  15559. }
  15560. var menu_add_item_seq = $('<div class="menu_add_item"></div>');
  15561. var index_temp = i + 1;
  15562. menu_add_item_seq.data('index_add', index_temp);
  15563. expression_div.append(menu_add_item_seq);
  15564. }
  15565. addMenuItens(command, function_obj, el);
  15566. }
  15567. function addMenuItens(command, function_obj, expression_div) {
  15568. var divs_expression = expression_div.find('.menu_add_item');
  15569. for (var i = 0; i < divs_expression.length; i++) {
  15570. var temp = $(divs_expression[i]).data('index_add');
  15571. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  15572. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_value') + '</div>';
  15573. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_operator') + '</div>';
  15574. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI('text_parentheses') + '</div>';
  15575. context_menu += '</div></div>';
  15576. context_menu = $(context_menu);
  15577. $(divs_expression[i]).append(context_menu);
  15578. context_menu.dropdown({
  15579. on: 'hover',
  15580. onChange: function onChange(value, text, $selectedItem) {
  15581. switch ($selectedItem.data('option')) {
  15582. case "value":
  15583. 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));
  15584. renderExpression(command, function_obj, expression_div);
  15585. break;
  15586. case "operator":
  15587. command.expression.splice($selectedItem.data('index'), 0, _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus);
  15588. renderExpression(command, function_obj, expression_div);
  15589. break;
  15590. case "parentheses":
  15591. command.expression.splice($selectedItem.data('index'), 0, "(");
  15592. 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));
  15593. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  15594. renderExpression(command, function_obj, expression_div);
  15595. break;
  15596. }
  15597. }
  15598. });
  15599. }
  15600. }
  15601. function addHandlers(command, function_obj, attribution_dom) {
  15602. attribution_dom.find('.button_write_expression').on('click', function () {
  15603. window.expressionEdition = true;
  15604. window.inputExpression = null;
  15605. var afterWhichElement;
  15606. var lockButton = $(attribution_dom.find('.button_alternate_expression')[0]);
  15607. var editButton = $(this);
  15608. afterWhichElement = attribution_dom.find('.expression_elements');
  15609. if (command.lockexpression) {
  15610. afterWhichElement = attribution_dom.find('.textual_expression');
  15611. }
  15612. var text = "";
  15613. if (command.expression) {
  15614. if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
  15615. text = "";
  15616. } else {
  15617. try {
  15618. text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  15619. } catch (ex) {
  15620. text = "";
  15621. }
  15622. }
  15623. }
  15624. var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
  15625. var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
  15626. var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
  15627. input.val(text);
  15628. input.focusout(function (evt) {
  15629. console.log('focosout event!');
  15630. ok_button.click();
  15631. evt.preventDefault();
  15632. return true;
  15633. });
  15634. input.keyup(function (evt) {
  15635. if (evt.keyCode == 27) {
  15636. // esc
  15637. cancel_button.click();
  15638. }
  15639. if (evt.keyCode == 13) {
  15640. // enter
  15641. ok_button.click();
  15642. }
  15643. });
  15644. ok_button.click(function () {
  15645. var parsed = null;
  15646. parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(input.val(), function_obj, input);
  15647. if (parsed) {
  15648. window.expressionEdition = false;
  15649. command.expression = parsed;
  15650. (0,_algorithm__WEBPACK_IMPORTED_MODULE_6__.renderAlgorithm)();
  15651. }
  15652. });
  15653. cancel_button.mousedown(function (evt) {
  15654. var parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(text, function_obj, input);
  15655. if (parsed) {
  15656. window.expressionEdition = false;
  15657. command.expression = parsed;
  15658. (0,_algorithm__WEBPACK_IMPORTED_MODULE_6__.renderAlgorithm)();
  15659. }
  15660. });
  15661. input.insertAfter(afterWhichElement);
  15662. input.focus();
  15663. cancel_button.insertAfter(input);
  15664. ok_button.insertAfter(input);
  15665. var len = text.length;
  15666. input[0].setSelectionRange(len, len);
  15667. afterWhichElement.css('display', 'none');
  15668. lockButton.css('display', 'none');
  15669. editButton.css('display', 'none');
  15670. ok_button.popup({
  15671. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression_confirm"),
  15672. delay: {
  15673. show: 750,
  15674. hide: 0
  15675. }
  15676. });
  15677. cancel_button.popup({
  15678. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression_cancel"),
  15679. delay: {
  15680. show: 750,
  15681. hide: 0
  15682. }
  15683. });
  15684. });
  15685. $(attribution_dom.find('.textual_expression')[0]).toggle();
  15686. attribution_dom.find('.button_alternate_expression').on('click', function () {
  15687. if (command.expression) {
  15688. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  15689. if (text) {
  15690. $(attribution_dom.find('.expression_elements')[0]).toggle();
  15691. $(attribution_dom.find('.textual_expression')[0]).text(text);
  15692. $(attribution_dom.find('.textual_expression')[0]).toggle();
  15693. $(this).toggleClass('unlock').toggleClass('lock');
  15694. command.lockexpression = !command.lockexpression;
  15695. }
  15696. if (command.lockexpression) {
  15697. attribution_dom.find('.lock').popup({
  15698. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
  15699. delay: {
  15700. show: 750,
  15701. hide: 0
  15702. }
  15703. });
  15704. } else {
  15705. attribution_dom.find('.unlock').popup({
  15706. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
  15707. delay: {
  15708. show: 750,
  15709. hide: 0
  15710. }
  15711. });
  15712. }
  15713. }
  15714. });
  15715. attribution_dom.find('.button_remove_command').on('click', function () {
  15716. if (_commands__WEBPACK_IMPORTED_MODULE_3__.removeCommand(command, function_obj, attribution_dom)) {
  15717. attribution_dom.fadeOut(400, function () {
  15718. attribution_dom.remove();
  15719. });
  15720. }
  15721. });
  15722. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  15723. renderExpressionElements(command, function_obj, attribution_dom);
  15724. });
  15725. }
  15726. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  15727. /*console.log("recebido o seguinte DOM: ");
  15728. console.log(dom_object);
  15729. if (dom_object.hasClass('var_attributed')) {
  15730. return;
  15731. } else {
  15732. var hier = dom_object.parentsUntil(".command_container");
  15733. for (var i = 0; i < hier.length; i++) {
  15734. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  15735. return;
  15736. }
  15737. }
  15738. }
  15739. dom_object.find('.context_menu_clear').remove();
  15740. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  15741. for (var tm in Models.ARITHMETIC_TYPES) {
  15742. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  15743. }
  15744. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  15745. menu_operations += '</div></div>';
  15746. menu_operations = $(menu_operations);
  15747. dom_object.append(menu_operations);
  15748. menu_operations.dropdown({
  15749. onChange: function(value, text, $selectedItem) {
  15750. switch ($($selectedItem).data('option')) {
  15751. case "clear":
  15752. $(dom_object).text('');
  15753. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  15754. break;
  15755. default:
  15756. createExpressionAround(command, ref_object, dom_object, function_obj);
  15757. menu_operations.find('.text').text('');
  15758. }
  15759. }
  15760. });*/
  15761. }
  15762. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  15763. $('<span> ( </span>').insertBefore(dom_object);
  15764. $('<span> ) </span>').insertAfter(dom_object);
  15765. _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);
  15766. }
  15767. /***/ }),
  15768. /***/ "./js/visualUI/commands/break.js":
  15769. /*!***************************************!*\
  15770. !*** ./js/visualUI/commands/break.js ***!
  15771. \***************************************/
  15772. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  15773. "use strict";
  15774. __webpack_require__.r(__webpack_exports__);
  15775. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  15776. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  15777. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  15778. /* harmony export */ });
  15779. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15780. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15781. function createFloatingCommand() {
  15782. 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>');
  15783. }
  15784. function renderCommand(command, function_obj) {
  15785. 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>');
  15786. el.data('command', command);
  15787. addHandlers(command, function_obj, el);
  15788. return el;
  15789. }
  15790. function addHandlers(command, function_obj, break_dom) {
  15791. break_dom.find('.button_remove_command').on('click', function () {
  15792. if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, break_dom)) {
  15793. break_dom.fadeOut(400, function () {
  15794. break_dom.remove();
  15795. });
  15796. }
  15797. });
  15798. }
  15799. /***/ }),
  15800. /***/ "./js/visualUI/commands/comment.js":
  15801. /*!*****************************************!*\
  15802. !*** ./js/visualUI/commands/comment.js ***!
  15803. \*****************************************/
  15804. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  15805. "use strict";
  15806. __webpack_require__.r(__webpack_exports__);
  15807. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  15808. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  15809. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  15810. /* harmony export */ });
  15811. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15812. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15813. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15814. function createFloatingCommand() {
  15815. 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>');
  15816. }
  15817. function renderCommand(command, function_obj) {
  15818. 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>');
  15819. el.data('command', command);
  15820. addHandlers(command, function_obj, el);
  15821. renderTextComment(command, function_obj, el);
  15822. return el;
  15823. }
  15824. function renderTextComment(command, function_obj, el) {
  15825. _variable_value_menu__WEBPACK_IMPORTED_MODULE_1__.renderMenu(command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  15826. }
  15827. function addHandlers(command, function_obj, comment_dom) {
  15828. comment_dom.find('.button_remove_command').on('click', function () {
  15829. if (_commands__WEBPACK_IMPORTED_MODULE_2__.removeCommand(command, function_obj, comment_dom)) {
  15830. comment_dom.fadeOut(400, function () {
  15831. comment_dom.remove();
  15832. });
  15833. }
  15834. });
  15835. }
  15836. /***/ }),
  15837. /***/ "./js/visualUI/commands/conditional_expression.js":
  15838. /*!********************************************************!*\
  15839. !*** ./js/visualUI/commands/conditional_expression.js ***!
  15840. \********************************************************/
  15841. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  15842. "use strict";
  15843. __webpack_require__.r(__webpack_exports__);
  15844. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  15845. /* harmony export */ "renderExpression": () => (/* binding */ renderExpression)
  15846. /* harmony export */ });
  15847. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15848. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15849. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15850. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  15851. expression.dom_object = initial_el_to_render;
  15852. if (expression.expression == null || expression.expression.length < 1) {
  15853. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  15854. } else {
  15855. var main_div = $('<div class="expression_elements"></div>');
  15856. switch (expression.expression.type) {
  15857. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic:
  15858. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  15859. break;
  15860. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic:
  15861. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  15862. break;
  15863. }
  15864. initial_el_to_render.append(main_div);
  15865. var restartMenu = $('<div class="ui restart_expression"><i class="ui icon undo"></i></div>');
  15866. initial_el_to_render.append(restartMenu);
  15867. restartMenu.on('click', function (e) {
  15868. expression.expression = null;
  15869. initial_el_to_render.empty();
  15870. renderExpression(command, expression, function_obj, initial_el_to_render);
  15871. });
  15872. }
  15873. }
  15874. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  15875. var menu_operator = $('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  15876. menu_operator.dropdown({
  15877. values: [{
  15878. name: '>',
  15879. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.greater_than,
  15880. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.greater_than
  15881. }, {
  15882. name: '<',
  15883. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.less_than,
  15884. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.less_than
  15885. }, {
  15886. name: '==',
  15887. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.equals_to,
  15888. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.equals_to
  15889. }, {
  15890. name: '!=',
  15891. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.not_equals_to,
  15892. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.not_equals_to
  15893. }, {
  15894. name: '>=',
  15895. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.greater_than_or_equals_to,
  15896. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.greater_than_or_equals_to
  15897. }, {
  15898. name: '<=',
  15899. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.less_than_or_equals_to,
  15900. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_COMPARISON.less_than_or_equals_to
  15901. }],
  15902. onChange: function onChange(value, text, $selectedItem) {
  15903. expression_arithmetic.operator = value;
  15904. }
  15905. });
  15906. element_to_append.append(menu_operator);
  15907. }
  15908. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  15909. var menu_operator = $('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  15910. menu_operator.dropdown({
  15911. values: [{
  15912. name: '==',
  15913. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.equals_to,
  15914. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.equals_to
  15915. }, {
  15916. name: '!=',
  15917. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.not_equals_to,
  15918. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.not_equals_to
  15919. }, {
  15920. name: '&&',
  15921. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.and,
  15922. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.and
  15923. }, {
  15924. name: '||',
  15925. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.or,
  15926. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.LOGIC_COMPARISON.or
  15927. }],
  15928. onChange: function onChange(value, text, $selectedItem) {
  15929. if ($selectedItem) {
  15930. expression_logic.operator = value;
  15931. if (expression_logic.second_operand == null) {
  15932. 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);
  15933. initial_el_to_render.empty();
  15934. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  15935. }
  15936. }
  15937. }
  15938. });
  15939. element_to_append.append(menu_operator);
  15940. }
  15941. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  15942. var exp_el_par_1 = $(' <span class="span_command_spec"> </span> ');
  15943. var exp_el_expr_el_1 = $('<div class="expression_element"></div>');
  15944. var exp_el_expr_operand = $('<div class="expression_element"></div>');
  15945. var exp_el_expr_el_2 = $('<div class="expression_element"></div>');
  15946. var exp_el_par_2 = $(' <span class="span_command_spec"> </span> ');
  15947. if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic) {
  15948. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  15949. } else if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic) {
  15950. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  15951. } else {
  15952. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  15953. }
  15954. element_to_append.append(exp_el_par_1);
  15955. element_to_append.append(exp_el_expr_el_1);
  15956. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  15957. element_to_append.append(exp_el_expr_operand);
  15958. if (expression_logic.second_operand) {
  15959. if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic) {
  15960. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  15961. } else if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic) {
  15962. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  15963. } else {
  15964. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  15965. }
  15966. element_to_append.append(exp_el_expr_el_2);
  15967. }
  15968. element_to_append.append(exp_el_par_2);
  15969. }
  15970. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  15971. var exp_el_par_1 = $(' <span class="span_command_spec"> </span> ');
  15972. var exp_el_expr_el_1 = $('<div class="expression_element"></div>');
  15973. var exp_el_expr_operand = $('<div class="expression_element"></div>');
  15974. var exp_el_expr_el_2 = $('<div class="expression_element"></div>');
  15975. var exp_el_par_2 = $(' <span class="span_command_spec"> </span> ');
  15976. if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic) {
  15977. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  15978. } else if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic) {
  15979. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  15980. } else {
  15981. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  15982. }
  15983. if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic) {
  15984. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  15985. } else if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic) {
  15986. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  15987. } else {
  15988. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  15989. }
  15990. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  15991. element_to_append.append(exp_el_par_1);
  15992. element_to_append.append(exp_el_expr_el_1);
  15993. element_to_append.append(exp_el_expr_operand);
  15994. element_to_append.append(exp_el_expr_el_2);
  15995. element_to_append.append(exp_el_par_2);
  15996. }
  15997. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  15998. var start_menu = '';
  15999. 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">';
  16000. 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>';
  16001. 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>';
  16002. start_menu += '</div></div>';
  16003. start_menu = $(start_menu);
  16004. start_menu.dropdown({
  16005. onChange: function onChange(value, text, $selectedItem) {
  16006. switch ($selectedItem.data('exp')) {
  16007. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_logic:
  16008. 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));
  16009. break;
  16010. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.EXPRESSION_TYPES.exp_arithmetic:
  16011. 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);
  16012. break;
  16013. }
  16014. initial_el_to_render.html('');
  16015. renderExpression(command, expression, function_obj, initial_el_to_render);
  16016. },
  16017. selectOnKeydown: false
  16018. });
  16019. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  16020. initial_el_to_render.append(start_menu);
  16021. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  16022. }
  16023. /***/ }),
  16024. /***/ "./js/visualUI/commands/contextualized_menu.js":
  16025. /*!*****************************************************!*\
  16026. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  16027. \*****************************************************/
  16028. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  16029. "use strict";
  16030. __webpack_require__.r(__webpack_exports__);
  16031. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  16032. /* harmony export */ "renderMenu": () => (/* binding */ renderMenu)
  16033. /* harmony export */ });
  16034. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16035. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16036. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16037. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16038. /* harmony import */ var _switch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  16039. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  16040. var menu_div = '<div class="ui dropdown menu_commands pause" ><button><i class="icon code"></i></button> <div class="menu"> ';
  16041. 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) {
  16042. 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>';
  16043. } else {
  16044. 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>';
  16045. 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>';
  16046. }
  16047. menu_div += '</div></div>';
  16048. menu_div = $(menu_div);
  16049. dom_where_render.append(menu_div);
  16050. addHandlers(command, dom_where_render, function_obj, dom_command);
  16051. if (command.collapsed) {
  16052. dom_command.children('.ui.block_commands').toggle();
  16053. }
  16054. }
  16055. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  16056. dom_where_render.find('.menu_commands').dropdown({
  16057. on: 'hover'
  16058. });
  16059. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  16060. 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) {
  16061. if (command.commands_block == null || command.commands_block.length == 0) {
  16062. command.commands_block = [];
  16063. var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_2__.genericCreateCommand($(this).data('command'));
  16064. command.commands_block.push(new_cmd);
  16065. _commands__WEBPACK_IMPORTED_MODULE_2__.renderCommand(new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  16066. } else {
  16067. _commands__WEBPACK_IMPORTED_MODULE_2__.createFloatingCommand(function_obj, dom_command.find('.block_commands'), $(this).data('command'), evt);
  16068. }
  16069. } else {
  16070. switch ($(this).data('command')) {
  16071. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES["break"]:
  16072. _commands__WEBPACK_IMPORTED_MODULE_2__.createFloatingCommand(function_obj, dom_command.find('.block_commands'), $(this).data('command'), evt);
  16073. break;
  16074. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.switchcase:
  16075. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  16076. break;
  16077. }
  16078. }
  16079. });
  16080. }
  16081. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  16082. if (command.cases == null) {
  16083. command.cases = [];
  16084. }
  16085. 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));
  16086. command.cases.push(sc);
  16087. _switch__WEBPACK_IMPORTED_MODULE_4__.renderCase(sc, command, function_obj, dom_command.find('.all_cases_div'));
  16088. }
  16089. /***/ }),
  16090. /***/ "./js/visualUI/commands/dowhiletrue.js":
  16091. /*!*********************************************!*\
  16092. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  16093. \*********************************************/
  16094. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  16095. "use strict";
  16096. __webpack_require__.r(__webpack_exports__);
  16097. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  16098. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  16099. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  16100. /* harmony export */ });
  16101. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16102. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16103. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  16104. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  16105. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  16106. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
  16107. function createFloatingCommand() {
  16108. 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>');
  16109. }
  16110. function renderCommand(command, function_obj) {
  16111. var ret = '';
  16112. 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>';
  16113. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  16114. ret += '</div>';
  16115. 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>';
  16116. 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> ';
  16117. ret += '</div>';
  16118. var el = $(ret);
  16119. el.data('command', command);
  16120. el.find('.block_commands').data('command', command);
  16121. addHandlers(command, function_obj, el);
  16122. _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'));
  16123. if (command.expression) {
  16124. _generic_expression__WEBPACK_IMPORTED_MODULE_4__.renderExpression(command, function_obj, el.find('.conditional_expression'), command.expression);
  16125. }
  16126. if (command.commands_block) {
  16127. for (var j = 0; j < command.commands_block.length; j++) {
  16128. _commands__WEBPACK_IMPORTED_MODULE_1__.renderCommand(command.commands_block[j], $(el.find('.block_commands')[0]), 3, function_obj);
  16129. }
  16130. }
  16131. if (command.lockexpression) {
  16132. if (command.expression) {
  16133. try {
  16134. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  16135. if (text) {
  16136. $(el.find('.conditional_expression')[el.find('.conditional_expression').length - 1]).toggle();
  16137. $(el.find('.textual_expression')[el.find('.textual_expression').length - 1]).text(text);
  16138. $(el.find('.textual_expression')[el.find('.textual_expression').length - 1]).toggle();
  16139. $(el.find('.button_alternate_expression')[el.find('.button_alternate_expression').length - 1]).toggleClass('unlock').toggleClass('lock');
  16140. }
  16141. } catch (e) {
  16142. command.lockexpression = false;
  16143. }
  16144. }
  16145. }
  16146. el.find('.unlock').popup({
  16147. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
  16148. delay: {
  16149. show: 750,
  16150. hide: 0
  16151. }
  16152. });
  16153. el.find('.lock').popup({
  16154. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
  16155. delay: {
  16156. show: 750,
  16157. hide: 0
  16158. }
  16159. });
  16160. el.find('.button_write_expression').popup({
  16161. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression"),
  16162. delay: {
  16163. show: 750,
  16164. hide: 0
  16165. }
  16166. });
  16167. return el;
  16168. }
  16169. function addHandlers(command, function_obj, dowhiletrue_dom) {
  16170. dowhiletrue_dom.find('.button_write_expression').on('click', function () {
  16171. window.expressionEdition = true;
  16172. window.inputExpression = null;
  16173. var afterWhichElement;
  16174. var lockButton = $(dowhiletrue_dom.find('.button_write_expression')[dowhiletrue_dom.find('.button_write_expression').length - 1]);
  16175. var editButton = $(this);
  16176. afterWhichElement = $(dowhiletrue_dom.find('.conditional_expression')[dowhiletrue_dom.find('.conditional_expression').length - 1]);
  16177. if (command.lockexpression) {
  16178. afterWhichElement = $(dowhiletrue_dom.find('.textual_expression')[dowhiletrue_dom.find('.textual_expression').length - 1]);
  16179. }
  16180. var text = "";
  16181. if (command.expression) {
  16182. if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
  16183. text = "";
  16184. } else {
  16185. try {
  16186. text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  16187. } catch (ex) {
  16188. text = "";
  16189. }
  16190. }
  16191. }
  16192. var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
  16193. var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
  16194. var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
  16195. input.val(text);
  16196. input.focusout(function (evt) {
  16197. ok_button.click();
  16198. evt.preventDefault();
  16199. return true;
  16200. });
  16201. input.keyup(function (evt) {
  16202. if (evt.keyCode == 27) {
  16203. // esc
  16204. cancel_button.click();
  16205. }
  16206. if (evt.keyCode == 13) {
  16207. // enter
  16208. ok_button.click();
  16209. }
  16210. });
  16211. ok_button.click(function () {
  16212. var parsed = null;
  16213. parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(input.val(), function_obj, input);
  16214. if (parsed) {
  16215. window.expressionEdition = false;
  16216. command.expression = parsed;
  16217. renderAlgorithm();
  16218. }
  16219. });
  16220. cancel_button.mousedown(function (evt) {
  16221. var parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(text, function_obj, input);
  16222. if (parsed) {
  16223. window.expressionEdition = false;
  16224. command.expression = parsed;
  16225. renderAlgorithm();
  16226. }
  16227. });
  16228. input.insertAfter(afterWhichElement);
  16229. input.focus();
  16230. cancel_button.insertAfter(input);
  16231. ok_button.insertAfter(input);
  16232. var len = text.length;
  16233. input[0].setSelectionRange(len, len);
  16234. afterWhichElement.css('display', 'none');
  16235. lockButton.css('display', 'none');
  16236. editButton.css('display', 'none');
  16237. ok_button.popup({
  16238. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_confirm"),
  16239. delay: {
  16240. show: 750,
  16241. hide: 0
  16242. }
  16243. });
  16244. cancel_button.popup({
  16245. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_cancel"),
  16246. delay: {
  16247. show: 750,
  16248. hide: 0
  16249. }
  16250. });
  16251. });
  16252. dowhiletrue_dom.find('.minimize_block_button').on('click', function (evt) {
  16253. dowhiletrue_dom.children('.ui.block_commands').toggle();
  16254. command.collapsed = !command.collapsed;
  16255. });
  16256. $(dowhiletrue_dom.find('.textual_expression')[0]).toggle();
  16257. dowhiletrue_dom.find('.button_alternate_expression').on('click', function () {
  16258. if (command.expression) {
  16259. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  16260. if (text) {
  16261. $(dowhiletrue_dom.find('.conditional_expression')[dowhiletrue_dom.find('.conditional_expression').length - 1]).toggle();
  16262. $(dowhiletrue_dom.find('.textual_expression')[dowhiletrue_dom.find('.textual_expression').length - 1]).text(text);
  16263. $(dowhiletrue_dom.find('.textual_expression')[dowhiletrue_dom.find('.textual_expression').length - 1]).toggle();
  16264. $(this).toggleClass('unlock').toggleClass('lock');
  16265. command.lockexpression = !command.lockexpression;
  16266. }
  16267. }
  16268. if (command.lockexpression) {
  16269. dowhiletrue_dom.find('.lock').popup({
  16270. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
  16271. delay: {
  16272. show: 750,
  16273. hide: 0
  16274. }
  16275. });
  16276. } else {
  16277. dowhiletrue_dom.find('.unlock').popup({
  16278. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
  16279. delay: {
  16280. show: 750,
  16281. hide: 0
  16282. }
  16283. });
  16284. }
  16285. });
  16286. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  16287. if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, dowhiletrue_dom)) {
  16288. dowhiletrue_dom.fadeOut(400, function () {
  16289. dowhiletrue_dom.remove();
  16290. });
  16291. }
  16292. });
  16293. }
  16294. /***/ }),
  16295. /***/ "./js/visualUI/commands/functioncall.js":
  16296. /*!**********************************************!*\
  16297. !*** ./js/visualUI/commands/functioncall.js ***!
  16298. \**********************************************/
  16299. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  16300. "use strict";
  16301. __webpack_require__.r(__webpack_exports__);
  16302. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  16303. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  16304. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  16305. /* harmony export */ });
  16306. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16307. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16308. function createFloatingCommand() {
  16309. return $('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  16310. }
  16311. function renderCommand(command, function_obj) {
  16312. 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>');
  16313. el.data('command', command);
  16314. _variable_value_menu__WEBPACK_IMPORTED_MODULE_0__.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  16315. addHandlers(command, function_obj, el);
  16316. return el;
  16317. }
  16318. function addHandlers(command, function_obj, functioncall_dom) {
  16319. functioncall_dom.find('.button_remove_command').on('click', function () {
  16320. if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, functioncall_dom)) {
  16321. functioncall_dom.fadeOut(400, function () {
  16322. functioncall_dom.remove();
  16323. });
  16324. }
  16325. });
  16326. }
  16327. /***/ }),
  16328. /***/ "./js/visualUI/commands/generic_expression.js":
  16329. /*!****************************************************!*\
  16330. !*** ./js/visualUI/commands/generic_expression.js ***!
  16331. \****************************************************/
  16332. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  16333. "use strict";
  16334. __webpack_require__.r(__webpack_exports__);
  16335. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  16336. /* harmony export */ "renderExpression": () => (/* binding */ renderExpression),
  16337. /* harmony export */ "expressionParserToVisual": () => (/* binding */ expressionParserToVisual),
  16338. /* harmony export */ "searchFunction": () => (/* binding */ searchFunction),
  16339. /* harmony export */ "expressionParserCodeVisual": () => (/* binding */ expressionParserCodeVisual)
  16340. /* harmony export */ });
  16341. /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
  16342. /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__);
  16343. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16344. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16345. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16346. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16347. /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../services/userLog */ "./js/services/userLog.js");
  16348. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  16349. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_6__);
  16350. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils */ "./js/visualUI/utils.js");
  16351. window.timer = false;
  16352. function renderExpression(command, function_obj, div_to_render, expression_array) {
  16353. div_to_render.empty();
  16354. melanke_watchjs__WEBPACK_IMPORTED_MODULE_6___default().unwatch(command, "expression");
  16355. melanke_watchjs__WEBPACK_IMPORTED_MODULE_6___default().watch(command, "expression", function () {
  16356. if (window.timer) return;
  16357. var m = div_to_render.find(".single_element_expression").not(".mouse_distance").not(".add_parentheses");
  16358. var s = "";
  16359. m.each(function (e) {
  16360. if ($(this).hasClass("parentheses_in_expression")) {
  16361. s += $(this).text() + " ";
  16362. } else {
  16363. s += $(this).find(".text").text();
  16364. s += $(this).find(".var_name").text();
  16365. s += $(this).find(".parameters_function_called").text();
  16366. s += $(this).find(".value_rendered").text();
  16367. s += " ";
  16368. }
  16369. });
  16370. if (s) {
  16371. window.timer = true;
  16372. } else {
  16373. return;
  16374. }
  16375. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_5__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_5__.ActionTypes.CHANGE_COMMAND_EXP, command.type, "/", s);
  16376. setTimeout(function () {
  16377. window.timer = false;
  16378. }, 200);
  16379. }, 20, true);
  16380. if (command.type === _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.COMMAND_TYPES.attribution) {
  16381. melanke_watchjs__WEBPACK_IMPORTED_MODULE_6___default().unwatch(command.variable);
  16382. melanke_watchjs__WEBPACK_IMPORTED_MODULE_6___default().watch(command.variable, function () {
  16383. renderExpression(command, function_obj, div_to_render, expression_array);
  16384. }, 0);
  16385. if (command.variable.content) {
  16386. var types_included = [];
  16387. if (command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__.Types.INTEGER || command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__.Types.REAL) {
  16388. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic);
  16389. } else if (command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__.Types.BOOLEAN) {
  16390. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional);
  16391. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic);
  16392. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic);
  16393. } else if (command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__.Types.TEXT) {
  16394. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional);
  16395. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic);
  16396. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic);
  16397. } else {//console.log("NÃO RECONHECI! VEJA: ", command.variable.content.type);
  16398. }
  16399. renderElements(command, function_obj, div_to_render, expression_array, types_included);
  16400. } else {
  16401. div_to_render.text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("var_menu_select_var").toLowerCase());
  16402. }
  16403. } else {
  16404. var _types_included = [];
  16405. _types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional);
  16406. _types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic);
  16407. 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);
  16408. _types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic);
  16409. renderElements(command, function_obj, div_to_render, expression_array, _types_included);
  16410. }
  16411. div_to_render.children(".mouse_distance").addClass("mouse_distance_hidden");
  16412. div_to_render.children(".higher_element").on("mousemove", function (evt) {
  16413. if (!window.open_or_close) {
  16414. $(this).css("position", "relative", "!important");
  16415. $(this).children(".mouse_distance").css("opacity", "1");
  16416. }
  16417. });
  16418. div_to_render.children(".higher_element").on("mouseout", function (evt) {
  16419. if (!window.open_or_close) {
  16420. $(this).css("position", "absolute", "!important");
  16421. $(this).children(".mouse_distance").css("opacity", "0");
  16422. }
  16423. });
  16424. var lixeira = $('<div class="lixeira" draggable="true"></div>');
  16425. div_to_render.find(".single_element_expression").on("mousedown", function (evt) {
  16426. window.posX = evt.clientX;
  16427. window.posY = evt.clientY;
  16428. });
  16429. Sortable.create(div_to_render[0], {
  16430. animation: 100,
  16431. ghostClass: "ghost",
  16432. group: {
  16433. name: "shared",
  16434. put: false // Do not allow items to be put into this list
  16435. },
  16436. draggable: ".single_element_expression",
  16437. sort: false,
  16438. filter: ".not_allowed",
  16439. onStart: function onStart() {
  16440. $("body").append(lixeira);
  16441. lixeira.css("display", "block");
  16442. lixeira.css("top", window.posY + 70, "!important");
  16443. lixeira.css("left", window.posX - 20, "!important");
  16444. },
  16445. onMove: function onMove() {
  16446. lixeira.addClass("color_test");
  16447. },
  16448. onEnd: function onEnd() {
  16449. lixeira.remove();
  16450. div_to_render.find(".ghost").removeClass("ghost");
  16451. }
  16452. });
  16453. new Sortable(lixeira[0], {
  16454. group: "shared",
  16455. animation: 150,
  16456. onAdd: function onAdd(evt) {
  16457. lixeira.css("display", "none");
  16458. lixeira.find(".single_element_expression").remove();
  16459. lixeira.css("background-color", "");
  16460. lixeira.remove();
  16461. removeElement(evt, expression_array);
  16462. renderExpression(command, function_obj, div_to_render, expression_array);
  16463. }
  16464. });
  16465. }
  16466. function removeElement(event, expression_array) {
  16467. var indice = $(event.item).data("index");
  16468. var first = expression_array[0];
  16469. if (expression_array[indice].type) {
  16470. // if is alone in expression:
  16471. if (expression_array.length == 1) {
  16472. //function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  16473. expression_array.splice(0, 1);
  16474. } else if (expression_array.length > 1) {
  16475. if (indice > 0 && expression_array[indice - 1].type_op) {
  16476. if (indice < expression_array.length && expression_array[indice - 2] == "(" && expression_array[indice + 1].type_op) {
  16477. expression_array.splice(indice + 1, 1);
  16478. }
  16479. expression_array.splice(indice, 1);
  16480. expression_array.splice(indice - 1, 1);
  16481. if (indice - 2 < expression_array.length && expression_array[indice - 2] == "(" && expression_array[indice - 1] == ")") {
  16482. expression_array.splice(indice - 1, 1);
  16483. expression_array.splice(indice - 2, 1);
  16484. if (indice - 3 >= 0 && indice - 3 < expression_array.length && expression_array[indice - 3].type_op) {
  16485. expression_array.splice(indice - 3, 1);
  16486. }
  16487. }
  16488. } else if (indice < expression_array.length - 1 && expression_array[indice + 1].type_op) {
  16489. expression_array.splice(indice + 1, 1);
  16490. expression_array.splice(indice, 1);
  16491. } else if (indice < expression_array.length - 1 && indice > 0 && expression_array[indice - 1] == "(" && expression_array[indice + 1] == ")") {
  16492. if (indice > 1 && expression_array[indice - 2].type_op) {
  16493. expression_array.splice(indice + 1, 1);
  16494. expression_array.splice(indice, 1);
  16495. expression_array.splice(indice - 1, 1);
  16496. expression_array.splice(indice - 2, 1);
  16497. } else if (indice < expression_array.length - 2 && expression_array[indice + 2].type_op) {
  16498. expression_array.splice(indice + 1, 1);
  16499. expression_array.splice(indice, 1);
  16500. expression_array.splice(indice - 1, 1);
  16501. } else {
  16502. expression_array.splice(indice + 1, 1);
  16503. expression_array.splice(indice, 1);
  16504. expression_array.splice(indice - 1, 1);
  16505. }
  16506. }
  16507. }
  16508. } else if (expression_array[indice].type_op) {// iVProg doesn't support operator remove
  16509. } else {
  16510. var opening = -1;
  16511. var closing = -1;
  16512. if (expression_array[indice] == "(") {
  16513. opening = indice;
  16514. for (var i = indice + 1; i < expression_array.length; i++) {
  16515. if (expression_array[i] == ")") {
  16516. closing = i;
  16517. break;
  16518. }
  16519. }
  16520. } else {
  16521. closing = indice;
  16522. for (var i = indice - 1; i >= 0; i--) {
  16523. if (expression_array[i] == "(") {
  16524. opening = i;
  16525. break;
  16526. }
  16527. }
  16528. }
  16529. if (expression_array[opening + 1].type_op) {
  16530. expression_array.splice(closing, 1);
  16531. expression_array.splice(opening + 1, 1);
  16532. expression_array.splice(opening, 1);
  16533. } else {
  16534. expression_array.splice(closing, 1);
  16535. expression_array.splice(opening, 1);
  16536. }
  16537. } // if expression is empty, add a new var value:
  16538. if (expression_array.length == 0) {
  16539. 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));
  16540. }
  16541. if (first != expression_array[0] && expression_array[0].type_op) {
  16542. expression_array.splice(0, 1);
  16543. }
  16544. }
  16545. function renderElements(command, function_obj, div_to_render, expression_array, types_included) {
  16546. /*if (expression_array.length > 0) {
  16547. if (!expression_array[0].type_op) {
  16548. renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, 0);
  16549. }
  16550. }*/
  16551. var i = 0;
  16552. for (i = 0; i < expression_array.length; i++) {
  16553. if (expression_array[i].type == "var_value") {
  16554. var div_temp = $('<div class="single_element_expression" data-index="' + i + '"></div>');
  16555. if (i == 0) {
  16556. if (expression_array.length > 0 && !expression_array[0].type_op) {//renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, 0);
  16557. }
  16558. }
  16559. _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, expression_array[i], div_temp, function_obj);
  16560. div_to_render.append(div_temp);
  16561. } else if (expression_array[i] == "(" || expression_array[i] == ")") {
  16562. if (expression_array[i] == ")") {
  16563. renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, i);
  16564. renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
  16565. } else if (expression_array[i] == "(" && !expression_array[i + 1].type_op) {
  16566. renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
  16567. renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, i + 1);
  16568. } else {
  16569. renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
  16570. }
  16571. } else {
  16572. if (i == 0) {} else if (expression_array[i - 1] == "(") {}
  16573. renderOperatorMenu(command, function_obj, div_to_render, expression_array[i], types_included, i, expression_array);
  16574. }
  16575. }
  16576. renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, i, true);
  16577. renderAddParenthesis(command, function_obj, div_to_render, expression_array, types_included);
  16578. }
  16579. window.parentheses_activate = false;
  16580. window.open_or_close = null;
  16581. function renderAddParenthesis(command, function_obj, div_to_render, expression_array, types_included) {
  16582. 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>');
  16583. div_to_render.append(addParentheses);
  16584. addParentheses.popup({
  16585. content: "Adicionar parênteses",
  16586. delay: {
  16587. show: 750,
  16588. hide: 0
  16589. }
  16590. });
  16591. addParentheses.on("click", function (mouse_event) {
  16592. // verificar se já está ativado
  16593. if (window.parentheses_activate) {
  16594. return;
  16595. }
  16596. div_to_render.find(".usepointer").off("click");
  16597. window.parentheses_activate = true;
  16598. window.open_or_close = "open";
  16599. div_to_render.find(".dropdown").addClass("disabled");
  16600. div_to_render.find(".ghost_element").addClass("temp_class");
  16601. div_to_render.find(".ghost_element").removeClass("ghost_element");
  16602. var floatingObject = $('<div class="floating_parenthesis"> ( </div>');
  16603. floatingObject.draggable().appendTo("body");
  16604. floatingObject.css("position", "absolute");
  16605. mouse_event.type = "mousedown.draggable";
  16606. mouse_event.target = floatingObject[0];
  16607. floatingObject.css("left", mouse_event.pageX + 10);
  16608. floatingObject.css("top", mouse_event.pageY + 10);
  16609. floatingObject.trigger(mouse_event);
  16610. div_to_render.on("mousemove", function (evt) {
  16611. var actual_target = null;
  16612. if ($(evt.target).hasClass("single_element_expression")) {
  16613. actual_target = $(evt.target);
  16614. } else {
  16615. actual_target = $(evt.target).closest(".single_element_expression");
  16616. }
  16617. 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")) {
  16618. return;
  16619. }
  16620. renderGhostParentheses(actual_target, command, function_obj, div_to_render, expression_array);
  16621. });
  16622. div_to_render.on("mouseleave", function () {
  16623. /*window.open_parentheses.remove();
  16624. window.close_parentheses.remove();*/
  16625. });
  16626. var floating;
  16627. $("body").on("mouseup", function (evt) {
  16628. if (window.open_or_close == "open") {
  16629. window.open_or_close = "close";
  16630. floatingObject.remove();
  16631. var comando_que_esta = $(evt.target).closest(".command_container");
  16632. var comando_certo = div_to_render.closest(".command_container");
  16633. if (!comando_que_esta.is(comando_certo)) {
  16634. window.parentheses_activate = false;
  16635. div_to_render.find(".temp_class").addClass("ghost_element");
  16636. div_to_render.find(".temp_class").removeClass("temp_class");
  16637. div_to_render.off("mousemove");
  16638. div_to_render.off("mouseleave");
  16639. $("body").off("mouseup");
  16640. window.open_parentheses.remove();
  16641. window.close_parentheses.remove();
  16642. window.inserir_open = -1;
  16643. window.inserir_close = -1;
  16644. window.open_or_close = null;
  16645. renderExpression(command, function_obj, div_to_render, expression_array);
  16646. return;
  16647. }
  16648. window.open_parentheses.addClass("parentheses_fixed");
  16649. floating = $('<div class="floating_parenthesis"> ) </div>');
  16650. floating.draggable().appendTo("body");
  16651. floating.css("position", "absolute");
  16652. floating.css("left", evt.pageX + 10);
  16653. floating.css("top", evt.pageY + 10);
  16654. $("body").on("mousemove", function (evts) {
  16655. floating.css("left", evts.pageX + 10);
  16656. floating.css("top", evts.pageY + 10);
  16657. });
  16658. } else {
  16659. floating.remove();
  16660. window.open_parentheses.removeClass("parentheses_fixed");
  16661. div_to_render.off("mousemove");
  16662. div_to_render.off("mouseleave");
  16663. $("body").off("mouseup");
  16664. setTimeout(function () {
  16665. window.parentheses_activate = false;
  16666. }, 50);
  16667. var comando_que_esta = $(evt.target).closest(".command_container");
  16668. var comando_certo = div_to_render.closest(".command_container");
  16669. var is_correct = false;
  16670. if (comando_que_esta.is(comando_certo)) {
  16671. is_correct = true;
  16672. }
  16673. if (is_correct) {
  16674. expression_array.splice(window.inserir_open, 0, "(");
  16675. expression_array.splice(window.inserir_close, 0, ")");
  16676. }
  16677. window.inserir_open = -1;
  16678. window.inserir_close = -1;
  16679. window.open_or_close = null;
  16680. renderExpression(command, function_obj, div_to_render, expression_array);
  16681. }
  16682. });
  16683. });
  16684. }
  16685. window.open_parentheses = $('<div class="parentheses_ghost">(</div>');
  16686. window.close_parentheses = $('<div class="parentheses_ghost">)</div>');
  16687. window.inserir_open = -1;
  16688. window.inserir_close = -1;
  16689. function renderGhostParentheses(actual_target, command, function_obj, div_to_render, expression_array) {
  16690. /*window.open_parentheses.remove();
  16691. window.close_parentheses.remove();*/
  16692. var index_in_array = actual_target.data("index");
  16693. if (expression_array[index_in_array] == "(" || expression_array[index_in_array] == ")") {
  16694. return;
  16695. }
  16696. if (window.open_or_close == "close") {
  16697. if (index_in_array < window.inserir_open) {
  16698. return;
  16699. }
  16700. } // Tratando a situação quando é na primeira posição:
  16701. if (index_in_array == 0) {
  16702. if (expression_array[index_in_array].type == "var_value") {
  16703. if (window.open_or_close == "open") {
  16704. window.open_parentheses.insertBefore(actual_target);
  16705. window.inserir_open = index_in_array;
  16706. }
  16707. /*if (expression_array.length == 1) {
  16708. if (window.open_or_close == "close") {
  16709. window.close_parentheses.insertAfter(actual_target);
  16710. window.inserir_close = index_in_array + 2;
  16711. }*/
  16712. //} else {
  16713. var count_opened = 0;
  16714. var count_closed = 0;
  16715. for (var i = 0; i < expression_array.length; i++) {
  16716. if (expression_array[i] == "(") {
  16717. count_opened++;
  16718. }
  16719. if (expression_array[i] == ")") {
  16720. count_closed++;
  16721. }
  16722. if (count_opened != count_closed) {} else {
  16723. if (count_opened > 0) {
  16724. if (window.open_or_close == "close") {
  16725. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  16726. window.inserir_close = i + 2;
  16727. }
  16728. break;
  16729. } else {
  16730. if (expression_array[i].type == "var_value") {
  16731. if (window.open_or_close == "close") {
  16732. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  16733. window.inserir_close = i + 2;
  16734. }
  16735. break;
  16736. }
  16737. }
  16738. }
  16739. } //}
  16740. } else if (expression_array[index_in_array].type_op) {
  16741. if (window.open_or_close == "open") {
  16742. window.open_parentheses.insertBefore(actual_target);
  16743. window.inserir_open = index_in_array;
  16744. }
  16745. var count_opened = 0;
  16746. var count_closed = 0;
  16747. for (var i = 1; i < expression_array.length; i++) {
  16748. // $('.slide-link[data-slide="0"]')
  16749. if (expression_array[i] == "(") {
  16750. count_opened++;
  16751. }
  16752. if (expression_array[i] == ")") {
  16753. count_closed++;
  16754. }
  16755. if (count_opened != count_closed) {} else {
  16756. if (count_opened > 0) {
  16757. if (expression_array[i].type == "var_value") {
  16758. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  16759. window.inserir_close = i + 2;
  16760. }
  16761. break;
  16762. } else {
  16763. if (expression_array[i].type == "var_value") {
  16764. if (expression_array[i].type == "var_value") {
  16765. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  16766. window.inserir_close = i + 2;
  16767. }
  16768. break;
  16769. }
  16770. }
  16771. }
  16772. }
  16773. }
  16774. return;
  16775. } // Tratando quando não é no índice 0:
  16776. if (expression_array[index_in_array].type == "var_value") {
  16777. if (window.open_or_close == "open") {
  16778. window.open_parentheses.insertBefore(actual_target);
  16779. window.inserir_open = index_in_array;
  16780. }
  16781. if (window.open_or_close == "close") {
  16782. window.close_parentheses.insertAfter(actual_target);
  16783. window.inserir_close = index_in_array + 2;
  16784. }
  16785. return;
  16786. }
  16787. if (expression_array[index_in_array].type_op) {
  16788. // buscar para a esquerda primeiro:
  16789. if (expression_array[index_in_array - 1] == "(") {
  16790. if (window.open_or_close == "open") {
  16791. window.open_parentheses.insertBefore(actual_target);
  16792. window.inserir_open = index_in_array;
  16793. }
  16794. } else if (expression_array[index_in_array - 1] == ")") {
  16795. // buscar a abertura
  16796. var count_opened = 0;
  16797. var count_closed = 0;
  16798. for (var j = index_in_array - 1; j >= 0; j--) {
  16799. if (expression_array[j] == "(") {
  16800. count_opened++;
  16801. }
  16802. if (expression_array[j] == ")") {
  16803. count_closed++;
  16804. }
  16805. if (count_opened != count_closed) {} else {
  16806. if (count_closed > 0) {
  16807. if (window.open_or_close == "open") {
  16808. window.open_parentheses.insertBefore(div_to_render.find('.single_element_expression[data-index="' + j + '"]'));
  16809. window.inserir_open = j;
  16810. }
  16811. break;
  16812. }
  16813. }
  16814. }
  16815. } else if (expression_array[index_in_array - 1].type == "var_value") {
  16816. if (window.open_or_close == "open") {
  16817. window.open_parentheses.insertBefore(div_to_render.find('.single_element_expression[data-index="' + (index_in_array - 1) + '"]'));
  16818. window.inserir_open = index_in_array - 1;
  16819. }
  16820. } // buscar para a direita agora:
  16821. if (expression_array[index_in_array + 1] == "(") {
  16822. // buscar o fechamento:
  16823. var count_opened = 0;
  16824. var count_closed = 0;
  16825. for (var j = index_in_array + 1; j < expression_array.length; j++) {
  16826. if (expression_array[j] == "(") {
  16827. count_opened++;
  16828. }
  16829. if (expression_array[j] == ")") {
  16830. count_closed++;
  16831. }
  16832. if (count_opened != count_closed) {} else {
  16833. if (count_opened > 0) {
  16834. if (window.open_or_close == "close") {
  16835. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + j + '"]'));
  16836. window.inserir_close = j + 2;
  16837. }
  16838. break;
  16839. }
  16840. }
  16841. }
  16842. } else if (expression_array[index_in_array + 1].type == "var_value") {
  16843. if (window.open_or_close == "close") {
  16844. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + (index_in_array + 1) + '"]'));
  16845. window.inserir_close = index_in_array + 3;
  16846. }
  16847. }
  16848. }
  16849. }
  16850. function renderParenthesis(div_to_render, expression_content, command, function_obj, position, expression_array) {
  16851. var ghost_parenthesis = $('<div class="single_element_expression parentheses_in_expression" data-index="' + position + '">' + expression_content + "</div>");
  16852. div_to_render.append(ghost_parenthesis);
  16853. }
  16854. function renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, position) {
  16855. var menu_final = '<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
  16856. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
  16857. if (types_included.length > 1) {
  16858. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_arithmetic_expression") + '<div class="menu">';
  16859. menu_final += getArithmeticOperators();
  16860. menu_final += "</div></div>";
  16861. } else {
  16862. menu_final += getArithmeticOperators();
  16863. }
  16864. }
  16865. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic) >= 0) {
  16866. if (types_included.length > 1) {
  16867. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_logic_expression") + '<div class="menu">';
  16868. menu_final += getLogicOperators();
  16869. menu_final += "</div></div>";
  16870. } else {
  16871. menu_final += getLogicOperators();
  16872. }
  16873. }
  16874. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional) >= 0) {
  16875. if (types_included.length > 1) {
  16876. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_relational_expression") + '<div class="menu">';
  16877. menu_final += getRelationalOperators();
  16878. menu_final += "</div></div>";
  16879. } else {
  16880. menu_final += getRelationalOperators();
  16881. }
  16882. }
  16883. menu_final += "</div></div>";
  16884. menu_final = $(menu_final);
  16885. var div_temp = $('<div class="single_element_expression ghost_element mouse_distance"></div>');
  16886. div_temp.append(menu_final);
  16887. var div_higher = $('<div class="higher_element"></div>');
  16888. div_higher.append(div_temp);
  16889. div_to_render.append(div_higher);
  16890. menu_final.dropdown("set selected", _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.minus);
  16891. div_temp.on("click", function () {
  16892. if (!window.open_or_close) {
  16893. var sera = position;
  16894. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
  16895. 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));
  16896. } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic) >= 0) {
  16897. 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));
  16898. } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional) >= 0) {
  16899. 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));
  16900. }
  16901. renderExpression(command, function_obj, div_to_render, expression_array);
  16902. }
  16903. });
  16904. }
  16905. function renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, position) {
  16906. var is_last = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
  16907. var menu_final = '<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
  16908. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
  16909. if (types_included.length > 1) {
  16910. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_arithmetic_expression") + '<div class="menu">';
  16911. menu_final += getArithmeticOperators();
  16912. menu_final += "</div></div>";
  16913. } else {
  16914. menu_final += getArithmeticOperators();
  16915. }
  16916. }
  16917. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic) >= 0) {
  16918. if (types_included.length > 1) {
  16919. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_logic_expression") + '<div class="menu">';
  16920. menu_final += getLogicOperators();
  16921. menu_final += "</div></div>";
  16922. } else {
  16923. menu_final += getLogicOperators();
  16924. }
  16925. }
  16926. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional) >= 0) {
  16927. if (types_included.length > 1) {
  16928. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_relational_expression") + '<div class="menu">';
  16929. menu_final += getRelationalOperators();
  16930. menu_final += "</div></div>";
  16931. } else {
  16932. menu_final += getRelationalOperators();
  16933. }
  16934. }
  16935. menu_final += "</div></div>";
  16936. menu_final = $(menu_final);
  16937. var div_temp = $('<div class="simple_add mouse_distance"></div>');
  16938. var div_higher = $('<div class="higher_element"></div>');
  16939. var button = $('<button class="ui button green add_expression"><i class="plus circle inverted icon"></i></button>');
  16940. div_temp.append(button);
  16941. if (!is_last) {
  16942. div_higher.append(div_temp);
  16943. div_to_render.append(div_higher); //div_temp.append(menu_final);
  16944. div_temp.css("opacity", "0", "!important");
  16945. } else {
  16946. div_temp.removeClass("mouse_distance");
  16947. div_temp.css("opacity", "1", "!important"); //div_temp.append(menu_final);
  16948. div_to_render.append(div_temp);
  16949. }
  16950. menu_final.dropdown("set selected", _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.ARITHMETIC_TYPES.plus);
  16951. div_temp.on("click", function () {
  16952. var sera = position;
  16953. if (expression_array[sera] == ")" && expression_array[sera - 1] == "(") {
  16954. 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));
  16955. renderExpression(command, function_obj, div_to_render, expression_array);
  16956. return;
  16957. }
  16958. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
  16959. 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));
  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_logic) >= 0) {
  16962. 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));
  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. } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional) >= 0) {
  16965. 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));
  16966. 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));
  16967. }
  16968. renderExpression(command, function_obj, div_to_render, expression_array);
  16969. });
  16970. }
  16971. function renderOperatorMenu(command, function_obj, div_to_render, expression_element, types_included, position, expression_array) {
  16972. var menu_final = '<div class="ui dropdown"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
  16973. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.write_sep) >= 0) {
  16974. menu_final += getSeparator();
  16975. }
  16976. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
  16977. if (types_included.length > 1) {
  16978. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_arithmetic_expression") + '<div class="menu">';
  16979. menu_final += getArithmeticOperators();
  16980. menu_final += "</div></div>";
  16981. } else {
  16982. menu_final += getArithmeticOperators();
  16983. }
  16984. }
  16985. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_logic) >= 0) {
  16986. if (types_included.length > 1) {
  16987. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_logic_expression") + '<div class="menu">';
  16988. menu_final += getLogicOperators();
  16989. menu_final += "</div></div>";
  16990. } else {
  16991. menu_final += getLogicOperators();
  16992. }
  16993. }
  16994. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__.EXPRESSION_TYPES.exp_conditional) >= 0) {
  16995. if (types_included.length > 1) {
  16996. menu_final += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("text_relational_expression") + '<div class="menu">';
  16997. menu_final += getRelationalOperators();
  16998. menu_final += "</div></div>";
  16999. } else {
  17000. menu_final += getRelationalOperators();
  17001. }
  17002. }
  17003. menu_final += "</div></div>";
  17004. menu_final = $(menu_final);
  17005. menu_final.find(".ivprog-write-sep").popup({
  17006. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI("write_seprator_menu_tooltip"),
  17007. delay: {
  17008. show: 500,
  17009. hide: 0
  17010. }
  17011. });
  17012. var div_temp = $('<div class="single_element_expression not_allowed" data-index="' + position + '"></div>');
  17013. div_temp.append(menu_final);
  17014. div_to_render.append(div_temp);
  17015. menu_final.dropdown({
  17016. onChange: function onChange(_value, _text, $selectedItem) {
  17017. expression_element.item = $selectedItem.data("value");
  17018. expression_element.type_op = $selectedItem.data("type");
  17019. }
  17020. });
  17021. menu_final.dropdown("set selected", expression_element.item);
  17022. }
  17023. function getArithmeticOperators() {
  17024. var arithmetic_operators;
  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.plus + '">+</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.minus + '">-</div>';
  17027. 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>';
  17028. 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>';
  17029. 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>';
  17030. return arithmetic_operators;
  17031. }
  17032. function getLogicOperators() {
  17033. var logic_operators;
  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.equals_to + '">==</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_equals_to + '">!=</div>';
  17036. 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>";
  17037. 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>";
  17038. 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>";
  17039. return logic_operators;
  17040. }
  17041. function getRelationalOperators() {
  17042. var relational_operators;
  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.greater_than + '">></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.less_than + '"><</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.equals_to + '">==</div>';
  17046. 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>';
  17047. 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>';
  17048. 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>';
  17049. return relational_operators;
  17050. }
  17051. function getSeparator() {
  17052. 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>");
  17053. }
  17054. function getVariable(function_obj, search) {
  17055. if (search == ")" || search == "(") {
  17056. return search;
  17057. }
  17058. if (search.instance == "operator") {
  17059. var obj;
  17060. switch (search.value) {
  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.plus);
  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.minus);
  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.multiplication);
  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.division);
  17072. break;
  17073. case '%':
  17074. 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);
  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.greater_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.less_than);
  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.greater_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.less_than_or_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.equals_to);
  17090. break;
  17091. case '!=':
  17092. 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);
  17093. break;
  17094. case 'and':
  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.and);
  17096. break;
  17097. case 'or':
  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.or);
  17099. break;
  17100. case 'not':
  17101. 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);
  17102. break;
  17103. }
  17104. return obj;
  17105. }
  17106. if (search.instance == "expression" && search.type == "const") {
  17107. if (search.value === true) {
  17108. 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);
  17109. return obj;
  17110. }
  17111. if (search.value === false) {
  17112. 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);
  17113. return obj;
  17114. }
  17115. 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);
  17116. return obj;
  17117. }
  17118. var variavel = null;
  17119. if (search.instance == "expression" && search.type == "var") {
  17120. // 1. Procurar a variável na função:
  17121. for (var j = 0; j < function_obj.variables_list.length; j++) {
  17122. if (function_obj.variables_list[j].name == search.value) {
  17123. variavel = function_obj.variables_list[j];
  17124. break;
  17125. }
  17126. } // 2. Procurar a variável nas gloais:
  17127. if (!variavel) for (var j = 0; j < program_obj.globals.length; j++) {
  17128. if (program_obj.globals[j].name == search.value) {
  17129. variavel = program_obj.globals[j];
  17130. break;
  17131. }
  17132. } // 3. Procurar na lista de parâmetros:
  17133. if (!variavel) for (var j = 0; j < function_obj.parameters_list.length; j++) {
  17134. if (function_obj.parameters_list[j].name == search.value) {
  17135. variavel = function_obj.parameters_list[j];
  17136. break;
  17137. }
  17138. }
  17139. }
  17140. if (search.instance == "expression" && search.type == "var" && !search.line) {
  17141. 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);
  17142. return obj;
  17143. }
  17144. if (search.instance == "expression" && search.type == "var" && search["class"] == "vector") {
  17145. 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);
  17146. return obj;
  17147. }
  17148. if (search.instance == "expression" && search.type == "var" && search["class"] == "matrix") {
  17149. 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);
  17150. return obj;
  17151. }
  17152. if (search.instance == "expression" && search.type == "function") {
  17153. 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:
  17154. for (var i = 0; i < program_obj.functions.length; i++) {
  17155. if (program_obj.functions[i].name == search.value) {
  17156. obj.function_called = program_obj.functions[i];
  17157. }
  17158. } // Se ainda não foi encontrada, procurar na biblioteca do iVProg:
  17159. if (!obj.function_called) {
  17160. for (var i = 0; i < window.system_functions.length; i++) {
  17161. if (search.value.split(".")[1] && search.value.split(".")[1] == window.system_functions[i].identifier) {
  17162. obj.function_called = window.system_functions[i];
  17163. } else if (search.value == window.system_functions[i].identifier) {
  17164. obj.function_called = window.system_functions[i];
  17165. }
  17166. }
  17167. }
  17168. obj.parameters_list = [];
  17169. for (var i = 0; i < search.params.length; i++) {
  17170. obj.parameters_list.push(getVariable(function_obj, search.params[i][0]));
  17171. }
  17172. return obj;
  17173. }
  17174. }
  17175. function expressionParserToVisual(text, function_obj, input_field) {
  17176. if (text.trim().length == 0) {
  17177. 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)];
  17178. }
  17179. var var_not_found = [];
  17180. var fun_not_found = [];
  17181. var parsed;
  17182. try {
  17183. parsed = ivprogCore.parseExpression(text);
  17184. } catch (ex) {
  17185. _utils__WEBPACK_IMPORTED_MODULE_7__.renderErrorMessage(input_field, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('expression_invalid'));
  17186. }
  17187. if (!parsed) return null;
  17188. for (var i = 0; i < parsed.length; i++) {
  17189. var variavel = null;
  17190. if (parsed[i].instance == "expression" && parsed[i].type == "var") {
  17191. // 1. Procurar a variável na função:
  17192. for (var j = 0; j < function_obj.variables_list.length; j++) {
  17193. if (function_obj.variables_list[j].name == parsed[i].value) {
  17194. variavel = function_obj.variables_list[j];
  17195. break;
  17196. }
  17197. } // 2. Procurar a variável nas globais:
  17198. if (!variavel) for (var j = 0; j < program_obj.globals.length; j++) {
  17199. if (program_obj.globals[j].name == parsed[i].value) {
  17200. variavel = program_obj.globals[j];
  17201. break;
  17202. }
  17203. } // 3. Procurar a variável nos parâmetros:
  17204. if (!variavel) for (var j = 0; j < function_obj.parameters_list.length; j++) {
  17205. if (function_obj.parameters_list[j].name == parsed[i].value) {
  17206. variavel = function_obj.parameters_list[j];
  17207. break;
  17208. }
  17209. }
  17210. if (!variavel) var_not_found.push(parsed[i].value);
  17211. }
  17212. var funcao;
  17213. if (parsed[i].instance == "expression" && parsed[i].type == "function") {
  17214. // Procurar a função para referência:
  17215. for (var j = 0; j < program_obj.functions.length; j++) {
  17216. if (program_obj.functions[j].name == parsed[i].value) {
  17217. funcao = program_obj.functions[j];
  17218. }
  17219. } // Se ainda não encontrou, procurar na biblioteca do iVProg:
  17220. if (!funcao) {
  17221. for (var j = 0; j < window.system_functions.length; j++) {
  17222. if (parsed[i].value.split(".")[1] && parsed[i].value.split(".")[1] == window.system_functions[j].identifier) {
  17223. funcao = window.system_functions[j];
  17224. } else if (parsed[i].value == window.system_functions[j].identifier) {
  17225. funcao = window.system_functions[j];
  17226. }
  17227. }
  17228. }
  17229. if (!funcao) {
  17230. fun_not_found.push(parsed[i].value);
  17231. }
  17232. }
  17233. }
  17234. if (fun_not_found.length > 0) {
  17235. var uniqueWords = _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(new Set(fun_not_found));
  17236. _utils__WEBPACK_IMPORTED_MODULE_7__.renderErrorMessage(input_field, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('expression_undeclared_function') + " " + uniqueWords.join(", "));
  17237. return null;
  17238. }
  17239. if (var_not_found.length > 0) {
  17240. var _uniqueWords = _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(new Set(var_not_found));
  17241. _utils__WEBPACK_IMPORTED_MODULE_7__.renderErrorMessage(input_field, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__.LocalizedStrings.getUI('expression_undelcared_variable') + " " + _uniqueWords.join(", "));
  17242. return null;
  17243. }
  17244. var exp_obj = [];
  17245. for (var i = 0; i < parsed.length; i++) {
  17246. exp_obj.push(getVariable(function_obj, parsed[i]));
  17247. }
  17248. return exp_obj;
  17249. }
  17250. function searchFunction(function_name) {
  17251. for (var j = 0; j < program_obj.functions.length; j++) {
  17252. if (program_obj.functions[j].name == function_name) {
  17253. return program_obj.functions[j];
  17254. }
  17255. } // Se ainda não encontrou, procurar na biblioteca do iVProg:
  17256. for (var j = 0; j < window.system_functions.length; j++) {
  17257. if (function_name.split(".")[1] && function_name.split(".")[1] == window.system_functions[j].identifier) {
  17258. return window.system_functions[j];
  17259. } else if (function_name == window.system_functions[j].identifier) {
  17260. return window.system_functions[j];
  17261. }
  17262. }
  17263. }
  17264. function expressionParserCodeVisual(parsed, function_obj) {
  17265. if (!parsed) return null;
  17266. var var_not_found = [];
  17267. var fun_not_found = [];
  17268. for (var i = 0; i < parsed.length; i++) {
  17269. var variavel = null;
  17270. if (parsed[i].instance == "expression" && parsed[i].type == "var") {
  17271. // 1. Procurar a variável na função:
  17272. for (var j = 0; j < function_obj.variables_list.length; j++) {
  17273. if (function_obj.variables_list[j].name == parsed[i].value) {
  17274. variavel = function_obj.variables_list[j];
  17275. break;
  17276. }
  17277. } // 2. Procurar a variável nas globais:
  17278. if (!variavel) for (var j = 0; j < program_obj.globals.length; j++) {
  17279. if (program_obj.globals[j].name == parsed[i].value) {
  17280. variavel = program_obj.globals[j];
  17281. break;
  17282. }
  17283. } // 3. Procurar a variável nos parâmetros:
  17284. if (!variavel) for (var j = 0; j < function_obj.parameters_list.length; j++) {
  17285. if (function_obj.parameters_list[j].name == parsed[i].value) {
  17286. variavel = function_obj.parameters_list[j];
  17287. break;
  17288. }
  17289. }
  17290. if (!variavel) var_not_found.push(parsed[i].value);
  17291. }
  17292. var funcao;
  17293. if (parsed[i].instance == "expression" && parsed[i].type == "function") {
  17294. // Procurar a função para referência:
  17295. for (var j = 0; j < program_obj.functions.length; j++) {
  17296. if (program_obj.functions[j].name == parsed[i].value) {
  17297. funcao = program_obj.functions[j];
  17298. }
  17299. } // Se ainda não encontrou, procurar na biblioteca do iVProg:
  17300. if (!funcao) {
  17301. for (var j = 0; j < window.system_functions.length; j++) {
  17302. if (parsed[i].value.split(".")[1] && parsed[i].value.split(".")[1] == window.system_functions[j].identifier) {
  17303. funcao = window.system_functions[j];
  17304. } else if (parsed[i].value == window.system_functions[j].identifier) {
  17305. funcao = window.system_functions[j];
  17306. }
  17307. }
  17308. }
  17309. if (!funcao) {
  17310. fun_not_found.push(parsed[i].value);
  17311. }
  17312. }
  17313. }
  17314. var exp_obj = [];
  17315. for (var i = 0; i < parsed.length; i++) {
  17316. exp_obj.push(getVariable(function_obj, parsed[i]));
  17317. }
  17318. return exp_obj;
  17319. }
  17320. /***/ }),
  17321. /***/ "./js/visualUI/commands/iftrue.js":
  17322. /*!****************************************!*\
  17323. !*** ./js/visualUI/commands/iftrue.js ***!
  17324. \****************************************/
  17325. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17326. "use strict";
  17327. __webpack_require__.r(__webpack_exports__);
  17328. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17329. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  17330. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  17331. /* harmony export */ });
  17332. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17333. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17334. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  17335. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
  17336. function createFloatingCommand() {
  17337. return $('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  17338. }
  17339. function renderCommand(command, function_obj) {
  17340. var ret = '';
  17341. 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>';
  17342. ret += '<span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI('text_if') + '</span>';
  17343. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="textual_expression"></span> <span class="span_command_spec"> ) </span> ';
  17344. ret += ' <i class="ui icon i cursor button_write_expression" style="margin-right: 1rem !important;"></i> ';
  17345. ret += '<i class="ui icon unlock button_alternate_expression"></i>';
  17346. ret += '<span> </span> ';
  17347. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  17348. ret += '</div></div>';
  17349. 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>';
  17350. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  17351. ret += '</div>';
  17352. ret += '<span></span></div>';
  17353. ret += '</div>';
  17354. var el = $(ret);
  17355. el.data('command', command);
  17356. el.find('.block_commands').data('command', command);
  17357. el.find('.data_block_if').data('command', command);
  17358. el.find('.data_block_else').data('command', command);
  17359. el.find('.commands_if').data('command', command);
  17360. addHandlers(command, function_obj, el); //ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17361. _generic_expression__WEBPACK_IMPORTED_MODULE_2__.renderExpression(command, function_obj, el.find('.conditional_expression'), command.expression);
  17362. if (command.commands_block) {
  17363. for (var j = 0; j < command.commands_block.length; j++) {
  17364. _commands__WEBPACK_IMPORTED_MODULE_1__.renderCommand(command.commands_block[j], $(el.find('.commands_if')[0]), 3, function_obj);
  17365. }
  17366. }
  17367. if (command.commands_else) {
  17368. for (var j = 0; j < command.commands_else.length; j++) {
  17369. _commands__WEBPACK_IMPORTED_MODULE_1__.renderCommand(command.commands_else[j], $(el.find('.commands_else')[0]), 3, function_obj);
  17370. }
  17371. }
  17372. if (command.collapsed) {
  17373. el.children('.data_block_else').toggle();
  17374. $(el.find('.block_commands')[0]).toggle();
  17375. }
  17376. if (command.lockexpression) {
  17377. if (command.expression) {
  17378. try {
  17379. var text = _code_generator__WEBPACK_IMPORTED_MODULE_3__.elementExpressionCode(command.expression);
  17380. if (text) {
  17381. $(el.find('.conditional_expression')[0]).toggle();
  17382. $(el.find('.textual_expression')[0]).text(text);
  17383. $(el.find('.textual_expression')[0]).toggle();
  17384. $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
  17385. }
  17386. } catch (e) {
  17387. command.lockexpression = false;
  17388. }
  17389. }
  17390. }
  17391. el.find('.unlock').popup({
  17392. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
  17393. delay: {
  17394. show: 750,
  17395. hide: 0
  17396. }
  17397. });
  17398. el.find('.lock').popup({
  17399. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
  17400. delay: {
  17401. show: 750,
  17402. hide: 0
  17403. }
  17404. });
  17405. el.find('.button_write_expression').popup({
  17406. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression"),
  17407. delay: {
  17408. show: 750,
  17409. hide: 0
  17410. }
  17411. });
  17412. return el;
  17413. }
  17414. function addHandlers(command, function_obj, iftrue_dom) {
  17415. iftrue_dom.find('.button_write_expression').on('click', function () {
  17416. window.expressionEdition = true;
  17417. window.inputExpression = null;
  17418. var afterWhichElement;
  17419. var lockButton = $(iftrue_dom.find('.button_alternate_expression')[0]);
  17420. var editButton = $(this);
  17421. afterWhichElement = $(iftrue_dom.find('.conditional_expression')[0]);
  17422. if (command.lockexpression) {
  17423. afterWhichElement = $(iftrue_dom.find('.textual_expression')[0]);
  17424. }
  17425. var text = "";
  17426. if (command.expression) {
  17427. if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
  17428. text = "";
  17429. } else {
  17430. try {
  17431. text = _code_generator__WEBPACK_IMPORTED_MODULE_3__.elementExpressionCode(command.expression);
  17432. } catch (ex) {
  17433. text = "";
  17434. }
  17435. }
  17436. }
  17437. var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
  17438. var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
  17439. var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
  17440. input.val(text);
  17441. input.focusout(function (evt) {
  17442. ok_button.click();
  17443. evt.preventDefault();
  17444. return true;
  17445. });
  17446. input.keyup(function (evt) {
  17447. if (evt.keyCode == 27) {
  17448. // esc
  17449. cancel_button.click();
  17450. }
  17451. if (evt.keyCode == 13) {
  17452. // enter
  17453. ok_button.click();
  17454. }
  17455. });
  17456. ok_button.click(function () {
  17457. var parsed = null;
  17458. parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_2__.expressionParserToVisual(input.val(), function_obj, input);
  17459. if (parsed) {
  17460. window.expressionEdition = false;
  17461. command.expression = parsed;
  17462. renderAlgorithm();
  17463. }
  17464. });
  17465. cancel_button.mousedown(function (evt) {
  17466. var parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_2__.expressionParserToVisual(text, function_obj, input);
  17467. if (parsed) {
  17468. window.expressionEdition = false;
  17469. command.expression = parsed;
  17470. renderAlgorithm();
  17471. }
  17472. });
  17473. input.insertAfter(afterWhichElement);
  17474. input.focus();
  17475. cancel_button.insertAfter(input);
  17476. ok_button.insertAfter(input);
  17477. var len = text.length;
  17478. input[0].setSelectionRange(len, len);
  17479. afterWhichElement.css('display', 'none');
  17480. lockButton.css('display', 'none');
  17481. editButton.css('display', 'none');
  17482. ok_button.popup({
  17483. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_confirm"),
  17484. delay: {
  17485. show: 750,
  17486. hide: 0
  17487. }
  17488. });
  17489. cancel_button.popup({
  17490. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_cancel"),
  17491. delay: {
  17492. show: 750,
  17493. hide: 0
  17494. }
  17495. });
  17496. });
  17497. $(iftrue_dom.find('.textual_expression')[0]).toggle();
  17498. iftrue_dom.find('.button_alternate_expression').on('click', function () {
  17499. if (command.expression) {
  17500. var text = _code_generator__WEBPACK_IMPORTED_MODULE_3__.elementExpressionCode(command.expression);
  17501. if (text) {
  17502. $(iftrue_dom.find('.conditional_expression')[0]).toggle();
  17503. $(iftrue_dom.find('.textual_expression')[0]).text(text);
  17504. $(iftrue_dom.find('.textual_expression')[0]).toggle();
  17505. $(this).toggleClass('unlock').toggleClass('lock');
  17506. command.lockexpression = !command.lockexpression;
  17507. }
  17508. }
  17509. if (command.lockexpression) {
  17510. iftrue_dom.find('.lock').popup({
  17511. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
  17512. delay: {
  17513. show: 750,
  17514. hide: 0
  17515. }
  17516. });
  17517. } else {
  17518. iftrue_dom.find('.unlock').popup({
  17519. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
  17520. delay: {
  17521. show: 750,
  17522. hide: 0
  17523. }
  17524. });
  17525. }
  17526. });
  17527. iftrue_dom.find('.button_remove_command').on('click', function () {
  17528. if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, iftrue_dom)) {
  17529. iftrue_dom.fadeOut(400, function () {
  17530. iftrue_dom.remove();
  17531. });
  17532. }
  17533. });
  17534. iftrue_dom.find('.minimize_block_button').on('click', function () {
  17535. iftrue_dom.children('.data_block_else').toggle();
  17536. $(iftrue_dom.find('.block_commands')[0]).toggle();
  17537. command.collapsed = !command.collapsed;
  17538. });
  17539. }
  17540. /***/ }),
  17541. /***/ "./js/visualUI/commands/reader.js":
  17542. /*!****************************************!*\
  17543. !*** ./js/visualUI/commands/reader.js ***!
  17544. \****************************************/
  17545. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17546. "use strict";
  17547. __webpack_require__.r(__webpack_exports__);
  17548. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17549. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  17550. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  17551. /* harmony export */ });
  17552. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17553. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17554. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17555. function createFloatingCommand() {
  17556. 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>');
  17557. }
  17558. function renderCommand(command, function_obj) {
  17559. 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>';
  17560. el = $(el);
  17561. el.data('command', command);
  17562. _variable_value_menu__WEBPACK_IMPORTED_MODULE_1__.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17563. addHandlers(command, function_obj, el);
  17564. return el;
  17565. }
  17566. function addHandlers(command, function_obj, reader_dom) {
  17567. reader_dom.find('.button_remove_command').on('click', function () {
  17568. if (_commands__WEBPACK_IMPORTED_MODULE_2__.removeCommand(command, function_obj, reader_dom)) {
  17569. reader_dom.fadeOut(400, function () {
  17570. reader_dom.remove();
  17571. });
  17572. }
  17573. });
  17574. }
  17575. /***/ }),
  17576. /***/ "./js/visualUI/commands/repeatNtimes.js":
  17577. /*!**********************************************!*\
  17578. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  17579. \**********************************************/
  17580. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17581. "use strict";
  17582. __webpack_require__.r(__webpack_exports__);
  17583. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17584. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  17585. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand),
  17586. /* harmony export */ "manageExpressionElements": () => (/* binding */ manageExpressionElements),
  17587. /* harmony export */ "manageClearExpressionElements": () => (/* binding */ manageClearExpressionElements)
  17588. /* harmony export */ });
  17589. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17590. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17591. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17592. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17593. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17594. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17595. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  17596. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
  17597. function createFloatingCommand() {
  17598. 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>');
  17599. }
  17600. function renderCommand(command, function_obj) {
  17601. 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>");
  17602. ret += '<div class="ui block_commands">';
  17603. ret += '</div>';
  17604. ret += '<span> </span>';
  17605. ret += '</div>';
  17606. var el = $(ret);
  17607. el.data('command', command);
  17608. el.find('.block_commands').data('command', command);
  17609. addHandlers(command, function_obj, el);
  17610. _contextualized_menu__WEBPACK_IMPORTED_MODULE_5__.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17611. _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'));
  17612. _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);
  17613. //VariableValueMenu.renderMenu(command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  17614. //angle double right
  17615. if (!command.expression1) {
  17616. 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);
  17617. }
  17618. el.find('.text_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_for_from"));
  17619. _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression1, el.find('.var_value_expression'), function_obj);
  17620. if (!command.expression3) {
  17621. 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>');
  17622. el.find('.pass_button').find('button').on('click', function () {
  17623. togglePasso(command);
  17624. });
  17625. /*var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp,
  17626. [command.var_attribution,
  17627. Models.ARITHMETIC_TYPES.plus,
  17628. new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "1", null, null, true)]);
  17629. command.expression3 = exp;
  17630. command.var_incrementation = command.var_attribution;*/
  17631. } else {
  17632. 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>');
  17633. el.find('.pass_button').find('button').on('click', function () {
  17634. togglePasso(command);
  17635. });
  17636. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  17637. _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  17638. }
  17639. if (command.commands_block) {
  17640. for (var j = 0; j < command.commands_block.length; j++) {
  17641. _commands__WEBPACK_IMPORTED_MODULE_2__.renderCommand(command.commands_block[j], $(el.find('.block_commands')[0]), 3, function_obj);
  17642. }
  17643. }
  17644. if (command.lockexpression) {
  17645. try {
  17646. var text = _code_generator__WEBPACK_IMPORTED_MODULE_7__.repeatNtimesHeader(command);
  17647. if (text) {
  17648. $(el.find('.textual_expression')[0]).html(text);
  17649. $(el.find('.textual_expression')[0]).toggle();
  17650. $(el.find('.attribution_expression')[0]).toggle();
  17651. $(el.find('.span_command_spec.separator_character')[0]).toggle();
  17652. $(el.find('.conditional_expression')[0]).toggle();
  17653. $(el.find('.pass_button')[0]).toggle();
  17654. $(el.find('.incrementation_field')[0]).toggle();
  17655. $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
  17656. }
  17657. } catch (e) {
  17658. command.lockexpression = false;
  17659. }
  17660. }
  17661. el.find('.unlock').popup({
  17662. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
  17663. delay: {
  17664. show: 750,
  17665. hide: 0
  17666. }
  17667. });
  17668. el.find('.lock').popup({
  17669. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
  17670. delay: {
  17671. show: 750,
  17672. hide: 0
  17673. }
  17674. });
  17675. return el;
  17676. }
  17677. function togglePasso(command) {
  17678. if (!command.expression3) {
  17679. 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)]);
  17680. command.expression3 = exp;
  17681. command.var_incrementation = command.var_attribution;
  17682. } else {
  17683. command.expression3 = null;
  17684. }
  17685. renderAlgorithm();
  17686. }
  17687. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17688. if (dom_object.hasClass('variable_attribution')) {
  17689. if (!command.expression3) {
  17690. 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)]);
  17691. command.expression3 = exp;
  17692. command.var_incrementation = command.var_attribution;
  17693. 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);
  17694. command.expression2.expression = cond_exp;
  17695. }
  17696. dom_object.parent().find('.text_receives').text('de');
  17697. 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);
  17698. dom_object.parent().find('.var_value_expression').empty();
  17699. _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  17700. renderAlgorithm();
  17701. }
  17702. if (dom_object.hasClass('incrementation_variable')) {
  17703. dom_object.parent().find('.text_inc_receives').text('de');
  17704. 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)]);
  17705. command.expression3 = exp;
  17706. _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  17707. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  17708. _variable_value_menu__WEBPACK_IMPORTED_MODULE_4__.renderMenu(command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  17709. }
  17710. }
  17711. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17712. if (dom_object.hasClass('variable_attribution')) {
  17713. $(dom_object).parent().find('.text_receives').text('');
  17714. command.expression1 = null;
  17715. $(dom_object).parent().find('.var_value_expression').empty();
  17716. }
  17717. if (dom_object.hasClass('incrementation_variable')) {
  17718. $(dom_object).parent().find('.text_inc_receives').text('');
  17719. command.expression3 = null;
  17720. $(dom_object).parent().find('.first_operand').empty();
  17721. $(dom_object).parent().find('.operator').empty();
  17722. $(dom_object).parent().find('.second_operand').empty();
  17723. }
  17724. }
  17725. function addHandlers(command, function_obj, repeatNtimes_dom) {
  17726. repeatNtimes_dom.find('.minimize_block_button').on('click', function (evt) {
  17727. repeatNtimes_dom.children('.ui.block_commands').toggle();
  17728. command.collapsed = !command.collapsed;
  17729. });
  17730. $(repeatNtimes_dom.find('.textual_expression')[0]).toggle();
  17731. repeatNtimes_dom.find('.button_alternate_expression').on('click', function () {
  17732. var text = _code_generator__WEBPACK_IMPORTED_MODULE_7__.repeatNtimesHeader(command);
  17733. if (text) {
  17734. $(repeatNtimes_dom.find('.textual_expression')[0]).html(text);
  17735. $(repeatNtimes_dom.find('.textual_expression')[0]).toggle();
  17736. $(repeatNtimes_dom.find('.attribution_expression')[0]).toggle();
  17737. $(repeatNtimes_dom.find('.span_command_spec.separator_character')[0]).toggle();
  17738. $(repeatNtimes_dom.find('.conditional_expression')[0]).toggle();
  17739. $(repeatNtimes_dom.find('.pass_button')[0]).toggle();
  17740. $(repeatNtimes_dom.find('.incrementation_field')[0]).toggle();
  17741. $(repeatNtimes_dom.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
  17742. command.lockexpression = !command.lockexpression;
  17743. }
  17744. if (command.lockexpression) {
  17745. repeatNtimes_dom.find('.lock').popup({
  17746. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
  17747. delay: {
  17748. show: 750,
  17749. hide: 0
  17750. }
  17751. });
  17752. } else {
  17753. repeatNtimes_dom.find('.unlock').popup({
  17754. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
  17755. delay: {
  17756. show: 750,
  17757. hide: 0
  17758. }
  17759. });
  17760. }
  17761. });
  17762. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  17763. if (_commands__WEBPACK_IMPORTED_MODULE_2__.removeCommand(command, function_obj, repeatNtimes_dom)) {
  17764. repeatNtimes_dom.fadeOut(400, function () {
  17765. repeatNtimes_dom.remove();
  17766. });
  17767. }
  17768. });
  17769. }
  17770. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  17771. var menu_operator = $('<div class="ui dropdown"><div class="text"></div></div>');
  17772. menu_operator.dropdown({
  17773. values: [{
  17774. name: '+',
  17775. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus,
  17776. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.plus
  17777. }, {
  17778. name: '-',
  17779. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus,
  17780. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.ARITHMETIC_TYPES.minus
  17781. }],
  17782. onChange: function onChange(value, text, $selectedItem) {
  17783. expression_element.itens[index_op] = value;
  17784. }
  17785. });
  17786. temp_op.append(menu_operator);
  17787. }
  17788. /***/ }),
  17789. /***/ "./js/visualUI/commands/return.js":
  17790. /*!****************************************!*\
  17791. !*** ./js/visualUI/commands/return.js ***!
  17792. \****************************************/
  17793. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17794. "use strict";
  17795. __webpack_require__.r(__webpack_exports__);
  17796. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17797. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  17798. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  17799. /* harmony export */ });
  17800. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17801. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17802. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17803. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17804. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  17805. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17806. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
  17807. function createFloatingCommand() {
  17808. 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>');
  17809. }
  17810. function renderCommand(command, function_obj) {
  17811. 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>');
  17812. el.data('command', command);
  17813. if (function_obj.return_type != _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID) {
  17814. if (!command.variable_value_menu) {
  17815. 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)];
  17816. }
  17817. _generic_expression__WEBPACK_IMPORTED_MODULE_4__.renderExpression(command, function_obj, el.find('.expression_elements'), command.variable_value_menu);
  17818. el.append($('<i class="ui icon unlock button_alternate_expression" style="margin-left: 1rem;"></i>'));
  17819. if (command.lockexpression) {
  17820. if (command.variable_value_menu) {
  17821. try {
  17822. var text = _code_generator__WEBPACK_IMPORTED_MODULE_6__.elementExpressionCode(command.variable_value_menu);
  17823. if (text) {
  17824. $(el.find('.expression_elements')[0]).toggle();
  17825. $(el.find('.textual_expression')[0]).text(text);
  17826. $(el.find('.textual_expression')[0]).toggle();
  17827. $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
  17828. }
  17829. } catch (e) {
  17830. command.lockexpression = false;
  17831. }
  17832. }
  17833. }
  17834. } else {
  17835. el.find('.expression_elements').remove();
  17836. command.variable_value_menu = null;
  17837. }
  17838. addHandlers(command, function_obj, el);
  17839. return el;
  17840. }
  17841. function addHandlers(command, function_obj, return_dom) {
  17842. return_dom.find('.button_alternate_expression').on('click', function () {
  17843. if (command.variable_value_menu) {
  17844. var text = _code_generator__WEBPACK_IMPORTED_MODULE_6__.elementExpressionCode(command.variable_value_menu);
  17845. if (text) {
  17846. $(return_dom.find('.expression_elements')[0]).toggle();
  17847. $(return_dom.find('.textual_expression')[0]).text(text);
  17848. $(return_dom.find('.textual_expression')[0]).toggle();
  17849. $(this).toggleClass('unlock').toggleClass('lock');
  17850. command.lockexpression = !command.lockexpression;
  17851. }
  17852. }
  17853. });
  17854. return_dom.find('.button_remove_command').on('click', function () {
  17855. if (_commands__WEBPACK_IMPORTED_MODULE_3__.removeCommand(command, function_obj, return_dom)) {
  17856. return_dom.fadeOut(400, function () {
  17857. return_dom.remove();
  17858. });
  17859. }
  17860. });
  17861. }
  17862. /***/ }),
  17863. /***/ "./js/visualUI/commands/switch.js":
  17864. /*!****************************************!*\
  17865. !*** ./js/visualUI/commands/switch.js ***!
  17866. \****************************************/
  17867. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17868. "use strict";
  17869. __webpack_require__.r(__webpack_exports__);
  17870. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17871. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  17872. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand),
  17873. /* harmony export */ "renderCase": () => (/* binding */ renderCase)
  17874. /* harmony export */ });
  17875. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17876. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17877. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17878. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17879. function createFloatingCommand() {
  17880. 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>');
  17881. }
  17882. function renderCommand(command, function_obj) {
  17883. var ret = '';
  17884. 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>';
  17885. ret += '</div>';
  17886. var el = $(ret);
  17887. el.data('command', command);
  17888. addHandlers(command, function_obj, el);
  17889. _contextualized_menu__WEBPACK_IMPORTED_MODULE_3__.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17890. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, command.variable, el.find('.variable_to_switch'), function_obj);
  17891. if (command.cases) {
  17892. for (var i = 0; i < command.cases.length; i++) {
  17893. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  17894. }
  17895. }
  17896. return el;
  17897. }
  17898. function renderCase(switchcase, command, function_obj, el) {
  17899. 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>');
  17900. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  17901. casediv.data('switchcase', switchcase);
  17902. casediv.find('.case_commands_block').data('switchcase', switchcase);
  17903. el.append(casediv);
  17904. if (switchcase.commands_block) {
  17905. for (var j = 0; j < switchcase.commands_block.length; j++) {
  17906. _commands__WEBPACK_IMPORTED_MODULE_1__.renderCommand(switchcase.commands_block[j], $(casediv.find('.case_commands_block')[0]), 3, function_obj);
  17907. }
  17908. }
  17909. casediv.find('.button_remove_command').on('click', function () {
  17910. for (var i = 0; i < command.cases.length; i++) {
  17911. if (switchcase == command.cases[i]) {
  17912. delete command.cases[i];
  17913. command.cases.splice(i, 1);
  17914. casediv.remove();
  17915. break;
  17916. }
  17917. }
  17918. });
  17919. }
  17920. function addHandlers(command, function_obj, switch_dom) {
  17921. switch_dom.find('.button_remove_command').on('click', function () {
  17922. if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, switch_dom)) {
  17923. switch_dom.fadeOut(400, function () {
  17924. switch_dom.remove();
  17925. });
  17926. }
  17927. });
  17928. }
  17929. /***/ }),
  17930. /***/ "./js/visualUI/commands/variable_value_menu.js":
  17931. /*!*****************************************************!*\
  17932. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  17933. \*****************************************************/
  17934. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17935. "use strict";
  17936. __webpack_require__.r(__webpack_exports__);
  17937. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17938. /* harmony export */ "VAR_OR_VALUE_TYPES": () => (/* binding */ VAR_OR_VALUE_TYPES),
  17939. /* harmony export */ "renderMenu": () => (/* binding */ renderMenu)
  17940. /* harmony export */ });
  17941. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17942. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17943. /* harmony import */ var _attribution__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  17944. /* harmony import */ var _repeatNtimes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17945. var VAR_OR_VALUE_TYPES = Object.freeze({
  17946. only_variable: 1,
  17947. only_value: 2,
  17948. only_function: 3,
  17949. variable_and_function: 4,
  17950. variable_and_value_opt: 5,
  17951. value_and_function: 6,
  17952. all: 7
  17953. });
  17954. function renderMenu(command, ref_object, dom_object, function_obj) {
  17955. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  17956. var expression_element = arguments.length > 5 ? arguments[5] : undefined;
  17957. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  17958. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  17959. if (ref_object.function_called) {
  17960. if (ref_object.function_called.parameters_list) {
  17961. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  17962. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  17963. ref_object.parameters_list.pop();
  17964. } else {
  17965. ref_object.parameters_list.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17966. }
  17967. }
  17968. }
  17969. } // Verificar agora, quando trata-se de chamada de função, se a passagem de parâmetro é
  17970. // por referência ou por cópia:
  17971. var index_references = [];
  17972. if (ref_object.function_called) {
  17973. if (ref_object.function_called.parameters_list) {
  17974. for (var i = 0; i < ref_object.function_called.parameters_list.length; i++) {
  17975. if (ref_object.function_called.parameters_list[i].reference) {
  17976. index_references.push(i);
  17977. ref_object.parameters_list[i].reference = true;
  17978. ref_object.parameters_list[i].variable_and_value = VAR_OR_VALUE_TYPES.only_variable;
  17979. if (ref_object.parameters_list[i].column) ref_object.parameters_list[i].column.reference_parent = true;
  17980. if (ref_object.parameters_list[i].row) ref_object.parameters_list[i].row.reference_parent = true;
  17981. } else {
  17982. ref_object.parameters_list[i].reference = false;
  17983. ref_object.parameters_list[i].variable_and_value = VAR_OR_VALUE_TYPES.all;
  17984. if (ref_object.parameters_list[i].column) ref_object.parameters_list[i].column.reference_parent = false;
  17985. if (ref_object.parameters_list[i].row) ref_object.parameters_list[i].row.reference_parent = false;
  17986. }
  17987. ref_object.parameters_list[i].reference_dimensions = ref_object.function_called.parameters_list[i].dimensions;
  17988. }
  17989. }
  17990. }
  17991. 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">';
  17992. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  17993. 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">';
  17994. menu_var_or_value += "</div>";
  17995. }
  17996. 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) {
  17997. 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");
  17998. menu_var_or_value += '<div class="menu menu_only_vars">';
  17999. menu_var_or_value += "</div></div>";
  18000. }
  18001. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  18002. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  18003. }
  18004. 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) {
  18005. 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>";
  18006. }
  18007. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  18008. 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">';
  18009. menu_var_or_value += "</div>";
  18010. }
  18011. 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) {
  18012. 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");
  18013. menu_var_or_value += '<div class="menu menu_only_functions">';
  18014. menu_var_or_value += "</div></div>";
  18015. /* if (command.type == Models.COMMAND_TYPES.attribution) {
  18016. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18017. menu_var_or_value += '<div class="menu">';
  18018. menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18019. menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18020. menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18021. menu_var_or_value += '</div></div>';
  18022. }*/
  18023. }
  18024. menu_var_or_value += "</div></div>";
  18025. menu_var_or_value = $(menu_var_or_value);
  18026. menu_var_or_value.find('.width-dynamic').on('input', function () {
  18027. var input_field = $(this);
  18028. var inputWidth = input_field.textWidth() + 10;
  18029. inputWidth = inputWidth < 50 ? 50 : inputWidth;
  18030. input_field.css({
  18031. width: inputWidth
  18032. });
  18033. }).trigger('input');
  18034. dom_object.append(menu_var_or_value);
  18035. ref_object.dom_object = menu_var_or_value;
  18036. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18037. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  18038. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  18039. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  18040. if (ref_object.content || ref_object.function_called) {
  18041. if (ref_object.content) {
  18042. // Verificar se a variável ainda existe:
  18043. var variable_fun = isVarInProgram(ref_object.content, function_obj);
  18044. if (variable_fun) {
  18045. ref_object.content = variable_fun;
  18046. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18047. } else {
  18048. if (ref_object.content && ref_object.content.type) {
  18049. ref_object.content = null;
  18050. appendSelectText(ref_object, menu_var_or_value);
  18051. } else {
  18052. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18053. }
  18054. }
  18055. } else if (ref_object.function_called) {
  18056. // Verificar se a função ainda existe:
  18057. var ret_function = isFunctionInProgram(ref_object.function_called);
  18058. if (ret_function) {
  18059. ref_object.function_called = ret_function;
  18060. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18061. } else {
  18062. ref_object.content = null;
  18063. ref_object.row = null;
  18064. ref_object.column = null;
  18065. delete ref_object.function_called;
  18066. delete ref_object.parameters_list;
  18067. appendSelectText(ref_object, menu_var_or_value);
  18068. }
  18069. }
  18070. } else {
  18071. appendSelectText(ref_object, menu_var_or_value);
  18072. }
  18073. }
  18074. function appendSelectText(ref_object, menu_var_or_value) {
  18075. // if (ref_object.reference_parent) {
  18076. // menu_var_or_value
  18077. // .find(".text")
  18078. // .append("<i>Opcional</i>");
  18079. // return;
  18080. // }
  18081. switch (ref_object.variable_and_value) {
  18082. case VAR_OR_VALUE_TYPES.only_variable:
  18083. menu_var_or_value.find(".text").append("<i>" + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("var_menu_select_var") + "</i>");
  18084. break;
  18085. case VAR_OR_VALUE_TYPES.all:
  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.variable_and_function:
  18089. menu_var_or_value.find(".text").append("<i>" + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("var_menu_select_all") + "</i>");
  18090. break;
  18091. case VAR_OR_VALUE_TYPES.only_function:
  18092. menu_var_or_value.find(".text").append("<i>" + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("var_menu_select_function") + "</i>");
  18093. break;
  18094. }
  18095. }
  18096. function isFunctionInProgram(function_called_obj) {
  18097. if (function_called_obj.name) {
  18098. if (window.program_obj.functions) {
  18099. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18100. if (window.program_obj.functions[i] == function_called_obj) {
  18101. return window.program_obj.functions[i];
  18102. }
  18103. }
  18104. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18105. if (window.program_obj.functions[i].name == function_called_obj.name) {
  18106. return window.program_obj.functions[i];
  18107. }
  18108. }
  18109. }
  18110. } else if (function_called_obj.identifier) {
  18111. for (var i = 0; i < window.system_functions.length; i++) {
  18112. if (window.system_functions[i].identifier == function_called_obj.identifier) {
  18113. return window.system_functions[i];
  18114. }
  18115. }
  18116. }
  18117. return null;
  18118. }
  18119. function isVarInProgram(var_obj, function_obj) {
  18120. // Verify in locals:
  18121. if (function_obj.variables_list) {
  18122. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18123. if (function_obj.variables_list[i] == var_obj) {
  18124. return function_obj.variables_list[i];
  18125. }
  18126. }
  18127. } // Verify in parameters:
  18128. if (function_obj.parameters_list) {
  18129. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18130. if (function_obj.parameters_list[i] == var_obj) {
  18131. return function_obj.parameters_list[i];
  18132. }
  18133. }
  18134. } // Verify in globals:
  18135. if (window.program_obj.globals) {
  18136. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18137. if (window.program_obj.globals[i] == var_obj) {
  18138. return window.program_obj.globals[i];
  18139. }
  18140. }
  18141. } // If not found, verify if the reference was lost
  18142. if (var_obj) {
  18143. if (function_obj.variables_list) {
  18144. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18145. if (function_obj.variables_list[i].name == var_obj.name) {
  18146. return function_obj.variables_list[i];
  18147. }
  18148. }
  18149. }
  18150. if (function_obj.parameters_list) {
  18151. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18152. if (function_obj.parameters_list[i].name == var_obj.name) {
  18153. return function_obj.parameters_list[i];
  18154. }
  18155. }
  18156. }
  18157. if (window.program_obj.globals) {
  18158. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18159. if (window.program_obj.globals[i].name == var_obj.name) {
  18160. return window.program_obj.globals[i];
  18161. }
  18162. }
  18163. }
  18164. }
  18165. return null;
  18166. }
  18167. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  18168. if (ref_object.function_called) {
  18169. menu_var_or_value.remove();
  18170. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18171. } else if (ref_object.content.type) {
  18172. menu_var_or_value.remove();
  18173. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18174. } else {
  18175. menu_var_or_value.remove();
  18176. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18177. }
  18178. }
  18179. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  18180. if (variable_obj.content || variable_obj.function_called) {
  18181. // Verificar se a variável ainda existe:
  18182. var var_fun = isVarInProgram(variable_obj.content, function_obj);
  18183. if (var_fun) {
  18184. variable_obj.content = var_fun;
  18185. } else {
  18186. if (variable_obj.content && variable_obj.content.type) {
  18187. variable_obj.content = null;
  18188. appendSelectText(variable_obj, menu_var_or_value);
  18189. }
  18190. }
  18191. } else {
  18192. appendSelectText(variable_obj, menu_var_or_value);
  18193. }
  18194. if (variable_obj.content == null && variable_obj.function_called == null) {
  18195. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18196. return;
  18197. }
  18198. var ret = "";
  18199. if (variable_obj.function_called) {
  18200. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  18201. menu_var_or_value.find(".text").text(" ");
  18202. dom_object.find(".menu_var_or_value_dom").remove();
  18203. var parameters_menu;
  18204. if (variable_obj.function_called.name) {
  18205. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + " <span> ( </span>";
  18206. } else {
  18207. 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>";
  18208. }
  18209. parameters_menu += "<span> ) </span></div>";
  18210. parameters_menu = $(parameters_menu);
  18211. dom_object.append(parameters_menu);
  18212. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18213. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18214. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18215. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18216. context_menu += '<div class="menu">';
  18217. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18218. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18219. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18220. context_menu += '</div></div>';
  18221. }*/
  18222. context_menu += "</div></div>";
  18223. context_menu = $(context_menu);
  18224. context_menu.insertAfter(dom_object.find(".parameters_function_called"));
  18225. context_menu.dropdown({
  18226. onChange: function onChange(value, text, $selectedItem) {
  18227. if ($selectedItem.data("clear")) {
  18228. dom_object.text("");
  18229. variable_obj.content = null;
  18230. variable_obj.row = null;
  18231. variable_obj.column = null;
  18232. delete variable_obj.function_called;
  18233. delete variable_obj.parameters_list;
  18234. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18235. }
  18236. if ($selectedItem.data("exp")) {
  18237. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18238. }
  18239. },
  18240. selectOnKeydown: false
  18241. });
  18242. } else {
  18243. menu_var_or_value.find(".text").text(" ");
  18244. dom_object.find(".menu_var_or_value_dom").remove();
  18245. var parameters_menu;
  18246. if (variable_obj.function_called.name) {
  18247. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + " <span> ( </span>";
  18248. } else {
  18249. 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>";
  18250. }
  18251. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  18252. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18253. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  18254. parameters_menu += " , ";
  18255. }
  18256. }
  18257. parameters_menu += "<span> ) </span></div>";
  18258. parameters_menu = $(parameters_menu);
  18259. dom_object.append(parameters_menu);
  18260. for (var _j = 0; _j < variable_obj.function_called.parameters_list.length; _j++) {
  18261. renderMenu(command, variable_obj.parameters_list[_j], parameters_menu.find(".parameter_" + _j), function_obj, 2, expression_element);
  18262. }
  18263. var _context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18264. _context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18265. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18266. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18267. context_menu += '<div class="menu">';
  18268. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18269. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18270. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18271. context_menu += '</div></div>';
  18272. }*/
  18273. _context_menu += "</div></div>";
  18274. _context_menu = $(_context_menu);
  18275. _context_menu.insertAfter(parameters_menu);
  18276. _context_menu.dropdown({
  18277. onChange: function onChange(value, text, $selectedItem) {
  18278. if ($selectedItem.data("clear")) {
  18279. dom_object.text("");
  18280. variable_obj.content = null;
  18281. variable_obj.row = null;
  18282. variable_obj.column = null;
  18283. delete variable_obj.function_called;
  18284. delete variable_obj.parameters_list;
  18285. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18286. }
  18287. if ($selectedItem.data("exp")) {
  18288. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18289. }
  18290. },
  18291. selectOnKeydown: false
  18292. });
  18293. }
  18294. } else if (variable_obj.content.type) {
  18295. var variable_render = "";
  18296. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  18297. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + "</span>";
  18298. if (variable_obj.reference_dimensions >= 1) variable_render += '';else variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18299. variable_render += "</div>";
  18300. variable_render = $(variable_render);
  18301. dom_object.append(variable_render);
  18302. var _context_menu2 = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18303. _context_menu2 += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18304. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18305. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18306. context_menu += '<div class="menu">';
  18307. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18308. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18309. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18310. context_menu += '</div></div>';
  18311. }*/
  18312. _context_menu2 += "</div></div>";
  18313. _context_menu2 = $(_context_menu2);
  18314. variable_render.append(_context_menu2);
  18315. _context_menu2.dropdown({
  18316. onChange: function onChange(value, text, $selectedItem) {
  18317. if ($selectedItem.data("clear")) {
  18318. dom_object.text("");
  18319. variable_obj.content = null;
  18320. variable_obj.row = null;
  18321. variable_obj.column = null;
  18322. delete variable_obj.function_called;
  18323. delete variable_obj.parameters_list;
  18324. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18325. }
  18326. if ($selectedItem.data("exp")) {
  18327. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18328. }
  18329. },
  18330. selectOnKeydown: false
  18331. });
  18332. if (!variable_obj.column) {
  18333. var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18334. if (variable_obj.reference) temp.reference_parent = true;
  18335. variable_obj.column = temp;
  18336. }
  18337. variableValueMenuCode(command, variable_obj.column, $(variable_render.find(".column_container")), function_obj, menu_var_or_value, expression_element);
  18338. } else if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  18339. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + "</span>";
  18340. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  18341. if (variable_obj.reference_dimensions == 0) variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  18342. variable_render += "</div>";
  18343. variable_render = $(variable_render);
  18344. dom_object.append(variable_render);
  18345. var _context_menu3 = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18346. _context_menu3 += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18347. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18348. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18349. context_menu += '<div class="menu">';
  18350. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18351. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18352. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18353. context_menu += '</div></div>';
  18354. }*/
  18355. _context_menu3 += "</div></div>";
  18356. _context_menu3 = $(_context_menu3);
  18357. variable_render.append(_context_menu3);
  18358. _context_menu3.dropdown({
  18359. onChange: function onChange(value, text, $selectedItem) {
  18360. if ($selectedItem.data("clear")) {
  18361. dom_object.text("");
  18362. variable_obj.content = null;
  18363. variable_obj.row = null;
  18364. variable_obj.column = null;
  18365. delete variable_obj.function_called;
  18366. delete variable_obj.parameters_list;
  18367. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18368. }
  18369. if ($selectedItem.data("exp")) {
  18370. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18371. }
  18372. },
  18373. selectOnKeydown: false
  18374. });
  18375. if (!variable_obj.column) {
  18376. var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18377. if (variable_obj.reference) temp.reference_parent = true;
  18378. variable_obj.column = temp;
  18379. }
  18380. if (!variable_obj.row) {
  18381. var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18382. if (variable_obj.reference) temp.reference_parent = true;
  18383. variable_obj.row = temp;
  18384. }
  18385. variableValueMenuCode(command, variable_obj.row, $(variable_render.find(".row_container")), function_obj, menu_var_or_value, expression_element);
  18386. if (variable_obj.reference_dimensions == 1) {
  18387. variable_obj.column = null;
  18388. } else {
  18389. variableValueMenuCode(command, variable_obj.column, $(variable_render.find(".column_container")), function_obj, menu_var_or_value, expression_element);
  18390. }
  18391. } else {
  18392. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + "</span>";
  18393. variable_render += "</div>";
  18394. variable_render = $(variable_render);
  18395. dom_object.append(variable_render);
  18396. var _context_menu4 = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18397. _context_menu4 += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18398. /*if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18399. console.log('dom_object6');
  18400. console.log(dom_object);
  18401. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18402. context_menu += '<div class="menu">';
  18403. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18404. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18405. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18406. context_menu += '</div></div>';
  18407. }*/
  18408. _context_menu4 += "</div></div>";
  18409. _context_menu4 = $(_context_menu4);
  18410. variable_render.append(_context_menu4);
  18411. _context_menu4.dropdown({
  18412. onChange: function onChange(value, text, $selectedItem) {
  18413. if ($selectedItem.data("clear")) {
  18414. dom_object.text("");
  18415. variable_obj.content = null;
  18416. variable_obj.row = null;
  18417. variable_obj.column = null;
  18418. delete variable_obj.function_called;
  18419. delete variable_obj.parameters_list;
  18420. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18421. }
  18422. if ($selectedItem.data("exp")) {
  18423. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18424. }
  18425. },
  18426. selectOnKeydown: false
  18427. });
  18428. }
  18429. } else {
  18430. var _variable_render;
  18431. _variable_render = '<div class="variable_rendered"> <span class="var_name">';
  18432. if (isNaN(variable_obj.content)) {
  18433. _variable_render += variable_obj.content.split(" ").join("&nbsp;");
  18434. } else {
  18435. _variable_render += variable_obj.content;
  18436. }
  18437. _variable_render += "</span>";
  18438. _variable_render += "</div>";
  18439. _variable_render = $(_variable_render);
  18440. dom_object.append(_variable_render);
  18441. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18442. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18443. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18444. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18445. context_menu += '<div class="menu">';
  18446. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18447. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18448. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18449. context_menu += '</div></div>';
  18450. }*/
  18451. context_menu += "</div></div>";
  18452. context_menu = $(context_menu);
  18453. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18454. context_menu.insertAfter(_variable_render);
  18455. }
  18456. context_menu.dropdown({
  18457. onChange: function onChange(value, text, $selectedItem) {
  18458. if ($selectedItem.data("clear")) {
  18459. dom_object.text("");
  18460. variable_obj.content = null;
  18461. variable_obj.row = null;
  18462. variable_obj.column = null;
  18463. delete variable_obj.function_called;
  18464. delete variable_obj.parameters_list;
  18465. dom_object.find(".value_rendered").remove();
  18466. dom_object.find(".context_menu_clear").remove();
  18467. dom_object.find(".width-dynamic-minus").remove();
  18468. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18469. }
  18470. if ($selectedItem.data("exp")) {
  18471. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18472. }
  18473. },
  18474. selectOnKeydown: false
  18475. });
  18476. _variable_render.on("click", function (e) {
  18477. _variable_render.remove();
  18478. _variable_render.empty();
  18479. _variable_render.remove();
  18480. dom_object.empty();
  18481. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18482. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  18483. });
  18484. }
  18485. }
  18486. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18487. var sub_menu = menu_var_or_value.find(".menu_only_functions");
  18488. sub_menu.append('<div class="divider"></div><div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_header_ivprog_functions") + "</div>");
  18489. 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>');
  18490. 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>');
  18491. 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>');
  18492. 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:
  18493. for (var i = 0; i < window.system_functions.length; i++) {
  18494. var t = $('<div class="item"></div>');
  18495. t.data("function_reference", window.system_functions[i]);
  18496. t.data("option", VAR_OR_VALUE_TYPES.only_function);
  18497. t.text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.translateInternalFunction(window.system_functions[i].identifier));
  18498. switch (window.system_functions[i].category) {
  18499. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SYSTEM_FUNCTIONS_CATEGORIES.math:
  18500. sub_menu.find(".menu_math_functions").append(t);
  18501. break;
  18502. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SYSTEM_FUNCTIONS_CATEGORIES.text:
  18503. sub_menu.find(".menu_text_functions").append(t);
  18504. break;
  18505. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SYSTEM_FUNCTIONS_CATEGORIES.arrangement:
  18506. sub_menu.find(".menu_arrangement_functions").append(t);
  18507. break;
  18508. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.SYSTEM_FUNCTIONS_CATEGORIES.conversion:
  18509. sub_menu.find(".menu_conversion_functions").append(t);
  18510. break;
  18511. }
  18512. }
  18513. }
  18514. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18515. var sub_menu = menu_var_or_value.find(".menu_only_functions");
  18516. sub_menu.text("");
  18517. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18518. var temp = $('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + " </div>");
  18519. temp.data("function_reference", window.program_obj.functions[i]);
  18520. sub_menu.append(temp);
  18521. }
  18522. }
  18523. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18524. var sub_menu = menu_var_or_value.find(".menu_only_vars");
  18525. sub_menu.text("");
  18526. var is_there = false;
  18527. if (window.program_obj.globals) {
  18528. if (ref_object.include_constant) {
  18529. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18530. var temp = $('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + " </div>");
  18531. temp.data("variable_reference", window.program_obj.globals[i]);
  18532. sub_menu.append(temp);
  18533. is_there = true;
  18534. }
  18535. } else {
  18536. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18537. if (!window.program_obj.globals[i].is_constant) {
  18538. var temp = $('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + " </div>");
  18539. temp.data("variable_reference", window.program_obj.globals[i]);
  18540. sub_menu.append(temp);
  18541. is_there = true;
  18542. }
  18543. }
  18544. }
  18545. }
  18546. if (function_obj.parameters_list) {
  18547. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18548. var temp = $('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + " </div>");
  18549. temp.data("variable_reference", function_obj.parameters_list[i]);
  18550. sub_menu.append(temp);
  18551. is_there = true;
  18552. }
  18553. }
  18554. if (function_obj.variables_list) {
  18555. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18556. var temp = $('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + " </div>");
  18557. temp.data("variable_reference", function_obj.variables_list[i]);
  18558. sub_menu.append(temp);
  18559. is_there = true;
  18560. }
  18561. }
  18562. if (!is_there) {
  18563. sub_menu.append($('<div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_no_variable") + "</div>"));
  18564. sub_menu.append($('<div class="item disabled">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_no_variable_instruction") + "</div>"));
  18565. }
  18566. }
  18567. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18568. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18569. menu_var_or_value.dropdown({
  18570. onChange: function onChange(value, text, $selectedItem) {
  18571. dom_object.find(".var_name").remove();
  18572. switch ($selectedItem.data("option")) {
  18573. case VAR_OR_VALUE_TYPES.only_function:
  18574. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, $($selectedItem).data("function_reference"), expression_element);
  18575. break;
  18576. case VAR_OR_VALUE_TYPES.only_value:
  18577. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18578. break;
  18579. case VAR_OR_VALUE_TYPES.only_variable:
  18580. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, $($selectedItem).data("variable_reference"), expression_element);
  18581. break;
  18582. }
  18583. if ($selectedItem.data("exp")) {
  18584. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18585. }
  18586. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes) {
  18587. _repeatNtimes__WEBPACK_IMPORTED_MODULE_3__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18588. }
  18589. },
  18590. selectOnKeydown: false
  18591. });
  18592. }
  18593. dom_object.find(".width-dynamic").on("input", function () {
  18594. var inputWidth = $(this).textWidth() + 10;
  18595. $(this).focus();
  18596. var tmpStr = $(this).val();
  18597. $(this).val("");
  18598. $(this).val(tmpStr);
  18599. $(this).css({
  18600. width: inputWidth
  18601. });
  18602. }).trigger("input");
  18603. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment) {
  18604. dom_object.parent().on("click", function (e) {
  18605. dom_object.find(".value_rendered").remove();
  18606. dom_object.find(".value_rendered").empty();
  18607. dom_object.find(".value_rendered").remove();
  18608. dom_object.empty();
  18609. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18610. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18611. });
  18612. }
  18613. }
  18614. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  18615. ref_object.function_called = function_selected;
  18616. ref_object.parameters_list = [];
  18617. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  18618. menu_var_or_value.find(".text").text(" ");
  18619. dom_object.find(".menu_var_or_value_dom").remove();
  18620. var parameters_menu;
  18621. if (function_selected.name) {
  18622. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + " <span> ( </span>";
  18623. } else {
  18624. 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>";
  18625. }
  18626. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18627. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18628. if (j + 1 != function_selected.parameters_list.length) {
  18629. parameters_menu += " , ";
  18630. }
  18631. }
  18632. parameters_menu += "<span> ) </span></div>";
  18633. parameters_menu = $(parameters_menu);
  18634. dom_object.append(parameters_menu);
  18635. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18636. var temp;
  18637. if (function_selected.parameters_list[j].dimensions > 0) {
  18638. 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);
  18639. } else {
  18640. temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18641. }
  18642. if (function_selected.parameters_list[j].reference == true) {
  18643. temp.reference = true;
  18644. temp.variable_and_value = VAR_OR_VALUE_TYPES.only_variable;
  18645. } else {
  18646. temp.reference = false;
  18647. temp.variable_and_value = VAR_OR_VALUE_TYPES.all;
  18648. }
  18649. temp.reference_dimensions = function_selected.parameters_list[j].dimensions;
  18650. ref_object.parameters_list.push(temp);
  18651. renderMenu(command, temp, parameters_menu.find(".parameter_" + j), function_obj, 2, expression_element);
  18652. }
  18653. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18654. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18655. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18656. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18657. context_menu += '<div class="menu">';
  18658. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18659. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18660. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18661. context_menu += '</div></div>';
  18662. }*/
  18663. context_menu += "</div></div>";
  18664. context_menu = $(context_menu);
  18665. context_menu.insertAfter(dom_object.find(".parameters_function_called"));
  18666. context_menu.dropdown({
  18667. onChange: function onChange(value, text, $selectedItem) {
  18668. if ($selectedItem.data("clear")) {
  18669. dom_object.text("");
  18670. ref_object.content = null;
  18671. ref_object.row = null;
  18672. ref_object.column = null;
  18673. delete ref_object.function_called;
  18674. delete ref_object.parameters_list;
  18675. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18676. }
  18677. if ($selectedItem.data("exp")) {
  18678. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18679. }
  18680. },
  18681. selectOnKeydown: false
  18682. });
  18683. } else {
  18684. menu_var_or_value.find(".text").text(" ");
  18685. dom_object.find(".menu_var_or_value_dom").remove();
  18686. var parameters_menu;
  18687. if (function_selected.name) {
  18688. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + " <span> ( </span>";
  18689. } else {
  18690. 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>";
  18691. }
  18692. parameters_menu += "<span> ) </span></div>";
  18693. parameters_menu = $(parameters_menu);
  18694. dom_object.append(parameters_menu);
  18695. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18696. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18697. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18698. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18699. context_menu += '<div class="menu">';
  18700. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18701. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18702. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18703. context_menu += '</div></div>';
  18704. }*/
  18705. context_menu += "</div></div>";
  18706. context_menu = $(context_menu);
  18707. context_menu.insertAfter(dom_object.find(".parameters_function_called"));
  18708. context_menu.dropdown({
  18709. onChange: function onChange(value, text, $selectedItem) {
  18710. if ($selectedItem.data("clear")) {
  18711. dom_object.text("");
  18712. ref_object.content = null;
  18713. ref_object.row = null;
  18714. ref_object.column = null;
  18715. delete ref_object.function_called;
  18716. delete ref_object.parameters_list;
  18717. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18718. }
  18719. if ($selectedItem.data("exp")) {
  18720. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18721. }
  18722. },
  18723. selectOnKeydown: false
  18724. });
  18725. }
  18726. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18727. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18728. }*/
  18729. }
  18730. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  18731. ref_object.content = variable_selected;
  18732. menu_var_or_value.find(".text").text(" ");
  18733. dom_object.find(".menu_var_or_value_dom").remove();
  18734. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + "</span>";
  18735. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  18736. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18737. }
  18738. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  18739. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  18740. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18741. }
  18742. variable_render += "</div>";
  18743. variable_render = $(variable_render);
  18744. dom_object.append(variable_render);
  18745. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  18746. var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18747. if (ref_object.reference) temp.reference_parent = true;
  18748. ref_object.column = temp;
  18749. renderMenu(command, ref_object.column, variable_render.find(".column_container"), function_obj, 2, expression_element);
  18750. }
  18751. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  18752. var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18753. if (ref_object.reference) temp.reference_parent = true;
  18754. ref_object.row = temp;
  18755. renderMenu(command, ref_object.row, variable_render.find(".row_container"), function_obj, 2, expression_element);
  18756. var temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18757. if (ref_object.reference) temp.reference_parent = true;
  18758. ref_object.column = temp;
  18759. renderMenu(command, ref_object.column, variable_render.find(".column_container"), function_obj, 2, expression_element);
  18760. }
  18761. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18762. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18763. /*if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18764. console.log("dom_object 10: ");
  18765. console.log(dom_object);
  18766. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18767. context_menu += '<div class="menu">';
  18768. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18769. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18770. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18771. context_menu += '</div></div>';
  18772. }*/
  18773. context_menu += "</div></div>";
  18774. context_menu = $(context_menu);
  18775. context_menu.insertAfter(dom_object.find(".variable_rendered"));
  18776. context_menu.dropdown({
  18777. onChange: function onChange(value, text, $selectedItem) {
  18778. if ($selectedItem.data("clear")) {
  18779. dom_object.text("");
  18780. ref_object.content = null;
  18781. ref_object.row = null;
  18782. ref_object.column = null;
  18783. delete ref_object.function_called;
  18784. delete ref_object.parameters_list;
  18785. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18786. }
  18787. if ($selectedItem.data("exp")) {
  18788. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18789. }
  18790. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.repeatNtimes) {
  18791. _repeatNtimes__WEBPACK_IMPORTED_MODULE_3__.manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18792. }
  18793. },
  18794. selectOnKeydown: false
  18795. });
  18796. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18797. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  18798. }*/
  18799. }
  18800. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18801. if (ref_object.content == null) {
  18802. ref_object.content = "";
  18803. }
  18804. menu_var_or_value.find(".text").text(" ");
  18805. var field = $('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  18806. field.insertBefore(dom_object.find(".menu_var_or_value_dom"));
  18807. field.on('input', function () {
  18808. var input_field = $(this);
  18809. var inputWidth = input_field.textWidth() + 10;
  18810. inputWidth = inputWidth < 50 ? 50 : inputWidth;
  18811. input_field.css({
  18812. width: inputWidth
  18813. });
  18814. }).trigger('input');
  18815. var rendered = $('<div class="value_rendered"></div>');
  18816. rendered.insertBefore(field);
  18817. field.focus();
  18818. field.val(ref_object.content);
  18819. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18820. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("btn_clear") + "</div>";
  18821. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18822. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  18823. context_menu += '<div class="menu">';
  18824. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  18825. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  18826. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  18827. context_menu += '</div></div>';
  18828. }*/
  18829. context_menu += "</div></div>";
  18830. context_menu = $(context_menu);
  18831. dom_object.find(".menu_var_or_value_dom").remove();
  18832. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18833. context_menu.insertAfter(field);
  18834. }
  18835. context_menu.dropdown({
  18836. onChange: function onChange(value, text, $selectedItem) {
  18837. if ($selectedItem.data("clear")) {
  18838. dom_object.text("");
  18839. dom_object.find(".value_rendered").remove();
  18840. dom_object.find(".context_menu_clear").remove();
  18841. dom_object.find(".width-dynamic-minus").remove();
  18842. ref_object.content = null;
  18843. ref_object.row = null;
  18844. ref_object.column = null;
  18845. delete ref_object.function_called;
  18846. delete ref_object.parameters_list;
  18847. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18848. }
  18849. if ($selectedItem.data("exp")) {
  18850. _attribution__WEBPACK_IMPORTED_MODULE_2__.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18851. }
  18852. },
  18853. selectOnKeydown: false
  18854. });
  18855. dom_object.find(".width-dynamic-minus").focusout(function () {
  18856. /*if (
  18857. $(this)
  18858. .val()
  18859. .trim()
  18860. ) {
  18861. ref_object.content = $(this)
  18862. .val()
  18863. .trim();
  18864. }*/
  18865. ref_object.content = $(this).val();
  18866. if (isNaN(ref_object.content)) {
  18867. rendered.html(ref_object.content.split(" ").join("&nbsp;"));
  18868. } else {
  18869. rendered.text(ref_object.content);
  18870. }
  18871. $(this).remove();
  18872. });
  18873. dom_object.find(".width-dynamic-minus").on("keydown", function (e) {
  18874. var code = e.keyCode || e.which;
  18875. if (code == 13) {
  18876. /*if (
  18877. $(this)
  18878. .val()
  18879. .trim()
  18880. ) {
  18881. ref_object.content = $(this)
  18882. .val()
  18883. .trim();
  18884. }*/
  18885. ref_object.content = $(this).val();
  18886. if (isNaN(ref_object.content)) {
  18887. rendered.html(ref_object.content.split(" ").join("&nbsp;"));
  18888. } else {
  18889. rendered.text(ref_object.content);
  18890. }
  18891. $(this).remove();
  18892. }
  18893. if (code == 27) {
  18894. if (isNaN(ref_object.content)) {
  18895. rendered.html(ref_object.content.split(" ").join("&nbsp;"));
  18896. } else {
  18897. rendered.text(ref_object.content);
  18898. }
  18899. $(this).remove();
  18900. }
  18901. });
  18902. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__.COMMAND_TYPES.comment) {
  18903. /*rendered.parent().on('click', function(e) {
  18904. rendered.parent().off();
  18905. console.log("TTT14");
  18906. rendered.remove();
  18907. rendered.empty();
  18908. rendered.remove();
  18909. dom_object.empty();
  18910. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18911. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element)
  18912. });*/
  18913. }
  18914. rendered.on("click", function (e) {
  18915. rendered.empty();
  18916. rendered.remove();
  18917. dom_object.empty();
  18918. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18919. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18920. });
  18921. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  18922. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18923. }*/
  18924. }
  18925. $.fn.textWidth = function (text, font) {
  18926. if (!$.fn.textWidth.fakeEl) $.fn.textWidth.fakeEl = $("<span>").hide().appendTo(document.body);
  18927. $.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr("placeholder")).css("font", font || this.css("font"));
  18928. return $.fn.textWidth.fakeEl.width();
  18929. };
  18930. /***/ }),
  18931. /***/ "./js/visualUI/commands/whiletrue.js":
  18932. /*!*******************************************!*\
  18933. !*** ./js/visualUI/commands/whiletrue.js ***!
  18934. \*******************************************/
  18935. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18936. "use strict";
  18937. __webpack_require__.r(__webpack_exports__);
  18938. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18939. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  18940. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand)
  18941. /* harmony export */ });
  18942. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18943. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18944. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  18945. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  18946. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  18947. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
  18948. function createFloatingCommand() {
  18949. 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>');
  18950. }
  18951. function renderCommand(command, function_obj) {
  18952. var ret = '';
  18953. 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>';
  18954. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="textual_expression"></span> <span class="span_command_spec"> ) </span>';
  18955. ret += ' </span>';
  18956. 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>';
  18957. ret += '<div class="ui block_commands">';
  18958. ret += '</div>';
  18959. ret += '<span> </span>';
  18960. ret += '</div>';
  18961. var el = $(ret);
  18962. el.data('command', command);
  18963. el.find('.block_commands').data('command', command);
  18964. addHandlers(command, function_obj, el);
  18965. _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'));
  18966. _generic_expression__WEBPACK_IMPORTED_MODULE_4__.renderExpression(command, function_obj, el.find('.conditional_expression'), command.expression);
  18967. if (command.commands_block) {
  18968. for (var j = 0; j < command.commands_block.length; j++) {
  18969. _commands__WEBPACK_IMPORTED_MODULE_1__.renderCommand(command.commands_block[j], $(el.find('.block_commands')[0]), 3, function_obj);
  18970. }
  18971. }
  18972. if (command.lockexpression) {
  18973. if (command.expression) {
  18974. try {
  18975. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  18976. if (text) {
  18977. $(el.find('.conditional_expression')[0]).toggle();
  18978. $(el.find('.textual_expression')[0]).text(text);
  18979. $(el.find('.textual_expression')[0]).toggle();
  18980. $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
  18981. }
  18982. } catch (e) {
  18983. command.lockexpression = false;
  18984. }
  18985. }
  18986. }
  18987. el.find('.unlock').popup({
  18988. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
  18989. delay: {
  18990. show: 750,
  18991. hide: 0
  18992. }
  18993. });
  18994. el.find('.lock').popup({
  18995. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
  18996. delay: {
  18997. show: 750,
  18998. hide: 0
  18999. }
  19000. });
  19001. el.find('.button_write_expression').popup({
  19002. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression"),
  19003. delay: {
  19004. show: 750,
  19005. hide: 0
  19006. }
  19007. });
  19008. return el;
  19009. }
  19010. function addHandlers(command, function_obj, whiletrue_dom) {
  19011. whiletrue_dom.find('.button_write_expression').on('click', function () {
  19012. window.expressionEdition = true;
  19013. window.inputExpression = null;
  19014. var afterWhichElement;
  19015. var lockButton = $(whiletrue_dom.find('.button_alternate_expression')[0]);
  19016. var editButton = $(this);
  19017. afterWhichElement = $(whiletrue_dom.find('.conditional_expression')[0]);
  19018. if (command.lockexpression) {
  19019. afterWhichElement = $(whiletrue_dom.find('.textual_expression')[0]);
  19020. }
  19021. var text = "";
  19022. if (command.expression) {
  19023. if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
  19024. text = "";
  19025. } else {
  19026. try {
  19027. text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  19028. } catch (ex) {
  19029. text = "";
  19030. }
  19031. }
  19032. }
  19033. var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
  19034. var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
  19035. var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
  19036. input.val(text);
  19037. input.focusout(function (evt) {
  19038. console.log('focosout event!');
  19039. ok_button.click();
  19040. evt.preventDefault();
  19041. return true;
  19042. });
  19043. input.keyup(function (evt) {
  19044. if (evt.keyCode == 27) {
  19045. // esc
  19046. cancel_button.click();
  19047. }
  19048. if (evt.keyCode == 13) {
  19049. // enter
  19050. ok_button.click();
  19051. }
  19052. });
  19053. ok_button.click(function () {
  19054. var parsed = null;
  19055. parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(input.val(), function_obj, input);
  19056. if (parsed) {
  19057. window.expressionEdition = false;
  19058. command.expression = parsed;
  19059. renderAlgorithm();
  19060. }
  19061. });
  19062. cancel_button.mousedown(function (evt) {
  19063. var parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(text, function_obj, input);
  19064. if (parsed) {
  19065. window.expressionEdition = false;
  19066. command.expression = parsed;
  19067. renderAlgorithm();
  19068. }
  19069. });
  19070. input.insertAfter(afterWhichElement);
  19071. input.focus();
  19072. cancel_button.insertAfter(input);
  19073. ok_button.insertAfter(input);
  19074. var len = text.length;
  19075. input[0].setSelectionRange(len, len);
  19076. afterWhichElement.css('display', 'none');
  19077. lockButton.css('display', 'none');
  19078. editButton.css('display', 'none');
  19079. ok_button.popup({
  19080. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_confirm"),
  19081. delay: {
  19082. show: 750,
  19083. hide: 0
  19084. }
  19085. });
  19086. cancel_button.popup({
  19087. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_edit_expression_cancel"),
  19088. delay: {
  19089. show: 750,
  19090. hide: 0
  19091. }
  19092. });
  19093. });
  19094. whiletrue_dom.find('.minimize_block_button').on('click', function (evt) {
  19095. whiletrue_dom.children('.ui.block_commands').toggle();
  19096. command.collapsed = !command.collapsed;
  19097. });
  19098. $(whiletrue_dom.find('.textual_expression')[0]).toggle();
  19099. whiletrue_dom.find('.button_alternate_expression').on('click', function () {
  19100. if (command.expression) {
  19101. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.expression);
  19102. if (text) {
  19103. $(whiletrue_dom.find('.conditional_expression')[0]).toggle();
  19104. $(whiletrue_dom.find('.textual_expression')[0]).text(text);
  19105. $(whiletrue_dom.find('.textual_expression')[0]).toggle();
  19106. $(this).toggleClass('unlock').toggleClass('lock');
  19107. command.lockexpression = !command.lockexpression;
  19108. }
  19109. }
  19110. if (command.lockexpression) {
  19111. whiletrue_dom.find('.lock').popup({
  19112. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_unlock_expression"),
  19113. delay: {
  19114. show: 750,
  19115. hide: 0
  19116. }
  19117. });
  19118. } else {
  19119. whiletrue_dom.find('.unlock').popup({
  19120. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__.LocalizedStrings.getUI("text_lock_expression"),
  19121. delay: {
  19122. show: 750,
  19123. hide: 0
  19124. }
  19125. });
  19126. }
  19127. });
  19128. whiletrue_dom.find('.button_remove_command').on('click', function () {
  19129. if (_commands__WEBPACK_IMPORTED_MODULE_1__.removeCommand(command, function_obj, whiletrue_dom)) {
  19130. whiletrue_dom.fadeOut(400, function () {
  19131. whiletrue_dom.remove();
  19132. });
  19133. }
  19134. });
  19135. }
  19136. /***/ }),
  19137. /***/ "./js/visualUI/commands/writer.js":
  19138. /*!****************************************!*\
  19139. !*** ./js/visualUI/commands/writer.js ***!
  19140. \****************************************/
  19141. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  19142. "use strict";
  19143. __webpack_require__.r(__webpack_exports__);
  19144. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  19145. /* harmony export */ "createFloatingCommand": () => (/* binding */ createFloatingCommand),
  19146. /* harmony export */ "renderCommand": () => (/* binding */ renderCommand),
  19147. /* harmony export */ "addContent": () => (/* binding */ addContent)
  19148. /* harmony export */ });
  19149. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19150. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19151. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  19152. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  19153. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  19154. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../code_generator */ "./js/visualUI/code_generator.js");
  19155. function createFloatingCommand() {
  19156. 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>");
  19157. }
  19158. function renderCommand(command, function_obj) {
  19159. 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>");
  19160. var el = $(ret);
  19161. el.data("command", command); //renderExpression (command, function_obj, div_to_render, expression_array)
  19162. _generic_expression__WEBPACK_IMPORTED_MODULE_4__.renderExpression(command, function_obj, el.find(".all_elements_write"), command.content);
  19163. addHandlers(command, function_obj, el);
  19164. if (command.content && command.lockexpression) {
  19165. try {
  19166. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.content);
  19167. if (text) {
  19168. $(el.find('.all_elements_write')[0]).toggle();
  19169. $(el.find('.textual_expression')[0]).text(text);
  19170. $(el.find('.textual_expression')[0]).toggle();
  19171. $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
  19172. }
  19173. } catch (e) {
  19174. command.lockexpression = false;
  19175. }
  19176. }
  19177. el.find('.unlock').popup({
  19178. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
  19179. delay: {
  19180. show: 750,
  19181. hide: 0
  19182. }
  19183. });
  19184. el.find('.lock').popup({
  19185. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
  19186. delay: {
  19187. show: 750,
  19188. hide: 0
  19189. }
  19190. });
  19191. el.find('.button_write_expression').popup({
  19192. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression"),
  19193. delay: {
  19194. show: 750,
  19195. hide: 0
  19196. }
  19197. });
  19198. return el;
  19199. }
  19200. function addHandlersManager(command, _function_obj, _writer_dom, item_div, content_element) {
  19201. item_div.find(".times").on("click", function () {
  19202. for (var i = 0; i < command.content.length; i++) {
  19203. if (command.content[i] == content_element) {
  19204. delete command.content[i];
  19205. command.content.splice(i, 1);
  19206. item_div.children().off();
  19207. item_div.off();
  19208. item_div.fadeOut();
  19209. if (command.content.length > 0) {
  19210. item_div.next(".icon_add_item_to_writer").fadeOut();
  19211. }
  19212. break;
  19213. }
  19214. }
  19215. });
  19216. }
  19217. function addHandlers(command, function_obj, writer_dom) {
  19218. $(writer_dom.find('.textual_expression')[0]).toggle();
  19219. writer_dom.find('.button_write_expression').on('click', function () {
  19220. window.expressionEdition = true;
  19221. window.inputExpression = null;
  19222. var afterWhichElement;
  19223. var lockButton = $(writer_dom.find('.button_alternate_expression')[0]);
  19224. var editButton = $(this);
  19225. afterWhichElement = writer_dom.find('.all_elements_write');
  19226. if (command.lockexpression) {
  19227. afterWhichElement = writer_dom.find('.textual_expression');
  19228. }
  19229. var text = "";
  19230. if (command.content) {
  19231. if (command.content.length == 1 && command.content[0].content == null && !command.content[0].function_called) {
  19232. text = "";
  19233. } else {
  19234. try {
  19235. text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.content);
  19236. } catch (ex) {
  19237. text = "";
  19238. }
  19239. }
  19240. }
  19241. var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
  19242. var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
  19243. var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
  19244. input.val(text);
  19245. input.focusout(function (evt) {
  19246. ok_button.click();
  19247. evt.preventDefault();
  19248. return true;
  19249. });
  19250. input.keyup(function (evt) {
  19251. if (evt.keyCode == 27) {
  19252. // esc
  19253. cancel_button.click();
  19254. }
  19255. if (evt.keyCode == 13) {
  19256. // enter
  19257. ok_button.click();
  19258. }
  19259. });
  19260. ok_button.click(function () {
  19261. var parsed = null;
  19262. parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(input.val(), function_obj, input);
  19263. if (parsed) {
  19264. window.expressionEdition = false;
  19265. command.content = parsed;
  19266. renderAlgorithm();
  19267. }
  19268. });
  19269. cancel_button.mousedown(function (evt) {
  19270. var parsed = _generic_expression__WEBPACK_IMPORTED_MODULE_4__.expressionParserToVisual(text, function_obj, input);
  19271. if (parsed) {
  19272. window.expressionEdition = false;
  19273. command.content = parsed;
  19274. renderAlgorithm();
  19275. }
  19276. });
  19277. input.insertAfter(afterWhichElement);
  19278. input.focus();
  19279. cancel_button.insertAfter(input);
  19280. ok_button.insertAfter(input);
  19281. var len = text.length;
  19282. input[0].setSelectionRange(len, len);
  19283. afterWhichElement.css('display', 'none');
  19284. lockButton.css('display', 'none');
  19285. editButton.css('display', 'none');
  19286. ok_button.popup({
  19287. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression_confirm"),
  19288. delay: {
  19289. show: 750,
  19290. hide: 0
  19291. }
  19292. });
  19293. cancel_button.popup({
  19294. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_edit_expression_cancel"),
  19295. delay: {
  19296. show: 750,
  19297. hide: 0
  19298. }
  19299. });
  19300. });
  19301. writer_dom.find('.button_alternate_expression').on('click', function () {
  19302. if (command.content) {
  19303. var text = _code_generator__WEBPACK_IMPORTED_MODULE_5__.elementExpressionCode(command.content);
  19304. if (text) {
  19305. $(writer_dom.find('.all_elements_write')[0]).toggle();
  19306. $(writer_dom.find('.textual_expression')[0]).text(text);
  19307. $(writer_dom.find('.textual_expression')[0]).toggle();
  19308. $(this).toggleClass('unlock').toggleClass('lock');
  19309. command.lockexpression = !command.lockexpression;
  19310. }
  19311. if (command.lockexpression) {
  19312. writer_dom.find('.lock').popup({
  19313. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_unlock_expression"),
  19314. delay: {
  19315. show: 750,
  19316. hide: 0
  19317. }
  19318. });
  19319. } else {
  19320. writer_dom.find('.unlock').popup({
  19321. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__.LocalizedStrings.getUI("text_lock_expression"),
  19322. delay: {
  19323. show: 750,
  19324. hide: 0
  19325. }
  19326. });
  19327. }
  19328. }
  19329. });
  19330. writer_dom.find(".button_remove_command").on("click", function () {
  19331. if (_commands__WEBPACK_IMPORTED_MODULE_3__.removeCommand(command, function_obj, writer_dom)) {
  19332. writer_dom.fadeOut(400, function () {
  19333. writer_dom.remove();
  19334. });
  19335. }
  19336. });
  19337. Sortable.create(writer_dom.find(".all_elements_write")[0], {
  19338. handle: ".ellipsis",
  19339. animation: 100,
  19340. ghostClass: "ghost",
  19341. group: "writer_" + Math.floor(Math.random() * 10000000),
  19342. draggable: ".div_parent_handler",
  19343. onEnd: function onEnd(evt) {
  19344. command.content.splice(evt.newIndex, 0, command.content.splice(evt.oldIndex, 1)[0]);
  19345. writer_dom.empty();
  19346. writer_dom.replaceWith(renderCommand(command, function_obj));
  19347. }
  19348. }); // Attach event handles for the newline button
  19349. var newlineBtn = writer_dom.find(".ivprog_newline_btn");
  19350. newlineBtn.on("click", function () {
  19351. var state = this.dataset.state;
  19352. if (state === "on") {
  19353. this.dataset.state = "off";
  19354. command.newline = false;
  19355. this.setAttribute("src", "img/no_new_line.svg");
  19356. } else {
  19357. this.dataset.state = "on";
  19358. command.newline = true;
  19359. this.setAttribute("src", "img/new_line.svg");
  19360. }
  19361. writer_dom.data("command", command);
  19362. setPopup(newlineBtn, command.newline);
  19363. }); // Attach jquery popup
  19364. setPopup(newlineBtn, command.newline);
  19365. }
  19366. function setPopup(element, state) {
  19367. if (element.popup("exists")) {
  19368. element.popup("destroy");
  19369. }
  19370. 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");
  19371. element.popup({
  19372. content: content,
  19373. delay: {
  19374. show: 750,
  19375. hide: 0
  19376. }
  19377. });
  19378. }
  19379. function _addHandlerIconAdd(dom_object, command, function_obj) {
  19380. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  19381. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  19382. var icon_add_item = $('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  19383. if (!insert_after) {
  19384. dom_object.append(icon_add_item);
  19385. } else {
  19386. icon_add_item.insertAfter(after_which);
  19387. }
  19388. icon_add_item.on("click", function (_event) {
  19389. var div_parent_with_handler = $('<div class="div_parent_handler" style="display:none;"></div>');
  19390. var new_div_item = $('<div class="var_value_menu_div"></div>');
  19391. div_parent_with_handler.append($('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  19392. div_parent_with_handler.append(new_div_item);
  19393. div_parent_with_handler.append($('<i class="white inverted icon times handler"></i>'));
  19394. div_parent_with_handler.insertAfter(icon_add_item);
  19395. 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);
  19396. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, new_related_menu, new_div_item, function_obj);
  19397. addHandlerIconAdd(dom_object, command, function_obj, true, div_parent_with_handler);
  19398. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  19399. var pos = 1;
  19400. dom_object.find(".icon_add_item_to_writer").each(function () {
  19401. if ($(this).get(0) === icon_add_item.get(0)) {
  19402. command.content.splice(pos, 0, new_related_menu);
  19403. } else {
  19404. pos++;
  19405. }
  19406. });
  19407. if (command.content.length == 1) {
  19408. icon_add_item.remove();
  19409. }
  19410. div_parent_with_handler.fadeIn();
  19411. });
  19412. }
  19413. function addContent(command, _ref_object, dom_object, _menu_var_or_value, function_obj, _ref_object_content) {
  19414. if (dom_object.hasClass("var_value_menu_div")) {
  19415. var icon_add_item = $('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  19416. icon_add_item.insertAfter(dom_object);
  19417. icon_add_item.on("click", function (_event) {
  19418. var div_parent_with_handler = $('<div class="div_parent_handler"></div>');
  19419. div_parent_with_handler.append($('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  19420. div_parent_with_handler.append(new_div_item);
  19421. div_parent_with_handler.append($('<i class="white inverted icon times handler"></i>'));
  19422. div_parent_with_handler.insertAfter(icon_add_item);
  19423. 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);
  19424. _variable_value_menu__WEBPACK_IMPORTED_MODULE_2__.renderMenu(command, new_related_menu, new_div_item, function_obj);
  19425. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  19426. command.content.push(new_related_menu);
  19427. if (command.content.length == 1) {
  19428. icon_add_item.remove();
  19429. }
  19430. });
  19431. }
  19432. }
  19433. /***/ }),
  19434. /***/ "./js/visualUI/functions.js":
  19435. /*!**********************************!*\
  19436. !*** ./js/visualUI/functions.js ***!
  19437. \**********************************/
  19438. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  19439. "use strict";
  19440. __webpack_require__.r(__webpack_exports__);
  19441. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  19442. /* harmony export */ "renderFunction": () => (/* binding */ renderFunction),
  19443. /* harmony export */ "initVisualUI": () => (/* binding */ initVisualUI),
  19444. /* harmony export */ "setTestCases": () => (/* binding */ setTestCases),
  19445. /* harmony export */ "getTestCases": () => (/* binding */ getTestCases),
  19446. /* harmony export */ "addFunctionChangeListener": () => (/* binding */ addFunctionChangeListener),
  19447. /* harmony export */ "addGlobalChangeListener": () => (/* binding */ addGlobalChangeListener),
  19448. /* harmony export */ "removeGlobalListener": () => (/* binding */ removeGlobalListener),
  19449. /* harmony export */ "removeFunctionListener": () => (/* binding */ removeFunctionListener)
  19450. /* harmony export */ });
  19451. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19452. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19453. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19454. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  19455. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  19456. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  19457. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  19458. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  19459. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  19460. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  19461. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  19462. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_10__);
  19463. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  19464. /* harmony import */ var _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  19465. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  19466. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  19467. /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./../services/userLog */ "./js/services/userLog.js");
  19468. /* harmony import */ var _ima_version_json__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./../../.ima_version.json */ "./.ima_version.json");
  19469. /* harmony import */ var _text_editor__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./text_editor */ "./js/visualUI/text_editor.js");
  19470. /* harmony import */ var _util_utils__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./../util/utils */ "./js/util/utils.js");
  19471. /* harmony import */ var _processor_modes__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../processor/modes */ "./js/processor/modes.ts");
  19472. var counter_new_functions = 0;
  19473. var counter_new_parameters = 0;
  19474. var ivprog_version = _ima_version_json__WEBPACK_IMPORTED_MODULE_16__.version;
  19475. var globalChangeListeners = [];
  19476. var functionsChangeListeners = [];
  19477. var proc = null;
  19478. var domConsole = null;
  19479. var _testCases = [];
  19480. var isRunning = false;
  19481. window.studentGrade = null;
  19482. window.LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings;
  19483. var program = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.Program();
  19484. window.system_functions = []; // Adding math functions:
  19485. 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));
  19486. 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));
  19487. 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));
  19488. 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));
  19489. 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));
  19490. 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));
  19491. 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));
  19492. 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));
  19493. 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));
  19494. 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));
  19495. 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));
  19496. 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:
  19497. 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));
  19498. 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));
  19499. 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));
  19500. 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));
  19501. 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:
  19502. 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));
  19503. 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));
  19504. 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:
  19505. 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));
  19506. 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));
  19507. 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));
  19508. 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));
  19509. 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));
  19510. 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));
  19511. 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));
  19512. 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));
  19513. 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');
  19514. 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);
  19515. mainFunction.function_comment = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__.Comment(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_comment_main'));
  19516. program.addFunction(mainFunction);
  19517. window.program_obj = program;
  19518. window.generator = _code_generator__WEBPACK_IMPORTED_MODULE_6__.generate;
  19519. window.runCodeAssessment = runCodeAssessment;
  19520. window.renderAlgorithm = _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm;
  19521. window.insertContext = false;
  19522. window.watchW = (melanke_watchjs__WEBPACK_IMPORTED_MODULE_10___default());
  19523. melanke_watchjs__WEBPACK_IMPORTED_MODULE_10___default().watch(window.program_obj.globals, function () {
  19524. if (window.insertContext) {
  19525. setTimeout(function () {
  19526. _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm();
  19527. globalChangeListeners.forEach(function (x) {
  19528. return x();
  19529. });
  19530. }, 300);
  19531. window.insertContext = false;
  19532. } else {
  19533. _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm();
  19534. globalChangeListeners.forEach(function (x) {
  19535. return x();
  19536. });
  19537. }
  19538. }, 1);
  19539. melanke_watchjs__WEBPACK_IMPORTED_MODULE_10___default().watch(window.program_obj.functions, function () {
  19540. if (window.insertContext) {
  19541. setTimeout(function () {
  19542. _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm();
  19543. functionsChangeListeners.forEach(function (x) {
  19544. return x();
  19545. });
  19546. }, 300);
  19547. window.insertContext = false;
  19548. } else {
  19549. _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm();
  19550. functionsChangeListeners.forEach(function (x) {
  19551. return x();
  19552. });
  19553. }
  19554. }, 1);
  19555. function addFunctionHandler() {
  19556. if (window.program_obj.functions) {
  19557. var in_use = false;
  19558. do {
  19559. in_use = false;
  19560. var temp_name = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('new_function') + '_' + counter_new_functions;
  19561. window.program_obj.functions.forEach(function (el) {
  19562. if (temp_name == el.name) {
  19563. in_use = true;
  19564. }
  19565. });
  19566. if (in_use) counter_new_functions++;
  19567. } while (in_use);
  19568. }
  19569. 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')));
  19570. program.addFunction(new_function);
  19571. counter_new_functions++;
  19572. window.insertContext = true;
  19573. (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);
  19574. renderFunction(new_function);
  19575. /*newe.css('display', 'none');
  19576. newe.fadeIn();*/
  19577. }
  19578. function addParameter(function_obj, function_container
  19579. /*, is_from_click = false*/
  19580. ) {
  19581. if (function_obj.parameters_list == null) {
  19582. function_obj.parameters_list = [];
  19583. }
  19584. if (function_obj.parameters_list) {
  19585. var in_use = false;
  19586. do {
  19587. in_use = false;
  19588. var temp_name = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('new_parameter') + '_' + counter_new_parameters;
  19589. function_obj.parameters_list.forEach(function (el) {
  19590. if (temp_name == el.name) {
  19591. in_use = true;
  19592. }
  19593. });
  19594. if (in_use) counter_new_parameters++;
  19595. } while (in_use);
  19596. }
  19597. 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);
  19598. function_obj.parameters_list.push(new_parameter);
  19599. counter_new_parameters++;
  19600. (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);
  19601. renderParameter(function_obj, new_parameter, function_container); // if (is_from_click) {
  19602. // newe.css('display', 'none');
  19603. // newe.fadeIn();
  19604. // }
  19605. }
  19606. function updateReturnType(function_obj, new_type) {
  19607. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19608. (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);
  19609. function_obj.return_type = new_type;
  19610. function_obj.return_dimensions = new_dimensions;
  19611. }
  19612. function removeFunction(function_obj) {
  19613. var index = program.functions.indexOf(function_obj);
  19614. if (index > -1) {
  19615. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.REMOVE_FUNCTION);
  19616. program.functions.splice(index, 1);
  19617. }
  19618. }
  19619. function minimizeFunction(function_obj) {
  19620. function_obj.is_hidden = !function_obj.is_hidden;
  19621. }
  19622. function addHandlers(function_obj, function_container) {
  19623. function_container.find('.ui.dropdown.function_return').dropdown({
  19624. onChange: function onChange(value, text, $selectedItem) {
  19625. if ($selectedItem.data('dimensions')) {
  19626. updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19627. } else {
  19628. updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')]);
  19629. }
  19630. },
  19631. selectOnKeydown: false
  19632. });
  19633. function_container.find(".name_function_updated").on('click', function (e) {
  19634. enableNameFunctionUpdate(function_obj, function_container);
  19635. });
  19636. function_container.find(".add_parameter_button").on('click', function (e) {
  19637. window.insertContext = true;
  19638. addParameter(function_obj, function_container, true);
  19639. });
  19640. function_container.find('.menu_commands').dropdown({
  19641. on: 'hover'
  19642. });
  19643. function_container.find('.menu_commands a').on('click', function (evt) {
  19644. if (function_obj.commands == null || function_obj.commands.length == 0) {
  19645. function_obj.commands = [];
  19646. var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_5__.genericCreateCommand($(this).data('command'));
  19647. function_obj.commands.push(new_cmd);
  19648. _commands__WEBPACK_IMPORTED_MODULE_5__.renderCommand(new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  19649. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.INSERT_COMMAND, $(this).data('command'), '/', 0);
  19650. } else {
  19651. _commands__WEBPACK_IMPORTED_MODULE_5__.createFloatingCommand(function_obj, function_container, $(this).data('command'), evt);
  19652. }
  19653. });
  19654. function_container.find('.add_var_button_function').on('click', function (e) {
  19655. window.insertContext = true;
  19656. _variables__WEBPACK_IMPORTED_MODULE_4__.addVariable(function_obj, function_container, true);
  19657. });
  19658. function_container.find('.remove_function_button').on('click', function (e) {
  19659. removeFunction(function_obj);
  19660. function_container.fadeOut();
  19661. });
  19662. function_container.find('.minimize_function_button').on('click', function (e) {
  19663. minimizeFunction(function_obj);
  19664. if (function_obj.is_hidden) {
  19665. function_container.find(".add_var_button_function").toggle();
  19666. function_container.find(".inline_add_command").toggle();
  19667. function_container.find(".function_area").slideToggle();
  19668. } else {
  19669. function_container.find(".function_area").slideToggle(function () {
  19670. function_container.find(".add_var_button_function").toggle();
  19671. function_container.find(".inline_add_command").toggle();
  19672. });
  19673. }
  19674. });
  19675. } // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  19676. function renderFunctionReturn(function_obj, function_element) {
  19677. var ret = '<div class="ui dropdown function_return">';
  19678. if (function_obj.return_dimensions == 1) {
  19679. 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()));
  19680. ret += ' [ ] </div>';
  19681. } else if (function_obj.return_dimensions == 2) {
  19682. 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()));
  19683. ret += ' [ ] [ ] </div>';
  19684. } else {
  19685. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(function_obj.return_type.toLowerCase())) + '</div>';
  19686. }
  19687. ret += '<div class="menu">';
  19688. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  19689. 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>';
  19690. }
  19691. 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">';
  19692. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  19693. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  19694. continue;
  19695. }
  19696. 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>';
  19697. }
  19698. ret += '</div></div>';
  19699. 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">';
  19700. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  19701. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  19702. continue;
  19703. }
  19704. 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>';
  19705. }
  19706. ret += '</div></div>';
  19707. ret += '</div></div>';
  19708. ret = $(ret);
  19709. function_element.find('.function_return').append(ret);
  19710. }
  19711. var cont = 0;
  19712. function renderFunction(function_obj) {
  19713. var appender = '<div class="ui secondary segment function_div list-group-item function_cont_' + cont + '">';
  19714. if (function_obj.function_comment) {//appender += renderComment(function_obj.function_comment, sequence, true, -1);
  19715. }
  19716. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  19717. 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>';
  19718. appender += '<div class="function_signature_div">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("function") + ' ';
  19719. if (function_obj.is_main) {
  19720. 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">';
  19721. } else {
  19722. appender += '<div class="ui function_return"></div>';
  19723. 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">';
  19724. }
  19725. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  19726. appender += '<div class="ui add_var_context add_var_button_function" style="float: left;"> <div class="ui icon button purple"> ';
  19727. 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>';
  19728. appender += '</div></div>';
  19729. appender += '<div class="ui top attached segment variables_list_div"></div>';
  19730. 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;">';
  19731. 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"> ';
  19732. 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>';
  19733. appender += '</div></div>' + '</div>';
  19734. appender += '</div></div>';
  19735. appender = $(appender);
  19736. $('.all_functions').append(appender);
  19737. appender.data('fun', function_obj);
  19738. appender.find('.commands_list_div').data('fun', function_obj);
  19739. renderFunctionReturn(function_obj, appender);
  19740. addHandlers(function_obj, appender); // Rendering parameters:
  19741. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  19742. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  19743. } // Rendering variables:
  19744. for (var j = 0; j < function_obj.variables_list.length; j++) {
  19745. _variables__WEBPACK_IMPORTED_MODULE_4__.renderVariable(appender, function_obj.variables_list[j], function_obj);
  19746. } // Rendering commands:
  19747. for (var j = 0; j < function_obj.commands.length; j++) {
  19748. _commands__WEBPACK_IMPORTED_MODULE_5__.renderCommand(function_obj.commands[j], $(appender.find('.commands_list_div')[0]), 3, function_obj);
  19749. }
  19750. appender.find('.minimize_function_button').popup({
  19751. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_hide_function"),
  19752. delay: {
  19753. show: 750,
  19754. hide: 0
  19755. }
  19756. });
  19757. appender.find('.move_function').popup({
  19758. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("btn_drag_and_drop_function"),
  19759. delay: {
  19760. show: 1000,
  19761. hide: 0
  19762. }
  19763. });
  19764. appender.find('.remove_function_button').popup({
  19765. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("btn_delete_function"),
  19766. delay: {
  19767. show: 750,
  19768. hide: 0
  19769. }
  19770. });
  19771. appender.find('.add_var_button_function').popup({
  19772. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("btn_add_var"),
  19773. delay: {
  19774. show: 750,
  19775. hide: 0
  19776. }
  19777. });
  19778. appender.find('a[data-command="attribution"]').popup({
  19779. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_attribution"),
  19780. position: 'right center',
  19781. delay: {
  19782. show: 750,
  19783. hide: 0
  19784. }
  19785. });
  19786. appender.find('a[data-command="functioncall"]').popup({
  19787. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_call_function"),
  19788. position: 'right center',
  19789. delay: {
  19790. show: 750,
  19791. hide: 0
  19792. }
  19793. });
  19794. appender.find('a[data-command="iftrue"]').popup({
  19795. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_if_else"),
  19796. position: 'right center',
  19797. delay: {
  19798. show: 750,
  19799. hide: 0
  19800. }
  19801. });
  19802. appender.find('a[data-command="comment"]').popup({
  19803. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_comments"),
  19804. position: 'right center',
  19805. delay: {
  19806. show: 750,
  19807. hide: 0
  19808. }
  19809. });
  19810. appender.find('a[data-command="reader"]').popup({
  19811. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_read"),
  19812. position: 'right center',
  19813. delay: {
  19814. show: 750,
  19815. hide: 0
  19816. }
  19817. });
  19818. appender.find('a[data-command="writer"]').popup({
  19819. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_write"),
  19820. position: 'right center',
  19821. delay: {
  19822. show: 750,
  19823. hide: 0
  19824. }
  19825. });
  19826. appender.find('a[data-command="repeatNtimes"]').popup({
  19827. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_repeat_n_times"),
  19828. position: 'right center',
  19829. delay: {
  19830. show: 750,
  19831. hide: 0
  19832. }
  19833. });
  19834. appender.find('a[data-command="whiletrue"]').popup({
  19835. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_repeat_whiletrue"),
  19836. position: 'right center',
  19837. delay: {
  19838. show: 750,
  19839. hide: 0
  19840. }
  19841. });
  19842. appender.find('a[data-command="dowhiletrue"]').popup({
  19843. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_repeat_dowhiletrue"),
  19844. position: 'right center',
  19845. delay: {
  19846. show: 750,
  19847. hide: 0
  19848. }
  19849. });
  19850. appender.find('a[data-command="switch"]').popup({
  19851. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_repeat_switch"),
  19852. position: 'right center',
  19853. delay: {
  19854. show: 750,
  19855. hide: 0
  19856. }
  19857. });
  19858. appender.find('a[data-command="return"]').popup({
  19859. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_menu_repeat_return"),
  19860. position: 'right center',
  19861. delay: {
  19862. show: 750,
  19863. hide: 0
  19864. }
  19865. });
  19866. var function_index = program.functions.indexOf(function_obj);
  19867. Sortable.create(appender.find(".variables_list_div")[0], {
  19868. handle: '.ellipsis',
  19869. animation: 100,
  19870. ghostClass: 'ghost',
  19871. group: 'local_vars_drag_' + function_index,
  19872. onEnd: function onEnd(evt) {
  19873. updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  19874. }
  19875. });
  19876. addSortableHandler(appender.find(".commands_list_div")[0], function_index);
  19877. if (!function_obj.is_main) {
  19878. Sortable.create(appender.find(".container_parameters_list")[0], {
  19879. handle: '.ellipsis',
  19880. animation: 100,
  19881. ghostClass: 'ghost',
  19882. group: 'parameters_drag_' + program.functions.indexOf(function_obj),
  19883. onEnd: function onEnd(evt) {
  19884. updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
  19885. }
  19886. });
  19887. }
  19888. if (function_obj.commands.length > 0) {
  19889. var teste = '.ui.sticky.sticky_cont_' + cont;
  19890. $(teste).sticky({
  19891. context: '.ui.bottom.attached.segment.commands_list_div.commands_cont_' + cont,
  19892. scrollContext: '.ivprog_visual_panel',
  19893. observeChanges: true,
  19894. offset: 40,
  19895. onStick: function onStick(evt) {
  19896. $(teste).css('top', '20px', 'important');
  19897. },
  19898. onBottom: function onBottom(evt) {
  19899. $(teste).css('top', '20px', 'important');
  19900. },
  19901. onUnstick: function onUnstick(evt) {
  19902. $(teste).css('top', '20px', 'important');
  19903. },
  19904. onReposition: function onReposition(evt) {
  19905. $(teste).css('top', '20px', 'important');
  19906. },
  19907. onScroll: function onScroll(evt) {
  19908. $(teste).css('top', '20px', 'important');
  19909. if (!isVisible($(teste), $(teste).parent())) {
  19910. $(teste).removeClass('fixed');
  19911. }
  19912. },
  19913. onTop: function onTop(evt) {
  19914. $(teste).css('top', '20px', 'important');
  19915. }
  19916. });
  19917. }
  19918. cont++;
  19919. appender.find('.add_parameter_button').popup({
  19920. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_add_parameters"),
  19921. delay: {
  19922. show: 750,
  19923. hide: 0
  19924. }
  19925. });
  19926. return appender;
  19927. }
  19928. function isVisible(element, container) {
  19929. var elementTop = $(element).offset().top,
  19930. elementHeight = $(element).height(),
  19931. containerTop = $(container).offset().top,
  19932. containerHeight = $(container).height() - 30;
  19933. return elementTop - containerTop + elementHeight > 0 && elementTop - containerTop < containerHeight;
  19934. }
  19935. window.evento_drag;
  19936. function updateProgramObjDrag() {
  19937. var nodes = Array.prototype.slice.call($('.all_functions').children());
  19938. var function_index;
  19939. var start_index;
  19940. var function_obj;
  19941. $(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  19942. var ref = $(this);
  19943. if (ref.hasClass('function_div')) {
  19944. function_index = nodes.indexOf(this);
  19945. start_index = index;
  19946. function_obj = ref;
  19947. }
  19948. });
  19949. var path_target = [];
  19950. $(evento_drag.item).parentsUntil(".all_functions").each(function () {
  19951. if ($(this).hasClass('command_container')) {
  19952. path_target.push(this);
  19953. }
  19954. });
  19955. if (path_target.length == 0) {//console.log('soltou na raiz, na posição: ' + evento_drag.newIndex + ' mas ainda não sei de onde saiu ');
  19956. } else {//console.log('soltou dentro de algum bloco, sequência vem logo abaixo (de baixo pra cima): ');
  19957. //console.log(path_target);
  19958. }
  19959. var index_each = [];
  19960. var path_relative = [];
  19961. for (var i = path_target.length - 1; i >= 0; i--) {
  19962. if (i == path_target.length - 1) {
  19963. // está na raiz
  19964. var indice_na_raiz = function_obj.find('.command_container').index(path_target[i]);
  19965. } else {
  19966. if ($(path_target[i + 1]).hasClass('iftrue')) {
  19967. if ($(path_target[i]).parent().hasClass('commands_if')) {
  19968. path_relative.push('if');
  19969. index_each.push($(path_target[i]).parent().find('.command_container').index(path_target[i]));
  19970. } else {
  19971. path_relative.push('else');
  19972. index_each.push($(path_target[i]).parent().find('.command_container').index(path_target[i]));
  19973. }
  19974. } else if ($(path_target[i + 1]).hasClass('dowhiletrue')) {
  19975. path_relative.push('dowhiletrue');
  19976. index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19977. } else if ($(path_target[i + 1]).hasClass('repeatNtimes')) {
  19978. path_relative.push('repeatNtimes');
  19979. index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19980. } else if ($(path_target[i + 1]).hasClass('whiletrue')) {
  19981. path_relative.push('whiletrue');
  19982. index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19983. } else if ($(path_target[i + 1]).hasClass('switch')) {
  19984. path_relative.push('switch'); //index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19985. }
  19986. }
  19987. } // var index_in_block = -1;
  19988. 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);
  19989. var is_in_case_switch = $(evento_drag.item).parent().hasClass('case_commands_block'); // encontrar o elemento na árvore:
  19990. var command_start_point = window.program_obj.functions[function_index].commands[indice_na_raiz];
  19991. var block_to_insert = command_start_point;
  19992. for (var i = 0; i < index_each.length; i++) {
  19993. if (path_relative[i] == "else") {
  19994. block_to_insert = block_to_insert.commands_else[index_each[i]];
  19995. } else if (path_relative[i] == "switch") {} else {
  19996. block_to_insert = block_to_insert.commands_block[index_each[i]];
  19997. }
  19998. } //console.log('command_start_point', command_start_point);
  19999. //console.log('block_to_insert', block_to_insert);
  20000. // agora tem que alocar o comando na árvore, mas considerar as quatro situações:
  20001. // (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.
  20002. if (path_target.length == 0) {
  20003. // soltou na raiz:
  20004. window.program_obj.functions[function_index].commands.splice(evento_drag.newIndex - 1, 0, command_in_drag);
  20005. } else if (is_in_else) {
  20006. if (block_to_insert.commands_else) {
  20007. block_to_insert.commands_else.splice(evento_drag.newIndex, 0, command_in_drag);
  20008. } else {
  20009. block_to_insert.commands_else = [];
  20010. block_to_insert.commands_else.push(command_in_drag);
  20011. }
  20012. } else if (is_in_case_switch) {} else {
  20013. // verificar se tem alguma coisa no bloco:
  20014. if (block_to_insert.commands_block) {
  20015. block_to_insert.commands_block.splice(evento_drag.newIndex, 0, command_in_drag);
  20016. } else {
  20017. block_to_insert.commands_block = [];
  20018. block_to_insert.commands_block.push(command_in_drag);
  20019. }
  20020. }
  20021. window.draging = false;
  20022. renderAlgorithm();
  20023. }
  20024. function prepareDragHandler(evt) {
  20025. window.draging = true;
  20026. var nodes = Array.prototype.slice.call($('.all_functions').children());
  20027. var function_index;
  20028. var function_obj;
  20029. $(evt.item).parentsUntil(".all_functions").each(function (index) {
  20030. if ($(this).hasClass('function_div')) {
  20031. function_index = nodes.indexOf(this);
  20032. function_obj = window.program_obj.functions[function_index];
  20033. }
  20034. });
  20035. command_in_drag = $(evt.item).data("command"); //console.log('$(evt.item).parent(): ');
  20036. //console.log($(evt.item).parent());
  20037. // descobrir qual das quatro situações:
  20038. if ($(evt.item).parent().hasClass('commands_list_div')) {
  20039. // está na raiz:
  20040. if (function_obj.commands.indexOf(command_in_drag) > -1) {
  20041. function_obj.commands.splice(function_obj.commands.indexOf(command_in_drag), 1);
  20042. }
  20043. } else if ($(evt.item).parent().hasClass('commands_else')) {
  20044. // está no else:
  20045. if ($(evt.item).parent().data('command').commands_else.indexOf(command_in_drag) > -1) {
  20046. $(evt.item).parent().data('command').commands_else.splice($(evt.item).parent().data('command').commands_else.indexOf(command_in_drag), 1);
  20047. }
  20048. } else if ($(evt.item).parent().hasClass('case_commands_block')) {// está em um switch:
  20049. } else {
  20050. // caso padrão:
  20051. if ($(evt.item).parent().data('command').commands_block.indexOf(command_in_drag) > -1) {
  20052. $(evt.item).parent().data('command').commands_block.splice($(evt.item).parent().data('command').commands_block.indexOf(command_in_drag), 1);
  20053. }
  20054. }
  20055. }
  20056. var command_in_drag;
  20057. function addSortableHandler(element, id_function) {
  20058. var n_group = 'commands_drag_' + id_function;
  20059. Sortable.create(element, {
  20060. handle: '.command_drag',
  20061. ghostClass: 'ghost',
  20062. animation: 300,
  20063. group: {
  20064. name: n_group
  20065. },
  20066. onEnd: function onEnd(evt) {
  20067. var nodes = Array.prototype.slice.call($('.all_functions').children());
  20068. var function_index;
  20069. var function_obj;
  20070. $(evt.item).parentsUntil(".all_functions").each(function (index) {
  20071. if ($(this).hasClass('function_div')) {
  20072. function_index = nodes.indexOf(this);
  20073. function_obj = window.program_obj.functions[function_index];
  20074. }
  20075. });
  20076. (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);
  20077. var itemEl = evt.item; // dragged HTMLElement
  20078. evt.to; // target list
  20079. evt.from; // previous list
  20080. evt.oldIndex; // element's old index within old parent
  20081. evt.newIndex; // element's new index within new parent
  20082. //console.log('::EVT::');
  20083. //console.log(evt);
  20084. window.evento_drag = evt;
  20085. try {
  20086. updateProgramObjDrag();
  20087. } catch (e) {
  20088. console.error(e);
  20089. window.draging = false;
  20090. }
  20091. },
  20092. onStart: function onStart(evt) {
  20093. //console.log("START::EVT::");
  20094. //console.log(evt);
  20095. //console.log("\n\ncommand_in_drag");
  20096. try {
  20097. prepareDragHandler(evt);
  20098. } catch (e) {
  20099. window.draging = false;
  20100. }
  20101. }
  20102. });
  20103. element = $(element);
  20104. element.find(".iftrue").each(function (index) {
  20105. addSortableHandler($(this).find(".block_commands")[0], id_function);
  20106. addSortableHandler($(this).find(".block_commands")[1], id_function);
  20107. });
  20108. element.find(".repeatNtimes").each(function (index) {
  20109. addSortableHandler($(this).find(".block_commands")[0], id_function);
  20110. });
  20111. element.find(".dowhiletrue").each(function (index) {
  20112. addSortableHandler($(this).find(".block_commands")[0], id_function);
  20113. });
  20114. element.find(".whiletrue").each(function (index) {
  20115. addSortableHandler($(this).find(".block_commands")[0], id_function);
  20116. });
  20117. element.find(".switch").each(function (index) {
  20118. $(this).find(".case_div").each(function (index) {
  20119. addSortableHandler($(this).find(".case_commands_block")[0], id_function);
  20120. });
  20121. });
  20122. }
  20123. function initVisualUI() {
  20124. // MUST USE CONST, LET, OR VAR !!!!!!
  20125. // const mainDiv = $('#visual-main-div');
  20126. // fill mainDiv with functions and globals...
  20127. // renderAlgorithm()...
  20128. domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_8__.DOMConsole("ivprog-term-div");
  20129. domConsole.hide();
  20130. $(document.getElementById("ivprog-term-div")).draggable();
  20131. $('.add_function_button').on('click', function () {
  20132. addFunctionHandler();
  20133. }).popup({
  20134. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_add_function"),
  20135. delay: {
  20136. show: 750,
  20137. hide: 0
  20138. }
  20139. });
  20140. $('.add_global_button').on('click', function () {
  20141. window.insertContext = true;
  20142. _globals__WEBPACK_IMPORTED_MODULE_3__.addGlobal(program, true);
  20143. });
  20144. $('#run_button').on('click', function () {
  20145. showStopButton();
  20146. runCode();
  20147. });
  20148. $('#download_file_button').on('click', function () {
  20149. downloadFile();
  20150. });
  20151. $('#upload_file_button').on('click', function () {
  20152. $('#ivph_file').click().off('change').change(uploadFile);
  20153. });
  20154. $('#stop_button').on('click', function () {
  20155. showRunButton();
  20156. stopExecution();
  20157. });
  20158. $('.visual_coding_button').on('click', function () {
  20159. toggleVisualCoding();
  20160. });
  20161. $('.textual_coding_button').on('click', function () {
  20162. toggleTextualCoding();
  20163. });
  20164. $('.assessment').on('click', function () {
  20165. is_iassign = true;
  20166. runCodeAssessment();
  20167. });
  20168. $('.div_toggle_console').on('click', function () {
  20169. toggleConsole();
  20170. });
  20171. $('.expand_button').on('click', function () {
  20172. full_screen();
  20173. });
  20174. $('.help_button').on('click', function () {
  20175. window.open('https://www.usp.br/line/ivprog/', '_blank');
  20176. });
  20177. $('.main_title h2').prop('title', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('text_ivprog_description'));
  20178. var time_show = 750;
  20179. $('.visual_coding_button').popup({
  20180. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_visual"),
  20181. delay: {
  20182. show: time_show,
  20183. hide: 0
  20184. }
  20185. });
  20186. $('.textual_coding_button').popup({
  20187. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_textual"),
  20188. delay: {
  20189. show: time_show,
  20190. hide: 0
  20191. }
  20192. });
  20193. $('.upload_file_button').popup({
  20194. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_upload"),
  20195. delay: {
  20196. show: time_show,
  20197. hide: 0
  20198. }
  20199. });
  20200. $('.download_file_button').popup({
  20201. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_download"),
  20202. delay: {
  20203. show: time_show,
  20204. hide: 0
  20205. }
  20206. });
  20207. $('.undo_button').popup({
  20208. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_undo"),
  20209. delay: {
  20210. show: time_show,
  20211. hide: 0
  20212. }
  20213. });
  20214. $('.redo_button').popup({
  20215. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_redo"),
  20216. delay: {
  20217. show: time_show,
  20218. hide: 0
  20219. }
  20220. });
  20221. $('.run_button').popup({
  20222. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_run"),
  20223. delay: {
  20224. show: time_show,
  20225. hide: 0
  20226. }
  20227. });
  20228. $('.assessment_button').popup({
  20229. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_evaluate"),
  20230. delay: {
  20231. show: time_show,
  20232. hide: 0
  20233. }
  20234. });
  20235. $('.help_button').popup({
  20236. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_help") + ' - ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_ivprog_version") + ' ' + ivprog_version,
  20237. delay: {
  20238. show: time_show,
  20239. hide: 0
  20240. }
  20241. });
  20242. $('.add_global_button').popup({
  20243. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_add_global"),
  20244. delay: {
  20245. show: time_show,
  20246. hide: 0
  20247. }
  20248. });
  20249. $('.div_toggle_console').popup({
  20250. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_console"),
  20251. delay: {
  20252. show: time_show,
  20253. hide: 0
  20254. }
  20255. });
  20256. Sortable.create(listWithHandle, {
  20257. handle: '.glyphicon-move',
  20258. animation: 100,
  20259. ghostClass: 'ghost',
  20260. group: 'functions_divs_drag',
  20261. onEnd: function onEnd(evt) {
  20262. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  20263. }
  20264. });
  20265. var listGlobalsHandle = document.getElementById("listGlobalsHandle");
  20266. Sortable.create(listGlobalsHandle, {
  20267. handle: '.ellipsis',
  20268. animation: 100,
  20269. ghostClass: 'ghost',
  20270. group: 'globals_divs_drag',
  20271. onEnd: function onEnd(evt) {
  20272. updateSequenceGlobals(evt.oldIndex, evt.newIndex);
  20273. }
  20274. });
  20275. }
  20276. function setTestCases(testCases) {
  20277. _testCases = testCases;
  20278. }
  20279. function getTestCases() {
  20280. // Deep clone of test cases to avoid unauthorized modification
  20281. // TODO: It may be not possible to use this once custom test are fully implemented
  20282. return JSON.parse(JSON.stringify(_testCases));
  20283. }
  20284. var is_iassign = false;
  20285. function updateSequenceParameters(oldIndex, newIndex, function_obj) {
  20286. function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
  20287. }
  20288. function updateSequenceLocals(oldIndex, newIndex, function_obj) {
  20289. function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
  20290. }
  20291. function updateSequenceGlobals(oldIndex, newIndex) {
  20292. program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
  20293. }
  20294. function updateSequenceFunction(oldIndex, newIndex) {
  20295. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  20296. }
  20297. function runCodeAssessment() {
  20298. if (isRunning) {
  20299. // cannot run assessment or it's already running
  20300. return -1;
  20301. }
  20302. var strCode = null;
  20303. is_iassign = false;
  20304. window.studentGrade = null;
  20305. if (settingsProgrammingTypes == "textual") {
  20306. strCode = _text_editor__WEBPACK_IMPORTED_MODULE_17__.getCode();
  20307. } else {
  20308. strCode = _code_generator__WEBPACK_IMPORTED_MODULE_6__.generate();
  20309. }
  20310. if (strCode == null) {
  20311. // No code, so no assessment
  20312. return -1;
  20313. }
  20314. toggleConsole(true);
  20315. try {
  20316. var data = _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_11__.SemanticAnalyser.analyseFromSource(strCode);
  20317. isRunning = true;
  20318. var runner = new _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_12__.IVProgAssessment(data, _testCases, domConsole);
  20319. runner.runTest().then(function (grade) {
  20320. if (!is_iassign) {
  20321. parent.getEvaluationCallback(grade);
  20322. } else {
  20323. is_iassign = false;
  20324. }
  20325. isRunning = false;
  20326. })["catch"](function (err) {
  20327. console.log(err);
  20328. isRunning = false;
  20329. });
  20330. } catch (error) {
  20331. isRunning = false;
  20332. domConsole.err(error.message);
  20333. console.log(error);
  20334. if (!is_iassign) {
  20335. parent.getEvaluationCallback(0);
  20336. } else {
  20337. is_iassign = false;
  20338. }
  20339. }
  20340. return 0;
  20341. }
  20342. function runCode() {
  20343. if (isRunning) {
  20344. return;
  20345. }
  20346. var strCode = null;
  20347. if (settingsProgrammingTypes == "textual") {
  20348. strCode = _text_editor__WEBPACK_IMPORTED_MODULE_17__.getCode();
  20349. } else {
  20350. strCode = _code_generator__WEBPACK_IMPORTED_MODULE_6__.generate();
  20351. }
  20352. if (strCode == null) {
  20353. return;
  20354. }
  20355. toggleConsole(true); // if(domConsole == null)
  20356. // domConsole = new DOMConsole("#ivprog-term");
  20357. //$("#ivprog-term").slideDown(500);
  20358. try {
  20359. var data = _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_11__.SemanticAnalyser.analyseFromSource(strCode);
  20360. proc = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_9__.IVProgProcessor(data);
  20361. proc.registerInput(domConsole);
  20362. proc.registerOutput(domConsole);
  20363. $("#ivprog-term").addClass('ivprog-term-active');
  20364. isRunning = true;
  20365. proc.interpretAST().then(function (_) {
  20366. scheduleCall(function () {
  20367. if (domConsole.pending_writes.length == 0) {
  20368. if (proc.mode === _processor_modes__WEBPACK_IMPORTED_MODULE_19__.Modes.ABORT) {
  20369. domConsole.info(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getMessage("aborted_execution"));
  20370. } else {
  20371. domConsole.info(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getMessage("success_execution"));
  20372. }
  20373. $("#ivprog-term").removeClass('ivprog-term-active');
  20374. isRunning = false;
  20375. proc = null;
  20376. showRunButton();
  20377. return true;
  20378. }
  20379. return false;
  20380. }, 100);
  20381. })["catch"](function (err) {
  20382. scheduleCall(function () {
  20383. if (domConsole.pending_writes.length == 0) {
  20384. if (err instanceof Error) {
  20385. domConsole.err(err.message);
  20386. } else {
  20387. domConsole.err(err);
  20388. }
  20389. $("#ivprog-term").removeClass('ivprog-term-active');
  20390. isRunning = false;
  20391. proc = null;
  20392. showRunButton();
  20393. return true;
  20394. }
  20395. return false;
  20396. }, 100);
  20397. });
  20398. } catch (error) {
  20399. scheduleCall(function () {
  20400. if (domConsole.pending_writes.length == 0) {
  20401. isRunning = false;
  20402. proc = null;
  20403. showRunButton();
  20404. domConsole.err(error.message);
  20405. console.log(error);
  20406. return true;
  20407. }
  20408. return false;
  20409. }, 100);
  20410. }
  20411. }
  20412. function toggleConsole(is_running) {
  20413. if (is_running) {
  20414. $('.ivprog-term-div').css('display', 'block');
  20415. $('#ivprog-term').css('min-height', '160px');
  20416. if (domConsole != null) domConsole.focus(); //$('#ivprog-term').css('margin-top', '-170px');
  20417. return;
  20418. } else {
  20419. domConsole.hide();
  20420. return;
  20421. }
  20422. if ($('#ivprog-term').css('min-height') == '160px') {
  20423. // esconder
  20424. $('.ivprog-term-div').css('display', 'none');
  20425. $('#ivprog-term').css('min-height', '0'); //$('#ivprog-term').css('margin-top', '-30px');
  20426. //$('#ivprog-term').css('padding', '5px');
  20427. } else {
  20428. // mostrar
  20429. $('.ivprog-term-div').css('display', 'block');
  20430. $('#ivprog-term').css('min-height', '160px'); //$('#ivprog-term').css('margin-top', '-170px');
  20431. }
  20432. } // function waitToCloseConsole () {
  20433. // domConsole.info("Aperte qualquer tecla para fechar...");
  20434. // const p = new Promise((resolve, _) => {
  20435. // domConsole.requestInput(resolve, true);
  20436. // });
  20437. // p.then( _ => {
  20438. // domConsole.dispose();
  20439. // domConsole = null;
  20440. // $("#ivprog-term").hide();
  20441. // })
  20442. // }
  20443. function toggleTextualCoding() {
  20444. var code = null;
  20445. if (settingsProgrammingTypes != "textual") {
  20446. code = _code_generator__WEBPACK_IMPORTED_MODULE_6__.generate();
  20447. if (code == null) {
  20448. return;
  20449. }
  20450. }
  20451. $('.ivprog_visual_panel').css('display', 'none');
  20452. $('.ivprog_textual_panel').css('display', 'block');
  20453. $('.ivprog_textual_panel').removeClass('loading');
  20454. _text_editor__WEBPACK_IMPORTED_MODULE_17__.updateEditor();
  20455. if (code != null) _text_editor__WEBPACK_IMPORTED_MODULE_17__.setCode(code); //$('.ivprog_textual_code').text(code);
  20456. $('.visual_coding_button').removeClass('active');
  20457. $('.textual_coding_button').addClass('active');
  20458. }
  20459. function toggleVisualCoding() {
  20460. $('.ivprog_textual_panel').addClass('loading');
  20461. $('.ivprog_textual_panel').css('display', 'none');
  20462. $('.ivprog_visual_panel').css('display', 'block');
  20463. $('.textual_coding_button').removeClass('active');
  20464. $('.visual_coding_button').addClass('active');
  20465. }
  20466. function removeParameter(function_obj, parameter_obj, parameter_container) {
  20467. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(parameter_obj.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.REMOVE_FUNCTION_PARAM, function_obj.name);
  20468. var index = function_obj.parameters_list.indexOf(parameter_obj);
  20469. if (index > -1) {
  20470. window.insertContext = true;
  20471. function_obj.parameters_list.splice(index, 1);
  20472. }
  20473. $(parameter_container).fadeOut();
  20474. }
  20475. function updateParameterType(parameter_obj, new_type, function_name) {
  20476. var new_dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  20477. (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);
  20478. parameter_obj.type = new_type;
  20479. parameter_obj.dimensions = new_dimensions;
  20480. if (new_dimensions > 0) {
  20481. parameter_obj.rows = new_dimensions;
  20482. parameter_obj.columns = 2;
  20483. }
  20484. }
  20485. function renderParameter(function_obj, parameter_obj, function_container) {
  20486. var ret = "";
  20487. ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
  20488. if (parameter_obj.reference) ret += '<input type="checkbox" checked class="by_reference">';else ret += '<input type="checkbox" class="by_copy">';
  20489. ret += '<div class="ui dropdown parameter_type">';
  20490. if (parameter_obj.dimensions > 0) {
  20491. 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()));
  20492. if (parameter_obj.dimensions == 1) {
  20493. ret += ' [ ] ';
  20494. } else {
  20495. ret += ' [ ] [ ] ';
  20496. }
  20497. ret += '</div>';
  20498. } else {
  20499. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(parameter_obj.type.toLowerCase())) + '</div>';
  20500. }
  20501. ret += '<div class="menu">';
  20502. for (var _tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  20503. if (_tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  20504. continue;
  20505. }
  20506. 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>';
  20507. }
  20508. 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">';
  20509. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  20510. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  20511. continue;
  20512. }
  20513. 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>';
  20514. }
  20515. ret += '</div></div>';
  20516. 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">';
  20517. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  20518. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  20519. continue;
  20520. }
  20521. 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>';
  20522. }
  20523. ret += '</div></div>';
  20524. ret += '</div></div>';
  20525. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  20526. ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
  20527. ret = $(ret);
  20528. function_container.find('.container_parameters_list').append(ret);
  20529. ret.find('.remove_parameter').on('click', function (e) {
  20530. removeParameter(function_obj, parameter_obj, ret);
  20531. });
  20532. ret.find('.ui.dropdown.parameter_type').dropdown({
  20533. onChange: function onChange(_, __, $selectedItem) {
  20534. if ($selectedItem.data('dimensions')) {
  20535. updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], function_obj.name, $selectedItem.data('dimensions'));
  20536. } else {
  20537. updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], function_obj.name);
  20538. }
  20539. },
  20540. selectOnKeydown: false
  20541. });
  20542. ret.find('.parameter_div_edit').on('click', function (e) {
  20543. (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);
  20544. enableNameParameterUpdate(parameter_obj, ret, function_obj);
  20545. });
  20546. ret.find('input:checkbox').change(function () {
  20547. parameter_obj.reference = this.checked;
  20548. _algorithm__WEBPACK_IMPORTED_MODULE_13__.renderAlgorithm();
  20549. });
  20550. ret.find('.by_reference').popup({
  20551. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_parameter_reference"),
  20552. delay: {
  20553. show: 750,
  20554. hide: 0
  20555. }
  20556. });
  20557. ret.find('.by_copy').popup({
  20558. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("text_parameter_copy"),
  20559. delay: {
  20560. show: 750,
  20561. hide: 0
  20562. }
  20563. });
  20564. return ret;
  20565. }
  20566. function updateParameterName(parameter_var, new_name, parameter_obj_dom, function_obj) {
  20567. if (parameter_var.name == new_name) {
  20568. return;
  20569. }
  20570. if ((0,_util_utils__WEBPACK_IMPORTED_MODULE_18__.isValidIdentifier)(new_name)) {
  20571. if (variableNameAlreadyExists(new_name, function_obj)) {
  20572. _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]));
  20573. } else {
  20574. (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);
  20575. parameter_var.name = new_name;
  20576. }
  20577. } else {
  20578. _utils__WEBPACK_IMPORTED_MODULE_14__.renderErrorMessage(parameter_obj_dom.find('.parameter_div_edit'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getError('inform_valid_identifier'));
  20579. }
  20580. }
  20581. function variableNameAlreadyExists(name_var, function_obj) {
  20582. if (function_obj.parameters_list) {
  20583. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  20584. if (function_obj.parameters_list[i].name == name_var) {
  20585. return true;
  20586. }
  20587. }
  20588. }
  20589. if (function_obj.variables_list) {
  20590. for (var i = 0; i < function_obj.variables_list.length; i++) {
  20591. if (function_obj.variables_list[i].name == name_var) {
  20592. return true;
  20593. }
  20594. }
  20595. }
  20596. return false;
  20597. }
  20598. function updateFunctionName(function_var, new_name, function_obj_dom) {
  20599. if (function_var.name == new_name) {
  20600. return;
  20601. }
  20602. if ((0,_util_utils__WEBPACK_IMPORTED_MODULE_18__.isValidIdentifier)(new_name)) {
  20603. if (functionNameAlreadyExists(new_name)) {
  20604. _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]));
  20605. } else {
  20606. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_15__.registerUserEvent)(function_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_15__.ActionTypes.RENAME_FUNCTION, new_name);
  20607. function_var.name = new_name;
  20608. }
  20609. } else {
  20610. _utils__WEBPACK_IMPORTED_MODULE_14__.renderErrorMessage(function_obj_dom.find('.function_name_div'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getError('inform_valid_identifier'));
  20611. }
  20612. }
  20613. function functionNameAlreadyExists(function_name) {
  20614. for (var i = 0; i < window.program_obj.functions.length; i++) {
  20615. if (window.program_obj.functions[i].name == function_name) {
  20616. return true;
  20617. }
  20618. }
  20619. return false;
  20620. }
  20621. var opened_name_parameter = false;
  20622. var opened_input_parameter = null;
  20623. function enableNameParameterUpdate(parameter_obj, parent_node, function_obj) {
  20624. if (opened_name_parameter) {
  20625. opened_input_parameter.focus();
  20626. return;
  20627. }
  20628. opened_name_parameter = true;
  20629. parent_node = $(parent_node);
  20630. var input_field;
  20631. parent_node.find('.span_name_parameter').text('');
  20632. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parameter_obj.name + "' />");
  20633. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  20634. input_field.on('input', function () {
  20635. var inputWidth = input_field.textWidth() + 10;
  20636. opened_input_parameter = input_field;
  20637. input_field.focus();
  20638. var tmpStr = input_field.val();
  20639. input_field.val('');
  20640. input_field.val(tmpStr);
  20641. input_field.css({
  20642. width: inputWidth
  20643. });
  20644. }).trigger('input');
  20645. input_field.focusout(function () {
  20646. /// update array:
  20647. if (input_field.val().trim()) {
  20648. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  20649. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  20650. }
  20651. input_field.off();
  20652. input_field.remove(); /// update elements:
  20653. opened_name_parameter = false;
  20654. opened_input_parameter = false;
  20655. });
  20656. input_field.on('keydown', function (e) {
  20657. var code = e.keyCode || e.which;
  20658. if (code == 13) {
  20659. if (input_field.val().trim()) {
  20660. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  20661. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  20662. }
  20663. input_field.off();
  20664. input_field.remove(); /// update elements:
  20665. opened_name_parameter = false;
  20666. opened_input_parameter = false;
  20667. }
  20668. if (code == 27) {
  20669. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  20670. input_field.off();
  20671. input_field.remove(); /// update elements:
  20672. opened_name_parameter = false;
  20673. opened_input_parameter = false;
  20674. }
  20675. });
  20676. input_field.select();
  20677. }
  20678. var opened_name_function = false;
  20679. var opened_input = null;
  20680. var previousPadding = null;
  20681. function enableNameFunctionUpdate(function_obj, parent_node) {
  20682. if (opened_name_function) {
  20683. opened_input.focus();
  20684. return;
  20685. }
  20686. parent_node = $(parent_node);
  20687. parent_node.find('.span_name_function').text('');
  20688. var input_field;
  20689. if (!previousPadding) {
  20690. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  20691. }
  20692. parent_node.find('.span_name_function').css('padding-left', '0');
  20693. parent_node.find('.span_name_function').css('padding-right', '0');
  20694. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + function_obj.name + "' />");
  20695. input_field.insertBefore(parent_node.find('.span_name_function'));
  20696. input_field.on('input', function () {
  20697. var inputWidth = input_field.textWidth() + 10;
  20698. opened_input = input_field;
  20699. input_field.focus();
  20700. var tmpStr = input_field.val();
  20701. input_field.val('');
  20702. input_field.val(tmpStr);
  20703. input_field.css({
  20704. width: inputWidth
  20705. });
  20706. }).trigger('input');
  20707. input_field.focusout(function () {
  20708. /// update array:
  20709. if (input_field.val().trim()) {
  20710. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  20711. }
  20712. input_field.off();
  20713. input_field.remove();
  20714. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  20715. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  20716. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  20717. opened_name_function = false;
  20718. opened_input = false;
  20719. });
  20720. input_field.on('keydown', function (e) {
  20721. var code = e.keyCode || e.which;
  20722. if (code == 13) {
  20723. if (input_field.val().trim()) {
  20724. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  20725. }
  20726. input_field.off();
  20727. input_field.remove();
  20728. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  20729. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  20730. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  20731. opened_name_function = false;
  20732. opened_input = false;
  20733. }
  20734. if (code == 27) {
  20735. input_field.off();
  20736. input_field.remove();
  20737. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  20738. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  20739. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  20740. opened_name_function = false;
  20741. opened_input = false;
  20742. }
  20743. });
  20744. input_field.select();
  20745. }
  20746. function addFunctionChangeListener(callback) {
  20747. functionsChangeListeners.push(callback);
  20748. return functionsChangeListeners.length - 1;
  20749. }
  20750. function addGlobalChangeListener(callback) {
  20751. globalChangeListeners.push(callback);
  20752. return globalChangeListeners.length - 1;
  20753. }
  20754. function removeGlobalListener(index) {
  20755. globalChangeListeners.splice(index, 1);
  20756. }
  20757. function removeFunctionListener(index) {
  20758. functionsChangeListeners.splice(index);
  20759. }
  20760. function scheduleCall(callback, time) {
  20761. var scheduled_call = function scheduled_call() {
  20762. var id = setInterval(function () {
  20763. if (callback()) {
  20764. clearInterval(id);
  20765. }
  20766. }, time);
  20767. };
  20768. scheduled_call();
  20769. }
  20770. function showRunButton() {
  20771. document.getElementById('run_button').style.display = 'inline';
  20772. document.getElementById('stop_button').style.display = 'none';
  20773. }
  20774. function showStopButton() {
  20775. document.getElementById('run_button').style.display = 'none';
  20776. document.getElementById('stop_button').style.display = 'inline';
  20777. }
  20778. function stopExecution() {
  20779. domConsole.clearPendingWrites();
  20780. domConsole.cancelPendingInputRequests();
  20781. if (!isRunning) {
  20782. return;
  20783. }
  20784. proc.mode = _processor_modes__WEBPACK_IMPORTED_MODULE_19__.Modes.ABORT;
  20785. }
  20786. function downloadFile() {
  20787. var contentToSend = '{}\n::algorithm::';
  20788. contentToSend = generator();
  20789. var date = new Date();
  20790. var temp = date.toISOString().split('T')[0] + "_" + date.toTimeString().split(' ')[0].replaceAll(':', '-');
  20791. var blob = new Blob([contentToSend], {
  20792. type: "text/plain;charset=utf-8"
  20793. });
  20794. saveAs(blob, "ivprog-exported_" + temp + ".ivph");
  20795. }
  20796. function uploadFile(evt) {
  20797. var oFReader = new FileReader();
  20798. oFReader.readAsText(document.getElementById("ivph_file").files[0]);
  20799. oFReader.onload = function (oFREvent) {
  20800. var txt = oFREvent.target.result;
  20801. try {
  20802. if (txt.indexOf("::algorithm::") >= 0) {
  20803. prepareActivityToStudent(txt, true);
  20804. } else {
  20805. ivprogCore.setPreviousAlgorithm(txt);
  20806. window.renderAlgorithm();
  20807. }
  20808. } catch (e) {
  20809. console.log(e);
  20810. }
  20811. };
  20812. }
  20813. /***/ }),
  20814. /***/ "./js/visualUI/globals.js":
  20815. /*!********************************!*\
  20816. !*** ./js/visualUI/globals.js ***!
  20817. \********************************/
  20818. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  20819. "use strict";
  20820. __webpack_require__.r(__webpack_exports__);
  20821. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  20822. /* harmony export */ "addGlobal": () => (/* binding */ addGlobal),
  20823. /* harmony export */ "renderGlobal": () => (/* binding */ renderGlobal)
  20824. /* harmony export */ });
  20825. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20826. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  20827. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  20828. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  20829. /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../services/userLog */ "./js/services/userLog.js");
  20830. /* harmony import */ var _util_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../util/utils */ "./js/util/utils.js");
  20831. var counter_new_globals = 0;
  20832. function addGlobal(program) {
  20833. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  20834. // Verify if the next global name is in use:
  20835. if (program.globals) {
  20836. var in_use = false;
  20837. do {
  20838. in_use = false;
  20839. var temp_name = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals;
  20840. program.globals.forEach(function (el) {
  20841. if (temp_name == el.name) {
  20842. in_use = true;
  20843. }
  20844. });
  20845. if (in_use) counter_new_globals++;
  20846. } while (in_use);
  20847. }
  20848. 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);
  20849. counter_new_globals++;
  20850. program.addGlobal(new_global);
  20851. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(new_global.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.INSERT_GLOBAL_VAR);
  20852. var newe = renderGlobal(new_global);
  20853. if (is_from_click) {
  20854. newe.css('display', 'none');
  20855. newe.fadeIn();
  20856. }
  20857. }
  20858. function toggleConstant(global_var) {
  20859. global_var.is_constant = !global_var.is_constant;
  20860. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.SET_GLOBAL_CONST);
  20861. }
  20862. function updateName(global_var, new_name, global_obj_dom) {
  20863. if (global_var.name == new_name) {
  20864. return;
  20865. }
  20866. if ((0,_util_utils__WEBPACK_IMPORTED_MODULE_5__.isValidIdentifier)(new_name)) {
  20867. if (globalNameAlreadyExists(new_name)) {
  20868. _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'));
  20869. } else {
  20870. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.RENAME_GLOBAL_VAR, new_name);
  20871. global_var.name = new_name;
  20872. }
  20873. } else {
  20874. _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(global_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getError('inform_valid_identifier'));
  20875. }
  20876. }
  20877. function globalNameAlreadyExists(global_name) {
  20878. for (var i = 0; i < window.program_obj.globals.length; i++) {
  20879. if (window.program_obj.globals[i].name == global_name) {
  20880. return true;
  20881. }
  20882. }
  20883. return false;
  20884. }
  20885. function updateType(global_var, new_type) {
  20886. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20887. global_var.type = new_type;
  20888. global_var.dimensions = new_dimensions;
  20889. if (new_dimensions > 0) {
  20890. global_var.rows = new_dimensions;
  20891. global_var.columns = 2;
  20892. }
  20893. (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);
  20894. updateInitialValues(global_var);
  20895. }
  20896. function removeGlobal(global_var, global_container) {
  20897. var index = window.program_obj.globals.indexOf(global_var);
  20898. if (index > -1) {
  20899. window.insertContext = true;
  20900. window.program_obj.globals.splice(index, 1);
  20901. }
  20902. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.REMOVE_GLOBAL_VAR);
  20903. global_container.children().off();
  20904. global_container.off();
  20905. global_container.fadeOut();
  20906. }
  20907. function updateInitialValues(global_var) {
  20908. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  20909. if (global_var.dimensions == 0) {
  20910. global_var.value = 0;
  20911. }
  20912. if (global_var.dimensions == 1) {
  20913. global_var.value = [0, 0];
  20914. }
  20915. if (global_var.dimensions == 2) {
  20916. global_var.value = [[0, 0], [0, 0]];
  20917. }
  20918. }
  20919. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  20920. if (global_var.dimensions == 0) {
  20921. global_var.value = 0.0;
  20922. }
  20923. if (global_var.dimensions == 1) {
  20924. global_var.value = [0.0, 0.0];
  20925. }
  20926. if (global_var.dimensions == 2) {
  20927. global_var.value = [[0.0, 0.0], [0.0, 0.0]];
  20928. }
  20929. }
  20930. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  20931. if (global_var.dimensions == 0) {
  20932. global_var.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value');
  20933. }
  20934. if (global_var.dimensions == 1) {
  20935. 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')];
  20936. }
  20937. if (global_var.dimensions == 2) {
  20938. 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')]];
  20939. }
  20940. }
  20941. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  20942. if (global_var.dimensions == 0) {
  20943. global_var.value = true;
  20944. }
  20945. if (global_var.dimensions == 1) {
  20946. global_var.value = [true, true];
  20947. }
  20948. if (global_var.dimensions == 2) {
  20949. global_var.value = [[true, true], [true, true]];
  20950. }
  20951. }
  20952. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  20953. if (global_var.dimensions == 0) {
  20954. global_var.value = 'A';
  20955. }
  20956. if (global_var.dimensions == 1) {
  20957. global_var.value = ['A', 'A'];
  20958. }
  20959. if (global_var.dimensions == 2) {
  20960. global_var.value = [['A', 'A'], ['A', 'A']];
  20961. }
  20962. }
  20963. (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);
  20964. }
  20965. function alternateBooleanGlobalValue(global_var, value_container) {
  20966. global_var.value = !global_var.value;
  20967. $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(global_var.value)));
  20968. }
  20969. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  20970. global_var.value[index] = !global_var.value[index];
  20971. $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(global_var.value[index])));
  20972. }
  20973. function removeGlobalColumnVector(global_var) {
  20974. if (global_var.columns == 0) {
  20975. return;
  20976. }
  20977. global_var.columns--;
  20978. global_var.value.splice(global_var.value.length - 1, 1);
  20979. }
  20980. function addGlobalColumnVector(global_var) {
  20981. global_var.columns++;
  20982. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  20983. global_var.value.push(0);
  20984. }
  20985. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  20986. global_var.value.push(0.0);
  20987. }
  20988. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  20989. global_var.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
  20990. }
  20991. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  20992. global_var.value.push(true);
  20993. }
  20994. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  20995. global_var.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
  20996. }
  20997. }
  20998. function removeColumnGlobalMatrix(global_var) {
  20999. if (global_var.columns == 0) {
  21000. return;
  21001. }
  21002. global_var.columns--;
  21003. for (var i = 0; i < global_var.rows; i++) {
  21004. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  21005. }
  21006. }
  21007. function addColumnGlobalMatrix(global_var) {
  21008. global_var.columns++;
  21009. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21010. for (var i = 0; i < global_var.rows; i++) {
  21011. global_var.value[i].push(0);
  21012. }
  21013. }
  21014. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21015. for (var i = 0; i < global_var.rows; i++) {
  21016. global_var.value[i].push(0.0);
  21017. }
  21018. }
  21019. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21020. for (var i = 0; i < global_var.rows; i++) {
  21021. global_var.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
  21022. }
  21023. }
  21024. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  21025. for (var i = 0; i < global_var.rows; i++) {
  21026. global_var.value[i].push(true);
  21027. }
  21028. }
  21029. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  21030. for (var i = 0; i < global_var.rows; i++) {
  21031. global_var.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
  21032. }
  21033. }
  21034. }
  21035. function removeLineGlobalMatrix(global_var) {
  21036. if (global_var.rows == 0) {
  21037. return;
  21038. }
  21039. global_var.rows--;
  21040. global_var.value.splice(global_var.value.length - 1, 1);
  21041. }
  21042. function addLineGlobalMatrix(global_var) {
  21043. global_var.rows++;
  21044. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21045. var n_l = [];
  21046. for (var i = 0; i < global_var.columns; i++) {
  21047. n_l.push(0);
  21048. }
  21049. global_var.value.push(n_l);
  21050. }
  21051. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21052. var n_l = [];
  21053. for (i = 0; i < global_var.columns; i++) {
  21054. n_l.push(0.0);
  21055. }
  21056. global_var.value.push(n_l);
  21057. }
  21058. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21059. var n_l = [];
  21060. for (i = 0; i < global_var.columns; i++) {
  21061. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
  21062. }
  21063. global_var.value.push(n_l);
  21064. }
  21065. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  21066. var n_l = [];
  21067. for (i = 0; i < global_var.columns; i++) {
  21068. n_l.push(true);
  21069. }
  21070. global_var.value.push(n_l);
  21071. }
  21072. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  21073. var n_l = [];
  21074. for (i = 0; i < global_var.columns; i++) {
  21075. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
  21076. }
  21077. global_var.value.push(n_l);
  21078. }
  21079. }
  21080. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  21081. global_var.value[row][index] = !global_var.value[row][index];
  21082. $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(global_var.value[row][index])));
  21083. }
  21084. function renderValues(global_var, global_container) {
  21085. var ret = "";
  21086. var j = 0;
  21087. if (global_var.dimensions == 0) {
  21088. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21089. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + parseFloat(global_var.value).toFixed(1) + '</span> </div> ';
  21090. } else {
  21091. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  21092. 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> ';
  21093. } else {
  21094. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  21095. }
  21096. }
  21097. } else {
  21098. ret += '<table class="tabela_var">';
  21099. if (global_var.dimensions == 1) {
  21100. ret += '<tr>';
  21101. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21102. for (var k = 0; k < global_var.columns; k++) {
  21103. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + parseFloat(global_var.value[k]).toFixed(1) + '</span></td>';
  21104. }
  21105. } else {
  21106. for (var k = 0; k < global_var.columns; k++) {
  21107. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  21108. 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>';
  21109. } else {
  21110. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  21111. }
  21112. }
  21113. }
  21114. ret += '</tr>';
  21115. ret += '</table>';
  21116. 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>';
  21117. }
  21118. if (global_var.dimensions == 2) {
  21119. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21120. for (var l = 0; l < global_var.rows; l++) {
  21121. ret += '<tr>';
  21122. for (var k = 0; k < global_var.columns; k++) {
  21123. 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>';
  21124. }
  21125. ret += '</tr>';
  21126. }
  21127. } else {
  21128. for (var l = 0; l < global_var.rows; l++) {
  21129. ret += '<tr>';
  21130. for (var k = 0; k < global_var.columns; k++) {
  21131. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  21132. 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>';
  21133. } else {
  21134. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  21135. }
  21136. }
  21137. ret += '</tr>';
  21138. }
  21139. }
  21140. if (global_var.rows == 0) {
  21141. ret += '<tr><td></td></tr>';
  21142. }
  21143. 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>';
  21144. ret += '</table>';
  21145. 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>';
  21146. }
  21147. }
  21148. global_container.find(".div_valor_var").html('');
  21149. ret = $(ret);
  21150. ret.find('.span_value_variable').data('associatedOject', global_var);
  21151. ret.find(".boolean_simple_type").on('click', function (e) {
  21152. alternateBooleanGlobalValue(global_var, this.parentNode);
  21153. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21154. });
  21155. ret.find(".simple_var").on('click', function (e) {
  21156. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_GLOBAL_VALUE);
  21157. enableGlobalValueUpdate(global_var, this.parentNode);
  21158. });
  21159. ret.find(".boolean_vector_var").on('click', function (e) {
  21160. alternateBooleanGlobalVectorValue(global_var, $(this).data('index'), this.parentNode);
  21161. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21162. });
  21163. ret.find(".vector_var").on('click', function (e) {
  21164. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_GLOBAL_VALUE);
  21165. enableGlobalVectorValueUpdate(global_var, $(this).data('index'), this.parentNode);
  21166. });
  21167. ret.find(".remove_global_vector_column").on('click', function (e) {
  21168. removeGlobalColumnVector(global_var);
  21169. global_container.find(".div_valor_var").html('');
  21170. (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);
  21171. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21172. renderValues(global_var, global_container);
  21173. });
  21174. ret.find(".add_global_vector_column").on('click', function (e) {
  21175. addGlobalColumnVector(global_var);
  21176. (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);
  21177. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21178. global_container.find(".div_valor_var").html('');
  21179. renderValues(global_var, global_container);
  21180. });
  21181. ret.find(".remove_global_matrix_column").on('click', function (e) {
  21182. removeColumnGlobalMatrix(global_var);
  21183. (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);
  21184. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21185. global_container.find(".div_valor_var").html('');
  21186. renderValues(global_var, global_container);
  21187. });
  21188. ret.find(".add_global_matrix_column").on('click', function (e) {
  21189. addColumnGlobalMatrix(global_var);
  21190. (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);
  21191. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21192. global_container.find(".div_valor_var").html('');
  21193. renderValues(global_var, global_container);
  21194. });
  21195. ret.find(".remove_global_matrix_line").on('click', function (e) {
  21196. removeLineGlobalMatrix(global_var);
  21197. (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);
  21198. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21199. global_container.find(".div_valor_var").html('');
  21200. renderValues(global_var, global_container);
  21201. });
  21202. ret.find(".add_global_matrix_line").on('click', function (e) {
  21203. addLineGlobalMatrix(global_var);
  21204. (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);
  21205. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerSystemEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21206. global_container.find(".div_valor_var").html('');
  21207. renderValues(global_var, global_container);
  21208. });
  21209. ret.find(".boolean_matrix_var").on('click', function (e) {
  21210. alternateBooleanGlobalMatrixValue(global_var, $(this).data('row'), $(this).data('index'), this.parentNode);
  21211. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21212. });
  21213. ret.find(".matrix_var").on('click', function (e) {
  21214. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_GLOBAL_VALUE);
  21215. enableGlobalMatrixValueUpdate(global_var, $(this).data('row'), $(this).data('index'), this.parentNode);
  21216. });
  21217. global_container.find(".div_valor_var").append(ret);
  21218. updateColumnsAndRowsText(global_container, global_var);
  21219. }
  21220. function addHandlers(global_container) {
  21221. var global_var = global_container.data('associatedOject'); // Manage constant option:
  21222. global_container.find(".alternate_constant").on('click', function (e) {
  21223. toggleConstant(global_var);
  21224. $(this).removeClass("on off");
  21225. if (global_var.is_constant) {
  21226. $(this).addClass("on");
  21227. } else {
  21228. $(this).addClass("off");
  21229. }
  21230. }); // Manage global name:
  21231. global_container.find(".editing_name_var").on('click', function (e) {
  21232. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_GLOBAL_NAME);
  21233. enableNameUpdate(global_container);
  21234. }); // Menu to change type:
  21235. global_container.find('.ui.dropdown.global_type').dropdown({
  21236. onChange: function onChange(_, __, $selectedItem) {
  21237. if ($selectedItem.data('dimensions')) {
  21238. updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  21239. } else {
  21240. updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')]);
  21241. }
  21242. renderValues(global_var, global_container);
  21243. },
  21244. selectOnKeydown: false
  21245. }); // Remove global:
  21246. global_container.find(".remove_global").on('click', function (e) {
  21247. removeGlobal(global_var, global_container);
  21248. });
  21249. global_container.find(".ellipsis").popup({
  21250. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_move_var"),
  21251. delay: {
  21252. show: 750,
  21253. hide: 0
  21254. }
  21255. });
  21256. global_container.find(".remove_global").popup({
  21257. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_remove_var"),
  21258. delay: {
  21259. show: 750,
  21260. hide: 0
  21261. }
  21262. });
  21263. }
  21264. function updateColumnsAndRowsText(global_container, global_var) {
  21265. var prev = global_container.find('.text').text().split('[');
  21266. if (prev.length == 2) {
  21267. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  21268. global_container.find('.text').empty();
  21269. global_container.find('.text').text(ff);
  21270. }
  21271. if (prev.length == 3) {
  21272. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  21273. global_container.find('.text').empty();
  21274. global_container.find('.text').text(ff);
  21275. }
  21276. }
  21277. function renderGlobal(global_var) {
  21278. var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  21279. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  21280. element += '<div class="ui dropdown global_type">';
  21281. if (global_var.dimensions == 1) {
  21282. 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));
  21283. element += ' [ <span class="dimensions_0"></span> ] ';
  21284. element += '</div>';
  21285. } else if (global_var.dimensions == 2) {
  21286. 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));
  21287. element += ' [ <span class="dimensions_0"></span> ] [ <span class="dimensions_1"></span> ] ';
  21288. element += '</div>';
  21289. } else {
  21290. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(global_var.type.toLowerCase())) + '</div>';
  21291. }
  21292. element += '<div class="menu">';
  21293. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  21294. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  21295. continue;
  21296. }
  21297. 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>';
  21298. }
  21299. 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">';
  21300. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  21301. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  21302. continue;
  21303. }
  21304. 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>';
  21305. }
  21306. element += '</div></div>';
  21307. 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">';
  21308. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  21309. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  21310. continue;
  21311. }
  21312. 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>';
  21313. }
  21314. element += '</div></div>';
  21315. 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> ';
  21316. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  21317. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  21318. var complete_element = $(element);
  21319. complete_element.data('associatedOject', global_var);
  21320. $('.list_globals').append(complete_element);
  21321. addHandlers(complete_element);
  21322. renderValues(global_var, complete_element);
  21323. if (global_var.dimensions == 1) {
  21324. complete_element.find('.dimensions_0').text(global_var.columns);
  21325. }
  21326. if (global_var.dimensions == 2) {
  21327. complete_element.find('.dimensions_0').text(global_var.columns);
  21328. complete_element.find('.dimensions_1').text(global_var.rows);
  21329. }
  21330. return complete_element;
  21331. }
  21332. var opened_name_value_matrix_global_v = false;
  21333. var opened_input_value_matrix_global_v = null;
  21334. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  21335. if (opened_name_value_matrix_global_v) {
  21336. opened_input_value_matrix_global_v.focus();
  21337. return;
  21338. }
  21339. parent_node = $(parent_node);
  21340. opened_name_value_matrix_global_v = true;
  21341. parent_node.find('.span_value_variable').text('');
  21342. var input_field;
  21343. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21344. 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) + "' />");
  21345. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21346. } else {
  21347. 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] + "' />");
  21348. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21349. }
  21350. input_field.on('input', function () {
  21351. var inputWidth = input_field.textWidth() + 10;
  21352. opened_input_value_matrix_global_v = input_field;
  21353. input_field.focus();
  21354. var tmpStr = input_field.val();
  21355. input_field.val('');
  21356. input_field.val(tmpStr);
  21357. input_field.css({
  21358. width: inputWidth
  21359. });
  21360. }).trigger('input');
  21361. input_field.focusout(function () {
  21362. /// update array:
  21363. if (input_field.val().trim()) {
  21364. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21365. global_var.value[row][index] = parseFloat(input_field.val().trim());
  21366. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[row][index]).toFixed(1));
  21367. } else {
  21368. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21369. global_var.value[row][index] = parseInt(input_field.val().trim());
  21370. } else {
  21371. global_var.value[row][index] = input_field.val().trim();
  21372. }
  21373. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21374. }
  21375. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21376. } else {
  21377. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21378. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  21379. } else {
  21380. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21381. }
  21382. }
  21383. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21384. global_var.value[row][index] = input_field.val();
  21385. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21386. }
  21387. input_field.off();
  21388. input_field.remove(); /// update elements:
  21389. opened_name_value_matrix_global_v = false;
  21390. opened_input_value_matrix_global_v = false;
  21391. });
  21392. input_field.on('keydown', function (e) {
  21393. var code = e.keyCode || e.which;
  21394. if (code == 13) {
  21395. if (input_field.val().trim()) {
  21396. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21397. global_var.value[row][index] = parseFloat(input_field.val().trim());
  21398. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[row][index]).toFixed(1));
  21399. } else {
  21400. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21401. global_var.value[row][index] = parseInt(input_field.val().trim());
  21402. } else {
  21403. global_var.value[row][index] = input_field.val().trim();
  21404. }
  21405. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21406. }
  21407. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21408. } else {
  21409. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21410. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[row][index]).toFixed(1));
  21411. } else {
  21412. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21413. }
  21414. }
  21415. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21416. global_var.value[row][index] = input_field.val();
  21417. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21418. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21419. }
  21420. input_field.off();
  21421. input_field.remove(); /// update elements:
  21422. opened_name_value_matrix_global_v = false;
  21423. opened_input_value_matrix_global_v = false;
  21424. }
  21425. if (code == 27) {
  21426. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21427. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[row][index]).toFixed(1));
  21428. } else {
  21429. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21430. }
  21431. input_field.off();
  21432. input_field.remove(); /// update elements:
  21433. opened_name_value_matrix_global_v = false;
  21434. opened_input_value_matrix_global_v = false;
  21435. }
  21436. });
  21437. input_field.select();
  21438. }
  21439. var opened_name_value_global_var = false;
  21440. var opened_input_value_global_ar = null;
  21441. function enableGlobalValueUpdate(global_var, parent_node) {
  21442. if (opened_name_value_global_var) {
  21443. opened_input_value_global_ar.focus();
  21444. return;
  21445. }
  21446. parent_node = $(parent_node);
  21447. opened_name_value_global_var = true;
  21448. parent_node.find('.span_value_variable').text('');
  21449. var input_field;
  21450. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21451. 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) + "' />");
  21452. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21453. } else {
  21454. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value + "' />");
  21455. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21456. }
  21457. input_field.on('input', function () {
  21458. var inputWidth = input_field.textWidth() + 10;
  21459. opened_input_value_global_ar = input_field;
  21460. input_field.focus();
  21461. var tmpStr = input_field.val();
  21462. input_field.val('');
  21463. input_field.val(tmpStr);
  21464. input_field.css({
  21465. width: inputWidth
  21466. });
  21467. }).trigger('input');
  21468. input_field.focusout(function () {
  21469. var changed = false; /// update array:
  21470. if (input_field.val().trim()) {
  21471. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21472. global_var.value = parseFloat(input_field.val().trim());
  21473. parent_node.find('.span_value_variable').text(parseFloat(global_var.value).toFixed(1));
  21474. } else {
  21475. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21476. global_var.value = parseInt(input_field.val().trim());
  21477. } else if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  21478. global_var.value = input_field.val().charAt(0);
  21479. } else {
  21480. global_var.value = input_field.val().trim();
  21481. }
  21482. parent_node.find('.span_value_variable').text(global_var.value);
  21483. }
  21484. changed = true;
  21485. } else {
  21486. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21487. parent_node.find('.span_value_variable').text(parseFloat(global_var.value).toFixed(1));
  21488. } else {
  21489. parent_node.find('.span_value_variable').text(global_var.value);
  21490. }
  21491. }
  21492. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21493. global_var.value = input_field.val();
  21494. changed = true;
  21495. parent_node.find('.span_value_variable').text(global_var.value);
  21496. }
  21497. if (changed) {
  21498. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21499. }
  21500. input_field.off();
  21501. input_field.remove(); /// update elements:
  21502. opened_name_value_global_var = false;
  21503. opened_input_value_global_ar = false;
  21504. });
  21505. input_field.on('keydown', function (e) {
  21506. var code = e.keyCode || e.which;
  21507. var changed = true;
  21508. if (code == 13) {
  21509. if (input_field.val().trim()) {
  21510. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21511. global_var.value = parseFloat(input_field.val().trim());
  21512. parent_node.find('.span_value_variable').text(parseFloat(global_var.value).toFixed(1));
  21513. } else {
  21514. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21515. global_var.value = parseInt(input_field.val().trim());
  21516. } else if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  21517. global_var.value = input_field.val().charAt(0);
  21518. } else {
  21519. global_var.value = input_field.val().trim();
  21520. }
  21521. parent_node.find('.span_value_variable').text(global_var.value);
  21522. }
  21523. changed = true;
  21524. } else {
  21525. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21526. parent_node.find('.span_value_variable').text(parseFloat(global_var.value).toFixed(1));
  21527. } else {
  21528. parent_node.find('.span_value_variable').text(global_var.value);
  21529. }
  21530. }
  21531. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21532. global_var.value = input_field.val();
  21533. changed = true;
  21534. parent_node.find('.span_value_variable').text(global_var.value);
  21535. }
  21536. if (changed) {
  21537. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21538. }
  21539. input_field.off();
  21540. input_field.remove(); /// update elements:
  21541. opened_name_value_global_var = false;
  21542. opened_input_value_global_ar = false;
  21543. }
  21544. if (code == 27) {
  21545. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21546. parent_node.find('.span_value_variable').text(parseFloat(global_var.value).toFixed(1));
  21547. } else {
  21548. parent_node.find('.span_value_variable').text(global_var.value);
  21549. }
  21550. input_field.off();
  21551. input_field.remove(); /// update elements:
  21552. opened_name_value_global_var = false;
  21553. opened_input_value_global_ar = false;
  21554. }
  21555. });
  21556. input_field.select();
  21557. }
  21558. var opened_name_global = false;
  21559. var opened_input_global = null;
  21560. function enableNameUpdate(global_container) {
  21561. var global_var = global_container.data('associatedOject');
  21562. if (opened_name_global) {
  21563. opened_input_global.focus();
  21564. return;
  21565. }
  21566. opened_name_global = true;
  21567. global_container.find('.span_name_variable').text('');
  21568. var input_name = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.name + "' />");
  21569. input_name.insertBefore(global_container.find('.span_name_variable'));
  21570. input_name.on('input', function () {
  21571. var inputWidth = input_name.textWidth() + 10;
  21572. opened_input_global = input_name;
  21573. opened_input_global.focus();
  21574. opened_input_global.css({
  21575. width: inputWidth
  21576. });
  21577. }).trigger('input');
  21578. input_name.focusout(function () {
  21579. /// update array:
  21580. if (input_name.val().trim().length > 0) {
  21581. updateName(global_var, input_name.val().trim(), global_container);
  21582. global_container.find('.span_name_variable').text(global_var.name);
  21583. } else {
  21584. global_container.find('.span_name_variable').text(global_var.name);
  21585. }
  21586. input_name.off();
  21587. input_name.remove(); /// update elements:
  21588. opened_name_global = false;
  21589. opened_input_global = false;
  21590. });
  21591. input_name.on('keydown', function (e) {
  21592. var code = e.keyCode || e.which;
  21593. if (code == 13) {
  21594. if (input_name.val().trim()) {
  21595. updateName(global_var, input_name.val().trim(), global_container);
  21596. global_container.find('.span_name_variable').text(global_var.name);
  21597. } else {
  21598. global_container.find('.span_name_variable').text(global_var.name);
  21599. }
  21600. input_name.off();
  21601. input_name.remove(); /// update elements:
  21602. opened_name_global = false;
  21603. opened_input_global = false;
  21604. }
  21605. if (code == 27) {
  21606. global_container.find('.span_name_variable').text(global_var.name);
  21607. input_name.off();
  21608. input_name.remove(); /// update elements:
  21609. opened_name_global = false;
  21610. opened_input_global = false;
  21611. }
  21612. });
  21613. input_name.select();
  21614. }
  21615. var opened_name_value_vector_global_ = false;
  21616. var opened_input_value_vector_global_ = null;
  21617. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  21618. if (opened_name_value_vector_global_) {
  21619. opened_input_value_vector_global_.focus();
  21620. return;
  21621. }
  21622. parent_node = $(parent_node);
  21623. opened_name_value_vector_global_ = true;
  21624. parent_node.find('.span_value_variable').text('');
  21625. var input_field;
  21626. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21627. 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) + "' />");
  21628. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21629. } else {
  21630. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index] + "' />");
  21631. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21632. }
  21633. input_field.on('input', function () {
  21634. var inputWidth = input_field.textWidth() + 10;
  21635. opened_input_value_vector_global_ = input_field;
  21636. input_field.focus();
  21637. var tmpStr = input_field.val();
  21638. input_field.val('');
  21639. input_field.val(tmpStr);
  21640. input_field.css({
  21641. width: inputWidth
  21642. });
  21643. }).trigger('input');
  21644. input_field.focusout(function () {
  21645. var changed = false; /// update array:
  21646. if (input_field.val().trim()) {
  21647. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21648. global_var.value[index] = parseFloat(input_field.val().trim());
  21649. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[index]).toFixed(1));
  21650. } else {
  21651. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21652. global_var.value[index] = parseInt(input_field.val().trim());
  21653. } else {
  21654. global_var.value[index] = input_field.val().trim();
  21655. }
  21656. parent_node.find('.span_value_variable').text(global_var.value[index]);
  21657. }
  21658. changed = true;
  21659. } else {
  21660. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21661. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[index]).toFixed(1));
  21662. } else {
  21663. parent_node.find('.span_value_variable').text(global_var.value[index]);
  21664. }
  21665. }
  21666. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21667. global_var.value[index] = input_field.val();
  21668. changed = true;
  21669. parent_node.find('.span_value_variable').text(global_var.value[index]);
  21670. }
  21671. if (changed) {
  21672. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21673. }
  21674. input_field.off();
  21675. input_field.remove(); /// update elements:
  21676. opened_name_value_vector_global_ = false;
  21677. opened_input_value_vector_global_ = false;
  21678. });
  21679. input_field.on('keydown', function (e) {
  21680. var code = e.keyCode || e.which;
  21681. var changed = false;
  21682. if (code == 13) {
  21683. if (input_field.val().trim()) {
  21684. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21685. global_var.value[index] = parseFloat(input_field.val().trim());
  21686. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[index]).toFixed(1));
  21687. } else {
  21688. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  21689. global_var.value[index] = parseInt(input_field.val().trim());
  21690. } else {
  21691. global_var.value[index] = input_field.val().trim();
  21692. }
  21693. parent_node.find('.span_value_variable').text(global_var.value[index]);
  21694. }
  21695. changed = true;
  21696. } else {
  21697. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21698. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[index]).toFixed(1));
  21699. } else {
  21700. parent_node.find('.span_value_variable').text(global_var.value[index]);
  21701. }
  21702. }
  21703. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  21704. global_var.value[index] = input_field.val();
  21705. changed = true;
  21706. parent_node.find('.span_value_variable').text(global_var.value[index]);
  21707. }
  21708. if (changed) {
  21709. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(global_var.name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.CHANGE_GLOBAL_VALUE, global_var.value);
  21710. }
  21711. input_field.off();
  21712. input_field.remove(); /// update elements:
  21713. opened_name_value_vector_global_ = false;
  21714. opened_input_value_vector_global_ = false;
  21715. }
  21716. if (code == 27) {
  21717. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  21718. parent_node.find('.span_value_variable').text(parseFloat(global_var.value[index]).toFixed(1));
  21719. } else {
  21720. parent_node.find('.span_value_variable').text(global_var.value[index]);
  21721. }
  21722. input_field.off();
  21723. input_field.remove(); /// update elements:
  21724. opened_name_value_vector_global_ = false;
  21725. opened_input_value_vector_global_ = false;
  21726. }
  21727. });
  21728. input_field.select();
  21729. }
  21730. $.fn.textWidth = function (text, font) {
  21731. if (!$.fn.textWidth.fakeEl) $.fn.textWidth.fakeEl = $('<span>').hide().appendTo(document.body);
  21732. $.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  21733. return $.fn.textWidth.fakeEl.width();
  21734. };
  21735. /***/ }),
  21736. /***/ "./js/visualUI/ivprog_elements.js":
  21737. /*!****************************************!*\
  21738. !*** ./js/visualUI/ivprog_elements.js ***!
  21739. \****************************************/
  21740. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  21741. "use strict";
  21742. __webpack_require__.r(__webpack_exports__);
  21743. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  21744. /* harmony export */ "COMMAND_TYPES": () => (/* binding */ COMMAND_TYPES),
  21745. /* harmony export */ "ARITHMETIC_TYPES": () => (/* binding */ ARITHMETIC_TYPES),
  21746. /* harmony export */ "EXPRESSION_ELEMENTS": () => (/* binding */ EXPRESSION_ELEMENTS),
  21747. /* harmony export */ "EXPRESSION_TYPES": () => (/* binding */ EXPRESSION_TYPES),
  21748. /* harmony export */ "ARITHMETIC_COMPARISON": () => (/* binding */ ARITHMETIC_COMPARISON),
  21749. /* harmony export */ "LOGIC_COMPARISON": () => (/* binding */ LOGIC_COMPARISON),
  21750. /* harmony export */ "SYSTEM_FUNCTIONS_CATEGORIES": () => (/* binding */ SYSTEM_FUNCTIONS_CATEGORIES),
  21751. /* harmony export */ "Variable": () => (/* binding */ Variable),
  21752. /* harmony export */ "Function": () => (/* binding */ Function),
  21753. /* harmony export */ "SystemFunction": () => (/* binding */ SystemFunction),
  21754. /* harmony export */ "Comment": () => (/* binding */ Comment),
  21755. /* harmony export */ "Break": () => (/* binding */ Break),
  21756. /* harmony export */ "Reader": () => (/* binding */ Reader),
  21757. /* harmony export */ "Writer": () => (/* binding */ Writer),
  21758. /* harmony export */ "Attribution": () => (/* binding */ Attribution),
  21759. /* harmony export */ "ExpressionOperator": () => (/* binding */ ExpressionOperator),
  21760. /* harmony export */ "ExpressionElement": () => (/* binding */ ExpressionElement),
  21761. /* harmony export */ "ConditionalExpression": () => (/* binding */ ConditionalExpression),
  21762. /* harmony export */ "LogicExpression": () => (/* binding */ LogicExpression),
  21763. /* harmony export */ "ArithmeticExpression": () => (/* binding */ ArithmeticExpression),
  21764. /* harmony export */ "IfTrue": () => (/* binding */ IfTrue),
  21765. /* harmony export */ "RepeatNTimes": () => (/* binding */ RepeatNTimes),
  21766. /* harmony export */ "WhileTrue": () => (/* binding */ WhileTrue),
  21767. /* harmony export */ "DoWhileTrue": () => (/* binding */ DoWhileTrue),
  21768. /* harmony export */ "Switch": () => (/* binding */ Switch),
  21769. /* harmony export */ "Return": () => (/* binding */ Return),
  21770. /* harmony export */ "SwitchCase": () => (/* binding */ SwitchCase),
  21771. /* harmony export */ "FunctionCall": () => (/* binding */ FunctionCall),
  21772. /* harmony export */ "VariableValueMenu": () => (/* binding */ VariableValueMenu),
  21773. /* harmony export */ "FunctionCallMenu": () => (/* binding */ FunctionCallMenu),
  21774. /* harmony export */ "Program": () => (/* binding */ Program)
  21775. /* harmony export */ });
  21776. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
  21777. /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_0__);
  21778. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
  21779. /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
  21780. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  21781. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  21782. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_3__);
  21783. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  21784. var COMMAND_TYPES = Object.freeze({
  21785. "function": "function",
  21786. comment: "comment",
  21787. reader: "reader",
  21788. writer: "writer",
  21789. attribution: "attribution",
  21790. iftrue: "iftrue",
  21791. repeatNtimes: "repeatNtimes",
  21792. whiletrue: "whiletrue",
  21793. dowhiletrue: "dowhiletrue",
  21794. "switch": "switch",
  21795. switchcase: "switchcase",
  21796. functioncall: "functioncall",
  21797. "break": "break",
  21798. "return": "return"
  21799. });
  21800. var ARITHMETIC_TYPES = Object.freeze({
  21801. plus: "plus",
  21802. minus: "minus",
  21803. multiplication: "multiplication",
  21804. division: "division",
  21805. module: "module",
  21806. none: "none"
  21807. });
  21808. var EXPRESSION_ELEMENTS = Object.freeze({
  21809. exp_op_exp: "exp_op_exp",
  21810. op_exp: "op_exp",
  21811. par_exp_par: "par_exp_par",
  21812. start_point: "start_point"
  21813. });
  21814. var EXPRESSION_TYPES = Object.freeze({
  21815. exp_conditional: "exp_conditional",
  21816. exp_logic: "exp_logic",
  21817. exp_arithmetic: "exp_arithmetic",
  21818. write_sep: "write_separator"
  21819. });
  21820. var ARITHMETIC_COMPARISON = Object.freeze({
  21821. greater_than: "greater_than",
  21822. less_than: "less_than",
  21823. equals_to: "equals_to",
  21824. not_equals_to: "not_equals_to",
  21825. greater_than_or_equals_to: "greater_than_or_equals_to",
  21826. less_than_or_equals_to: "less_than_or_equals_to"
  21827. });
  21828. var LOGIC_COMPARISON = Object.freeze({
  21829. equals_to: "equals_to",
  21830. not_equals_to: "not_equals_to",
  21831. and: "and",
  21832. or: "or",
  21833. not: "not"
  21834. });
  21835. var SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({
  21836. math: "$mathLib",
  21837. text: "$strLib",
  21838. arrangement: "$arrayLib",
  21839. conversion: "$langLib"
  21840. });
  21841. var Variable = function Variable(type, name, value) {
  21842. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  21843. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  21844. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  21845. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  21846. var reference = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
  21847. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Variable);
  21848. this.type = type;
  21849. this.name = name;
  21850. this.value = value;
  21851. this.dimensions = dimensions;
  21852. this.is_constant = is_constant;
  21853. this.rows = rows;
  21854. this.columns = columns;
  21855. this.reference = reference;
  21856. };
  21857. var Function = function Function(name) {
  21858. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types__WEBPACK_IMPORTED_MODULE_2__.Types.VOID;
  21859. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  21860. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  21861. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  21862. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  21863. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  21864. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  21865. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  21866. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Function);
  21867. this.type = COMMAND_TYPES["function"];
  21868. this.name = name;
  21869. this.return_type = return_type;
  21870. this.return_dimensions = return_dimensions;
  21871. this.parameters_list = parameters_list;
  21872. this.is_main = is_main;
  21873. this.is_hidden = is_hidden;
  21874. this.variables_list = variables_list;
  21875. this.function_comment = function_comment;
  21876. this.commands = commands;
  21877. };
  21878. var SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  21879. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  21880. var category = arguments.length > 5 ? arguments[5] : undefined;
  21881. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, SystemFunction);
  21882. this.type = COMMAND_TYPES["function"];
  21883. this.identifier = identifier;
  21884. this.return_type = return_type;
  21885. this.return_dimensions = return_dimensions;
  21886. this.parameters_list = parameters_list;
  21887. this.function_comment = function_comment;
  21888. this.category = category;
  21889. };
  21890. var Comment = function Comment(comment_text) {
  21891. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Comment);
  21892. this.type = COMMAND_TYPES.comment;
  21893. this.comment_text = comment_text;
  21894. };
  21895. var Break = function Break() {
  21896. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Break);
  21897. this.type = COMMAND_TYPES["break"];
  21898. };
  21899. var Reader = function Reader() {
  21900. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  21901. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Reader);
  21902. this.type = COMMAND_TYPES.reader;
  21903. this.variable_value_menu = variable_value_menu;
  21904. };
  21905. var Writer = function Writer(content) {
  21906. var newline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  21907. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Writer);
  21908. this.type = COMMAND_TYPES.writer;
  21909. this.content = content;
  21910. this.newline = newline;
  21911. };
  21912. var Attribution = function Attribution(variable) {
  21913. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21914. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Attribution);
  21915. this.type = COMMAND_TYPES.attribution;
  21916. this.variable = variable;
  21917. this.expression = expression;
  21918. };
  21919. var ExpressionOperator = function ExpressionOperator(type_op, item) {
  21920. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, ExpressionOperator);
  21921. this.type_op = type_op; // Logic, Arithmetic OR Relational
  21922. this.item = item;
  21923. };
  21924. var ExpressionElement = function ExpressionElement(type_exp) {
  21925. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21926. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, ExpressionElement);
  21927. this.type_exp = type_exp;
  21928. this.itens = itens;
  21929. };
  21930. var ConditionalExpression = function ConditionalExpression(expression) {
  21931. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, ConditionalExpression);
  21932. this.type = EXPRESSION_TYPES.exp_conditional;
  21933. this.expression = expression;
  21934. };
  21935. var LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  21936. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, LogicExpression);
  21937. this.type = EXPRESSION_TYPES.exp_logic;
  21938. this.has_neg = has_neg;
  21939. this.first_operand = first_operand;
  21940. this.second_operand = second_operand;
  21941. this.operator = operator;
  21942. };
  21943. var ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  21944. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, ArithmeticExpression);
  21945. this.type = EXPRESSION_TYPES.exp_arithmetic;
  21946. this.first_operand = first_operand;
  21947. this.second_operand = second_operand;
  21948. this.operator = operator;
  21949. };
  21950. var IfTrue = function IfTrue(expression, commands_block, commands_else) {
  21951. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, IfTrue);
  21952. this.type = COMMAND_TYPES.iftrue;
  21953. this.expression = expression;
  21954. this.commands_block = commands_block;
  21955. this.commands_else = commands_else;
  21956. };
  21957. var RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  21958. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, RepeatNTimes);
  21959. this.type = COMMAND_TYPES.repeatNtimes;
  21960. this.var_attribution = var_attribution;
  21961. this.var_incrementation = var_incrementation;
  21962. this.expression1 = expression1;
  21963. this.expression2 = expression2;
  21964. this.expression3 = expression3;
  21965. this.commands_block = commands_block;
  21966. };
  21967. var WhileTrue = function WhileTrue(expression, commands_block) {
  21968. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, WhileTrue);
  21969. this.type = COMMAND_TYPES.whiletrue;
  21970. this.expression = expression;
  21971. this.commands_block = commands_block;
  21972. };
  21973. var DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  21974. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, DoWhileTrue);
  21975. this.type = COMMAND_TYPES.dowhiletrue;
  21976. this.expression = expression;
  21977. this.commands_block = commands_block;
  21978. };
  21979. var Switch = function Switch(variable) {
  21980. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21981. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Switch);
  21982. this.type = COMMAND_TYPES["switch"];
  21983. this.variable = variable;
  21984. this.cases = cases;
  21985. };
  21986. var Return = function Return(variable_value_menu) {
  21987. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Return);
  21988. this.type = COMMAND_TYPES["return"];
  21989. this.variable_value_menu = variable_value_menu;
  21990. };
  21991. var SwitchCase = function SwitchCase(variable_value_menu) {
  21992. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21993. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, SwitchCase);
  21994. this.type = COMMAND_TYPES.switchcase;
  21995. this.variable_value_menu = variable_value_menu;
  21996. this.commands_block = commands_block;
  21997. };
  21998. var FunctionCall = function FunctionCall(function_called, parameters_list) {
  21999. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, FunctionCall);
  22000. this.type = COMMAND_TYPES.functioncall;
  22001. this.function_called = function_called;
  22002. this.parameters_list = parameters_list;
  22003. };
  22004. var VariableValueMenu = function VariableValueMenu() {
  22005. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  22006. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  22007. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  22008. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  22009. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  22010. var dimensions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  22011. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, VariableValueMenu);
  22012. this.type = "var_value";
  22013. this.variable_and_value = variable_and_value;
  22014. this.content = content;
  22015. this.row = row;
  22016. this.column = column;
  22017. this.include_constant = include_constant;
  22018. this.dimensions = dimensions;
  22019. };
  22020. var FunctionCallMenu = function FunctionCallMenu() {
  22021. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  22022. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  22023. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, FunctionCallMenu);
  22024. this.type = "function_call";
  22025. this.function_called = function_called;
  22026. this.parameters_list = parameters_list;
  22027. };
  22028. var Program = /*#__PURE__*/function () {
  22029. function Program() {
  22030. _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, Program);
  22031. this.functions = [];
  22032. this.globals = [];
  22033. }
  22034. _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_0___default()(Program, [{
  22035. key: "addFunction",
  22036. value: function addFunction(function_to_add) {
  22037. melanke_watchjs__WEBPACK_IMPORTED_MODULE_3___default().watch(function_to_add.parameters_list, function () {
  22038. if (window.insertContext) {
  22039. setTimeout(function () {
  22040. _algorithm__WEBPACK_IMPORTED_MODULE_4__.renderAlgorithm();
  22041. }, 300);
  22042. window.insertContext = false;
  22043. } else {
  22044. _algorithm__WEBPACK_IMPORTED_MODULE_4__.renderAlgorithm();
  22045. }
  22046. }, 1);
  22047. melanke_watchjs__WEBPACK_IMPORTED_MODULE_3___default().watch(function_to_add.variables_list, function () {
  22048. if (window.insertContext) {
  22049. setTimeout(function () {
  22050. _algorithm__WEBPACK_IMPORTED_MODULE_4__.renderAlgorithm();
  22051. }, 300);
  22052. window.insertContext = false;
  22053. } else {
  22054. _algorithm__WEBPACK_IMPORTED_MODULE_4__.renderAlgorithm();
  22055. }
  22056. }, 1);
  22057. this.functions.push(function_to_add);
  22058. }
  22059. }, {
  22060. key: "addVariable",
  22061. value: function addVariable(function_to_receive, variable) {
  22062. if (this.functions[function_to_receive].variable === null) {
  22063. this.functions[function_to_receive].variables_list = [];
  22064. }
  22065. this.functions[function_to_receive].variables_list.push(variable);
  22066. }
  22067. }, {
  22068. key: "addGlobal",
  22069. value: function addGlobal(variable) {
  22070. this.globals.push(variable);
  22071. }
  22072. }]);
  22073. return Program;
  22074. }();
  22075. /***/ }),
  22076. /***/ "./js/visualUI/text_editor.js":
  22077. /*!************************************!*\
  22078. !*** ./js/visualUI/text_editor.js ***!
  22079. \************************************/
  22080. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  22081. "use strict";
  22082. __webpack_require__.r(__webpack_exports__);
  22083. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  22084. /* harmony export */ "initTextEditor": () => (/* binding */ initTextEditor),
  22085. /* harmony export */ "disable": () => (/* binding */ disable),
  22086. /* harmony export */ "updateEditor": () => (/* binding */ updateEditor),
  22087. /* harmony export */ "setCode": () => (/* binding */ setCode),
  22088. /* harmony export */ "getCode": () => (/* binding */ getCode)
  22089. /* harmony export */ });
  22090. /* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! codemirror */ "./node_modules/codemirror/lib/codemirror.js");
  22091. /* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(codemirror__WEBPACK_IMPORTED_MODULE_0__);
  22092. /* harmony import */ var codemirror_addon_edit_closebrackets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! codemirror/addon/edit/closebrackets */ "./node_modules/codemirror/addon/edit/closebrackets.js");
  22093. /* harmony import */ var codemirror_addon_edit_closebrackets__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(codemirror_addon_edit_closebrackets__WEBPACK_IMPORTED_MODULE_1__);
  22094. /* harmony import */ var codemirror_addon_edit_matchbrackets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! codemirror/addon/edit/matchbrackets */ "./node_modules/codemirror/addon/edit/matchbrackets.js");
  22095. /* harmony import */ var codemirror_addon_edit_matchbrackets__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(codemirror_addon_edit_matchbrackets__WEBPACK_IMPORTED_MODULE_2__);
  22096. /* 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");
  22097. /* 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__);
  22098. /* harmony import */ var _util_editorMode2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../util/editorMode2 */ "./js/util/editorMode2.js");
  22099. // import "codemirror/addon/hint/show-hint";
  22100. // import "codemirror/addon/hint/anyword-hint";
  22101. (0,_util_editorMode2__WEBPACK_IMPORTED_MODULE_4__.CodeEditorMode)(codemirror__WEBPACK_IMPORTED_MODULE_0__);
  22102. var codeEditor = null;
  22103. function initTextEditor(element) {
  22104. var id = element;
  22105. if (element[0] == '#') {
  22106. id = element.substring(1);
  22107. }
  22108. codeEditor = codemirror__WEBPACK_IMPORTED_MODULE_0__.fromTextArea(document.getElementById(id), {
  22109. theme: "ttcn",
  22110. value: "",
  22111. mode: "text/x-ivprog",
  22112. indentUnit: 4,
  22113. lineNumbers: true,
  22114. matchBrackets: true,
  22115. autoCloseBrackets: true,
  22116. fixedGutter: true,
  22117. styleActiveLine: true,
  22118. readOnly: true
  22119. });
  22120. }
  22121. function disable(flag) {
  22122. codeEditor.setOption("readOnly", flag);
  22123. updateEditor();
  22124. }
  22125. function updateEditor() {
  22126. codeEditor.refresh();
  22127. }
  22128. function setCode(code) {
  22129. codeEditor.setValue(code);
  22130. }
  22131. function getCode() {
  22132. return codeEditor.getValue();
  22133. }
  22134. /***/ }),
  22135. /***/ "./js/visualUI/types.js":
  22136. /*!******************************!*\
  22137. !*** ./js/visualUI/types.js ***!
  22138. \******************************/
  22139. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  22140. "use strict";
  22141. __webpack_require__.r(__webpack_exports__);
  22142. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  22143. /* harmony export */ "Types": () => (/* binding */ Types)
  22144. /* harmony export */ });
  22145. var Types = Object.freeze({
  22146. INTEGER: "integer",
  22147. REAL: "real",
  22148. TEXT: "text",
  22149. CHAR: 'char',
  22150. BOOLEAN: "boolean",
  22151. VOID: "void"
  22152. });
  22153. /***/ }),
  22154. /***/ "./js/visualUI/utils.js":
  22155. /*!******************************!*\
  22156. !*** ./js/visualUI/utils.js ***!
  22157. \******************************/
  22158. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  22159. "use strict";
  22160. __webpack_require__.r(__webpack_exports__);
  22161. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  22162. /* harmony export */ "renderErrorMessage": () => (/* binding */ renderErrorMessage)
  22163. /* harmony export */ });
  22164. function renderErrorMessage(dom_obj_target, message_text) {
  22165. dom_obj_target.popup({
  22166. html: '<i class="ui icon inverted exclamation triangle yellow"></i>' + message_text,
  22167. transition: "fade up",
  22168. on: 'click',
  22169. closable: true,
  22170. movePopup: true,
  22171. boundary: window,
  22172. preserve: false,
  22173. target: false,
  22174. className: {
  22175. popup: 'ui popup invalid-identifier'
  22176. },
  22177. onHidden: function onHidden($module) {
  22178. dom_obj_target.popup('destroy');
  22179. }
  22180. }).popup('toggle');
  22181. }
  22182. /***/ }),
  22183. /***/ "./js/visualUI/variables.js":
  22184. /*!**********************************!*\
  22185. !*** ./js/visualUI/variables.js ***!
  22186. \**********************************/
  22187. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  22188. "use strict";
  22189. __webpack_require__.r(__webpack_exports__);
  22190. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  22191. /* harmony export */ "addVariable": () => (/* binding */ addVariable),
  22192. /* harmony export */ "renderVariable": () => (/* binding */ renderVariable)
  22193. /* harmony export */ });
  22194. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  22195. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22196. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22197. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  22198. /* harmony import */ var _services_userLog__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../services/userLog */ "./js/services/userLog.js");
  22199. /* harmony import */ var _util_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../util/utils */ "./js/util/utils.js");
  22200. var counter_new_variables = 0;
  22201. function addVariable(function_obj, function_container) {
  22202. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  22203. // Verify if the next variable name is in use:
  22204. if (function_obj.variables_list) {
  22205. var in_use = false;
  22206. do {
  22207. in_use = false;
  22208. var temp_name = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('new_variable') + '_' + counter_new_variables;
  22209. function_obj.variables_list.forEach(function (el) {
  22210. if (temp_name == el.name) {
  22211. in_use = true;
  22212. }
  22213. });
  22214. if (in_use) counter_new_variables++;
  22215. } while (in_use);
  22216. }
  22217. 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);
  22218. if (function_obj.variables_list == null) {
  22219. function_obj.variables_list = [];
  22220. }
  22221. function_obj.variables_list.push(new_var);
  22222. counter_new_variables++;
  22223. (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);
  22224. var newe = renderVariable(function_container, new_var, function_obj);
  22225. if (is_in_click) {
  22226. newe.css('display', 'none');
  22227. newe.fadeIn();
  22228. }
  22229. }
  22230. function updateName(variable_obj, new_name, variable_obj_dom, function_obj) {
  22231. if (variable_obj.name == new_name) {
  22232. return;
  22233. }
  22234. if ((0,_util_utils__WEBPACK_IMPORTED_MODULE_5__.isValidIdentifier)(new_name)) {
  22235. if (variableNameAlreadyExists(new_name, function_obj)) {
  22236. _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]));
  22237. } else {
  22238. (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);
  22239. variable_obj.name = new_name;
  22240. }
  22241. } else {
  22242. _utils__WEBPACK_IMPORTED_MODULE_3__.renderErrorMessage(variable_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getError('inform_valid_identifier'));
  22243. }
  22244. }
  22245. function variableNameAlreadyExists(name_var, function_obj) {
  22246. if (function_obj.parameters_list) {
  22247. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  22248. if (function_obj.parameters_list[i].name == name_var) {
  22249. return true;
  22250. }
  22251. }
  22252. }
  22253. if (function_obj.variables_list) {
  22254. for (var i = 0; i < function_obj.variables_list.length; i++) {
  22255. if (function_obj.variables_list[i].name == name_var) {
  22256. return true;
  22257. }
  22258. }
  22259. }
  22260. return false;
  22261. }
  22262. function removeVariable(variable_obj, variable_container, function_name) {
  22263. var function_associated = variable_container.data('associatedFunction');
  22264. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.REMOVE_FUNCTION_VAR, variable_obj.name);
  22265. var index = function_associated.variables_list.indexOf(variable_obj);
  22266. if (index > -1) {
  22267. window.insertContext = true;
  22268. delete function_associated.variables_list[index];
  22269. function_associated.variables_list.splice(index, 1);
  22270. }
  22271. variable_container.children().off();
  22272. variable_container.off();
  22273. variable_container.fadeOut();
  22274. }
  22275. function updateType(variable_obj, new_type, function_name) {
  22276. var new_dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  22277. variable_obj.type = new_type;
  22278. variable_obj.dimensions = new_dimensions;
  22279. if (new_dimensions > 0) {
  22280. variable_obj.rows = new_dimensions;
  22281. variable_obj.columns = 2;
  22282. }
  22283. (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);
  22284. updateInitialValues(variable_obj, function_name);
  22285. }
  22286. function addHandlers(variable_obj, variable_container, function_obj) {
  22287. // Manage variable name:
  22288. variable_container.find(".editing_name_var").on('click', function (e) {
  22289. (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);
  22290. enableNameUpdate(variable_obj, variable_container, function_obj);
  22291. }); // Menu to change type:
  22292. variable_container.find('.ui.dropdown.variable_type').dropdown({
  22293. onChange: function onChange(_, __, $selectedItem) {
  22294. if ($selectedItem.data('dimensions')) {
  22295. updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], function_obj.name, $selectedItem.data('dimensions'));
  22296. } else {
  22297. updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_0__.Types[$selectedItem.data('type')], function_obj.name);
  22298. }
  22299. renderValues(variable_obj, variable_container, function_obj.name);
  22300. },
  22301. selectOnKeydown: false
  22302. }); // Remove variable:
  22303. variable_container.find(".remove_variable").on('click', function (e) {
  22304. removeVariable(variable_obj, variable_container, function_obj.name);
  22305. });
  22306. variable_container.find(".ellipsis").popup({
  22307. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_move_var"),
  22308. delay: {
  22309. show: 750,
  22310. hide: 0
  22311. }
  22312. });
  22313. variable_container.find(".remove_variable").popup({
  22314. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("tooltip_remove_var"),
  22315. delay: {
  22316. show: 750,
  22317. hide: 0
  22318. }
  22319. });
  22320. }
  22321. function renderVariable(function_container, new_var, function_obj) {
  22322. var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
  22323. element += '<div class="ui dropdown variable_type">';
  22324. if (new_var.dimensions == 1) {
  22325. 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()));
  22326. element += ' [ ] </div>';
  22327. } else if (new_var.dimensions == 2) {
  22328. 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()));
  22329. element += ' [ ] [ ] </div>';
  22330. } else {
  22331. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("type_".concat(new_var.type.toLowerCase())) + '</div>';
  22332. }
  22333. element += '<div class="menu">';
  22334. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  22335. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  22336. continue;
  22337. }
  22338. 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>';
  22339. }
  22340. 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">';
  22341. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  22342. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  22343. continue;
  22344. }
  22345. 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>';
  22346. }
  22347. element += '</div></div>';
  22348. 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">';
  22349. for (var tm in _types__WEBPACK_IMPORTED_MODULE_0__.Types) {
  22350. if (tm == _types__WEBPACK_IMPORTED_MODULE_0__.Types.VOID.toUpperCase()) {
  22351. continue;
  22352. }
  22353. 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>';
  22354. }
  22355. element += '</div></div>';
  22356. element += '</div></div> ';
  22357. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  22358. element += ' <span class="character_equals"> <&#8212; </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  22359. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  22360. element = $(element);
  22361. element.data('associatedFunction', function_obj);
  22362. function_container.find('.variables_list_div').append(element);
  22363. addHandlers(new_var, element, function_obj);
  22364. renderValues(new_var, element, function_obj.name);
  22365. return element;
  22366. }
  22367. function updateColumnsAndRowsText(variable_container, variable_var) {
  22368. var prev = variable_container.find('.text').text().split('[');
  22369. if (prev.length == 2) {
  22370. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  22371. variable_container.find('.text').empty();
  22372. variable_container.find('.text').text(ff);
  22373. }
  22374. if (prev.length == 3) {
  22375. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  22376. variable_container.find('.text').empty();
  22377. variable_container.find('.text').text(ff);
  22378. }
  22379. }
  22380. function renderValues(new_var, variable_container, function_name) {
  22381. var ret = "";
  22382. var j = 0;
  22383. if (new_var.dimensions == 0) {
  22384. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22385. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  22386. } else {
  22387. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  22388. 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> ';
  22389. } else {
  22390. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  22391. }
  22392. }
  22393. } else {
  22394. ret += '<table class="tabela_var">';
  22395. if (new_var.dimensions == 1) {
  22396. ret += '<tr>';
  22397. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22398. for (var k = 0; k < new_var.columns; k++) {
  22399. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  22400. }
  22401. } else {
  22402. for (var k = 0; k < new_var.columns; k++) {
  22403. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  22404. 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>';
  22405. } else {
  22406. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  22407. }
  22408. }
  22409. }
  22410. ret += '</tr>';
  22411. ret += '</table>';
  22412. 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>';
  22413. }
  22414. if (new_var.dimensions == 2) {
  22415. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22416. for (var l = 0; l < new_var.rows; l++) {
  22417. ret += '<tr>';
  22418. for (var k = 0; k < new_var.columns; k++) {
  22419. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  22420. }
  22421. ret += '</tr>';
  22422. }
  22423. } else {
  22424. for (var l = 0; l < new_var.rows; l++) {
  22425. ret += '<tr>';
  22426. for (var k = 0; k < new_var.columns; k++) {
  22427. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  22428. 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>';
  22429. } else {
  22430. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  22431. }
  22432. }
  22433. ret += '</tr>';
  22434. }
  22435. }
  22436. if (new_var.rows == 0) {
  22437. ret += '<tr><td></td></tr>';
  22438. }
  22439. 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>';
  22440. ret += '</table>';
  22441. 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>';
  22442. }
  22443. }
  22444. $(variable_container).find(".div_valor_var").html('');
  22445. ret = $(ret);
  22446. $(ret).find('.span_value_variable').data('associatedOject', new_var);
  22447. $(ret).find(".boolean_simple_type").on('click', function (e) {
  22448. (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);
  22449. alternateBooleanValue(new_var, this.parentNode);
  22450. });
  22451. $(ret).find(".simple_var").on('click', function (e) {
  22452. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_VAR_VALUE, new_var.name);
  22453. enableValueUpdate(new_var, this.parentNode, function_name);
  22454. });
  22455. $(ret).find(".boolean_vector_var").on('click', function (e) {
  22456. alternateBooleanVectorValue(new_var, $(this).data('index'), this.parentNode);
  22457. (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);
  22458. });
  22459. $(ret).find(".vector_var").on('click', function (e) {
  22460. enableVectorValueUpdate(new_var, $(this).data('index'), this.parentNode, function_name);
  22461. });
  22462. $(ret).find(".remove_global_vector_column").on('click', function (e) {
  22463. removeColumnVector(new_var);
  22464. (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);
  22465. (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);
  22466. $(variable_container).find(".div_valor_var").html('');
  22467. renderValues(new_var, variable_container, function_name);
  22468. });
  22469. $(ret).find(".add_global_vector_column").on('click', function (e) {
  22470. addColumnVector(new_var);
  22471. (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);
  22472. (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);
  22473. $(variable_container).find(".div_valor_var").html('');
  22474. renderValues(new_var, variable_container, function_name);
  22475. });
  22476. $(ret).find(".remove_global_matrix_column").on('click', function (e) {
  22477. removeColumnMatrix(new_var);
  22478. (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);
  22479. (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);
  22480. $(variable_container).find(".div_valor_var").html('');
  22481. renderValues(new_var, variable_container, function_name);
  22482. });
  22483. $(ret).find(".add_global_matrix_column").on('click', function (e) {
  22484. addColumnMatrix(new_var);
  22485. (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);
  22486. (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);
  22487. $(variable_container).find(".div_valor_var").html('');
  22488. renderValues(new_var, variable_container, function_name);
  22489. });
  22490. $(ret).find(".remove_global_matrix_line").on('click', function (e) {
  22491. removeLineMatrix(new_var);
  22492. (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);
  22493. (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);
  22494. $(variable_container).find(".div_valor_var").html('');
  22495. renderValues(new_var, variable_container, function_name);
  22496. });
  22497. $(ret).find(".add_global_matrix_line").on('click', function (e) {
  22498. addLineMatrix(new_var);
  22499. (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);
  22500. (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);
  22501. $(variable_container).find(".div_valor_var").html('');
  22502. renderValues(new_var, variable_container, function_name);
  22503. });
  22504. $(ret).find(".boolean_matrix_var").on('click', function (e) {
  22505. alternateBooleanMatrixValue(new_var, $(this).data('row'), $(this).data('index'), this.parentNode);
  22506. (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);
  22507. });
  22508. $(ret).find(".matrix_var").on('click', function (e) {
  22509. (0,_services_userLog__WEBPACK_IMPORTED_MODULE_4__.registerUserEvent)(function_name, _services_userLog__WEBPACK_IMPORTED_MODULE_4__.ActionTypes.ENTER_CHANGE_VAR_VALUE, new_var.name);
  22510. enableMatrixValueUpdate(new_var, $(this).data('row'), $(this).data('index'), this.parentNode, function_name);
  22511. });
  22512. $(variable_container).find(".div_valor_var").append(ret);
  22513. updateColumnsAndRowsText(variable_container, new_var);
  22514. }
  22515. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  22516. var_obj.value[row][index] = !var_obj.value[row][index];
  22517. $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(var_obj.value[row][index])));
  22518. }
  22519. function addLineMatrix(var_obj) {
  22520. var_obj.rows++;
  22521. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22522. var n_l = [];
  22523. for (var i = 0; i < var_obj.columns; i++) {
  22524. n_l.push(0);
  22525. }
  22526. var_obj.value.push(n_l);
  22527. }
  22528. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22529. var n_l = [];
  22530. for (i = 0; i < var_obj.columns; i++) {
  22531. n_l.push(0.0);
  22532. }
  22533. var_obj.value.push(n_l);
  22534. }
  22535. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22536. var n_l = [];
  22537. for (i = 0; i < var_obj.columns; i++) {
  22538. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
  22539. }
  22540. var_obj.value.push(n_l);
  22541. }
  22542. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  22543. var n_l = [];
  22544. for (i = 0; i < var_obj.columns; i++) {
  22545. n_l.push(true);
  22546. }
  22547. var_obj.value.push(n_l);
  22548. }
  22549. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  22550. var n_l = [];
  22551. for (i = 0; i < var_obj.columns; i++) {
  22552. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
  22553. }
  22554. var_obj.value.push(n_l);
  22555. }
  22556. }
  22557. function removeLineMatrix(var_obj) {
  22558. if (var_obj.rows == 0) {
  22559. return;
  22560. }
  22561. var_obj.rows--;
  22562. var_obj.value.splice(var_obj.value.length - 1, 1);
  22563. }
  22564. function addColumnMatrix(var_obj) {
  22565. var_obj.columns++;
  22566. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22567. for (var i = 0; i < var_obj.rows; i++) {
  22568. var_obj.value[i].push(0);
  22569. }
  22570. }
  22571. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22572. for (var i = 0; i < var_obj.rows; i++) {
  22573. var_obj.value[i].push(0.0);
  22574. }
  22575. }
  22576. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22577. for (var i = 0; i < var_obj.rows; i++) {
  22578. var_obj.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
  22579. }
  22580. }
  22581. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  22582. for (var i = 0; i < var_obj.rows; i++) {
  22583. var_obj.value[i].push(true);
  22584. }
  22585. }
  22586. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  22587. for (var i = 0; i < var_obj.rows; i++) {
  22588. var_obj.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
  22589. }
  22590. }
  22591. }
  22592. function removeColumnMatrix(var_obj) {
  22593. if (var_obj.columns == 0) {
  22594. return;
  22595. }
  22596. var_obj.columns--;
  22597. for (var i = 0; i < var_obj.rows; i++) {
  22598. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  22599. }
  22600. }
  22601. function addColumnVector(var_obj) {
  22602. var_obj.columns++;
  22603. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22604. var_obj.value.push(0);
  22605. }
  22606. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22607. var_obj.value.push(0.0);
  22608. }
  22609. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22610. var_obj.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value'));
  22611. }
  22612. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  22613. var_obj.value.push(true);
  22614. }
  22615. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  22616. var_obj.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('charvar_default_value'));
  22617. }
  22618. }
  22619. function removeColumnVector(var_obj) {
  22620. if (var_obj.columns == 0) {
  22621. return;
  22622. }
  22623. var_obj.columns--;
  22624. var_obj.value.splice(var_obj.value.length - 1, 1);
  22625. }
  22626. function alternateBooleanValue(var_obj, value_container) {
  22627. var_obj.value = !var_obj.value;
  22628. $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(var_obj.value)));
  22629. }
  22630. function alternateBooleanVectorValue(var_obj, index, value_container) {
  22631. var_obj.value[index] = !var_obj.value[index];
  22632. $(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI("logic_value_".concat(var_obj.value[index])));
  22633. }
  22634. function updateInitialValues(variable_obj, function_name) {
  22635. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22636. if (variable_obj.dimensions == 0) {
  22637. variable_obj.value = 0;
  22638. }
  22639. if (variable_obj.dimensions == 1) {
  22640. variable_obj.value = [0, 0];
  22641. }
  22642. if (variable_obj.dimensions == 2) {
  22643. variable_obj.value = [[0, 0], [0, 0]];
  22644. }
  22645. }
  22646. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22647. if (variable_obj.dimensions == 0) {
  22648. variable_obj.value = 0.0;
  22649. }
  22650. if (variable_obj.dimensions == 1) {
  22651. variable_obj.value = [0.0, 0.0];
  22652. }
  22653. if (variable_obj.dimensions == 2) {
  22654. variable_obj.value = [[0.0, 0.0], [0.0, 0.0]];
  22655. }
  22656. }
  22657. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22658. if (variable_obj.dimensions == 0) {
  22659. variable_obj.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__.LocalizedStrings.getUI('textvar_default_value');
  22660. }
  22661. if (variable_obj.dimensions == 1) {
  22662. 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')];
  22663. }
  22664. if (variable_obj.dimensions == 2) {
  22665. 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')]];
  22666. }
  22667. }
  22668. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.BOOLEAN) {
  22669. if (variable_obj.dimensions == 0) {
  22670. variable_obj.value = true;
  22671. }
  22672. if (variable_obj.dimensions == 1) {
  22673. variable_obj.value = [true, true];
  22674. }
  22675. if (variable_obj.dimensions == 2) {
  22676. variable_obj.value = [[true, true], [true, true]];
  22677. }
  22678. }
  22679. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  22680. if (variable_obj.dimensions == 0) {
  22681. variable_obj.value = 'A';
  22682. }
  22683. if (variable_obj.dimensions == 1) {
  22684. variable_obj.value = ['A', 'A'];
  22685. }
  22686. if (variable_obj.dimensions == 2) {
  22687. variable_obj.value = [['A', 'A'], ['A', 'A']];
  22688. }
  22689. }
  22690. (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);
  22691. }
  22692. var opened_name_value_vector_global_ = false;
  22693. var opened_input_value_vector_global_ = null;
  22694. function enableVectorValueUpdate(var_obj, index, parent_node, function_name) {
  22695. if (opened_name_value_vector_global_) {
  22696. opened_input_value_vector_global_.focus();
  22697. return;
  22698. }
  22699. parent_node = $(parent_node);
  22700. opened_name_value_vector_global_ = true;
  22701. parent_node.find('.span_value_variable').text('');
  22702. var input_field;
  22703. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22704. 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) + "' />");
  22705. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22706. } else {
  22707. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index] + "' />");
  22708. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22709. }
  22710. input_field.on('input', function () {
  22711. var inputWidth = input_field.textWidth() + 10;
  22712. opened_input_value_vector_global_ = input_field;
  22713. input_field.focus();
  22714. var tmpStr = input_field.val();
  22715. input_field.val('');
  22716. input_field.val(tmpStr);
  22717. input_field.css({
  22718. width: inputWidth
  22719. });
  22720. }).trigger('input');
  22721. input_field.focusout(function () {
  22722. var changed = false; /// update array:
  22723. if (input_field.val().trim()) {
  22724. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22725. var_obj.value[index] = parseFloat(input_field.val().trim());
  22726. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  22727. } else {
  22728. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22729. var_obj.value[index] = parseInt(input_field.val().trim());
  22730. } else {
  22731. var_obj.value[index] = input_field.val().trim();
  22732. }
  22733. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  22734. }
  22735. changed = true;
  22736. } else {
  22737. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22738. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  22739. } else {
  22740. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  22741. }
  22742. }
  22743. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22744. var_obj.value[index] = input_field.val();
  22745. changed = true;
  22746. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  22747. }
  22748. if (changed) {
  22749. (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);
  22750. }
  22751. input_field.off();
  22752. input_field.remove(); /// update elements:
  22753. opened_name_value_vector_global_ = false;
  22754. opened_input_value_vector_global_ = false;
  22755. });
  22756. input_field.on('keydown', function (e) {
  22757. var code = e.keyCode || e.which;
  22758. var changed = false;
  22759. if (code == 13) {
  22760. if (input_field.val().trim()) {
  22761. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22762. var_obj.value[index] = parseFloat(input_field.val().trim());
  22763. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  22764. } else {
  22765. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22766. var_obj.value[index] = parseInt(input_field.val().trim());
  22767. } else {
  22768. var_obj.value[index] = input_field.val().trim();
  22769. }
  22770. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  22771. }
  22772. changed = true;
  22773. } else {
  22774. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22775. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  22776. } else {
  22777. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  22778. }
  22779. }
  22780. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22781. var_obj.value[index] = input_field.val();
  22782. changed = true;
  22783. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  22784. }
  22785. if (changed) {
  22786. (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);
  22787. }
  22788. input_field.off();
  22789. input_field.remove(); /// update elements:
  22790. opened_name_value_vector_global_ = false;
  22791. opened_input_value_vector_global_ = false;
  22792. }
  22793. if (code == 27) {
  22794. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22795. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  22796. } else {
  22797. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  22798. }
  22799. input_field.off();
  22800. input_field.remove(); /// update elements:
  22801. opened_name_value_vector_global_ = false;
  22802. opened_input_value_vector_global_ = false;
  22803. }
  22804. });
  22805. input_field.select();
  22806. }
  22807. var opened_name_value_global_var = false;
  22808. var opened_input_value_global_ar = null;
  22809. function enableValueUpdate(var_obj, parent_node, function_name) {
  22810. if (opened_name_value_global_var) {
  22811. opened_input_value_global_ar.focus();
  22812. return;
  22813. }
  22814. parent_node = $(parent_node);
  22815. opened_name_value_global_var = true;
  22816. var input_field;
  22817. parent_node.find('.span_value_variable').text('');
  22818. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22819. 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) + "' />");
  22820. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22821. } else {
  22822. input_field = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value + "' />");
  22823. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22824. }
  22825. input_field.on('input', function () {
  22826. var inputWidth = input_field.textWidth() + 10;
  22827. opened_input_value_global_ar = input_field;
  22828. input_field.focus();
  22829. var tmpStr = input_field.val();
  22830. input_field.val('');
  22831. input_field.val(tmpStr);
  22832. input_field.css({
  22833. width: inputWidth
  22834. });
  22835. }).trigger('input');
  22836. input_field.focusout(function () {
  22837. /// update array:
  22838. var changed = false;
  22839. if (input_field.val().trim()) {
  22840. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22841. var_obj.value = parseFloat(input_field.val().trim());
  22842. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  22843. } else {
  22844. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22845. var_obj.value = parseInt(input_field.val().trim());
  22846. } else if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  22847. var_obj.value = input_field.val().charAt(0);
  22848. } else {
  22849. var_obj.value = input_field.val().trim();
  22850. }
  22851. parent_node.find('.span_value_variable').text(var_obj.value);
  22852. }
  22853. changed = true;
  22854. } else {
  22855. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22856. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  22857. } else {
  22858. parent_node.find('.span_value_variable').text(var_obj.value);
  22859. }
  22860. }
  22861. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22862. var_obj.value = input_field.val();
  22863. changed = true;
  22864. parent_node.find('.span_value_variable').text(var_obj.value);
  22865. }
  22866. if (changed) {
  22867. (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);
  22868. }
  22869. input_field.off();
  22870. input_field.remove(); /// update elements:
  22871. opened_name_value_global_var = false;
  22872. opened_input_value_global_ar = false;
  22873. });
  22874. input_field.on('keydown', function (e) {
  22875. var code = e.keyCode || e.which;
  22876. var changed = false;
  22877. if (code == 13) {
  22878. if (input_field.val().trim()) {
  22879. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22880. var_obj.value = parseFloat(input_field.val().trim());
  22881. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  22882. } else {
  22883. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  22884. var_obj.value = parseInt(input_field.val().trim());
  22885. } else if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.CHAR) {
  22886. var_obj.value = input_field.val().charAt(0);
  22887. } else {
  22888. var_obj.value = input_field.val().trim();
  22889. }
  22890. parent_node.find('.span_value_variable').text(var_obj.value);
  22891. }
  22892. changed = true;
  22893. } else {
  22894. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22895. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  22896. } else {
  22897. parent_node.find('.span_value_variable').text(var_obj.value);
  22898. }
  22899. }
  22900. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  22901. var_obj.value = input_field.val();
  22902. changed = true;
  22903. parent_node.find('.span_value_variable').text(var_obj.value);
  22904. }
  22905. if (changed) {
  22906. (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);
  22907. }
  22908. input_field.off();
  22909. input_field.remove(); /// update elements:
  22910. opened_name_value_global_var = false;
  22911. opened_input_value_global_ar = false;
  22912. }
  22913. if (code == 27) {
  22914. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22915. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  22916. } else {
  22917. parent_node.find('.span_value_variable').text(var_obj.value);
  22918. }
  22919. input_field.off();
  22920. input_field.remove(); /// update elements:
  22921. opened_name_value_global_var = false;
  22922. opened_input_value_global_ar = false;
  22923. }
  22924. });
  22925. input_field.select();
  22926. }
  22927. var opened_name_global = false;
  22928. var opened_input_global = null;
  22929. function enableNameUpdate(variable_obj, variable_container, function_obj) {
  22930. if (opened_name_global) {
  22931. opened_input_global.focus();
  22932. return;
  22933. }
  22934. opened_name_global = true;
  22935. variable_container.find('.span_name_variable').text('');
  22936. var input_name;
  22937. input_name = $("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + variable_obj.name + "' />");
  22938. input_name.insertBefore(variable_container.find('.span_name_variable'));
  22939. input_name.on('input', function () {
  22940. var inputWidth = input_name.textWidth() + 10;
  22941. opened_input_global = input_name;
  22942. input_name.focus();
  22943. var tmpStr = input_name.val();
  22944. input_name.val('');
  22945. input_name.val(tmpStr);
  22946. input_name.css({
  22947. width: inputWidth
  22948. });
  22949. }).trigger('input');
  22950. input_name.focusout(function () {
  22951. /// update array:
  22952. if (input_name.val().trim().length > 0) {
  22953. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  22954. variable_container.find('.span_name_variable').text(variable_obj.name);
  22955. } else {
  22956. variable_container.find('.span_name_variable').text(variable_obj.name);
  22957. }
  22958. input_name.off();
  22959. input_name.remove(); /// update elements:
  22960. opened_name_global = false;
  22961. opened_input_global = false;
  22962. });
  22963. input_name.on('keydown', function (e) {
  22964. var code = e.keyCode || e.which;
  22965. if (code == 13) {
  22966. if (input_name.val().trim().length > 0) {
  22967. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  22968. variable_container.find('.span_name_variable').text(variable_obj.name);
  22969. } else {
  22970. variable_container.find('.span_name_variable').text(variable_obj.name);
  22971. }
  22972. input_name.off();
  22973. input_name.remove(); /// update elements:
  22974. opened_name_global = false;
  22975. opened_input_global = false;
  22976. }
  22977. if (code == 27) {
  22978. variable_container.find('.span_name_variable').text(variable_obj.name);
  22979. input_name.off();
  22980. input_name.remove(); /// update elements:
  22981. opened_name_global = false;
  22982. opened_input_global = false;
  22983. }
  22984. });
  22985. input_name.select();
  22986. }
  22987. var opened_name_value_matrix_global_v = false;
  22988. var opened_input_value_matrix_global_v = null;
  22989. function enableMatrixValueUpdate(var_obj, row, index, parent_node, function_name) {
  22990. if (opened_name_value_matrix_global_v) {
  22991. opened_input_value_matrix_global_v.focus();
  22992. return;
  22993. }
  22994. parent_node = $(parent_node);
  22995. opened_name_value_matrix_global_v = true;
  22996. parent_node.find('.span_value_variable').text('');
  22997. var input_field;
  22998. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  22999. 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) + "' />");
  23000. input_field.insertBefore(parent_node.find('.span_value_variable'));
  23001. } else {
  23002. 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] + "' />");
  23003. input_field.insertBefore(parent_node.find('.span_value_variable'));
  23004. }
  23005. input_field.on('input', function () {
  23006. var inputWidth = input_field.textWidth() + 10;
  23007. opened_input_value_matrix_global_v = input_field;
  23008. input_field.focus();
  23009. var tmpStr = input_field.val();
  23010. input_field.val('');
  23011. input_field.val(tmpStr);
  23012. input_field.css({
  23013. width: inputWidth
  23014. });
  23015. }).trigger('input');
  23016. input_field.focusout(function () {
  23017. var changed = false; /// update array:
  23018. if (input_field.val().trim()) {
  23019. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  23020. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  23021. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  23022. } else {
  23023. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  23024. var_obj.value[row][index] = parseInt(input_field.val().trim());
  23025. } else {
  23026. var_obj.value[row][index] = input_field.val().trim();
  23027. }
  23028. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  23029. }
  23030. changed = true;
  23031. } else {
  23032. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  23033. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  23034. } else {
  23035. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  23036. }
  23037. }
  23038. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  23039. var_obj.value[row][index] = input_field.val();
  23040. changed = true;
  23041. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  23042. }
  23043. if (changed) {
  23044. (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);
  23045. }
  23046. input_field.off();
  23047. input_field.remove(); /// update elements:
  23048. opened_name_value_matrix_global_v = false;
  23049. opened_input_value_matrix_global_v = false;
  23050. });
  23051. input_field.on('keydown', function (e) {
  23052. var code = e.keyCode || e.which;
  23053. var changed = false;
  23054. if (code == 13) {
  23055. if (input_field.val().trim()) {
  23056. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  23057. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  23058. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  23059. } else {
  23060. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.INTEGER) {
  23061. var_obj.value[row][index] = parseInt(input_field.val().trim());
  23062. } else {
  23063. var_obj.value[row][index] = input_field.val().trim();
  23064. }
  23065. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  23066. }
  23067. changed = true;
  23068. } else {
  23069. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  23070. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  23071. } else {
  23072. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  23073. }
  23074. }
  23075. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.TEXT) {
  23076. var_obj.value[row][index] = input_field.val();
  23077. changed = true;
  23078. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  23079. }
  23080. if (changed) {
  23081. (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);
  23082. }
  23083. input_field.off();
  23084. input_field.remove(); /// update elements:
  23085. opened_name_value_matrix_global_v = false;
  23086. opened_input_value_matrix_global_v = false;
  23087. }
  23088. if (code == 27) {
  23089. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_0__.Types.REAL) {
  23090. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  23091. } else {
  23092. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  23093. }
  23094. input_field.off();
  23095. input_field.remove(); /// update elements:
  23096. opened_name_value_matrix_global_v = false;
  23097. opened_input_value_matrix_global_v = false;
  23098. }
  23099. });
  23100. input_field.select();
  23101. }
  23102. /***/ }),
  23103. /***/ "./grammar/en/ivprog.ts":
  23104. /*!******************************!*\
  23105. !*** ./grammar/en/ivprog.ts ***!
  23106. \******************************/
  23107. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23108. "use strict";
  23109. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23110. exports.enLexer = void 0;
  23111. const lexer_1 = __webpack_require__(/*! ../lexer */ "./grammar/lexer.ts");
  23112. // i18n lexer strings for the language.
  23113. const types = {
  23114. // types
  23115. RK_REAL: "real",
  23116. RK_INTEGER: "int",
  23117. RK_BOOLEAN: "bool",
  23118. RK_CHARACTER: "char",
  23119. RK_STRING: "string",
  23120. };
  23121. const commands = {
  23122. // RK_VOID is not formally part of Types since it doesn't have a valid value/instance
  23123. RK_VOID: "vazio",
  23124. // commands
  23125. RK_PROGRAM: "program",
  23126. RK_SWITCH: "switch",
  23127. RK_CASE: "case",
  23128. RK_DEFAULT: "otherwise",
  23129. RK_CONST: "const",
  23130. RK_FUNCTION: "function",
  23131. RK_RETURN: "return",
  23132. RK_FOR: "for",
  23133. RK_FOR_ALT: "repeat_for",
  23134. RK_FOR_FROM: "from",
  23135. RK_FOR_TO: "to",
  23136. RK_FOR_PASS: "pass",
  23137. RK_BREAK: "break",
  23138. RK_DO: "repeat",
  23139. RK_DO_UNTIL: "until",
  23140. RK_WHILE: "while",
  23141. RK_WHILE_ALT: "repeat_while",
  23142. RK_IF: "if",
  23143. RK_ELSE: "else",
  23144. RK_REFERENCE: "&",
  23145. };
  23146. const boolVal = {
  23147. RK_FALSE: "false",
  23148. RK_TRUE: "true",
  23149. };
  23150. const logicOp = {
  23151. RK_LOGICAL_NOT: "not",
  23152. RK_LOGICAL_AND: "AND",
  23153. RK_LOGICAL_OR: "OR",
  23154. };
  23155. const langLibs = {
  23156. $mathLib: "Mathematics",
  23157. $ioLib: "IO",
  23158. $strLib: "Text",
  23159. $arrayLib: "Array",
  23160. $langLib: "Conversion",
  23161. };
  23162. const langFuncs = {
  23163. main_function: "main",
  23164. $read: "read",
  23165. $write: "write",
  23166. $numElements: "total_of_elements",
  23167. $matrixLines: "total_of_lines",
  23168. $matrixColumns: "total_of_columns",
  23169. $substring: "substring",
  23170. $length: "length",
  23171. $uppercase: "uppercase",
  23172. $lowercase: "lowercase",
  23173. $charAt: "char_at",
  23174. $isReal: "is_real",
  23175. $isInt: "is_integer",
  23176. $isBool: "is_logic",
  23177. $castReal: "to_real",
  23178. $castInt: "to_integer",
  23179. $castBool: "to_logic",
  23180. $castString: "to_string",
  23181. $castChar: "to_char",
  23182. $sin: "sin",
  23183. $cos: "cos",
  23184. $tan: "tan",
  23185. $sqrt: "sqrt",
  23186. $pow: "pow",
  23187. $log: "log",
  23188. $abs: "abs",
  23189. $negate: "negate",
  23190. $invert: "invert",
  23191. $max: "maximum",
  23192. $min: "minimum",
  23193. $rand: "random",
  23194. };
  23195. // END i18n lexer strings
  23196. exports.enLexer = lexer_1.makeLexer({
  23197. commands,
  23198. boolVal,
  23199. logicOp,
  23200. types,
  23201. langLibs,
  23202. langFuncs,
  23203. });
  23204. /***/ }),
  23205. /***/ "./grammar/helper.ts":
  23206. /*!***************************!*\
  23207. !*** ./grammar/helper.ts ***!
  23208. \***************************/
  23209. /***/ ((__unused_webpack_module, exports) => {
  23210. "use strict";
  23211. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23212. exports.combineRegex = void 0;
  23213. function combineRegex(strings, ...pieces) {
  23214. return new RegExp(strings.raw
  23215. .map((r, i) => r + (pieces[i] === undefined ? "" : "(?:" + pieces[i].source + ")"))
  23216. .join(""));
  23217. }
  23218. exports.combineRegex = combineRegex;
  23219. /***/ }),
  23220. /***/ "./grammar/index.ts":
  23221. /*!**************************!*\
  23222. !*** ./grammar/index.ts ***!
  23223. \**************************/
  23224. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23225. "use strict";
  23226. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23227. const ivprog_1 = __webpack_require__(/*! ./pt/ivprog */ "./grammar/pt/ivprog.ts");
  23228. const ivprog_2 = __webpack_require__(/*! ./en/ivprog */ "./grammar/en/ivprog.ts");
  23229. /*import * as ES from "./es/ivprog.g4";
  23230. import ESFuncs from "./es/langFunctions";
  23231. import ESLibs from "./es/langLibs";*/
  23232. const lexers = {};
  23233. lexers["pt"] = ivprog_1.ptLexer;
  23234. lexers["en"] = ivprog_2.enLexer;
  23235. exports["default"] = lexers;
  23236. /***/ }),
  23237. /***/ "./grammar/lexer.ts":
  23238. /*!**************************!*\
  23239. !*** ./grammar/lexer.ts ***!
  23240. \**************************/
  23241. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23242. "use strict";
  23243. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23244. exports.makeLexer = exports.IVProgLexer = void 0;
  23245. const moo = __webpack_require__(/*! moo */ "./node_modules/moo/moo.js");
  23246. const helper_1 = __webpack_require__(/*! ./helper */ "./grammar/helper.ts");
  23247. class IVProgLexer {
  23248. constructor(RKs, lexer, rules, i18nLexer) {
  23249. this.RKs = RKs;
  23250. this.lexer = lexer;
  23251. this.rules = rules;
  23252. this.i18nLexer = i18nLexer;
  23253. }
  23254. getReservedKeys() {
  23255. return this.RKs;
  23256. }
  23257. getRules() {
  23258. return this.rules;
  23259. }
  23260. getTypeKeys() {
  23261. return this.i18nLexer.types;
  23262. }
  23263. getLangLibs() {
  23264. return this.i18nLexer.langLibs;
  23265. }
  23266. getLangFuncs() {
  23267. return this.i18nLexer.langFuncs;
  23268. }
  23269. }
  23270. exports.IVProgLexer = IVProgLexer;
  23271. // General Regex Rules
  23272. const ID = "[a-zA-Z_][a-zA-Z0-9_]*";
  23273. const HEX_DIGIT = "[0-9a-fA-F]";
  23274. const OCTAL_DIGIT = "[0-7]";
  23275. const ESC_OCTAL = RegExp(`\\\\[0-3]${OCTAL_DIGIT}${OCTAL_DIGIT}|\\\\${OCTAL_DIGIT}${OCTAL_DIGIT}|\\\\${OCTAL_DIGIT}`);
  23276. const ESC_UNICODE = RegExp(`\\\\u${HEX_DIGIT}${HEX_DIGIT}${HEX_DIGIT}${HEX_DIGIT}`);
  23277. const ESC_SEQ_BASE = /\\[b,t,n,f,r,",',\\]|/;
  23278. const ESC_SEQ = helper_1.combineRegex `${ESC_SEQ_BASE}|${ESC_UNICODE}|${ESC_OCTAL}`;
  23279. const STRING_CHARACTER = helper_1.combineRegex `${ESC_SEQ}|[^"\\\\]`;
  23280. function makeLexer(lexer) {
  23281. const RKs = {};
  23282. const rules = {};
  23283. Object.entries(lexer.types).forEach(([key, value]) => {
  23284. RKs[key] = value;
  23285. rules[key] = key;
  23286. });
  23287. Object.entries(lexer.boolVal).forEach(([key, value]) => {
  23288. RKs[key] = value;
  23289. rules[key] = key;
  23290. });
  23291. Object.entries(lexer.commands).forEach(([key, value]) => {
  23292. RKs[key] = value;
  23293. rules[key] = key;
  23294. });
  23295. RKs["AND_OPERATOR"] = lexer.logicOp.RK_LOGICAL_AND;
  23296. RKs["OR_OPERATOR"] = lexer.logicOp.RK_LOGICAL_OR;
  23297. RKs["NOT_OPERATOR"] = lexer.logicOp.RK_LOGICAL_NOT;
  23298. const RESERVED_KEYS = moo.keywords(RKs);
  23299. const lexerRules = {
  23300. COMMENTS: { match: /\/\/[^$]*?$|\/\*[^$]*?\*\//, lineBreaks: true },
  23301. OPEN_BRACE: /\[/,
  23302. CLOSE_BRACE: /\]/,
  23303. OPEN_PARENTHESIS: /\(/,
  23304. CLOSE_PARENTHESIS: /\)/,
  23305. OPEN_CURLY: /\{/,
  23306. CLOSE_CURLY: /\}/,
  23307. COMMA: /,/,
  23308. ASSIGNMENT: /<-|←/,
  23309. REAL: /[0-9]+\.[0-9]*[eE][+-]?[0-9]+|[0-9]+\.[0-9]+/,
  23310. INTEGER: RegExp(`(?:0x|0X)${HEX_DIGIT}+|(?:0b|0B)[0-1]+|[0-9]+`),
  23311. SUM_OP: /[+-]/,
  23312. MULTI_OP: /[*/%]/,
  23313. RELATIONAL_OPERATOR: />=|==|<=|>|<|!=/,
  23314. COLON: /:/,
  23315. STRING: helper_1.combineRegex `"(?:${STRING_CHARACTER})*?"`,
  23316. CHARACTER: helper_1.combineRegex `'(?:${ESC_SEQ}|[^'\\\\])'`,
  23317. EOS: { match: /;\r?\n?|[\r\n]+/, lineBreaks: true },
  23318. WHITESPACE: /(?: |\t)+/,
  23319. RK_REFERENCE: RegExp(lexer.commands.RK_REFERENCE),
  23320. ID: { match: RegExp(ID), type: RESERVED_KEYS },
  23321. DOT: /\./,
  23322. ERROR: { match: /[\$?`]/, error: true },
  23323. };
  23324. Object.entries(lexerRules).forEach(([key, _]) => (rules[key] = key));
  23325. const moolexer = moo.compile(lexerRules);
  23326. return new IVProgLexer(RKs, moolexer, rules, lexer);
  23327. }
  23328. exports.makeLexer = makeLexer;
  23329. /***/ }),
  23330. /***/ "./grammar/pt/ivprog.ts":
  23331. /*!******************************!*\
  23332. !*** ./grammar/pt/ivprog.ts ***!
  23333. \******************************/
  23334. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23335. "use strict";
  23336. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23337. exports.ptLexer = void 0;
  23338. const lexer_1 = __webpack_require__(/*! ../lexer */ "./grammar/lexer.ts");
  23339. // i18n lexer strings for the language.
  23340. const types = {
  23341. // types
  23342. RK_REAL: "real",
  23343. RK_INTEGER: "inteiro",
  23344. RK_BOOLEAN: "logico",
  23345. RK_CHARACTER: "caractere",
  23346. RK_STRING: "cadeia",
  23347. };
  23348. const commands = {
  23349. // RK_VOID is not formally part of Types since it doesn't have a valid value/instance
  23350. RK_VOID: "vazio",
  23351. // commands
  23352. RK_PROGRAM: "programa",
  23353. RK_SWITCH: "escolha",
  23354. RK_CASE: "caso",
  23355. RK_DEFAULT: "contrario",
  23356. RK_CONST: "const",
  23357. RK_FUNCTION: "funcao",
  23358. RK_RETURN: "devolva",
  23359. RK_FOR: "para",
  23360. RK_FOR_ALT: "repita_para",
  23361. RK_FOR_FROM: "de",
  23362. RK_FOR_TO: "ate",
  23363. RK_FOR_PASS: "passo",
  23364. RK_BREAK: "pare",
  23365. RK_DO: "repita",
  23366. RK_DO_UNTIL: "ate_que",
  23367. RK_WHILE: "enquanto",
  23368. RK_WHILE_ALT: "repita_enquanto",
  23369. RK_IF: "se",
  23370. RK_ELSE: "senao",
  23371. RK_REFERENCE: "&",
  23372. };
  23373. const boolVal = {
  23374. RK_FALSE: "falso",
  23375. RK_TRUE: "verdadeiro",
  23376. };
  23377. const logicOp = {
  23378. RK_LOGICAL_NOT: "nao",
  23379. RK_LOGICAL_AND: "E",
  23380. RK_LOGICAL_OR: "OU",
  23381. };
  23382. const langLibs = {
  23383. $mathLib: "Matematica",
  23384. $ioLib: "ES",
  23385. $strLib: "Texto",
  23386. $arrayLib: "Arranjo",
  23387. $langLib: "Conversao",
  23388. };
  23389. const langFuncs = {
  23390. main_function: "inicio",
  23391. $read: "leia",
  23392. $write: "escreva",
  23393. $numElements: "total_de_elementos",
  23394. $matrixLines: "total_de_linhas",
  23395. $matrixColumns: "total_de_colunas",
  23396. $substring: "subcadeia",
  23397. $length: "comprimento",
  23398. $uppercase: "caixa_alta",
  23399. $lowercase: "caixa_baixa",
  23400. $charAt: "caractere_na_posicao",
  23401. $isReal: "e_real",
  23402. $isInt: "e_inteiro",
  23403. $isBool: "e_logico",
  23404. $castReal: "como_real",
  23405. $castInt: "como_inteiro",
  23406. $castBool: "como_logico",
  23407. $castString: "como_cadeia",
  23408. $castChar: "como_caractere",
  23409. $sin: "seno",
  23410. $cos: "cosseno",
  23411. $tan: "tangente",
  23412. $sqrt: "raiz_quadrada",
  23413. $pow: "potencia",
  23414. $log: "logaritmo",
  23415. $abs: "modulo",
  23416. $negate: "trocar_sinal",
  23417. $invert: "inverter_valor",
  23418. $max: "maximo",
  23419. $min: "minimo",
  23420. $rand: "numero_aleatorio",
  23421. };
  23422. // END i18n lexer strings
  23423. exports.ptLexer = lexer_1.makeLexer({
  23424. commands,
  23425. boolVal,
  23426. logicOp,
  23427. types,
  23428. langLibs,
  23429. langFuncs,
  23430. });
  23431. /***/ }),
  23432. /***/ "./i18n/index.ts":
  23433. /*!***********************!*\
  23434. !*** ./i18n/index.ts ***!
  23435. \***********************/
  23436. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23437. "use strict";
  23438. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23439. const Messages = __webpack_require__(/*! ./message.csv */ "./i18n/message.csv");
  23440. const UI = __webpack_require__(/*! ./ui.csv */ "./i18n/ui.csv");
  23441. const Errors = __webpack_require__(/*! ./error.csv */ "./i18n/error.csv");
  23442. const MessagesObj = Messages;
  23443. const UIObj = UI;
  23444. const ErrorsObj = Errors;
  23445. const i18n_data = {};
  23446. for (const key in UIObj) {
  23447. const data = {};
  23448. data['error'] = ErrorsObj[key];
  23449. data['message'] = MessagesObj[key];
  23450. data['ui'] = UIObj[key];
  23451. i18n_data[key] = data;
  23452. }
  23453. exports["default"] = i18n_data;
  23454. /***/ }),
  23455. /***/ "./js/ast/operators.ts":
  23456. /*!*****************************!*\
  23457. !*** ./js/ast/operators.ts ***!
  23458. \*****************************/
  23459. /***/ ((__unused_webpack_module, exports) => {
  23460. "use strict";
  23461. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23462. exports.convertFromString = exports.Operators = void 0;
  23463. exports.Operators = Object.freeze({
  23464. ADD: { ord: 0, value: "+" },
  23465. SUB: { ord: 1, value: "-" },
  23466. MULT: { ord: 2, value: '*' },
  23467. DIV: { ord: 3, value: '/' },
  23468. MOD: { ord: 4, value: '%' },
  23469. GT: { ord: 5, value: '>' },
  23470. GE: { ord: 6, value: '>=' },
  23471. LT: { ord: 7, value: '<' },
  23472. LE: { ord: 8, value: '<=' },
  23473. EQ: { ord: 9, value: '==' },
  23474. NEQ: { ord: 10, value: '!=' },
  23475. AND: { ord: 11, value: 'and' },
  23476. OR: { ord: 12, value: 'or' },
  23477. NOT: { ord: 13, value: 'not' }
  23478. });
  23479. function convertFromString(op) {
  23480. switch (op) {
  23481. case '+': return exports.Operators.ADD;
  23482. case '-': return exports.Operators.SUB;
  23483. case '*': return exports.Operators.MULT;
  23484. case '/': return exports.Operators.DIV;
  23485. case '%': return exports.Operators.MOD;
  23486. case '>': return exports.Operators.GT;
  23487. case '>=': return exports.Operators.GE;
  23488. case '<': return exports.Operators.LT;
  23489. case '<=': return exports.Operators.LE;
  23490. case '==': return exports.Operators.EQ;
  23491. case '!=': return exports.Operators.NEQ;
  23492. case 'and': return exports.Operators.AND;
  23493. case 'or': return exports.Operators.OR;
  23494. case 'not': return exports.Operators.NOT;
  23495. }
  23496. return null;
  23497. }
  23498. exports.convertFromString = convertFromString;
  23499. /***/ }),
  23500. /***/ "./js/memory/address.ts":
  23501. /*!******************************!*\
  23502. !*** ./js/memory/address.ts ***!
  23503. \******************************/
  23504. /***/ ((__unused_webpack_module, exports) => {
  23505. "use strict";
  23506. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23507. exports.Address = void 0;
  23508. class Address {
  23509. /**
  23510. *
  23511. * @param {Number} id the address id
  23512. * @param {never} value the value stored at this address
  23513. */
  23514. constructor(id, value) {
  23515. this.id = id;
  23516. this.value = value;
  23517. }
  23518. }
  23519. exports.Address = Address;
  23520. /***/ }),
  23521. /***/ "./js/memory/location.ts":
  23522. /*!*******************************!*\
  23523. !*** ./js/memory/location.ts ***!
  23524. \*******************************/
  23525. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23526. "use strict";
  23527. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23528. exports.Location = void 0;
  23529. const address_1 = __webpack_require__(/*! ./address */ "./js/memory/address.ts");
  23530. class LocationHolder {
  23531. constructor() {
  23532. this.data = [];
  23533. this.address_id = 0;
  23534. }
  23535. /**
  23536. *
  23537. * @param {never} value the value to be allocated
  23538. * @returns {number} - the address id
  23539. */
  23540. allocate(value) {
  23541. const id = this.address_id;
  23542. // console.log("Allocation address "+ id);
  23543. const address = new address_1.Address(id, value);
  23544. this.data.push(address);
  23545. this.address_id += 1;
  23546. return id;
  23547. }
  23548. /**
  23549. *
  23550. * @param {number} id
  23551. */
  23552. deallocate(id) {
  23553. const index = this.findIndex(id);
  23554. // console.log("Deallocation address "+ id);
  23555. if (index !== -1) {
  23556. this.data.splice(index, 1);
  23557. return true;
  23558. }
  23559. return false;
  23560. }
  23561. /**
  23562. *
  23563. * @param {number} id
  23564. * @returns {Address} the address identified by id
  23565. */
  23566. find(id) {
  23567. let beg = 0;
  23568. let end = this.data.length;
  23569. // console.log("Finding address "+id);
  23570. while (beg < end) {
  23571. const med = Math.floor((beg + end) / 2);
  23572. const address = this.getAddressAt(med);
  23573. if (address.id === id) {
  23574. return address;
  23575. }
  23576. else if (id > address.id) {
  23577. beg = med;
  23578. }
  23579. else {
  23580. end = med;
  23581. }
  23582. }
  23583. return undefined;
  23584. }
  23585. getAddressAt(pos) {
  23586. return this.data[pos];
  23587. }
  23588. /**
  23589. *
  23590. * @param {number} id address id
  23591. * @returns {number} the index of the address identified by id
  23592. */
  23593. findIndex(id) {
  23594. let beg = 0;
  23595. let end = this.data.length;
  23596. while (beg < end) {
  23597. const med = Math.floor((beg + end) / 2);
  23598. const address = this.getAddressAt(med);
  23599. if (address.id === id) {
  23600. return med;
  23601. }
  23602. else if (id > address.id) {
  23603. beg = med;
  23604. }
  23605. else {
  23606. end = med;
  23607. }
  23608. }
  23609. return -1;
  23610. }
  23611. updateAddress(id, value) {
  23612. const index = this.findIndex(id);
  23613. if (index === -1) {
  23614. throw new Error("Invalid address..." + id);
  23615. }
  23616. this.data[index].value = value;
  23617. }
  23618. clear() {
  23619. for (let i = 0; i < this.data.length; i += 1) {
  23620. delete this.data[i];
  23621. }
  23622. this.data = [];
  23623. this.address_id = 0;
  23624. }
  23625. }
  23626. const inner_ref = new LocationHolder();
  23627. exports.Location = Object.freeze({
  23628. allocate: inner_ref.allocate.bind(inner_ref),
  23629. deallocate: inner_ref.deallocate.bind(inner_ref),
  23630. find: inner_ref.find.bind(inner_ref),
  23631. updateAddress: inner_ref.updateAddress.bind(inner_ref),
  23632. clear: inner_ref.clear.bind(inner_ref),
  23633. size: () => inner_ref.data.length
  23634. });
  23635. /***/ }),
  23636. /***/ "./js/processor/compatibilityTable.ts":
  23637. /*!********************************************!*\
  23638. !*** ./js/processor/compatibilityTable.ts ***!
  23639. \********************************************/
  23640. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23641. "use strict";
  23642. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23643. exports.resultTypeAfterUnaryOp = exports.resultTypeAfterInfixOp = void 0;
  23644. const types_1 = __webpack_require__(/*! ../typeSystem/types */ "./js/typeSystem/types.ts");
  23645. const operators_1 = __webpack_require__(/*! ../ast/operators */ "./js/ast/operators.ts");
  23646. const multiType_1 = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.ts");
  23647. const config_1 = __webpack_require__(/*! ../util/config */ "./js/util/config.ts");
  23648. function buildInfixAddTable() {
  23649. const table = [[], [], [], [], []];
  23650. table[types_1.Types.INTEGER.ord][types_1.Types.INTEGER.ord] = types_1.Types.INTEGER;
  23651. table[types_1.Types.INTEGER.ord][types_1.Types.REAL.ord] = types_1.Types.REAL;
  23652. table[types_1.Types.INTEGER.ord][types_1.Types.STRING.ord] = types_1.Types.STRING;
  23653. table[types_1.Types.REAL.ord][types_1.Types.INTEGER.ord] = types_1.Types.REAL;
  23654. table[types_1.Types.REAL.ord][types_1.Types.REAL.ord] = types_1.Types.REAL;
  23655. table[types_1.Types.REAL.ord][types_1.Types.STRING.ord] = types_1.Types.STRING;
  23656. table[types_1.Types.STRING.ord][types_1.Types.INTEGER.ord] = types_1.Types.STRING;
  23657. table[types_1.Types.STRING.ord][types_1.Types.REAL.ord] = types_1.Types.STRING;
  23658. table[types_1.Types.STRING.ord][types_1.Types.STRING.ord] = types_1.Types.STRING;
  23659. table[types_1.Types.STRING.ord][types_1.Types.BOOLEAN.ord] = types_1.Types.STRING;
  23660. table[types_1.Types.STRING.ord][types_1.Types.CHAR.ord] = types_1.Types.STRING;
  23661. table[types_1.Types.CHAR.ord][types_1.Types.CHAR.ord] = types_1.Types.STRING;
  23662. table[types_1.Types.CHAR.ord][types_1.Types.STRING.ord] = types_1.Types.STRING;
  23663. return table;
  23664. }
  23665. function buildInfixMultiDivSubTable() {
  23666. const table = [[], []];
  23667. table[types_1.Types.INTEGER.ord][types_1.Types.INTEGER.ord] = types_1.Types.INTEGER;
  23668. table[types_1.Types.INTEGER.ord][types_1.Types.REAL.ord] = types_1.Types.REAL;
  23669. table[types_1.Types.REAL.ord][types_1.Types.INTEGER.ord] = types_1.Types.REAL;
  23670. table[types_1.Types.REAL.ord][types_1.Types.REAL.ord] = types_1.Types.REAL;
  23671. return table;
  23672. }
  23673. function buildInfixEqualityInequalityTable() {
  23674. const table = [[], [], [], [], []];
  23675. table[types_1.Types.INTEGER.ord][types_1.Types.INTEGER.ord] = types_1.Types.BOOLEAN;
  23676. table[types_1.Types.REAL.ord][types_1.Types.REAL.ord] = types_1.Types.BOOLEAN;
  23677. table[types_1.Types.BOOLEAN.ord][types_1.Types.BOOLEAN.ord] = types_1.Types.BOOLEAN;
  23678. table[types_1.Types.STRING.ord][types_1.Types.STRING.ord] = types_1.Types.BOOLEAN;
  23679. table[types_1.Types.CHAR.ord][types_1.Types.CHAR.ord] = types_1.Types.BOOLEAN;
  23680. return table;
  23681. }
  23682. function buildInfixRelationalTable() {
  23683. const table = [[], [], [], [], []];
  23684. table[types_1.Types.INTEGER.ord][types_1.Types.INTEGER.ord] = types_1.Types.BOOLEAN;
  23685. table[types_1.Types.REAL.ord][types_1.Types.REAL.ord] = types_1.Types.BOOLEAN;
  23686. table[types_1.Types.STRING.ord][types_1.Types.STRING.ord] = types_1.Types.BOOLEAN;
  23687. table[types_1.Types.CHAR.ord][types_1.Types.CHAR.ord] = types_1.Types.BOOLEAN;
  23688. return table;
  23689. }
  23690. function buildInfixAndOrTable() {
  23691. const table = [[], [], [], []];
  23692. table[types_1.Types.BOOLEAN.ord][types_1.Types.BOOLEAN.ord] = types_1.Types.BOOLEAN;
  23693. return table;
  23694. }
  23695. function buildInfixModTable() {
  23696. const table = [[]];
  23697. table[types_1.Types.INTEGER.ord][types_1.Types.INTEGER.ord] = types_1.Types.INTEGER;
  23698. return table;
  23699. }
  23700. function buildUnarySumSubList() {
  23701. const list = [];
  23702. list[types_1.Types.INTEGER.ord] = types_1.Types.INTEGER;
  23703. list[types_1.Types.REAL.ord] = types_1.Types.REAL;
  23704. return list;
  23705. }
  23706. function buildUnaryNegList() {
  23707. const list = [];
  23708. list[types_1.Types.BOOLEAN.ord] = types_1.Types.BOOLEAN;
  23709. return list;
  23710. }
  23711. function buildInfixCompatibilityTable() {
  23712. const compatibilityMap = new WeakMap();
  23713. compatibilityMap.set(operators_1.Operators.ADD, buildInfixAddTable());
  23714. compatibilityMap.set(operators_1.Operators.SUB, buildInfixMultiDivSubTable());
  23715. compatibilityMap.set(operators_1.Operators.MULT, buildInfixMultiDivSubTable());
  23716. compatibilityMap.set(operators_1.Operators.DIV, buildInfixMultiDivSubTable());
  23717. compatibilityMap.set(operators_1.Operators.EQ, buildInfixEqualityInequalityTable());
  23718. compatibilityMap.set(operators_1.Operators.NEQ, buildInfixEqualityInequalityTable());
  23719. compatibilityMap.set(operators_1.Operators.GE, buildInfixRelationalTable());
  23720. compatibilityMap.set(operators_1.Operators.GT, buildInfixRelationalTable());
  23721. compatibilityMap.set(operators_1.Operators.LE, buildInfixRelationalTable());
  23722. compatibilityMap.set(operators_1.Operators.LT, buildInfixRelationalTable());
  23723. compatibilityMap.set(operators_1.Operators.OR, buildInfixAndOrTable());
  23724. compatibilityMap.set(operators_1.Operators.AND, buildInfixAndOrTable());
  23725. compatibilityMap.set(operators_1.Operators.MOD, buildInfixModTable());
  23726. return compatibilityMap;
  23727. }
  23728. function buildUnaryCompatibilityTable() {
  23729. const compatibilityMap = new WeakMap();
  23730. compatibilityMap.set(operators_1.Operators.ADD, buildUnarySumSubList());
  23731. compatibilityMap.set(operators_1.Operators.SUB, buildUnarySumSubList());
  23732. compatibilityMap.set(operators_1.Operators.NOT, buildUnaryNegList());
  23733. return compatibilityMap;
  23734. }
  23735. const infixMap = buildInfixCompatibilityTable();
  23736. const unaryMap = buildUnaryCompatibilityTable();
  23737. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  23738. try {
  23739. if (leftExpressionType instanceof multiType_1.MultiType && rightExpressionType instanceof multiType_1.MultiType) {
  23740. let newMulti = [];
  23741. for (let i = 0; i < leftExpressionType.types.length; ++i) {
  23742. const typeA = leftExpressionType.types[i];
  23743. for (let j = 0; j < rightExpressionType.types.length; ++i) {
  23744. const typeB = rightExpressionType.types[j];
  23745. newMulti.push(resultTypeAfterInfixOp(operator, typeA, typeB));
  23746. }
  23747. }
  23748. newMulti = newMulti.filter(x => !x.isCompatible(types_1.Types.UNDEFINED));
  23749. if (newMulti.length <= 0) {
  23750. if (config_1.Config.enable_type_casting) {
  23751. if (leftExpressionType.isCompatible(types_1.Types.INTEGER) || leftExpressionType.isCompatible(types_1.Types.REAL)) {
  23752. if (rightExpressionType.isCompatible(types_1.Types.INTEGER) || rightExpressionType.isCompatible(types_1.Types.REAL)) {
  23753. return new multiType_1.MultiType([types_1.Types.INTEGER, types_1.Types.REAL]);
  23754. }
  23755. }
  23756. }
  23757. return types_1.Types.UNDEFINED;
  23758. }
  23759. else {
  23760. return new multiType_1.MultiType(newMulti);
  23761. }
  23762. }
  23763. else if (leftExpressionType instanceof multiType_1.MultiType) {
  23764. if (leftExpressionType.isCompatible(rightExpressionType)) {
  23765. return resultTypeAfterInfixOp(operator, rightExpressionType, rightExpressionType);
  23766. }
  23767. else {
  23768. if (config_1.Config.enable_type_casting) {
  23769. if (leftExpressionType.isCompatible(types_1.Types.INTEGER) || leftExpressionType.isCompatible(types_1.Types.REAL)) {
  23770. if (rightExpressionType.isCompatible(types_1.Types.INTEGER) || rightExpressionType.isCompatible(types_1.Types.REAL)) {
  23771. return rightExpressionType;
  23772. }
  23773. }
  23774. }
  23775. return types_1.Types.UNDEFINED;
  23776. }
  23777. }
  23778. else if (rightExpressionType instanceof multiType_1.MultiType) {
  23779. if (rightExpressionType.isCompatible(leftExpressionType)) {
  23780. return resultTypeAfterInfixOp(operator, leftExpressionType, leftExpressionType);
  23781. }
  23782. else {
  23783. if (config_1.Config.enable_type_casting) {
  23784. if (leftExpressionType.isCompatible(types_1.Types.INTEGER) || leftExpressionType.isCompatible(types_1.Types.REAL)) {
  23785. if (rightExpressionType.isCompatible(types_1.Types.INTEGER) || rightExpressionType.isCompatible(types_1.Types.REAL)) {
  23786. return leftExpressionType;
  23787. }
  23788. }
  23789. }
  23790. return types_1.Types.UNDEFINED;
  23791. }
  23792. }
  23793. const resultTable = infixMap.get(operator) || [];
  23794. // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  23795. const resultType = resultTable[leftExpressionType.ord][rightExpressionType.ord];
  23796. if (resultType === null || resultType === undefined) {
  23797. if (config_1.Config.enable_type_casting) {
  23798. if (leftExpressionType.isCompatible(types_1.Types.INTEGER) || leftExpressionType.isCompatible(types_1.Types.REAL)) {
  23799. if (rightExpressionType.isCompatible(types_1.Types.INTEGER) || rightExpressionType.isCompatible(types_1.Types.REAL)) {
  23800. if (operator === operators_1.Operators.MOD) {
  23801. return types_1.Types.INTEGER;
  23802. }
  23803. else if (operator.ord >= 5 && operator.ord <= 10) {
  23804. return types_1.Types.BOOLEAN;
  23805. }
  23806. }
  23807. }
  23808. }
  23809. return types_1.Types.UNDEFINED;
  23810. }
  23811. return resultType;
  23812. }
  23813. catch (e) {
  23814. if (e instanceof TypeError) {
  23815. return types_1.Types.UNDEFINED;
  23816. }
  23817. else {
  23818. throw e;
  23819. }
  23820. }
  23821. }
  23822. exports.resultTypeAfterInfixOp = resultTypeAfterInfixOp;
  23823. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  23824. try {
  23825. if (leftExpressionType instanceof multiType_1.MultiType) {
  23826. let newMulti = [];
  23827. for (let i = 0; i < leftExpressionType.types.length; ++i) {
  23828. const type = leftExpressionType.types[i];
  23829. newMulti.push(resultTypeAfterUnaryOp(operator, type));
  23830. }
  23831. newMulti = newMulti.filter(x => !x.isCompatible(types_1.Types.UNDEFINED));
  23832. if (newMulti.length <= 0) {
  23833. return types_1.Types.UNDEFINED;
  23834. }
  23835. return new multiType_1.MultiType(newMulti);
  23836. }
  23837. const resultTable = unaryMap.get(operator) || [];
  23838. // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  23839. const resultType = resultTable[leftExpressionType.ord];
  23840. if (resultType == null) {
  23841. return types_1.Types.UNDEFINED;
  23842. }
  23843. return resultType;
  23844. }
  23845. catch (e) {
  23846. if (e instanceof TypeError) {
  23847. return types_1.Types.UNDEFINED;
  23848. }
  23849. else {
  23850. throw e;
  23851. }
  23852. }
  23853. }
  23854. exports.resultTypeAfterUnaryOp = resultTypeAfterUnaryOp;
  23855. /***/ }),
  23856. /***/ "./js/processor/context.ts":
  23857. /*!*********************************!*\
  23858. !*** ./js/processor/context.ts ***!
  23859. \*********************************/
  23860. /***/ ((__unused_webpack_module, exports) => {
  23861. "use strict";
  23862. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23863. exports.Context = void 0;
  23864. exports.Context = Object.freeze({
  23865. BASE: Symbol('context:base'),
  23866. BREAKABLE: Symbol('context:breakable'),
  23867. FUNCTION: Symbol('context:function')
  23868. });
  23869. /***/ }),
  23870. /***/ "./js/processor/modes.ts":
  23871. /*!*******************************!*\
  23872. !*** ./js/processor/modes.ts ***!
  23873. \*******************************/
  23874. /***/ ((__unused_webpack_module, exports) => {
  23875. "use strict";
  23876. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23877. exports.Modes = void 0;
  23878. exports.Modes = Object.freeze({
  23879. RETURN: Symbol('mode:return'),
  23880. BREAK: Symbol('mode:break'),
  23881. PAUSE: Symbol('mode:pause'),
  23882. RUN: Symbol('mode:run'),
  23883. ABORT: Symbol('mode:abort')
  23884. });
  23885. /***/ }),
  23886. /***/ "./js/processor/store/store.ts":
  23887. /*!*************************************!*\
  23888. !*** ./js/processor/store/store.ts ***!
  23889. \*************************************/
  23890. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  23891. "use strict";
  23892. Object.defineProperty(exports, "__esModule", ({ value: true }));
  23893. exports.Store = void 0;
  23894. /* eslint-disable @typescript-eslint/no-non-null-assertion */
  23895. const modes_1 = __webpack_require__(/*! ../modes */ "./js/processor/modes.ts");
  23896. const types_1 = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.ts");
  23897. const storeObject_1 = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.ts");
  23898. const storeObjectRef_1 = __webpack_require__(/*! ./storeObjectRef */ "./js/processor/store/storeObjectRef.ts");
  23899. const array_type_1 = __webpack_require__(/*! ../../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
  23900. const array_store_value_1 = __webpack_require__(/*! ./value/array_store_value */ "./js/processor/store/value/array_store_value.ts");
  23901. const location_1 = __webpack_require__(/*! ../../memory/location */ "./js/memory/location.ts");
  23902. const storeObjectArray_1 = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.ts");
  23903. const store_value_1 = __webpack_require__(/*! ./value/store_value */ "./js/processor/store/value/store_value.ts");
  23904. const store_value_address_1 = __webpack_require__(/*! ./value/store_value_address */ "./js/processor/store/value/store_value_address.ts");
  23905. const store_value_ref_1 = __webpack_require__(/*! ./value/store_value_ref */ "./js/processor/store/value/store_value_ref.ts");
  23906. const array_store_value_ref_1 = __webpack_require__(/*! ./value/array_store_value_ref */ "./js/processor/store/value/array_store_value_ref.ts");
  23907. const store_object_array_ref_1 = __webpack_require__(/*! ./store_object_array_ref */ "./js/processor/store/store_object_array_ref.ts");
  23908. class Store {
  23909. constructor(name) {
  23910. this.name = name;
  23911. this.store = new Map();
  23912. this.mode = modes_1.Modes.RUN;
  23913. }
  23914. static canImplicitTypeCast(castType, sourceType) {
  23915. if (castType.isCompatible(types_1.Types.INTEGER) || castType.isCompatible(types_1.Types.REAL)) {
  23916. if (sourceType.isCompatible(types_1.Types.INTEGER) || sourceType.isCompatible(types_1.Types.REAL)) {
  23917. return true;
  23918. }
  23919. }
  23920. return false;
  23921. }
  23922. static doImplicitCasting(castType, stoObj) {
  23923. if (!Store.canImplicitTypeCast(castType, stoObj.type)) {
  23924. throw new Error("!!!Critical error: attempted to type cast invalid types");
  23925. }
  23926. if (castType.isCompatible(types_1.Types.INTEGER)) {
  23927. return new store_value_1.StoreValue(types_1.Types.INTEGER, stoObj.get().trunc());
  23928. }
  23929. else {
  23930. return new store_value_1.StoreValue(types_1.Types.REAL, stoObj.get());
  23931. }
  23932. }
  23933. extendStore(nextStore) {
  23934. this.nextStore = nextStore;
  23935. }
  23936. applyStore(id) {
  23937. if (!this.store.has(id)) {
  23938. if (this.nextStore != null) {
  23939. return this.nextStore.applyStore(id);
  23940. }
  23941. else {
  23942. throw new Error(`Variable ${id} not found.`);
  23943. }
  23944. }
  23945. const val = this.store.get(id);
  23946. let result = null;
  23947. if (val.type instanceof array_type_1.ArrayType) {
  23948. const array = val;
  23949. const array_type = array.type;
  23950. let l = 0, c = 0;
  23951. const values = array.value.map(v => {
  23952. if (array.isVector) {
  23953. return new store_value_address_1.StoreValueAddress(array_type.innerType, v, l++, undefined, array.id, array.readOnly);
  23954. }
  23955. else {
  23956. if (c >= array.columns) {
  23957. c = 0;
  23958. l += 1;
  23959. }
  23960. return new store_value_address_1.StoreValueAddress(array_type.innerType, v, l, c++, array.id, array.readOnly);
  23961. }
  23962. });
  23963. result = new array_store_value_1.ArrayStoreValue(array_type, values, array.lines, array.columns, val.id, val.readOnly);
  23964. }
  23965. else {
  23966. result = new store_value_1.StoreValue(val.type, val.value, val.id, val.readOnly);
  23967. }
  23968. return result;
  23969. }
  23970. updateStore(id, stoValue) {
  23971. if (!this.store.has(id)) {
  23972. if (this.nextStore != null) {
  23973. this.nextStore.updateStore(id, stoValue);
  23974. return this;
  23975. }
  23976. else {
  23977. // TODO: better error message
  23978. throw new Error(`Variable ${id} not found.`);
  23979. }
  23980. }
  23981. else {
  23982. const oldObj = this.store.get(id);
  23983. if (oldObj.readOnly) {
  23984. // TODO: better error message
  23985. throw new Error("Cannot change value of a read only variable: " + id);
  23986. }
  23987. if (oldObj instanceof storeObjectArray_1.StoreObjectArray) {
  23988. const array_value = stoValue;
  23989. if (oldObj.isCompatible(array_value)) {
  23990. if (oldObj.isVector) {
  23991. array_value.get().forEach((val, index) => {
  23992. oldObj.setAt(val, index, undefined);
  23993. });
  23994. }
  23995. else {
  23996. let line = 0;
  23997. let column = 0;
  23998. array_value.get().forEach((val) => {
  23999. oldObj.setAt(val, line, column);
  24000. column += 1;
  24001. if (column >= oldObj.columns) {
  24002. line += 1;
  24003. column = 0;
  24004. }
  24005. });
  24006. }
  24007. return this;
  24008. }
  24009. }
  24010. else if (oldObj.isCompatible(stoValue)) {
  24011. const loc_address = oldObj.locAddress;
  24012. location_1.Location.updateAddress(loc_address, stoValue.get());
  24013. return this;
  24014. }
  24015. const oldType = oldObj.type;
  24016. const stoType = stoValue.type;
  24017. // TODO: better error message
  24018. throw new Error(`${oldType.value} is not compatible with type ${stoType.value} given`);
  24019. }
  24020. }
  24021. /**
  24022. * Method used to update regions of an array (vector or matrix). The should only be used when update an specific
  24023. * possition since it will only update the required addresses.
  24024. * @param {string} id the variable id to be updated
  24025. * @param {IStoreValue} sto_value the value to be used in the update process
  24026. * @param {number} line the line address of the vector/matrix
  24027. * @param {number} column the matrix column, which can be undefined
  24028. */
  24029. updateStoreArray(id, sto_value, line, column) {
  24030. if (!this.store.has(id)) {
  24031. if (this.nextStore != null) {
  24032. this.nextStore.updateStoreArray(id, sto_value, line, column);
  24033. return this;
  24034. }
  24035. else {
  24036. // TODO: better error message
  24037. throw new Error(`Variable ${id} not found.`);
  24038. }
  24039. }
  24040. else {
  24041. const oldObj = this.store.get(id);
  24042. if (oldObj.readOnly) {
  24043. // TODO: better error message
  24044. throw new Error("Cannot change value of a read only variable: " + id);
  24045. }
  24046. if (oldObj instanceof storeObjectArray_1.StoreObjectArray) {
  24047. if (sto_value instanceof array_store_value_1.ArrayStoreValue) {
  24048. // this must be a vector or matrix line update
  24049. const actual_values = sto_value.get();
  24050. if (oldObj.isVector && sto_value.isVector()) {
  24051. for (let i = 0; i < sto_value.lines; i += 1) {
  24052. const val = actual_values[i];
  24053. oldObj.setAt(val, i, undefined);
  24054. }
  24055. }
  24056. else if (!oldObj.isVector && column == null && sto_value.isVector()) {
  24057. for (let i = 0; i < oldObj.columns; i += 1) {
  24058. const val = actual_values[i];
  24059. oldObj.setAt(val, line, i);
  24060. }
  24061. }
  24062. else {
  24063. // TODO: better error message
  24064. throw new Error(`Attempting to assign an invalid value to array ${id}`);
  24065. }
  24066. }
  24067. else {
  24068. if (!oldObj.isVector && column == null) {
  24069. // TODO: better error message
  24070. throw new Error(`Attempting to assign an invalid value to array ${id}`);
  24071. }
  24072. oldObj.setAt(sto_value, line, column);
  24073. }
  24074. }
  24075. else {
  24076. throw new Error("Cannot update a non-array variable using updateStoreArray");
  24077. }
  24078. // const oldType = oldObj.type;
  24079. // const stoType = sto_value.type;
  24080. // // TODO: better error message
  24081. // throw new Error(`${oldType.value} is not compatible with type ${stoType.value} given`);
  24082. return this;
  24083. }
  24084. }
  24085. /**
  24086. * Inserts a new variable into the Store. This method should be used when declaring a new variable,
  24087. * including the special return variable $.
  24088. * @param id variable id
  24089. * @param stoValue the value to be used as the initial value of id
  24090. */
  24091. insertStore(id, stoValue) {
  24092. if (this.store.has(id)) {
  24093. // TODO: better error message
  24094. throw new Error(`${id} is already defined`);
  24095. }
  24096. // TODO check for array....
  24097. let newObj;
  24098. if (stoValue instanceof store_value_ref_1.StoreValueRef) {
  24099. newObj = new storeObjectRef_1.StoreObjectRef(stoValue);
  24100. }
  24101. else if (stoValue instanceof array_store_value_ref_1.ArrayStoreValueRef) {
  24102. newObj = new store_object_array_ref_1.StoreObjectArrayRef(stoValue, stoValue.lines, stoValue.columns);
  24103. }
  24104. else if (stoValue instanceof array_store_value_1.ArrayStoreValue) {
  24105. const columns = stoValue.isVector() ? 0 : stoValue.columns;
  24106. const addresses = [];
  24107. const all_values = stoValue.get();
  24108. if (all_values.length > 0) {
  24109. for (let i = 0; i < stoValue.get().length; i += 1) {
  24110. const val = all_values[i].get();
  24111. addresses.push(location_1.Location.allocate(val));
  24112. }
  24113. }
  24114. else {
  24115. let total = stoValue.lines;
  24116. total = stoValue.isVector() ? total : total * columns;
  24117. for (let i = 0; i < total; i += 1) {
  24118. addresses.push(location_1.Location.allocate(null));
  24119. }
  24120. }
  24121. newObj = new storeObjectArray_1.StoreObjectArray(stoValue.type, stoValue.lines, columns, addresses, stoValue.isConst);
  24122. }
  24123. else {
  24124. const loc_address = location_1.Location.allocate(stoValue.get());
  24125. newObj = new storeObject_1.StoreObject(stoValue.type, loc_address, stoValue.isConst);
  24126. }
  24127. newObj.setID(id);
  24128. this.store.set(id, newObj);
  24129. return this;
  24130. }
  24131. /**
  24132. * Helper function similar to applyStore. But it returns the actual object in the store be it ref or not
  24133. * applyStore will return the refferenced object if the object in the store is a ref
  24134. */
  24135. getStoreObject(id) {
  24136. if (!this.store.has(id)) {
  24137. if (this.nextStore != null) {
  24138. return this.nextStore.getStoreObject(id);
  24139. }
  24140. else {
  24141. throw new Error(`Variable ${id} not found.`);
  24142. }
  24143. }
  24144. return this.store.get(id);
  24145. }
  24146. destroy() {
  24147. this.store.forEach(sto => sto.destroy(), this);
  24148. }
  24149. isDefined(id) {
  24150. if (!this.store.has(id)) {
  24151. if (this.nextStore != null) {
  24152. return this.nextStore.isDefined(id);
  24153. }
  24154. else {
  24155. return false;
  24156. }
  24157. }
  24158. return true;
  24159. }
  24160. }
  24161. exports.Store = Store;
  24162. /***/ }),
  24163. /***/ "./js/processor/store/storeObject.ts":
  24164. /*!*******************************************!*\
  24165. !*** ./js/processor/store/storeObject.ts ***!
  24166. \*******************************************/
  24167. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24168. "use strict";
  24169. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24170. exports.StoreObject = void 0;
  24171. const location_1 = __webpack_require__(/*! ../../memory/location */ "./js/memory/location.ts");
  24172. class StoreObject {
  24173. /**
  24174. *
  24175. * @param {Type} type
  24176. * @param {Number} loc_address
  24177. * @param {Boolean} readOnly
  24178. */
  24179. constructor(type, loc_address, readOnly = false) {
  24180. this._loc_address = loc_address;
  24181. this._type = type;
  24182. this._readOnly = readOnly;
  24183. this._id = undefined;
  24184. }
  24185. setID(id) {
  24186. this._id = id;
  24187. }
  24188. get id() {
  24189. return this._id;
  24190. }
  24191. get inStore() {
  24192. return this.id !== null;
  24193. }
  24194. get type() {
  24195. return this._type;
  24196. }
  24197. /**
  24198. * Returns the actual value stored at the loccation address present in this object.
  24199. * The returned value is compatible with @prop{StoreObject.type}
  24200. */
  24201. get value() {
  24202. const address = location_1.Location.find(this._loc_address);
  24203. if (address != null) {
  24204. return address.value;
  24205. }
  24206. else {
  24207. throw new Error("!!!Critical Error: variable " + this.id + " does not have a valid address. Loc-Address " + this.locAddress);
  24208. }
  24209. }
  24210. get number() {
  24211. throw new Error("DOT NOT USE THIS PROPERTY!");
  24212. }
  24213. get readOnly() {
  24214. return this._readOnly;
  24215. }
  24216. set readOnly(value) {
  24217. this._readOnly = value;
  24218. }
  24219. isCompatible(another) {
  24220. return this.type.isCompatible(another.type);
  24221. }
  24222. destroy() {
  24223. return location_1.Location.deallocate(this._loc_address);
  24224. }
  24225. get locAddress() {
  24226. return this._loc_address;
  24227. }
  24228. }
  24229. exports.StoreObject = StoreObject;
  24230. /***/ }),
  24231. /***/ "./js/processor/store/storeObjectArray.ts":
  24232. /*!************************************************!*\
  24233. !*** ./js/processor/store/storeObjectArray.ts ***!
  24234. \************************************************/
  24235. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24236. "use strict";
  24237. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24238. exports.StoreObjectArray = void 0;
  24239. const storeObject_1 = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.ts");
  24240. const array_store_value_1 = __webpack_require__(/*! ./value/array_store_value */ "./js/processor/store/value/array_store_value.ts");
  24241. const location_1 = __webpack_require__(/*! ../../memory/location */ "./js/memory/location.ts");
  24242. class StoreObjectArray extends storeObject_1.StoreObject {
  24243. constructor(type, _lines, _columns, loc_addresses, readOnly = false) {
  24244. super(type, -1, readOnly);
  24245. this._lines = _lines;
  24246. this._columns = _columns;
  24247. this.loc_addresses = loc_addresses;
  24248. }
  24249. get lines() {
  24250. return this._lines;
  24251. }
  24252. get columns() {
  24253. return this._columns;
  24254. }
  24255. isCompatible(another) {
  24256. if (another instanceof array_store_value_1.ArrayStoreValue) {
  24257. const cols = another.columns == null ? 0 : another.columns;
  24258. if (this.lines === another.lines && this.columns === cols) {
  24259. return super.isCompatible(another);
  24260. }
  24261. }
  24262. return false;
  24263. }
  24264. get isVector() {
  24265. return this.type.dimensions === 1;
  24266. }
  24267. /**@override
  24268. * Returns the list of values stored by this array.
  24269. * All returned values are compatible with @prop{StoreObject.type}
  24270. */
  24271. get value() {
  24272. const values = [];
  24273. for (let i = 0; i < this.addresses.length; i += 1) {
  24274. const address = location_1.Location.find(this.addresses[i]);
  24275. if (address != null) {
  24276. values.push(address.value);
  24277. }
  24278. else {
  24279. throw new Error("!!!Critical Error: variable " + this.id + " does not have a valid address. Loc-Address " + this.locAddress);
  24280. }
  24281. }
  24282. return values;
  24283. }
  24284. destroy() {
  24285. let bool = true;
  24286. for (let i = 0; i < this.addresses.length; i += 1) {
  24287. bool = bool && location_1.Location.deallocate(this.addresses[i]);
  24288. }
  24289. return bool;
  24290. }
  24291. /**
  24292. * @override
  24293. *
  24294. * Returns the address that contains a list of all addresses of the values present in the array
  24295. */
  24296. get locAddress() {
  24297. throw new Error("!!!Internal Error: Cannot invoke locAddress on StoreObjectArray");
  24298. }
  24299. get addresses() {
  24300. return this.loc_addresses;
  24301. }
  24302. getAt(line, column) {
  24303. if (this.isVector) {
  24304. if (column != null) {
  24305. throw new Error(this.id + " is not a matrix!");
  24306. }
  24307. column = line;
  24308. line = 0;
  24309. }
  24310. else if (column == null) {
  24311. // this is a whole line...
  24312. const values = [];
  24313. for (let col = 0; col < this.columns; col += 1) {
  24314. const index = this.getIndexOf(line, col);
  24315. const address = location_1.Location.find(this.addresses[index]);
  24316. values.push(address.value);
  24317. }
  24318. return values;
  24319. }
  24320. const index = this.getIndexOf(line, column);
  24321. const address = location_1.Location.find(this.addresses[index]);
  24322. return address.value;
  24323. }
  24324. setAt(value, line, column) {
  24325. let used_dims = 1;
  24326. if (column != null) {
  24327. used_dims += 1;
  24328. }
  24329. if (!this.type.canAccept(value.type, used_dims)) {
  24330. throw new Error("!!!Internal Error: Attempting to insert an invalid value inside array " + this.id);
  24331. }
  24332. if (this.isVector) {
  24333. if (column != null) {
  24334. throw new Error(this.id + " is not a matrix!");
  24335. }
  24336. column = line;
  24337. line = 0;
  24338. }
  24339. else if (column == null) {
  24340. throw new Error("!!!Internal Error: Attempting to insert a line into matrix " + this.id);
  24341. }
  24342. const pos = this.getIndexOf(line, column);
  24343. location_1.Location.updateAddress(this.addresses[pos], value.get());
  24344. }
  24345. getIndexOf(line, column) {
  24346. return line * this.columns + column;
  24347. }
  24348. getLocAddressOf(line, column) {
  24349. if (this.isVector) {
  24350. if (column != null) {
  24351. throw new Error(this.id + " is not a matrix!");
  24352. }
  24353. column = line;
  24354. line = 0;
  24355. }
  24356. else if (column == null) {
  24357. // this is a whole line...
  24358. const values = [];
  24359. for (let col = 0; col < this.columns; col += 1) {
  24360. const index = this.getIndexOf(line, col);
  24361. values.push(this.addresses[index]);
  24362. }
  24363. return values;
  24364. }
  24365. const index = this.getIndexOf(line, column);
  24366. return this.addresses[index];
  24367. }
  24368. }
  24369. exports.StoreObjectArray = StoreObjectArray;
  24370. /***/ }),
  24371. /***/ "./js/processor/store/storeObjectRef.ts":
  24372. /*!**********************************************!*\
  24373. !*** ./js/processor/store/storeObjectRef.ts ***!
  24374. \**********************************************/
  24375. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24376. "use strict";
  24377. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24378. exports.StoreObjectRef = void 0;
  24379. const storeObject_1 = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.ts");
  24380. class StoreObjectRef extends storeObject_1.StoreObject {
  24381. /**
  24382. *
  24383. * @param {StoreObject} stoValue
  24384. */
  24385. constructor(stoValue) {
  24386. super(stoValue.type, stoValue.getRefAddress(), false);
  24387. this.refObj = stoValue.id;
  24388. this.reference_dimension = stoValue.getReferenceDimension();
  24389. }
  24390. get isRef() {
  24391. return true;
  24392. }
  24393. getRefObj() {
  24394. return this.refObj;
  24395. }
  24396. getReferenceDimension() {
  24397. return this.reference_dimension;
  24398. }
  24399. destroy() {
  24400. return false;
  24401. }
  24402. }
  24403. exports.StoreObjectRef = StoreObjectRef;
  24404. /***/ }),
  24405. /***/ "./js/processor/store/store_object_array_ref.ts":
  24406. /*!******************************************************!*\
  24407. !*** ./js/processor/store/store_object_array_ref.ts ***!
  24408. \******************************************************/
  24409. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24410. "use strict";
  24411. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24412. exports.StoreObjectArrayRef = void 0;
  24413. const storeObjectArray_1 = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.ts");
  24414. class StoreObjectArrayRef extends storeObjectArray_1.StoreObjectArray {
  24415. constructor(stoValue, lines, columns) {
  24416. super(stoValue.type, lines, columns, stoValue.getAddresses(), false);
  24417. this.refObj = stoValue.id;
  24418. }
  24419. get isRef() {
  24420. return true;
  24421. }
  24422. getRefObj() {
  24423. return this.refObj;
  24424. }
  24425. destroy() {
  24426. return false;
  24427. }
  24428. }
  24429. exports.StoreObjectArrayRef = StoreObjectArrayRef;
  24430. /***/ }),
  24431. /***/ "./js/processor/store/value/array_store_value.ts":
  24432. /*!*******************************************************!*\
  24433. !*** ./js/processor/store/value/array_store_value.ts ***!
  24434. \*******************************************************/
  24435. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24436. "use strict";
  24437. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24438. exports.ArrayStoreValue = void 0;
  24439. const array_type_1 = __webpack_require__(/*! ../../../typeSystem/array_type */ "./js/typeSystem/array_type.ts");
  24440. const store_value_address_1 = __webpack_require__(/*! ./store_value_address */ "./js/processor/store/value/store_value_address.ts");
  24441. class ArrayStoreValue {
  24442. constructor(type, values, lines, columns, id, isConst = false) {
  24443. this.type = type;
  24444. this.id = id;
  24445. this.isConst = isConst;
  24446. this.values = values;
  24447. this.lines = lines;
  24448. this.columns = columns;
  24449. }
  24450. get() {
  24451. return this.values;
  24452. }
  24453. /**
  24454. * @deprecated
  24455. * Potential not necessary since array access is occuring directly in the StoreObject
  24456. * @param line
  24457. * @param column
  24458. */
  24459. getAt(line, column) {
  24460. console.log("Column ", column);
  24461. if (this.isVector()) {
  24462. if (column != null) {
  24463. throw new Error(this.id + " is not a matrix!");
  24464. }
  24465. column = line;
  24466. line = 0;
  24467. }
  24468. else if (column == null) {
  24469. const values = [];
  24470. for (let col = 0; col < this.columns; col += 1) {
  24471. const index = line * this.lines + col;
  24472. values.push(this.values[index]);
  24473. }
  24474. const array_type = this.type;
  24475. const vector_type = new array_type_1.ArrayType(array_type.innerType, array_type.dimensions - 1);
  24476. return new ArrayStoreValue(vector_type, values, this.columns, 0, this.id, this.isConst);
  24477. }
  24478. const index = line * this.lines + column;
  24479. console.log("Get at: ", index);
  24480. return this.values[index];
  24481. }
  24482. setAt(value, line, column) {
  24483. let used_dims = 1;
  24484. if (column != null) {
  24485. used_dims += 1;
  24486. }
  24487. let actual_line = line;
  24488. let actual_column = column;
  24489. if (!this.type.canAccept(value.type, used_dims)) {
  24490. throw new Error("!!!Internal Error: Attempting to insert an invalid value inside array " + this.id);
  24491. }
  24492. if (this.isVector()) {
  24493. if (column != null) {
  24494. throw new Error(this.id + " is not a matrix!");
  24495. }
  24496. actual_column = actual_line;
  24497. actual_line = 0;
  24498. }
  24499. else if (column == null) {
  24500. if (!(value instanceof ArrayStoreValue)) {
  24501. throw new Error("Attempting to insert a single value as a line of matrix " + this.id);
  24502. }
  24503. const actual_values = value.get();
  24504. for (let i = 0; i < this.columns; i += 1) {
  24505. const pos = actual_line * this.columns + i;
  24506. const val = actual_values[i];
  24507. this.values[pos] = new store_value_address_1.StoreValueAddress(value.type, val.get(), actual_line, i, this.id, this.isConst);
  24508. }
  24509. }
  24510. const columns = this.columns == null ? 0 : this.columns;
  24511. const pos = actual_line * columns + actual_column;
  24512. this.values[pos] = new store_value_address_1.StoreValueAddress(value.type, value.get(), line, column, this.id, this.isConst);
  24513. }
  24514. inStore() {
  24515. return this.id != null;
  24516. }
  24517. isVector() {
  24518. return this.type.dimensions == 1;
  24519. }
  24520. }
  24521. exports.ArrayStoreValue = ArrayStoreValue;
  24522. /***/ }),
  24523. /***/ "./js/processor/store/value/array_store_value_ref.ts":
  24524. /*!***********************************************************!*\
  24525. !*** ./js/processor/store/value/array_store_value_ref.ts ***!
  24526. \***********************************************************/
  24527. /***/ ((__unused_webpack_module, exports) => {
  24528. "use strict";
  24529. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24530. exports.ArrayStoreValueRef = void 0;
  24531. class ArrayStoreValueRef {
  24532. constructor(type, values, addresses, lines, columns, id) {
  24533. this.type = type;
  24534. this.values = values;
  24535. this.addresses = addresses;
  24536. this.lines = lines;
  24537. this.columns = columns;
  24538. this.id = id;
  24539. this.isConst = false;
  24540. }
  24541. get() {
  24542. return this.values;
  24543. }
  24544. getAddresses() {
  24545. return this.addresses;
  24546. }
  24547. inStore() {
  24548. return this.id != null;
  24549. }
  24550. }
  24551. exports.ArrayStoreValueRef = ArrayStoreValueRef;
  24552. /***/ }),
  24553. /***/ "./js/processor/store/value/store_value.ts":
  24554. /*!*************************************************!*\
  24555. !*** ./js/processor/store/value/store_value.ts ***!
  24556. \*************************************************/
  24557. /***/ ((__unused_webpack_module, exports) => {
  24558. "use strict";
  24559. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24560. exports.StoreValue = void 0;
  24561. class StoreValue {
  24562. constructor(type, value, id, isConst = false) {
  24563. this.type = type;
  24564. this.id = id;
  24565. this.isConst = isConst;
  24566. this.value = value;
  24567. }
  24568. get() {
  24569. return this.value;
  24570. }
  24571. inStore() {
  24572. return this.id != null;
  24573. }
  24574. }
  24575. exports.StoreValue = StoreValue;
  24576. /***/ }),
  24577. /***/ "./js/processor/store/value/store_value_address.ts":
  24578. /*!*********************************************************!*\
  24579. !*** ./js/processor/store/value/store_value_address.ts ***!
  24580. \*********************************************************/
  24581. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24582. "use strict";
  24583. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24584. exports.StoreValueAddress = void 0;
  24585. const store_value_1 = __webpack_require__(/*! ./store_value */ "./js/processor/store/value/store_value.ts");
  24586. class StoreValueAddress extends store_value_1.StoreValue {
  24587. constructor(type, value, line, column, id, isConst = false) {
  24588. super(type, value, id, isConst);
  24589. this.line = line;
  24590. this.column = column;
  24591. }
  24592. }
  24593. exports.StoreValueAddress = StoreValueAddress;
  24594. /***/ }),
  24595. /***/ "./js/processor/store/value/store_value_ref.ts":
  24596. /*!*****************************************************!*\
  24597. !*** ./js/processor/store/value/store_value_ref.ts ***!
  24598. \*****************************************************/
  24599. /***/ ((__unused_webpack_module, exports) => {
  24600. "use strict";
  24601. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24602. exports.StoreValueRef = void 0;
  24603. class StoreValueRef {
  24604. constructor(type, value, loc_address, id) {
  24605. this.type = type;
  24606. this.value = value;
  24607. this.loc_address = loc_address;
  24608. this.id = id;
  24609. this.isConst = false;
  24610. this.reference_dimesion = 0;
  24611. }
  24612. get() {
  24613. return this.value;
  24614. }
  24615. getRefAddress() {
  24616. return this.loc_address;
  24617. }
  24618. inStore() {
  24619. return this.id != null;
  24620. }
  24621. getReferenceDimension() {
  24622. return this.reference_dimesion;
  24623. }
  24624. setReferenceDimension(dimension) {
  24625. this.reference_dimesion = dimension;
  24626. }
  24627. }
  24628. exports.StoreValueRef = StoreValueRef;
  24629. /***/ }),
  24630. /***/ "./js/services/languageService.ts":
  24631. /*!****************************************!*\
  24632. !*** ./js/services/languageService.ts ***!
  24633. \****************************************/
  24634. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24635. "use strict";
  24636. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24637. exports.LanguageService = void 0;
  24638. const grammar_1 = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.ts");
  24639. const line_i18n_1 = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  24640. const config_1 = __webpack_require__(/*! ./../util/config */ "./js/util/config.ts");
  24641. class LanguageServiceExtended extends line_i18n_1.default.LanguageServiceNoLS {
  24642. constructor() {
  24643. super(typeof iLMparameters === "undefined"
  24644. ? config_1.Config.default_lang
  24645. : iLMparameters.lang);
  24646. }
  24647. getDefaultLang() {
  24648. return "en";
  24649. }
  24650. getCurrentLexer() {
  24651. const langLexer = grammar_1.default[this.getLang()];
  24652. if (langLexer === null || langLexer === undefined) {
  24653. return grammar_1.default[this.getDefaultLang()];
  24654. }
  24655. else {
  24656. return langLexer;
  24657. }
  24658. }
  24659. getCurrentLangFuncs() {
  24660. const langInfo = grammar_1.default[this.getLang()];
  24661. if (langInfo === null || langInfo === undefined) {
  24662. return grammar_1.default[this.getDefaultLang()].getLangFuncs();
  24663. }
  24664. else {
  24665. return langInfo.getLangFuncs();
  24666. }
  24667. }
  24668. getCurrentLangLibs() {
  24669. const langInfo = grammar_1.default[this.getLang()];
  24670. if (langInfo === null || langInfo === undefined) {
  24671. return grammar_1.default[this.getDefaultLang()].getLangLibs();
  24672. }
  24673. return langInfo.getLangLibs();
  24674. }
  24675. }
  24676. exports.LanguageService = new LanguageServiceExtended();
  24677. /***/ }),
  24678. /***/ "./js/typeSystem/array_type.ts":
  24679. /*!*************************************!*\
  24680. !*** ./js/typeSystem/array_type.ts ***!
  24681. \*************************************/
  24682. /***/ ((__unused_webpack_module, exports) => {
  24683. "use strict";
  24684. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24685. exports.ArrayType = void 0;
  24686. class ArrayType {
  24687. constructor(type, dimensions) {
  24688. this.dimensions = dimensions;
  24689. this.innerType = type;
  24690. }
  24691. get isVector() {
  24692. return this.dimensions == 1;
  24693. }
  24694. isCompatible(another) {
  24695. if (another instanceof ArrayType) {
  24696. if (this.dimensions !== another.dimensions) {
  24697. return false;
  24698. }
  24699. return this.innerType.isCompatible(another.innerType);
  24700. }
  24701. return false;
  24702. }
  24703. stringInfo() {
  24704. const list = this.innerType.stringInfo();
  24705. list.forEach(v => {
  24706. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  24707. const tmp = v;
  24708. tmp.dim = this.dimensions;
  24709. });
  24710. return list;
  24711. }
  24712. get value() {
  24713. return undefined;
  24714. }
  24715. get ord() {
  24716. return undefined;
  24717. }
  24718. canAccept(another, used_dims) {
  24719. const free_dims = this.dimensions - used_dims;
  24720. if (another instanceof ArrayType) {
  24721. return free_dims == another.dimensions && this.innerType.isCompatible(another.innerType);
  24722. }
  24723. else {
  24724. return free_dims == 0 && this.innerType.isCompatible(another);
  24725. }
  24726. }
  24727. }
  24728. exports.ArrayType = ArrayType;
  24729. /***/ }),
  24730. /***/ "./js/typeSystem/multiType.ts":
  24731. /*!************************************!*\
  24732. !*** ./js/typeSystem/multiType.ts ***!
  24733. \************************************/
  24734. /***/ ((__unused_webpack_module, exports) => {
  24735. "use strict";
  24736. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24737. exports.MultiType = void 0;
  24738. class MultiType {
  24739. constructor(types) {
  24740. this.types = types;
  24741. }
  24742. get value() {
  24743. return undefined;
  24744. }
  24745. get ord() {
  24746. return undefined;
  24747. }
  24748. stringInfo() {
  24749. let list = [];
  24750. for (let i = 0; i < this.types.length; i++) {
  24751. const t = this.types[i];
  24752. list = list.concat(t.stringInfo());
  24753. }
  24754. return list;
  24755. }
  24756. isCompatible(another) {
  24757. for (let i = 0; i < this.types.length; i++) {
  24758. const t = this.types[i];
  24759. if (another.isCompatible(t)) {
  24760. return true;
  24761. }
  24762. }
  24763. return false;
  24764. }
  24765. }
  24766. exports.MultiType = MultiType;
  24767. /***/ }),
  24768. /***/ "./js/typeSystem/type.ts":
  24769. /*!*******************************!*\
  24770. !*** ./js/typeSystem/type.ts ***!
  24771. \*******************************/
  24772. /***/ ((__unused_webpack_module, exports) => {
  24773. "use strict";
  24774. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24775. exports.Type = void 0;
  24776. class Type {
  24777. constructor(value, ord) {
  24778. this.value = value;
  24779. this.ord = ord;
  24780. }
  24781. stringInfo() {
  24782. return [{ type: this.value, dim: 0 }];
  24783. }
  24784. isCompatible(another) {
  24785. return this.value === another.value && this.ord === another.ord;
  24786. }
  24787. }
  24788. exports.Type = Type;
  24789. /***/ }),
  24790. /***/ "./js/typeSystem/types.ts":
  24791. /*!********************************!*\
  24792. !*** ./js/typeSystem/types.ts ***!
  24793. \********************************/
  24794. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  24795. "use strict";
  24796. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24797. exports.fromOrdToType = exports.Types = void 0;
  24798. const type_1 = __webpack_require__(/*! ./type */ "./js/typeSystem/type.ts");
  24799. const multiType_1 = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.ts");
  24800. const maybe_1 = __webpack_require__(/*! ../util/maybe */ "./js/util/maybe.ts");
  24801. const INTEGER = new type_1.Type("integer", 0);
  24802. const REAL = new type_1.Type("real", 1);
  24803. const STRING = new type_1.Type("text", 2);
  24804. const BOOLEAN = new type_1.Type("boolean", 3);
  24805. const CHAR = new type_1.Type("char", 4);
  24806. const VOID = new type_1.Type("void", 5);
  24807. const UNDEFINED = new type_1.Type("undefined", 6);
  24808. const ALL = new multiType_1.MultiType([INTEGER, REAL, STRING, CHAR, BOOLEAN]);
  24809. exports.Types = Object.freeze({
  24810. INTEGER: INTEGER,
  24811. REAL: REAL,
  24812. STRING: STRING,
  24813. CHAR: CHAR,
  24814. BOOLEAN: BOOLEAN,
  24815. VOID: VOID,
  24816. UNDEFINED: UNDEFINED,
  24817. ALL: ALL
  24818. });
  24819. function fromOrdToType(ord) {
  24820. const typeMap = exports.Types;
  24821. for (const t in typeMap) {
  24822. if (typeMap[t].ord && typeMap[t].ord === ord) {
  24823. return maybe_1.Maybe.some(typeMap[t]);
  24824. }
  24825. }
  24826. return maybe_1.Maybe.none();
  24827. }
  24828. exports.fromOrdToType = fromOrdToType;
  24829. /***/ }),
  24830. /***/ "./js/util/config.ts":
  24831. /*!***************************!*\
  24832. !*** ./js/util/config.ts ***!
  24833. \***************************/
  24834. /***/ ((__unused_webpack_module, exports) => {
  24835. "use strict";
  24836. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24837. exports.Config = void 0;
  24838. class ConfigObject {
  24839. constructor() {
  24840. this.decimalPlaces = 8;
  24841. this.intConvertRoundMode = 2;
  24842. this.default_lang = "pt";
  24843. this.enable_type_casting = true;
  24844. this.idle_input_interval = 5000;
  24845. this.suspend_threshold = 1000;
  24846. // this.max_instruction_count = 350250; - automated evaluation limit
  24847. this.max_instruction_count = Number.MAX_SAFE_INTEGER;
  24848. this.activity_programming_type = new Map();
  24849. this.activity_functions = new Map();
  24850. this.activity_datatypes = new Map();
  24851. this.activity_commands = new Map();
  24852. this.activity_filter = new Map();
  24853. }
  24854. setConfig(opts) {
  24855. const otherConfig = opts;
  24856. for (const key in otherConfig) {
  24857. if (Object.prototype.hasOwnProperty.call(this, key)) {
  24858. this[key] = otherConfig[key];
  24859. }
  24860. }
  24861. }
  24862. }
  24863. const config = new ConfigObject();
  24864. exports.Config = config;
  24865. /***/ }),
  24866. /***/ "./js/util/maybe.ts":
  24867. /*!**************************!*\
  24868. !*** ./js/util/maybe.ts ***!
  24869. \**************************/
  24870. /***/ ((__unused_webpack_module, exports) => {
  24871. "use strict";
  24872. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24873. exports.Maybe = void 0;
  24874. /**
  24875. *
  24876. * Maybe Monad
  24877. * @Source: https://codewithstyle.info/advanced-functional-programming-in-typescript-maybe-monad/
  24878. * @Modified by: @lucascalion - 28/08/2019
  24879. *
  24880. **/
  24881. class Maybe {
  24882. constructor(value) {
  24883. this.value = value;
  24884. }
  24885. static some(value) {
  24886. if (!value) {
  24887. throw Error("Provided value must not be empty");
  24888. }
  24889. return new Maybe(value);
  24890. }
  24891. static none() {
  24892. return new Maybe(null);
  24893. }
  24894. static fromValue(value) {
  24895. return value ? Maybe.some(value) : Maybe.none();
  24896. }
  24897. getOrElse(defaultValue) {
  24898. return this.value === null ? defaultValue : this.value;
  24899. }
  24900. map(f) {
  24901. if (this.value === null) {
  24902. return Maybe.none();
  24903. }
  24904. else {
  24905. return Maybe.fromValue(f(this.value));
  24906. }
  24907. }
  24908. }
  24909. exports.Maybe = Maybe;
  24910. /***/ }),
  24911. /***/ "./.ima_version.json":
  24912. /*!***************************!*\
  24913. !*** ./.ima_version.json ***!
  24914. \***************************/
  24915. /***/ ((module) => {
  24916. "use strict";
  24917. module.exports = JSON.parse('{"version":"2022_01_13 11_33"}');
  24918. /***/ })
  24919. /******/ });
  24920. /************************************************************************/
  24921. /******/ // The module cache
  24922. /******/ var __webpack_module_cache__ = {};
  24923. /******/
  24924. /******/ // The require function
  24925. /******/ function __webpack_require__(moduleId) {
  24926. /******/ // Check if module is in cache
  24927. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  24928. /******/ if (cachedModule !== undefined) {
  24929. /******/ return cachedModule.exports;
  24930. /******/ }
  24931. /******/ // Create a new module (and put it into the cache)
  24932. /******/ var module = __webpack_module_cache__[moduleId] = {
  24933. /******/ // no module.id needed
  24934. /******/ // no module.loaded needed
  24935. /******/ exports: {}
  24936. /******/ };
  24937. /******/
  24938. /******/ // Execute the module function
  24939. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  24940. /******/
  24941. /******/ // Return the exports of the module
  24942. /******/ return module.exports;
  24943. /******/ }
  24944. /******/
  24945. /******/ // expose the modules object (__webpack_modules__)
  24946. /******/ __webpack_require__.m = __webpack_modules__;
  24947. /******/
  24948. /************************************************************************/
  24949. /******/ /* webpack/runtime/chunk loaded */
  24950. /******/ (() => {
  24951. /******/ var deferred = [];
  24952. /******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
  24953. /******/ if(chunkIds) {
  24954. /******/ priority = priority || 0;
  24955. /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
  24956. /******/ deferred[i] = [chunkIds, fn, priority];
  24957. /******/ return;
  24958. /******/ }
  24959. /******/ var notFulfilled = Infinity;
  24960. /******/ for (var i = 0; i < deferred.length; i++) {
  24961. /******/ var [chunkIds, fn, priority] = deferred[i];
  24962. /******/ var fulfilled = true;
  24963. /******/ for (var j = 0; j < chunkIds.length; j++) {
  24964. /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
  24965. /******/ chunkIds.splice(j--, 1);
  24966. /******/ } else {
  24967. /******/ fulfilled = false;
  24968. /******/ if(priority < notFulfilled) notFulfilled = priority;
  24969. /******/ }
  24970. /******/ }
  24971. /******/ if(fulfilled) {
  24972. /******/ deferred.splice(i--, 1)
  24973. /******/ var r = fn();
  24974. /******/ if (r !== undefined) result = r;
  24975. /******/ }
  24976. /******/ }
  24977. /******/ return result;
  24978. /******/ };
  24979. /******/ })();
  24980. /******/
  24981. /******/ /* webpack/runtime/compat get default export */
  24982. /******/ (() => {
  24983. /******/ // getDefaultExport function for compatibility with non-harmony modules
  24984. /******/ __webpack_require__.n = (module) => {
  24985. /******/ var getter = module && module.__esModule ?
  24986. /******/ () => (module['default']) :
  24987. /******/ () => (module);
  24988. /******/ __webpack_require__.d(getter, { a: getter });
  24989. /******/ return getter;
  24990. /******/ };
  24991. /******/ })();
  24992. /******/
  24993. /******/ /* webpack/runtime/define property getters */
  24994. /******/ (() => {
  24995. /******/ // define getter functions for harmony exports
  24996. /******/ __webpack_require__.d = (exports, definition) => {
  24997. /******/ for(var key in definition) {
  24998. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  24999. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  25000. /******/ }
  25001. /******/ }
  25002. /******/ };
  25003. /******/ })();
  25004. /******/
  25005. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  25006. /******/ (() => {
  25007. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  25008. /******/ })();
  25009. /******/
  25010. /******/ /* webpack/runtime/make namespace object */
  25011. /******/ (() => {
  25012. /******/ // define __esModule on exports
  25013. /******/ __webpack_require__.r = (exports) => {
  25014. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  25015. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  25016. /******/ }
  25017. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  25018. /******/ };
  25019. /******/ })();
  25020. /******/
  25021. /******/ /* webpack/runtime/jsonp chunk loading */
  25022. /******/ (() => {
  25023. /******/ // no baseURI
  25024. /******/
  25025. /******/ // object to store loaded and loading chunks
  25026. /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
  25027. /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
  25028. /******/ var installedChunks = {
  25029. /******/ "main": 0
  25030. /******/ };
  25031. /******/
  25032. /******/ // no chunk on demand loading
  25033. /******/
  25034. /******/ // no prefetching
  25035. /******/
  25036. /******/ // no preloaded
  25037. /******/
  25038. /******/ // no HMR
  25039. /******/
  25040. /******/ // no HMR manifest
  25041. /******/
  25042. /******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
  25043. /******/
  25044. /******/ // install a JSONP callback for chunk loading
  25045. /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
  25046. /******/ var [chunkIds, moreModules, runtime] = data;
  25047. /******/ // add "moreModules" to the modules object,
  25048. /******/ // then flag all "chunkIds" as loaded and fire callback
  25049. /******/ var moduleId, chunkId, i = 0;
  25050. /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
  25051. /******/ for(moduleId in moreModules) {
  25052. /******/ if(__webpack_require__.o(moreModules, moduleId)) {
  25053. /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
  25054. /******/ }
  25055. /******/ }
  25056. /******/ if(runtime) var result = runtime(__webpack_require__);
  25057. /******/ }
  25058. /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
  25059. /******/ for(;i < chunkIds.length; i++) {
  25060. /******/ chunkId = chunkIds[i];
  25061. /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
  25062. /******/ installedChunks[chunkId][0]();
  25063. /******/ }
  25064. /******/ installedChunks[chunkIds[i]] = 0;
  25065. /******/ }
  25066. /******/ return __webpack_require__.O(result);
  25067. /******/ }
  25068. /******/
  25069. /******/ var chunkLoadingGlobal = self["webpackChunkivprogCore"] = self["webpackChunkivprogCore"] || [];
  25070. /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
  25071. /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
  25072. /******/ })();
  25073. /******/
  25074. /************************************************************************/
  25075. /******/
  25076. /******/ // startup
  25077. /******/ // Load entry module and return exports
  25078. /******/ // This entry module depends on other loaded chunks and execution need to be delayed
  25079. /******/ 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")))
  25080. /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
  25081. /******/
  25082. /******/ return __webpack_exports__;
  25083. /******/ })()
  25084. ;
  25085. });
  25086. //# sourceMappingURL=main.1f2ec643885ac2dda183.js.map